diff options
-rw-r--r-- | crt0_5200.s | 99 |
1 files changed, 27 insertions, 72 deletions
diff --git a/crt0_5200.s b/crt0_5200.s index 5210ec1..cdc882a 100644 --- a/crt0_5200.s +++ b/crt0_5200.s @@ -33,10 +33,7 @@ ;;; machine (the hardware changes don't break compatibility), so the code ;;; here comes from the 4-port OS. -; I've gone to a lot of trouble to get the vectors and display list -; set up correctly for either ROM revision... but the display list, at -; least, was really a waste of time: conio is going to set up a GR.1 -; display list... at least until I modify it to use GR.0 instead. + tmpptr = $11 ; 2 bytes, aka PADDL0 and PADDL1 start: ldx #0 @@ -51,95 +48,53 @@ start: lda #$F8 sta CHBASE ;Set Character base to $F800 -; determine which OS revision we're running under. This affects +; Determine which OS revision we're running under. This affects ; the locations of the vector table and display list in the ROM, ; and is probably the reason a few published 5200 games are ; incompatible with the Rev A ROM. -; rev A has $07 at $fee5, original OS has $61. If there are other -; OS revisions out there in the wild, this code will likely fail -; on them. - - lda #$fe - sta $fb -; sta $fd -; sta $ff +; Rev A has $07 at $fee5, original OS has $61. The vector table +; lives at $fe95 on the original OS and $feab on rev A. +; If there are other OS revisions out there in the wild, this +; code will likely fail on them. + + lda #$fe ; either way, the hi byte of the vector table is $fe + sta tmpptr+1 lda $fee5 cmp #$07 beq @rev_a - ; set up $fa to point to vector table, - ; $fc to point to display list start, - ; $fe to point to DL end. - - ; old OS: - lda #$95 - sta $fa -; lda #$c8 -; sta $fc -; lda #$cf -; sta $fe - bne @copy_vectors - + ; set up pointer to vector table according to the OS revision we're on. + lda #$95 ; the old gods... + .byte $2c @rev_a: - lda #$ab - sta $fa -; lda #$de -; sta $fc -; lda #$e5 -; sta $fe + lda #$ab ; ...and the new. + sta tmpptr @copy_vectors: - ldy #$0B + ldy #$0B ; 6 vectors, 2 bytes each. @cploop: - lda ($fa),y + lda (tmpptr),y sta VIMIRQ,y ;Copy vectors to vector table dey bpl @cploop + ; clear 3K of memory from $3000 to $3c00 (why only 3K?) + ; if ROM space gets *really* tight, check & see whether we + ; can live without this. lda #$3C ;Set pointer to $3C00 - sta $12 + sta tmpptr+1 lda #$00 - sta $11 + sta tmpptr ldx #$0C - tay -@vecloop: - sta ($11),y + tay ; A still 0 +@memclrloop: + sta (tmpptr),y dey - bne @vecloop - dec $12 + bne @memclrloop + dec tmpptr+1 dex - bpl @vecloop - -;;; taipan doesn't need the OS-provided display list. -;;; conio init will set up a GR.1 DL (at least, until -;;; I modify it to the GR.0 that taipan needs) -;Build display list -; lda #$0D ;Antic mode 13 -; ldx #$4D -;@dl13loop: -; sta $2007,x ;write to display list -; dex -; bpl @dl13loop -; -; ldy #$06 ;Copy start of display list -;@dlloop: -; lda ($fc),y -; sta $2000,y -; dey -; bpl @dlloop -; -; ldy #$04 ;Copy end of display list -;@dlendloop: -; lda ($fe),y -; sta $2055,y -; dey -; bpl @dlendloop -; -; lda #$00 ;Set Display List pointer to $2000 -; sta $05 -; lda #$20 -; sta $06 + bpl @memclrloop lda #$22 ;Set DMACTL, dlist on/normal background sta SDMCTL |