diff --git a/rom5x/B0_CFF9_switch_cmd.s b/rom5x/B0_CFF9_switch_cmd.s index 67c637c..62bfa5d 100644 --- a/rom5x/B0_CFF9_switch_cmd.s +++ b/rom5x/B0_CFF9_switch_cmd.s @@ -1,6 +1,13 @@ +; This is the dispatch routine to call the primary ROM 5X +; functions of intercepting RESET and the boot process. +; If one enters at $CFF9, the command $A9 is loaded and +; we go to the BELL1 hijack. If entering at $CFFA, we +; load the command $EA and proceed the same way. +; thus we get two dispatch codes in 6 bytes. + #include "iic+.defs" .text -* = $cff9 ; 7 bytes available here +* = $cff9 ; 7 bytes available here, but don't count on $CFFF lda #$a9 ; lda opcode nop ; jmp/jsr $cffa does lda #$ea jmp $fbdf ; jump to bell1 hijack diff --git a/rom5x/B0_FBDF_bell1_hijack.s b/rom5x/B0_FBDF_bell1_hijack.s index 2898a2b..853b4d7 100644 --- a/rom5x/B0_FBDF_bell1_hijack.s +++ b/rom5x/B0_FBDF_bell1_hijack.s @@ -1,3 +1,20 @@ +; Hijack the BELL1 monitor routine to do our bidding. +; BELL1 implements the beep sound heard on reset or +; Ctrl-G, etc. It starts with +; LDA #$40 +; JSR WAIT ; delay .1 sec +; followed by code to actually beep the speaker +; In our case, BELL1 always loads the accumulator with +; a fixed number, and executes a 3-byte instruction +; Well, it turns out that to switch banks we need +; 3 bytes, and as luck would have it the other bank +; is empty here. +; So the routine on the other side is the ROM 5X +; dispatcher. It will take what is in the accumulator +; and use that to determine the next action. +; Obviously, $40 should beep the speaker, anything +; else can do whatever we want. + .text * = $fbdf sta $c028 diff --git a/rom5x/B1_C53D_patch_out_rom_cksum.s b/rom5x/B1_C53D_patch_out_rom_cksum.s new file mode 100644 index 0000000..ed7be8c --- /dev/null +++ b/rom5x/B1_C53D_patch_out_rom_cksum.s @@ -0,0 +1,13 @@ +; Patch the Apple IIc+ diagnostics to skip the ROM checksum test. +; We should really examine the routine at $D249 in the aux firmware +; to see if we can calculate a new checksum. +; the $D249 routine copies a small routine into the zero page that +; calculates the checksum. It returns with carry set = error and +; carry clear = OK. So we just patch the JSR to always clear the +; carry. For now. +* = $C53D +.text + nop + nop + clc + diff --git a/rom5x/B1_D516_boot5x.s b/rom5x/B1_D516_boot5x.s index 659b9e2..1f25091 100644 --- a/rom5x/B1_D516_boot5x.s +++ b/rom5x/B1_D516_boot5x.s @@ -1,8 +1,7 @@ #include "iic+.defs" .text -* = boot5x ; 234 bytes available, code assembles to 231 when - ; next line uncommented - jsr titl5x ; TODO "Apple IIc +" +* = boot5x ; 234 bytes available, code assembles to 231 + jsr titl5x ; "Apple IIc +" jsr rdrecov ; try to recover ramdisk lda power2 + rx_mslot ; get action saved by reset5x beq boot4 ; if zero, continue boot diff --git a/rom5x/B1_D6CE_rom5x_misc.s b/rom5x/B1_D6CE_rom5x_misc.s index d91ebd1..17f6ec1 100644 --- a/rom5x/B1_D6CE_rom5x_misc.s +++ b/rom5x/B1_D6CE_rom5x_misc.s @@ -1,11 +1,11 @@ #include "iic+.defs" .text * = misc5x ; max 306 bytes - bra domenu - bra dobann - bra gtkey - bra confirm - bra ntitle + bra domenu ; Display menu + bra dobann ; Display banner (title + By MG) + bra gtkey ; get a key + bra confirm ; ask SURE? + bra ntitle ; display "Apple IIc +" dobann jsr ntitle ldx #(msg2-msg1) ; msg display entry point jmp disp @@ -50,10 +50,11 @@ confirm pha plp rts ; display "Apple IIc +" in a convoluted manner -; ultimately, the rts instruction here "rts" to swrts2 -; which switches banks and "rts" to the title/banner firmware call -; which then "rts" to swrts (same addr as swrts2, but main bank) -; which then actually rts to our caller +; we push the address of swrts/swrts2 onto the stack +; and then the address of the title routine +; we then jump to swrts2 which switches banks and RTS to +; display "Apple IIc +", which then RTS to swrts, which +; switches banks back to here and RTS to our caller. ntitle lda #>(swrts2-1) ; put return addr of swrts/swrts2 on stack pha lda #<(swrts2-1) @@ -62,11 +63,6 @@ ntitle lda #>(swrts2-1) ; put return addr of swrts/swrts2 on stack pha lda #<(banner-1) pha - ;lda #>(swrts2-1) ; put swrts on the stack - ;pha - ;lda #<(swrts2-1) - ;pha - ;rts ; jump to swrts2 jmp swrts2 ; jump to swrts2 ; msg format ; A byte < $20 indicates high byte of address. diff --git a/rom5x/B1_FBE2_rom5x_dispatch.s b/rom5x/B1_FBE2_rom5x_dispatch.s index 5bbb798..709dcaa 100644 --- a/rom5x/B1_FBE2_rom5x_dispatch.s +++ b/rom5x/B1_FBE2_rom5x_dispatch.s @@ -8,10 +8,10 @@ chk2: cmp #$ea ; boot patch bne dowait jmp boot5x dowait: jsr $fcb5 ; do delay if anything else - lda #>($fbe2-1) - pha - lda #<($fbe2-1) + lda #>($fbe2-1) ; return to other bank here + pha ; by pushing address onto + lda #<($fbe2-1) ; the stack pha lda #$00 ; in case someone assumes this - jmp swrts2 + jmp swrts2 ; back to other bank ; 28 bytes, will have to move if we get bigger diff --git a/rom5x/Rakefile b/rom5x/Rakefile index 7d47ae6..3898693 100644 --- a/rom5x/Rakefile +++ b/rom5x/Rakefile @@ -12,6 +12,7 @@ end desc "Clean object files" task :clean do sh "rm -f #{dest_rom}" + sh "rm -f sf512_#{dest_rom}" sh "rm -f *.o65" sh "rm -f *.o65.lbl" end