mirror of
https://github.com/david-schmidt/AII2048.git
synced 2024-06-13 11:29:42 +00:00
Add 'won' message
This commit is contained in:
parent
45cb7e8175
commit
f9d5d2553e
1
src/.gitignore
vendored
1
src/.gitignore
vendored
|
@ -1,4 +1,3 @@
|
||||||
/AII2048.lst
|
/AII2048.lst
|
||||||
/AII2048.map
|
/AII2048.map
|
||||||
/AII2048.o
|
/AII2048.o
|
||||||
/ascreen.asm
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.export CellTable, GameState
|
.export CellTable, GameState
|
||||||
.exportzp RestartLatch, P0ScoreBCD, P1ScoreBCD
|
.exportzp RestartLatch, P0ScoreBCD, P1ScoreBCD
|
||||||
.import READ_CHAR, PRBYTE, DisplayBoard, DisplayState, InitScreen, VTAB, DisplayGameOverMsg
|
.import READ_CHAR, PRBYTE, DisplayBoard, DisplayState, InitScreen, VTAB, DisplayGameOverMsg, DisplayWonMsg
|
||||||
|
|
||||||
;
|
;
|
||||||
; 2048 2600
|
; 2048 2600
|
||||||
|
@ -657,6 +657,7 @@ DoneCounterManagement:
|
||||||
lda Party2048Counter
|
lda Party2048Counter
|
||||||
bne NoParty ; Already had a party
|
bne NoParty ; Already had a party
|
||||||
inc Party2048Counter ; Let's party!
|
inc Party2048Counter ; Let's party!
|
||||||
|
jsr DisplayWonMsg
|
||||||
NoParty:
|
NoParty:
|
||||||
|
|
||||||
|
|
||||||
|
|
150
src/ascreen.asm
Normal file
150
src/ascreen.asm
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
.import FirstDataCellOffset
|
||||||
|
.importzp CellTable, GameState, RestartLatch, P0ScoreBCD, P1ScoreBCD
|
||||||
|
.export READ_CHAR, DisplayBoard, InitScreen, DisplayGameOverMsg, DisplayWonMsg
|
||||||
|
|
||||||
|
DisplayBoard:
|
||||||
|
; Home cursor
|
||||||
|
lda #$06
|
||||||
|
sta <CH
|
||||||
|
lda #$06
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
; Paint bottom border
|
||||||
|
lda #$20
|
||||||
|
ldx #$0d
|
||||||
|
: jsr COUT
|
||||||
|
dex
|
||||||
|
bne :-
|
||||||
|
; Paint top border
|
||||||
|
lda #$01
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
lda #$06
|
||||||
|
sta <CH
|
||||||
|
lda #$20
|
||||||
|
ldx #$0d
|
||||||
|
: jsr COUT
|
||||||
|
dex
|
||||||
|
bne :-
|
||||||
|
|
||||||
|
|
||||||
|
lda #$01
|
||||||
|
sta <CV
|
||||||
|
ldy #$5 ; FirstDataCellOffset
|
||||||
|
; Paint a data row
|
||||||
|
@Paint: ldx #$00
|
||||||
|
lda #$06
|
||||||
|
sta <CH
|
||||||
|
inc <CV
|
||||||
|
lda <CV
|
||||||
|
jsr VTAB
|
||||||
|
lda #$20
|
||||||
|
jsr COUT
|
||||||
|
: lda CellTable,y
|
||||||
|
jsr PRBYTE
|
||||||
|
lda #$a0
|
||||||
|
jsr COUT
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
cpx #$04
|
||||||
|
bne :-
|
||||||
|
iny ; Skip over barrier
|
||||||
|
dec <CH
|
||||||
|
lda #$20
|
||||||
|
jsr COUT
|
||||||
|
lda #$a0
|
||||||
|
jsr COUT
|
||||||
|
lda CV
|
||||||
|
cmp #$05
|
||||||
|
bne @Paint
|
||||||
|
|
||||||
|
DisplayScore:
|
||||||
|
lda #$1c
|
||||||
|
sta <CH
|
||||||
|
lda #$03
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
lda P0ScoreBCD
|
||||||
|
jsr PRBYTE
|
||||||
|
lda P0ScoreBCD+1
|
||||||
|
jsr PRBYTE
|
||||||
|
lda P0ScoreBCD+2
|
||||||
|
jsr PRBYTE
|
||||||
|
lda #$1c
|
||||||
|
sta <CH
|
||||||
|
lda #$04
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
lda P1ScoreBCD
|
||||||
|
jsr PRBYTE
|
||||||
|
lda P1ScoreBCD+1
|
||||||
|
jsr PRBYTE
|
||||||
|
lda P1ScoreBCD+2
|
||||||
|
jsr PRBYTE
|
||||||
|
rts
|
||||||
|
|
||||||
|
DisplayScoreMsg:
|
||||||
|
lda #$16
|
||||||
|
sta <CH
|
||||||
|
lda #$03
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
ldy #$00
|
||||||
|
@NextS: lda ScoreMsg,y
|
||||||
|
beq @High
|
||||||
|
jsr COUT
|
||||||
|
iny
|
||||||
|
bne @NextS
|
||||||
|
@High: lda #$17
|
||||||
|
sta <CH
|
||||||
|
lda #$04
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
ldy #$00
|
||||||
|
@NextH: lda HighMsg,y
|
||||||
|
beq @Done
|
||||||
|
jsr COUT
|
||||||
|
iny
|
||||||
|
bne @NextH
|
||||||
|
@Done: rts
|
||||||
|
|
||||||
|
DisplayGameOverMsg:
|
||||||
|
lda #$0f
|
||||||
|
sta <CH
|
||||||
|
lda #$0c
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
ldy #$00
|
||||||
|
@Next: lda GameOverMsg,y
|
||||||
|
beq @Done
|
||||||
|
jsr COUT
|
||||||
|
iny
|
||||||
|
bne @Next
|
||||||
|
@Done: rts
|
||||||
|
|
||||||
|
DisplayWonMsg:
|
||||||
|
lda #$0d
|
||||||
|
sta <CH
|
||||||
|
lda #$0e
|
||||||
|
sta <CV
|
||||||
|
jsr VTAB
|
||||||
|
ldy #$00
|
||||||
|
@Next: lda WonMsg,y
|
||||||
|
beq @Done
|
||||||
|
jsr COUT
|
||||||
|
iny
|
||||||
|
bne @Next
|
||||||
|
@Done: rts
|
||||||
|
|
||||||
|
ScoreMsg:
|
||||||
|
asc "SCORE:"
|
||||||
|
.byte $00
|
||||||
|
HighMsg:
|
||||||
|
asc "HIGH:"
|
||||||
|
.byte $00
|
||||||
|
GameOverMsg:
|
||||||
|
asc "GAME OVER!"
|
||||||
|
.byte $00
|
||||||
|
WonMsg:
|
||||||
|
asc "!YOU GOT 2048!"
|
||||||
|
.byte $00
|
Loading…
Reference in New Issue
Block a user