Skip to content

Commit 32ca5e2

Browse files
committed
Win screen implemented, nuke disabled
1 parent 8699423 commit 32ca5e2

File tree

9 files changed

+194
-14
lines changed

9 files changed

+194
-14
lines changed

build_test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ cl65 --cpu 65C02 -o startscreen_browse.prg -l startscreen_browse.list startscree
77
cl65 --cpu 65C02 -o joystick_test.prg -l joystick_test.list joystick_test.asm
88
cl65 --cpu 65C02 -o fireball_test.prg -l fireball_test.list fireball_test.asm
99
cl65 --cpu 65C02 -o bomb_test.prg -l bomb_test.list bomb_test.asm
10+
cl65 --cpu 65C02 -o ws_test.prg -l ws_test.list ws_test.asm

game.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ GAME_INC = 1
1313
.include "skull.asm"
1414
.include "fireball.asm"
1515
.include "bomb.asm"
16+
.include "winscreen.asm"
1617

1718
init_game:
1819
lda #0
@@ -43,7 +44,7 @@ game_tick: ; called after every VSYNC detected (60 Hz)
4344
jsr skull_tick
4445
jsr fireball_tick
4546
jsr bomb_tick
46-
; TODO add other tick handlers
47+
jsr winscreen_tick
4748
@return:
4849
rts
4950

globals.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
GLOBALS_INC = 1
33

44
; ---------- Build Options ----------
5-
NUKE_ENABLED = 1
5+
NUKE_ENABLED = 0
66

77
; ------------ Constants ------------
88

@@ -87,6 +87,7 @@ num_fireballs: .byte 0
8787
regenerate_req: .byte 0
8888
move_req: .byte 0
8989
refresh_req: .byte 0
90+
winscreen_req: .byte 0
9091
move_x: .byte 0
9192
move_y: .byte 0
9293
start_prompt: .byte 1

levels.asm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
LEVELS_INC = 1
33

44
.include "x16.inc"
5+
.include "tiles.inc"
56
.include "globals.asm"
67
.include "timer.asm"
78
.include "skull.asm"
89
.include "bomb.asm"
10+
.include "wallstub.asm"
911

1012
LEVEL_X = 10
1113
LEVEL_Y = 0

player.asm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,15 @@ next_level:
911911
rts
912912
@level_up:
913913
SUPERIMPOSE "complete!", 5, 9
914+
lda level
915+
cmp #48
916+
beq @win
914917
SET_TIMER 30, @update_level
915918
jmp timer_done
919+
@win:
920+
lda #1
921+
sta winscreen_req
922+
jmp timer_done
916923
@update_level:
917924
SUPERIMPOSE_RESTORE
918925
jsr clear_bars

sprites_tiles.ods

1.42 KB
Binary file not shown.

