mirror of
https://github.com/digarok/flapple.git
synced 2024-05-28 10:41:27 +00:00
mono mode and working IIc vblanks
This commit is contained in:
parent
c001358342
commit
065ec1274d
BIN
flapple140.po
BIN
flapple140.po
Binary file not shown.
BIN
flapple800.po
BIN
flapple800.po
Binary file not shown.
|
@ -16,5 +16,7 @@ SPEAKER equ $C030
|
|||
VBL equ $C02E
|
||||
RDVBLBAR equ $C019 ;not VBL (VBL signal low
|
||||
|
||||
RAMWRTAUX equ $C005
|
||||
RAMWRTMAIN equ $C004
|
||||
SETAN3 equ $C05E ;Set annunciator-3 output to 0
|
||||
SET80VID equ $C00D ;enable 80-column display mode (WR-only)
|
||||
|
|
51
src/bird.s
51
src/bird.s
|
@ -23,8 +23,6 @@ SPRITE_SCREEN_P4 equz $FA
|
|||
SPRITE_IMASK_P equz $FC
|
||||
|
||||
SPRITE_SCREEN_IDX db #$0
|
||||
AUX_BG_COLOR db #$BB
|
||||
MAIN_BG_COLOR db #$77
|
||||
|
||||
|
||||
BIRD_X equ #17
|
||||
|
@ -57,10 +55,15 @@ FlapBird
|
|||
|
||||
***** EVEN then ODD, i.e. AUX then MAIN
|
||||
BIRD_WUP_E_PIXEL
|
||||
DO MONO
|
||||
hex 00,EA,EA,FF,F0,50,D5,A5,0F,00
|
||||
hex AA,EA,EE,CF,CF,D5,55,8A,90,90
|
||||
hex 05,AD,A4,08,08,05,5D,51,01,00
|
||||
ELSE
|
||||
hex BB,EA,EA,FF,FB,57,D5,A5,0F,77
|
||||
hex AA,EA,EE,CF,CF,D5,55,8A,90,97
|
||||
hex B5,AD,A4,B8,B8,75,5D,51,71,77
|
||||
|
||||
FIN
|
||||
|
||||
BIRD_WUP_E_MASK
|
||||
hex FF,00,00,00,0F,0F,00,00,00,FF
|
||||
|
@ -75,10 +78,15 @@ BIRD_WUP_E_IMASK
|
|||
|
||||
***** EVEN then ODD, i.e. AUX then MAIN
|
||||
BIRD_WDN_E_PIXEL
|
||||
DO MONO
|
||||
hex 00,EA,EA,FF,F0,50,D5,A5,0F,00
|
||||
hex AA,EE,EE,CF,CF,DD,5D,8A,90,90
|
||||
hex 54,AE,A4,08,08,5D,55,51,01,00
|
||||
ELSE
|
||||
hex BB,EA,EA,FF,FB,57,D5,A5,0F,77
|
||||
hex AA,EE,EE,CF,CF,DD,5D,8A,90,97
|
||||
hex 54,AE,A4,B8,B8,5D,55,51,71,77
|
||||
|
||||
FIN
|
||||
|
||||
BIRD_WDN_E_MASK
|
||||
hex FF,00,00,00,0F,0F,00,00,00,FF
|
||||
|
@ -94,11 +102,18 @@ BIRD_WDN_E_IMASK
|
|||
|
||||
***** EVEN then ODD, i.e. AUX then MAIN
|
||||
BIRD_WUP_O_PIXEL
|
||||
DO MONO
|
||||
hex 00,A0,A0,F0,00,00,50,50,F0,00
|
||||
hex A0,AE,EE,FF,FF,55,5D,AA,00,00
|
||||
hex 5A,DE,4E,8C,8C,5D,D5,18,19,09
|
||||
hex 00,0A,0A,00,00,00,05,05,00,00
|
||||
ELSE
|
||||
hex BB,AB,AB,FB,BB,77,57,57,F7,77
|
||||
hex AB,AE,EE,FF,FF,55,5D,AA,00,77
|
||||
hex 5A,DE,4E,8C,8C,5D,D5,18,19,79
|
||||
hex BB,BA,BA,BB,BB,77,75,75,77,77
|
||||
|
||||
FIN
|
||||
|
||||
BIRD_WUP_O_MASK
|
||||
hex FF,0F,0F,0F,FF,FF,0F,0F,0F,FF
|
||||
|
@ -116,11 +131,17 @@ BIRD_WUP_O_IMASK
|
|||
|
||||
***** EVEN then ODD, i.e. AUX then MAIN
|
||||
BIRD_WDN_O_PIXEL
|
||||
DO MONO
|
||||
hex 00,A0,A0,F0,00,00,50,50,F0,00
|
||||
hex A0,EE,EE,FF,FF,D5,DD,AA,00,00
|
||||
hex 4A,EE,4E,8C,8C,DD,55,18,19,09
|
||||
hex 05,0A,0A,00,00,05,05,05,00,00
|
||||
ELSE
|
||||
hex BB,AB,AB,FB,BB,77,57,57,F7,77
|
||||
hex AB,EE,EE,FF,FF,D5,DD,AA,00,77
|
||||
hex 4A,EE,4E,8C,8C,DD,55,18,19,79
|
||||
hex B5,BA,BA,BB,BB,75,75,75,77,77
|
||||
|
||||
FIN
|
||||
|
||||
BIRD_WDN_O_MASK
|
||||
hex FF,0F,0F,0F,FF,FF,0F,0F,0F,FF
|
||||
|
@ -163,7 +184,7 @@ UndrawBird lda BIRD_Y_OLD
|
|||
pha ; stash
|
||||
tay ; COL offset
|
||||
sta TXTPAGE2
|
||||
lda #$BB
|
||||
lda #BGCOLORAUX
|
||||
:wipe1 sta (SPRITE_SCREEN_P),y
|
||||
sta (SPRITE_SCREEN_P2),y
|
||||
sta (SPRITE_SCREEN_P3),y
|
||||
|
@ -187,7 +208,7 @@ UndrawBird lda BIRD_Y_OLD
|
|||
pla ; unstash
|
||||
tay
|
||||
sta TXTPAGE1
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
:wipe2 sta (SPRITE_SCREEN_P),y
|
||||
sta (SPRITE_SCREEN_P2),y
|
||||
sta (SPRITE_SCREEN_P3),y
|
||||
|
@ -234,7 +255,7 @@ UndrawBird lda BIRD_Y_OLD
|
|||
pha ; stash
|
||||
tay ; COL offset
|
||||
sta TXTPAGE2
|
||||
lda #$BB
|
||||
lda #BGCOLORAUX
|
||||
:wipe3 sta (SPRITE_SCREEN_P),y
|
||||
sta (SPRITE_SCREEN_P2),y
|
||||
sta (SPRITE_SCREEN_P3),y
|
||||
|
@ -263,7 +284,7 @@ UndrawBird lda BIRD_Y_OLD
|
|||
pla ; unstash
|
||||
tay
|
||||
sta TXTPAGE1
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
:wipe4 sta (SPRITE_SCREEN_P),y
|
||||
sta (SPRITE_SCREEN_P2),y
|
||||
sta (SPRITE_SCREEN_P3),y
|
||||
|
@ -384,13 +405,13 @@ DD_EVEN lda #0
|
|||
lda (SPRITE_SCREEN_P),y
|
||||
|
||||
ldy SPRITE_X_IDX ; PREP Y INDEX
|
||||
cmp #$BB ; AUX BGCOLOR @TODO
|
||||
cmp #BGCOLORAUX ; AUX BGCOLOR @TODO
|
||||
beq :noCollisionSIMPLE
|
||||
pha ; SAVE -> STACK
|
||||
and (SPRITE_IMASK_P),y
|
||||
cmp #$B0
|
||||
cmp #BGCOLORAUX_0LO
|
||||
beq :noCollision
|
||||
cmp #$0B
|
||||
cmp #BGCOLORAUX_0HI
|
||||
beq :noCollision
|
||||
lda #1
|
||||
sta SPRITE_COLLISION
|
||||
|
@ -429,13 +450,13 @@ DD_ODD
|
|||
ldy SPRITE_SCREEN_IDX ; GET SCREEN PIXELS
|
||||
lda (SPRITE_SCREEN_P),y
|
||||
ldy SPRITE_X_IDX ; PREP Y INDEX
|
||||
cmp #$77 ; MAIN BGCOLOR @TODO
|
||||
cmp #BGCOLOR ; MAIN BGCOLOR @TODO
|
||||
beq :noCollisionSIMPLE
|
||||
pha ; SAVE -> STACK
|
||||
and (SPRITE_IMASK_P),y
|
||||
cmp #$70
|
||||
cmp #BGCOLOR_0LO
|
||||
beq :noCollision
|
||||
cmp #$07
|
||||
cmp #BGCOLOR_0HI
|
||||
beq :noCollision
|
||||
lda #1
|
||||
sta SPRITE_COLLISION
|
||||
|
|
142
src/flapple.s
142
src/flapple.s
|
@ -6,7 +6,6 @@
|
|||
****************************************
|
||||
lst off
|
||||
org $2000 ; start at $2000 (all ProDOS8 system files)
|
||||
dsk flap.system ; tell compiler output filename
|
||||
typ $ff ; set P8 type ($ff = "SYS") for output file
|
||||
xc off ; @todo force 6502?
|
||||
xc off
|
||||
|
@ -21,9 +20,33 @@ CopyPtr MAC
|
|||
sta ]2+1 ; store high byte
|
||||
<<<
|
||||
|
||||
; HANDLE GREENSCREEN DOODS
|
||||
MONO equ 0 ; set 0 = color mode, 1 = mono mode
|
||||
|
||||
DO MONO
|
||||
dsk fmono.system ; tell compiler output filename
|
||||
BGCOLOR equ #$00
|
||||
BGCOLORAUX equ #$00
|
||||
BGCOLOR_0LO equ #$00
|
||||
BGCOLOR_0HI equ #$00
|
||||
BGCOLORAUX_0LO equ #$00
|
||||
BGCOLORAUX_0HI equ #$00
|
||||
|
||||
; HANDLE COLOR DOODS
|
||||
ELSE
|
||||
dsk flap.system ; tell compiler output filename
|
||||
BGCOLOR equ #$77
|
||||
BGCOLORAUX equ #$BB
|
||||
BGCOLOR_0LO equ #$70
|
||||
BGCOLOR_0HI equ #$07
|
||||
BGCOLORAUX_0LO equ #$B0
|
||||
BGCOLORAUX_0HI equ #$0B
|
||||
|
||||
FIN
|
||||
|
||||
|
||||
|
||||
Main
|
||||
jsr GetRand ; hack to avoid ugly color on first high score display
|
||||
jsr DetectMachine ; also inits vbl
|
||||
jsr LoadHiScore
|
||||
jsr IntroWipe
|
||||
|
@ -32,13 +55,17 @@ Main
|
|||
|
||||
Title
|
||||
jsr VBlank
|
||||
DO MONO
|
||||
lda #$FF
|
||||
ELSE
|
||||
lda #$00
|
||||
FIN
|
||||
jsr DL_Clear
|
||||
ldx #3 ;slight pause
|
||||
jsr VBlankX
|
||||
lda #$F6
|
||||
ldx #$27
|
||||
ldy #$77
|
||||
ldy #BGCOLOR
|
||||
jsr DL_WipeIn
|
||||
jsr DrawFlogo
|
||||
lda FlogoCount
|
||||
|
@ -74,7 +101,7 @@ PreGameLoop
|
|||
|
||||
** CLEAR SCREEN - SETUP BIRD
|
||||
jsr VBlank
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
jsr DL_Clear
|
||||
|
||||
lda #BIRD_X
|
||||
|
@ -111,7 +138,7 @@ PreGameLoop
|
|||
:checkKey lda KEY
|
||||
bpl :noKey
|
||||
:key sta STROBE
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
jsr DL_Clear
|
||||
jmp GameLoop
|
||||
|
||||
|
@ -210,8 +237,6 @@ FlogoCount db 0 ; used to throttle how often song is played
|
|||
|
||||
SND_Flap jmp SND_Flap2
|
||||
SND_Flap1
|
||||
* lda #5
|
||||
* sta $c034
|
||||
ldx #$1c ;LENGTH OF NOISE BURST
|
||||
:spkLoop lda SPEAKER ;TOGGLE SPEAKER
|
||||
txa
|
||||
|
@ -223,8 +248,6 @@ SND_Flap1
|
|||
bne :waitLoop
|
||||
dex ;GET NEXT PULSE OF THIS NOISE BURST
|
||||
bne :spkLoop
|
||||
* ldx #$0 ;LENGTH OF NOISE BURST
|
||||
* stx $c034
|
||||
rts
|
||||
|
||||
SND_Flap2
|
||||
|
@ -499,6 +522,7 @@ WriteResult dw 0 ; result count (amount transferred)
|
|||
|
||||
|
||||
Quit jsr QRPause
|
||||
sta TXTPAGE1 ; Don't forget to give them back the right page!
|
||||
jsr MLI ; first actual command, call ProDOS vector
|
||||
dfb $65 ; QUIT P8 request ($65)
|
||||
da QuitParm
|
||||
|
@ -837,13 +861,14 @@ DetectMachine
|
|||
* bcc :newmachine ;If carry is clear, then new machine
|
||||
:newmachine asl _compType ;multiply vblank detection val $7E * 2
|
||||
lda #1
|
||||
sta GMachineIIgs
|
||||
rts
|
||||
bne :setmachine
|
||||
:oldmachine lda #0
|
||||
sta GMachineIIgs
|
||||
:setmachine sta GMachineIIgs
|
||||
|
||||
jsr InitVBlank
|
||||
rts
|
||||
|
||||
GMachineIIgs dw 0
|
||||
GMachineIIgs db 0
|
||||
|
||||
IntroWipe
|
||||
sta C80STOREON
|
||||
|
@ -871,16 +896,93 @@ IntroText str "Dagen Brock presents..."
|
|||
**************************************************
|
||||
* Wait for vertical blanking interval - IIe/IIgs
|
||||
**************************************************
|
||||
VBlankX lda _compType
|
||||
:vblActive cmp RDVBLBAR ; make sure we wait for the current one to stop
|
||||
bpl :vblActive ; in case it got launched in rapid succession
|
||||
:screenActive cmp RDVBLBAR
|
||||
bmi :screenActive
|
||||
VBlankX
|
||||
:xloop txa
|
||||
pha
|
||||
jsr VBlank
|
||||
pla
|
||||
tax
|
||||
dex
|
||||
bne :vblActive
|
||||
bne :xloop
|
||||
rts
|
||||
|
||||
VBlank lda _compType
|
||||
|
||||
InitVBlank
|
||||
lda $FBC0 ; check for IIc
|
||||
bne ]rts ; not a IIc--use VBlankIIeIIgs
|
||||
|
||||
jsr MLI ; instantiate our interrupt
|
||||
dfb $40
|
||||
da VBLIntParm
|
||||
|
||||
lda #%00001000 ; enable vblint only
|
||||
ldx #SETMOUSE
|
||||
jsr mouse
|
||||
|
||||
lda #VBlankIIc ; override vblank
|
||||
sta VBlankRoutine
|
||||
lda #>VBlankIIc
|
||||
sta VBlankRoutine+1
|
||||
|
||||
cli
|
||||
|
||||
]rts rts
|
||||
|
||||
|
||||
VBLIntParm dfb 2
|
||||
brk ;?
|
||||
da VBLIntHandler
|
||||
|
||||
VBLIntHandler cld ; Expected by ProDOS
|
||||
ldx #SERVEMOUSE
|
||||
jsr mouse
|
||||
bcs :notOurs ; pass if not
|
||||
sec
|
||||
ror _vblflag ;set hibit
|
||||
|
||||
clc
|
||||
:notOurs rts
|
||||
|
||||
mouse ldy $C400,x
|
||||
sty ]jump+1
|
||||
|
||||
ldx #$C4
|
||||
ldy #$40
|
||||
|
||||
sei
|
||||
]jump jmp $C400
|
||||
|
||||
|
||||
|
||||
|
||||
MOUSE = $c400 ; mouse = slot 4
|
||||
*SETMOUSE = $c412 ; Apple IIc Ref p.168
|
||||
*SERVEMOUSE = $c413 ; Apple IIc Ref p.168
|
||||
|
||||
SETMOUSE = $12
|
||||
SERVEMOUSE = $13
|
||||
READMOUSE = $14
|
||||
INITMOUSE = $19
|
||||
|
||||
VBlank jmp VBlankIIeIIgs
|
||||
VBlankRoutine equ *-2
|
||||
VBlankIIc
|
||||
cli ;enable interrupts
|
||||
|
||||
:loop1 bit _vblflag
|
||||
bpl :loop1 ;wait for vblflag = 1
|
||||
lsr _vblflag ;...& set vblflag = 0
|
||||
|
||||
*:loop2 bit _vblflag
|
||||
* bpl :loop2
|
||||
* lsr _vblflag
|
||||
|
||||
sei
|
||||
rts
|
||||
_vblflag db 0
|
||||
|
||||
VBlankIIeIIgs
|
||||
lda _compType
|
||||
:vblActive cmp RDVBLBAR ; make sure we wait for the current one to stop
|
||||
bpl :vblActive ; in case it got launched in rapid succession
|
||||
:screenActive cmp RDVBLBAR
|
||||
|
|
28
src/pipes.s
28
src/pipes.s
|
@ -17,11 +17,19 @@
|
|||
* hex bb,aa,77,77,66,77,66,66,22,66,22,22,aa,bb,bb
|
||||
|
||||
** "interleave" format
|
||||
DO MONO
|
||||
PipeBody_Main_E hex 55,ee,ee,cc,cc,44,00
|
||||
PipeBody_Main_O hex 00,ee,cc,cc,44,44,55,00
|
||||
PipeBody_Aux_E hex 00,77,66,66,22,22,aa,00
|
||||
PipeBody_Aux_O hex aa,77,77,66,66,22,00
|
||||
ELSE
|
||||
PipeBody_Main_E hex 55,ee,ee,cc,cc,44,77
|
||||
PipeBody_Main_O hex 77,ee,cc,cc,44,44,55,77
|
||||
PipeBody_Aux_E hex bb,77,66,66,22,22,aa,bb
|
||||
PipeBody_Aux_O hex aa,77,77,66,66,22,bb
|
||||
|
||||
FIN
|
||||
|
||||
PipeInterval equ #60 ; game ticks to spawn new pipe
|
||||
PipeSpawn db #45 ; our counter, starting point for spawning
|
||||
PipeSpawnSema db 0 ; points to next spot (even if currently unavailable)
|
||||
|
@ -275,7 +283,7 @@ DrawPipeEven
|
|||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP3),y
|
||||
iny ;col 14 (final!)
|
||||
lda #$BB ; BGCOLOR! Last column, no need to undraw whole pipe
|
||||
lda #BGCOLORAUX ; BGCOLOR! Last column, no need to undraw whole pipe
|
||||
sta (PIPE_DP0),y
|
||||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP2),y
|
||||
|
@ -381,7 +389,7 @@ DrawPipeBodyEven
|
|||
lda #$44
|
||||
sta (PIPE_DP),y
|
||||
iny
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
sta (PIPE_DP),y
|
||||
|
||||
|
||||
|
@ -408,7 +416,7 @@ DrawPipeBodyEven
|
|||
lda #$AA
|
||||
sta (PIPE_DP),y
|
||||
iny
|
||||
lda #$BB
|
||||
lda #BGCOLORAUX
|
||||
sta (PIPE_DP),y
|
||||
|
||||
inc PIPE_Y
|
||||
|
@ -475,7 +483,7 @@ DrawPipeOdd
|
|||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP3),y
|
||||
iny ;col 14 (final!)
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
sta (PIPE_DP0),y
|
||||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP2),y
|
||||
|
@ -580,7 +588,7 @@ DrawPipeBodyOdd
|
|||
lda #$55
|
||||
sta (PIPE_DP),y
|
||||
iny
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
sta (PIPE_DP),y
|
||||
|
||||
|
||||
|
@ -604,7 +612,7 @@ DrawPipeBodyOdd
|
|||
lda #$22
|
||||
sta (PIPE_DP),y
|
||||
iny
|
||||
lda #$BB
|
||||
lda #BGCOLORAUX
|
||||
sta (PIPE_DP),y
|
||||
|
||||
inc PIPE_Y
|
||||
|
@ -684,7 +692,7 @@ DrawPipeEvenR
|
|||
iny ;col 14 (final!)
|
||||
cpy #PIPE_RCLIP
|
||||
bcs :RCLIP
|
||||
lda #$BB
|
||||
lda #BGCOLORAUX
|
||||
sta (PIPE_DP0),y
|
||||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP2),y
|
||||
|
@ -890,7 +898,7 @@ DrawPipeOddR
|
|||
iny ;col 14 (final!)
|
||||
cpy #PIPE_RCLIP
|
||||
bcs :RCLIP
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
sta (PIPE_DP0),y
|
||||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP2),y
|
||||
|
@ -1038,7 +1046,7 @@ DrawPipeEvenL
|
|||
;col 14 (rightmost)
|
||||
cpy #PIPE_RCLIP
|
||||
bcs :RCLIP
|
||||
lda #$BB
|
||||
lda #BGCOLORAUX
|
||||
sta (PIPE_DP0),y
|
||||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP2),y
|
||||
|
@ -1244,7 +1252,7 @@ DrawPipeOddL
|
|||
;col 14 (rightmost)
|
||||
cpy #PIPE_RCLIP
|
||||
bcs :RCLIP
|
||||
lda #$77
|
||||
lda #BGCOLOR
|
||||
sta (PIPE_DP0),y
|
||||
sta (PIPE_DP1),y
|
||||
sta (PIPE_DP2),y
|
||||
|
|
Loading…
Reference in New Issue
Block a user