;BOOT65 ;C64 file that is loaded and executed to start CP/M load ;miscellaneous definitions CR = $0D carriage return ;C64 KERNAL entry points SETLFS = $FFBA set LA, FA, SA SETNAM = $FFBD set length & file name address OPEN = $FFC0 open logical file CHKIN = $FFC6 set channel in CKOUT = $FFC9 set channel out CLRCH = $FFCC restore default channel BASIN = $FFCF input from channel BSOUT = $FFD2 output to channel CLALL = $FFE7 close all files & channels ;equates that define load address and amount to load ;code assumes BIOS65 & BOOT80 start at page start BIOS65 = $A00 start of BIOS65 BIOS6L = 4 length of BIOS65 in pages BOOT80 = $1000 start of BOOT80 - $0000 in Z80 memory BOOT8L = 1 length of BOOT80 in pages ;Z80 data area translated to C64 address space ;in Z80 memory these are $f900 & $f905 CMD = $900 command KYCHAR = $905 key character ;start of actual BOOT-65 ;This is in BASIC data area so it must be loaded as a BASIC ;file at $0800 that then jumps to $080F * = $80F SEI disable interrupts JSR CLALL close all files & channels ;set up read from drive 8 ;first open command channel LDA #15 logical file number 15 LDX #8 device 8 LDY #15 secondary address 15 JSR SETLFS set LA, FA, SA LDA #0 zero length file name JSR SETNAM set length & file name address JSR OPEN open logical file ;now set up for random access LDA #2 logical file number 2 LDX #8 device 8 LDY #2 secondary address 2 JSR SETLFS set LA, FA, SA LDA #1 name is one char long LDX #L8B5 JSR SETNAM set length & file name address JSR OPEN open logical file ;load five pages starting at $A00 ;first four are BIOS65 and last is BOOT80 LDA #BIOS6L+BOOT8L STA L8B6 save number of pages L83E LDX #15 set 15 as active channel out JSR CKOUT set channel out LDX #0 LDY #11 name is 11 characters long L847 LDA L8AA,X point to character in name JSR BSOUT output to channel INX DEY BNE L847 loop until last character sent JSR CLRCH restore default channel LDX #2 set 2 as active channel in JSR CHKIN set channel in LDX #0 L85B JSR BASIN input from channel L85E STA BIOS65,X and save INX BNE L85B loop until one page done JSR CLRCH restore default channel ;following operation assumes there are no more than ;9 pages in the file being read as it has no provision ;for a second digit in the secvtor number INC L8B3 bump sector number ;uses self modifying code INC L85E+2 bump load high byte at L85E+2 DEC L8B6 drop pages remainings BNE L83E if more then loop ;move Z80 boot page to $1000 that maps to $0 in Z80 space LDX #0 L874 LDA BIOS6L*256+BIOS65,X get from where loaded STA BOOT80,X and then store for Z80 INX BNE L874 JSR CLALL close all files & channels ;set up C64 memory by disabling BASIC ROM & Character ROM ;by writing to second 6510 I/O port LDA #%00110110 STA 1 ;now send a series of characters to screen to set it up LDA #9 enable char set change JSR BSOUT output to channel LDA #14 switch to upper/lower case JSR BSOUT output to channel LDA #8 disable char set change JSR BSOUT output to channel LDA #147 clear & home JSR BSOUT output to channel LDA #CR return & do line feed JSR BSOUT output to channel ;the first command sets up the command register ;in Z80 hardware space at $f900 LDA #$FF STA CMD ;this seta up key code ;in Z80 hardware space at $f905 LDA #$28 STA KYCHAR ;loading, moving, and configuring done JMP BIOS65 jump to BIOS65 ;data area ;start reading at track 1 and sector 1 L8AA .byt "U1:2 0 1 " ;next character is 256 byte sector number L8B3 .byt "1",CR L8B5 .byt "#" file name for random access L8B6 .byt 0 pages left to load