tilemap.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@
145145
#
146146
# Start Screen: B800 End Screen: B828
147147
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
148-
0000 ba00 bb00 bc00 bd00 be00 bf00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
149-
0000 c000 c100 c200 c300 c400 c500 0000 0000 0000 0000 0000 0000 6000 6100 6200 6300 6400 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
150-
0000 c600 c700 c800 c900 ca00 cb00 0000 0000 6500 6600 0000 6700 6800 6900 6a00 6b00 6c00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
151-
0000 cc00 cd00 ce00 cf00 d000 d100 0000 6d00 6e00 6f00 7000 7100 7200 7300 7400 7500 7600 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
152-
0000 0000 0000 0000 0000 0000 0000 0000 0000 7700 7800 7900 7a00 7b00 7c00 7d00 7e00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
153-
0000 0000 0000 0000 0000 0000 7f00 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 8a00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
154-
0000 0000 0000 0000 0000 0000 8b00 8c00 8d00 8e00 8f00 9000 9100 9200 9300 9400 9400 9600 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
155-
0000 1b00 1c00 1d00 1e00 0000 0000 0000 0000 9700 9800 9900 9a00 9b00 9c00 9d00 9e00 9f00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
148+
0000 ba00 bb00 bc00 bd00 be00 bf00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0400 0000 0000 0000 0400 0000 0000 0508 0100 050C 0000 0000 0400 0000 0000 0000 0400 0000 0000 0460 0000 0000 0000 0000 0000 0000 0000 0460 0000 0260 0760 026C 0000 0460 0000 0000 0000 0000 0460 0000 0558 055C 0000
149+
0000 c000 c100 c200 c300 c400 c500 0000 0000 0000 0000 0000 0000 6000 6100 6200 6300 6400 0000 0000 0000 0300 0000 0000 0000 0300 0000 0508 0504 0000 0500 050C 0000 0300 0000 0000 0000 0300 0000 0000 0360 0000 0000 0000 0000 0000 0000 0000 0360 0000 0000 0360 0000 0000 0360 0000 0000 0000 0000 0360 0000 0850 085C 0000
150+
0000 c600 c700 c800 c900 ca00 cb00 0000 0000 6500 6600 0000 6700 6800 6900 6a00 6b00 6c00 0000 0000 0000 0500 050C 0000 0508 0504 0000 0300 0000 0000 0000 0300 0000 0300 0000 0000 0000 0300 0000 0000 0360 0000 0000 0000 0000 0000 0000 0000 0360 0000 0000 0360 0000 0000 0860 056C 0000 0000 0000 0360 0000 0850 085C 0000
151+
0000 cc00 cd00 ce00 cf00 d000 d100 0000 6d00 6e00 6f00 7000 7100 7200 7300 7400 7500 7600 0000 0000 0000 0000 0300 0000 0300 0000 0000 0300 0000 0000 0000 0300 0000 0300 0000 0000 0000 0300 0000 0000 0560 056C 0000 0000 0460 0000 0000 0568 0564 0000 0000 0360 0000 0000 0360 0560 056C 0000 0000 0360 0000 0850 0554 0000
152+
0000 0000 0000 0000 0000 0000 0000 0000 0000 7700 7800 7900 7a00 7b00 7c00 7d00 7e00 0000 0000 0000 0000 0000 0500 0700 0504 0000 0000 0300 0000 0000 0000 0300 0000 0300 0000 0000 0000 0300 0000 0000 0000 0360 0000 0568 076C 056C 0000 0360 0000 0000 0000 0360 0000 0000 0360 0000 0560 056C 0000 0360 0000 0350 0000 0000
153+
0000 0000 0000 0000 0000 0000 7f00 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 8a00 0000 0000 0000 0000 0000 0300 0000 0000 0000 0300 0000 0000 0000 0300 0000 0300 0000 0000 0000 0300 0000 0000 0000 0360 0000 0360 0000 0360 0000 0360 0000 0000 0000 0360 0000 0000 0360 0000 0000 0560 056C 0360 0000 045C 0000 0000
154+
0000 0000 0000 0000 0000 0000 8b00 8c00 8d00 8e00 8f00 9000 9100 9200 9300 9400 9400 9600 0000 0000 0000 0000 0000 0300 0000 0000 0000 0500 050C 0000 0508 0504 0000 0500 050C 0000 0508 0504 0000 0000 0000 0560 0760 0564 0000 0560 0760 0564 0000 0000 0000 0360 0000 0000 0360 0000 0000 0000 0560 086C 0000 0000 0000 0000
155+
0000 1b00 1c00 1d00 1e00 0000 0000 0000 0000 9700 9800 9900 9a00 9b00 9c00 9d00 9e00 9f00 0000 0000 0000 0000 0000 040C 0000 0000 0000 0000 0500 0100 0504 0000 0000 0000 0500 0100 0504 0000 0000 0000 0000 0000 046C 0000 0000 0000 046C 0000 0000 0000 0260 076C 026C 0000 046C 0000 0000 0000 0000 046C 0000 9500 0000 0000
156156
0000 0000 0000 0000 0000 0000 0000 0000 a000 a100 a200 a300 a400 a500 a600 a700 a800 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
157-
0000 0000 0000 0000 0000 0000 a900 aa00 ab00 ac00 ad00 ae00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
158-
0000 0000 0000 0000 0000 0000 af00 b000 b100 0000 b200 b300 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
159-
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 b400 b500 b600 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
160-
0000 5b00 5c00 5d00 5e00 5f00 0000 0000 0000 0000 b700 b800 b900 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
157+
0000 0000 0000 0000 0000 0000 a900 aa00 ab00 ac00 ad00 ae00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 ba00 bb00 bc00 bd00 be00 bf00 0000
158+
0000 0000 0000 0000 0000 0000 af00 b000 b100 0000 b200 b300 0000 0000 0000 0000 0000 0000 0000 0000 0000 1900 0000 1F00 0000 D300 0000 9500 0000 1A00 0000 D200 0000 2000 0000 1900 0000 1F00 0000 D300 0000 9500 0000 1A00 0000 D200 0000 2000 0000 1900 0000 1F00 0000 D300 0000 0000 0000 c000 c100 c200 c300 c400 c500 0000
159+
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 b400 b500 b600 0000 0000 0000 0000 0000 0000 0000 0000 0000 1A00 0000 D200 0000 2000 0000 1900 0000 1F00 0000 D300 0000 9500 0000 1A00 0000 D200 0000 2000 0000 1900 0000 1F00 0000 D300 0000 9500 0000 1A00 0000 D200 0000 0000 1000 0000 c600 c700 c800 c900 ca00 cb00 0000
160+
0000 5b00 5c00 5d00 5e00 5f00 0000 0000 0000 0000 b700 b800 b900 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 cc00 cd00 ce00 cf00 d000 d100 0000
161161
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
162162
# Spare
163163
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

