Index

Function Name: BOOT CALL

Purpose: Boot load program from disk
Call address: $FF53 (hex) 65363 (decimal)
Preparation:

	Registers:	.A = drive number (ASCII)
			.X = device number (0-31)
	Memory:		system map
	Flags:		none
	Calls:		none
Results:
	Registers:	.A used
			.X used
			.Y used
	Memory:		changed as per command
	Flags:		.C -> 1 if I/O error

Description: BOOT CALL attempts to load and execute the boot sector from an auto-boot disk in the given drive and device. The BOOT protocol is as follows:

  1. Close all open files on boot device.
  2. Read track 1 sector 0 into TBUFFR ($B00).
  3. Check for auto-boot header, RTS if not.
  4. If (blk# > 0), BLOCK READ sequential sectors into RAM at given (adrl, adrh, bank) location.
  5. If LEN(filename) > 0, LOAD file into RAM-0 (normal load).
  6. JSR to user code at location C above.
On any error, the BOOT operation is aborted and the UI command is issued to the disk. A return may or may not be made to the caller depending upon the completion status and the BOOTed code. The BOOT sector has the following layout:
$00$01$02$03$04$05$06ABC
C B M adrladrhbankblk#title0file0code
where: A = $07 + LEN(title)
       B =   A + LEN(filename)
       C =   B + 1
The following examples illustrate the flexibility of this layout. This loads and runs a BASIC program:
$00->CBM :key
$03->$00,$00,$00,$00:no other BOOT sector
$07->NAME,$00 :message "NAME"
$0C->$00 :no filename
$0D->$A2,$13,$A0,$0B
$4C,$A5,$AF
:code
$14->RUN"PROGRAM":data (BASIC stmt)
$20->$00
This results in the message Booting NAME... being displayed and, utilizing a C128 BASIC jump table entry that finds and executes a BASIC statement, loads and runs the BASIC program named " P R O G R A M . " The same header can be used to load and execute a binary (machine code) program by simply changing RUN to BOOT. (While the file auto-load feature of the boot header could be used to load binary files simply by furnishing a filename, to execute it you must know the starting address and JMP to it. BASIC's BOOT command does that, and allows a more generic mechanism.) In the next example, a menu is displayed and you are asked to select the operating mode. Nothing else is loaded in this "configure"-type header:
$00->CBM :key
$03->$00,$00,$00,$00:no other BOOT sector
$07->$00 :no message
$0C->$00 :no filename
$0D->$20,$7D, $FF,$0D, $53, $45,$4C, $45
$43, $54, $20,$4D, $4F, $44, $45,$3A
$0D,$0D, $20, $31,$2E, $20, $43, $36
$34, $20, $20, $42, $41, $53, $49, $43
$0D, $20, $32,$2E, $20, $43, $31, $32
$38, $20, $42, $41, $53, $49, $43,$0D
$20, $33,$2E, $20, $43, $31, $32, $38
$20,$4D, $4F, $4E, $49, $54, $4F, $52
$0D,$0D, $00, $20,$E4,$FF,$C9, $31
$D0, $03,$4C,$4D,$FF,$C9, $32,$D0
$03,$4C, $03, $40,$C9, $33,$DO, $E3
$4C, $00,$B0
The loading of sequential sectors is designed primarily for specialized applications (such as CP/M or games) that do not need a disk directory entry.

EXAMPLE:

	LDA	#$30	;drive 0
	LDX	#$08	;device 8
	JSR	$FF53	;BOOT
	BCS	IO_ERROR
	BCC	NO_BOOT_SECTOR