add Bejeweled to the collection, make TR compatible

This commit is contained in:
Peter Ferrie 2020-01-28 11:19:10 -08:00
parent 4d66f48cfd
commit cd73cff13d
8 changed files with 128 additions and 83 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -145,49 +145,27 @@ SwitchToBank2
!word Ignore ; IRQ vector ($FFFE-F) !word Ignore ; IRQ vector ($FFFE-F)
} }
LastMover LastMover
!if ((hdddataend & 255) > $ec) and ((hdddataend & 255) < $f2) { COPYSRC = *
; in the unlikely event that a bit over 16 bytes are left in the page !pseudopc hdddataend {
; then use it for the stack COPYDST = *
STACKBASE = ((hdddataend + 15) and -16) + 1
FONTSRC = *
!pseudopc STACKBASE + 15 {
FONTDST = *
!source "src/ui.font.data.lc2.a"
COPYDST = *
COPYSRC = LastMover + COPYDST - FONTDST
!source "src/ui.font.lc2.a"
!source "src/prodos.impl.lc2.a"
!source "src/glue.prorwts2.lc2.a"
!source "src/glue.launch.lc2.a"
!source "src/hw.accel.lc2.a"
LCRAM2_END = *
!if * > $E000 {
!error "code is too large: ends at ", *
}
}
EvenLasterMover
} else {
; otherwise place stack after code
; and begin font on the next page
COPYSRC = *
!pseudopc hdddataend {
COPYDST = *
!source "src/prodos.impl.lc2.a" !source "src/prodos.impl.lc2.a"
!source "src/ui.font.lc2.a" !source "src/ui.font.lc2.a"
!source "src/glue.prorwts2.lc2.a" !source "src/glue.prorwts2.lc2.a"
!source "src/glue.launch.lc2.a" !source "src/glue.launch.lc2.a"
!source "src/hw.accel.lc2.a" !source "src/hw.accel.lc2.a"
STACKBASE = * STACKBASE = *
LCRAM2_END = STACKBASE + 15 LCRAM2_END = STACKBASE + 15
FONTDST = (LCRAM2_END + 255) and -256 !if LCRAM2_END > DisableAccelerator {
!error "code is too large: ends at ", LCRAM2_END
} }
FONTDST = (LCRAM2_END + 255) and -256
}
EvenLasterMover EvenLasterMover
FONTSRC = * FONTSRC = *
!pseudopc FONTDST { !pseudopc FONTDST {
!source "src/ui.font.data.lc2.a" !source "src/ui.font.data.lc2.a"
!if * > $E000 { !if * > $E000 {
!error "code is too large: ends at ", * !error "code is too large: ends at ", *
}
} }
} }
!if RELBASE = $2000 { !if RELBASE = $2000 {

View File

@ -134,6 +134,16 @@
inc @FM+5 inc @FM+5
bne @FM bne @FM
ldy #>(255 + EvenLasterMover - LastMover)
@LM lda COPYSRC,x ; relocate pseudo-ProDOS to RAM bank 2
sta COPYDST,x
inx
bne @LM
inc @LM+2
inc @LM+5
dey
bne @LM
ldy #4 ldy #4
@ELM lda FONTSRC,x @ELM lda FONTSRC,x
; relocate font data to RAM bank 2 ; relocate font data to RAM bank 2
@ -145,16 +155,6 @@
dey dey
bne @ELM bne @ELM
ldy #>(255 + EvenLasterMover - LastMover)
@LM lda COPYSRC,x ; relocate pseudo-ProDOS to RAM bank 2
sta COPYDST,x
inx
bne @LM
inc @LM+2
inc @LM+5
dey
bne @LM
+READ_ROM_NO_WRITE +READ_ROM_NO_WRITE
jsr BuildAcceleratorFunction jsr BuildAcceleratorFunction
+READ_RAM2_WRITE_RAM2 +READ_RAM2_WRITE_RAM2

View File

@ -9,14 +9,14 @@
; D000..E635 - persistent data structures (per-game cheat categories, ; D000..E635 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore) ; gGlobalPrefsStore, gGamesListStore)
; ...unused... ; ...unused...
; ECBB..FFF9 - main program code ; ECA6..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors ; FFFA..FFFF - NMI, reset, IRQ vectors
; ;
; LC RAM BANK 2 ; LC RAM BANK 2
; D000..D3FF - ProRWTS data ; D000..D3FF - ProRWTS data
; D400..D66F - ProRWTS code ; D400..D66F - ProRWTS code
; D670..DB6C - HGR font code & ProRWTS glue code ; D670..DB98 - HGR font code & ProRWTS glue code
; DB6D..DB7B - backup of stack (during gameplay and self-running demos) ; DB99..DBA7 - backup of stack (during gameplay and self-running demos)
; ...unused... ; ...unused...
; DBAF..DBFF - (de)acceleration function ; DBAF..DBFF - (de)acceleration function
; DC00..DFFF - HGR font data ; DC00..DFFF - HGR font data

24
src/prelaunch/bejeweled.a Normal file
View File

@ -0,0 +1,24 @@
;license:MIT
;(c) 2020 by qkumba
!cpu 6502
!to "build/PRELAUNCH/BEJEWELED",plain
*=$106
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #<callback
sta $4451
lda #>callback
sta $4452
jmp $800 ; decompress
callback
jsr $BE00
+DISABLE_ACCEL
rts
!if * > $1C0 {
!error "code is too large, ends at ", *
}

View File

@ -43,16 +43,22 @@ ProDOS_enter
pha pha
@request @request
lda #$d1 lda #$d1
cmp #$40
beq @imp_allocint ;;@do_allocint
cmp #$41
beq @do_deallocint
cmp #$80 cmp #$80
beq @do_readblock beq @imp_rdwrblock ;;@do_readblock
cmp #$81 cmp #$81
beq @do_writeblock beq @imp_rdwrblock ;;@do_writeblock
cmp #$c0
beq @do_create
cmp #$c4 cmp #$c4
beq @do_getattrib beq @imp_getattrib ;;@do_getattrib
cmp #$c6 cmp #$c6
beq @do_nothing beq @do_setprefix
cmp #$c7 cmp #$c7
beq @do_prefix beq @do_getprefix
cmp #$c8 cmp #$c8
beq @do_open beq @do_open
cmp #$ca cmp #$ca
@ -63,19 +69,21 @@ ProDOS_enter
beq @do_close beq @do_close
cmp #$ce cmp #$ce
beq @do_seek beq @do_seek
cmp #$d1 cmp #$d0
beq @do_seteof
;; cmp #$d1
;; bne @do_fatal ;; bne @do_fatal
@do_eof @do_geteof
jmp @imp_eof jmp @imp_geteof
@do_allocint
;; jmp @imp_allocint
@do_readblock @do_readblock
@do_writeblock @do_writeblock
jmp @imp_rdwrblock ;; jmp @imp_rdwrblock
@do_getattrib @do_getattrib
jmp @imp_getattrib ;; jmp @imp_getattrib
@do_nothing @do_getprefix
jmp @restore_zp jmp @imp_getprefix
@do_prefix
jmp @imp_prefix
@do_open @do_open
jmp @imp_open jmp @imp_open
@do_read @do_read
@ -84,12 +92,31 @@ ProDOS_enter
jmp @imp_write jmp @imp_write
@do_close @do_close
jsr @imp_close ;subroutine special case because of dual-use jsr @imp_close ;subroutine special case because of dual-use
@do_deallocint ;nothing for now
@do_create ;nothing for now
@do_setprefix ;nothing for now
@do_seteof ;nothing for now
jmp @restore_zp jmp @restore_zp
@do_seek @do_seek
jmp @imp_seek jmp @imp_seek
@do_fatal @do_fatal
;; jmp ProDOS_fatal ;; jmp ProDOS_fatal
@imp_allocint
ldy #2
lda (ipacket), y
sta ProDOS_irq + 1
iny
lda (ipacket), y
sta ProDOS_irq + 2
lda #<ProDOS_int
ldx #>ProDOS_int
sta $3fe
sta $fffe
stx $3ff
stx $ffff
bne @jmp_zp2 ;always
@imp_rdwrblock @imp_rdwrblock
and #$7f and #$7f
tay tay
@ -143,7 +170,7 @@ ProDOS_enter
@jmp_zp2 @jmp_zp2
jmp @restore_zp jmp @restore_zp
@imp_prefix @imp_getprefix
ldx #buffer ldx #buffer
jsr @setbuffer1 jsr @setbuffer1
ldy ProDOS_prefix ldy ProDOS_prefix
@ -259,7 +286,7 @@ ProDOS_enter
@jmp_zp @jmp_zp
jmp @restore_zp jmp @restore_zp
@imp_eof @imp_geteof
ldy #2 ldy #2
lda bleftlo lda bleftlo
sta (ipacket), y sta (ipacket), y
@ -513,6 +540,28 @@ ProDOS_savedY
ProDOS_unit ProDOS_unit
!byte $d1 !byte $d1
ProDOS_int
pha
txa
pha
tya
pha
ProDOS_irq
jsr $d1d1 ;SMC
pla
tay
pla
tax
pla
bit $c012
bmi +
lda $45
+ rti
!if * > $bf58 {
!error "code is too large, ends at ", *
}
ProDOS_fatal ;only for debugging, will be removed ProDOS_fatal ;only for debugging, will be removed
;; bit $c081 ;; bit $c081
;; pha ;; pha

View File

@ -38,14 +38,13 @@ DrawPageInternal
beq @doneParsingLine beq @doneParsingLine
ldx #3 ldx #3
- cmp @subs_a,x - cmp @subs_a,x
beq @makesub bne @nosub
dex
bpl -
bmi +
@makesub
lda @subs_b,x lda @subs_b,x
sta (PTR),y sta (PTR),y
+ iny @nosub
dex
bpl -
iny
bne @parseLine bne @parseLine
@doneParsingLine @doneParsingLine
sty SAVE sty SAVE
@ -99,17 +98,15 @@ DrawCenteredStringInternal
; clobbers PTR/PTR+1 ; clobbers PTR/PTR+1
+STAY PTR +STAY PTR
php
ldy #0 ldy #0
lda (PTR),y php
sta HTAB
lda #40 lda #40
sec sec
sbc HTAB sbc (PTR),y
lsr lsr
sta HTAB sta HTAB
plp plp
jmp + beq +
DrawStringInternal DrawStringInternal
; A/Y contains address of length-prefixed string ; A/Y contains address of length-prefixed string
@ -145,12 +142,7 @@ DrawBufferInternal
; VTAB is NOT incremented ; VTAB is NOT incremented
; clobbers A/X/Y ; clobbers A/X/Y
+STAY @src+1 +STAY @src+1
bcs + php
lda #$00
+HIDE_NEXT_2_BYTES
+
lda #$60
sta @pagemask
dex dex
lda VTAB lda VTAB
asl asl
@ -174,10 +166,12 @@ DrawBufferInternal
adc #$10 adc #$10
asl @hgrlo+1 asl @hgrlo+1
rol rol
@pagemask=*+1 plp
eor #$FD ; SMC (0=hi-res page 1, #$60=hi-res page 2) bcc +
sta @row0+2 eor #$60
clc clc
+
sta @row0+2
adc #$04 adc #$04
sta @row1+2 sta @row1+2
adc #$04 adc #$04