winscreen.asm

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.ifndef WINSCREEN_INC
2+
WINSCREEN_INC = 1
3+
4+
.include "x16.inc"
5+
.include "globals.asm"
6+
.include "levels.asm"
7+
8+
WS_MAX_SCROLL = 704
9+
10+
__ws_scroll: .word 320
11+
__ws_reqd: .byte 0
12+
13+
winscreen_tick:
14+
lda winscreen_req
15+
bne @start
16+
jmp @return
17+
@start:
18+
lda __ws_reqd
19+
bne @check_scroll
20+
inc __ws_reqd
21+
lda #PLAYER_idx
22+
jsr sprite_disable
23+
jsr bomb_clear
24+
jsr fruit_clear
25+
stz VERA_ctrl
26+
VERA_SET_ADDR VRAM_layer1, 1
27+
lda #$61 ; 4bpp tiles
28+
sta VERA_data0
29+
lda #$31 ; 64x32 map of 16x16 tiles
30+
sta VERA_data0
31+
lda #((VRAM_STARTSCRN >> 2) & $FF)
32+
sta VERA_data0
33+
lda #((VRAM_STARTSCRN >> 10) & $FF)
34+
sta VERA_data0
35+
lda #((VRAM_TILES >> 2) & $FF)
36+
sta VERA_data0
37+
lda #((VRAM_TILES >> 10) & $FF)
38+
sta VERA_data0
39+
lda __ws_scroll ; initial scroll position on screen
40+
sta VERA_data0
41+
lda __ws_scroll+1
42+
sta VERA_data0
43+
lda #0
44+
sta VERA_data0
45+
sta VERA_data0
46+
lda #7 ; blackout background
47+
jsr set_bg_palette
48+
jmp @return
49+
@check_scroll:
50+
clc
51+
lda __ws_scroll
52+
adc #1
53+
sta __ws_scroll
54+
lda __ws_scroll+1
55+
adc #0
56+
sta __ws_scroll+1
57+
lda __ws_scroll
58+
cmp #<WS_MAX_SCROLL
59+
bne @scroll
60+
lda __ws_scroll+1
61+
cmp #>WS_MAX_SCROLL
62+
bne @scroll
63+
stz winscreen_req
64+
jmp @return
65+
@scroll:
66+
stz VERA_ctrl
67+
lda #<(VRAM_layer1+6)
68+
sta VERA_addr_low
69+
lda #>VRAM_layer1
70+
sta VERA_addr_high
71+
lda #(^VRAM_layer1 | $10)
72+
sta VERA_addr_bank
73+
lda __ws_scroll
74+
sta VERA_data0
75+
lda __ws_scroll+1
76+
sta VERA_data0
77+
@return:
78+
rts
79+
80+
.endif

ws_test.asm

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
.include "x16.inc"
2+
3+
.org $080D
4+
.segment "STARTUP"
5+
.segment "INIT"
6+
.segment "ONCE"
7+
.segment "CODE"
8+
jmp start
9+
10+
.include "filenames.asm"
11+
.include "loadvram.asm"
12+
.include "globals.asm"
13+
.include "timer.asm"
14+
.include "winscreen.asm"
15+
16+
vsync_trig: .byte 0
17+
18+
def_irq: .word $0000
19+
20+
init_irq:
21+
lda IRQVec
22+
sta def_irq
23+
lda IRQVec+1
24+
sta def_irq+1
25+
lda #<handle_irq
26+
sta IRQVec
27+
lda #>handle_irq
28+
sta IRQVec+1
29+
rts
30+
31+
handle_irq:
32+
; check for VSYNC
33+
lda VERA_irq
34+
and #$01
35+
beq @done_vsync
36+
sta vsync_trig
37+
@done_vsync:
38+
jmp (def_irq)
39+
40+
41+
start:
42+
43+
VERA_SET_ADDR VRAM_hscale, 1 ; set display to 2x scale
44+
lda #64
45+
sta VERA_data0
46+
sta VERA_data0
47+
48+
lda #>(VRAM_TILEMAP>>4)
49+
ldx #<(VRAM_TILEMAP>>4)
50+
ldy #<tilemap_fn
51+
jsr loadvram
52+
53+
lda #>(VRAM_TILES>>4)
54+
ldx #<(VRAM_TILES>>4)
55+
ldy #<tiles_fn
56+
jsr loadvram
57+
58+
lda #>(VRAM_palette>>4)
59+
ldx #<(VRAM_palette>>4)
60+
ldy #<palette_fn
61+
jsr loadvram
62+
63+
; Setup interrupts
64+
jsr init_irq
65+
66+
; request winscreen
67+
lda #1
68+
sta winscreen_req
69+
70+
mainloop:
71+
wai
72+
lda vsync_trig
73+
beq mainloop
74+
75+
; VSYNC has occurred, handle
76+
inc frame_num
77+
lda frame_num
78+
cmp #60
79+
bne @do_tick
80+
stz frame_num
81+
82+
@do_tick:
83+
jsr winscreen_tick
84+
85+
stz vsync_trig
86+
bra mainloop ; loop forever
87+
88+
brk

0 commit comments

Comments
 (0)