I'm pulling my hair out with this code. Its intended to run from the internal function ROM in the C128 and is trying to dump track 18, sector 1 to the screen as a proof of concept. The problem with this is that the drive reports a syntax error. Trouble is, I can't figure out why! I've tried both the B-R and U1 commands, but nothing seems to work.
I'm developing this code with the cc65 tools, just in case it matters.
Code: Select all
; ; The BOOT ROM for c128 - version 0.1 ; ; Note: This version is to be used as Option ROM ; starting from $8000 onwards on a c128! ; ; ; disk access routines adapted from original Commodore CP/M code ; http://www.z80.eu/c64/BOOT65.ASM SETLFS = $ffba SETNAM = $ffbd OPEN = $ffc0 CHKIN = $ffc6 CKOUT = $ffc9 CLRCH = $ffcc BASIN = $ffcf BSOUT = $ffd2 CLALL = $ffe7 LOADADR = $1c01 .org $8000 ; c128 Option ROM trickery jmp start_code ;Cold start vector jmp start_code ;Warm start vector .byte $FF ;> $01 for Autostart .byte $43,$42,$4d ;"CBM" .byte $00,$00,$00 ;padding (easier on the eyes) start_code: lda #6 ;Kernal and Internal ROM (LOW), RAM(0), I/O sta $d501 ;write to preconfiguration register A sta $ff01 ;write to LCR A sei ;disable interrupts jsr CLALL ;close all files and channels ; set up 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 jsr OPEN ;open command channel ; set up for random access lda #5 ;logical file number 5 ldx #8 ;device 8 ldy #5 ;secondary address 5 jsr SETLFS ;set LA, FA, SA lda #1 ;single character file name ldx #<buffer ldy #>buffer ;set file name jsr SETNAM jsr OPEN ;open command channel ; grab info from Track 1, Sector 0 (block-read) ldx #15 ;15 is active channel out jsr CKOUT ldx #0 ldy #13 ;length of file name (11 characters) fname: lda drivecmd,x ;pointer to file name jsr BSOUT ;output to channel inx dey bne fname ;loop to finish sending filename jsr CLRCH ;restore default channel ldx #5 ;set 5 as active channel in jsr CHKIN ldx #0 rdloop: jsr BASIN ;input from channel rl1: sta $0400,x ;put to screen inx bne rdloop ;read 256 bytes jsr CLRCH ;restore default channel ;jsr CLALL ;close all channels brk ; data buffer: .byte "#" drivecmd: .byte "u1: 5 0 18 1", $0D readcnt: .byte 0