From 7d1fb17aa8e45b71de5ecb7fb0210ce48de02aff Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 7 Mar 2020 11:06:29 -0500 Subject: [PATCH] mist: start adding clock puzzle --- mist/Makefile | 1 + mist/clock_bridge_puzzle.s | 44 ++++++++++++++++++++++ mist/clock_sprites.inc | 75 ++++++++++++++++++++++++++++++++++++++ mist/mist.s | 21 ++++++++++- mist/zp.inc | 4 +- 5 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 mist/clock_bridge_puzzle.s create mode 100644 mist/clock_sprites.inc diff --git a/mist/Makefile b/mist/Makefile index 6f466e16..3f73e388 100644 --- a/mist/Makefile +++ b/mist/Makefile @@ -49,6 +49,7 @@ mist.o: mist.s zp.inc hardware.inc \ graphics_island/mist_graphics.inc \ common_sprites.inc \ leveldata_island.inc \ + clock_bridge_puzzle.s clock_sprites.inc \ gr_copy.s audio.s text_print.s decompress_fast_v2.s ca65 -o mist.o mist.s -l mist.lst diff --git a/mist/clock_bridge_puzzle.s b/mist/clock_bridge_puzzle.s new file mode 100644 index 00000000..2f61383a --- /dev/null +++ b/mist/clock_bridge_puzzle.s @@ -0,0 +1,44 @@ + + +;====================== +; draw the clock face + +draw_clock_face: + + + lda CLOCK_HOUR + asl + tay + lda clock_hour_sprites,Y + sta INL + lda clock_hour_sprites+1,Y + sta INH + + lda #20 + sta XPOS + lda #6 + sta YPOS + jsr put_sprite_crop + + lda CLOCK_MINUTE + asl + tay + lda clock_minute_sprites,Y + sta INL + lda clock_minute_sprites+1,Y + sta INH + + lda #20 + sta XPOS + lda #6 + sta YPOS + jsr put_sprite_crop + + + rts + + + + + +.include "clock_sprites.inc" diff --git a/mist/clock_sprites.inc b/mist/clock_sprites.inc new file mode 100644 index 00000000..658a5db4 --- /dev/null +++ b/mist/clock_sprites.inc @@ -0,0 +1,75 @@ + +clock_hour_sprites: + .word hour12_sprite,hour1_sprite,hour2_sprite,hour3_sprite + .word hour12_sprite,hour1_sprite,hour2_sprite,hour3_sprite + .word hour12_sprite,hour1_sprite,hour2_sprite,hour3_sprite +clock_minute_sprites: + .word minute12_sprite,minute1_sprite,minute2_sprite,minute3_sprite + .word minute12_sprite,minute1_sprite,minute2_sprite,minute3_sprite + .word minute12_sprite,minute1_sprite,minute2_sprite,minute3_sprite + +hour12_sprite: + .byte 3,5 + .byte $fd,$0d,$fd + .byte $ff,$00,$ff + .byte $ff,$00,$ff + .byte $ff,$ff,$ff + .byte $ff,$ff,$ff + +hour1_sprite: + .byte 3,5 + .byte $fd,$fd,$0d + .byte $ff,$0f,$f0 + .byte $ff,$00,$ff + .byte $ff,$ff,$ff + .byte $ff,$ff,$ff + +hour2_sprite: + .byte 3,5 + .byte $fd,$fd,$fd + .byte $ff,$ff,$0f + .byte $ff,$00,$ff + .byte $ff,$ff,$ff + .byte $ff,$ff,$ff + +hour3_sprite: + .byte 3,5 + .byte $fd,$fd,$fd + .byte $ff,$ff,$ff + .byte $ff,$0f,$0f + .byte $ff,$ff,$ff + .byte $ff,$ff,$ff + +minute12_sprite: + .byte 3,5 + .byte $aa,$aa,$aa + .byte $aa,$00,$aa + .byte $aa,$00,$aa + .byte $aa,$aa,$aa + .byte $aa,$aa,$aa + +minute1_sprite: + .byte 3,5 + .byte $aa,$aa,$aa + .byte $aa,$0a,$a0 + .byte $aa,$00,$aa + .byte $aa,$aa,$aa + .byte $aa,$aa,$aa + +minute2_sprite: + .byte 3,5 + .byte $aa,$aa,$aa + .byte $aa,$aa,$5a + .byte $aa,$00,$aa + .byte $aa,$aa,$aa + .byte $aa,$aa,$aa + +minute3_sprite: + .byte 3,5 + .byte $aa,$aa,$aa + .byte $aa,$aa,$aa + .byte $aa,$0a,$5a + .byte $aa,$aa,$aa + .byte $aa,$aa,$aa + + diff --git a/mist/mist.s b/mist/mist.s index e5062c08..e4dee88c 100644 --- a/mist/mist.s +++ b/mist/mist.s @@ -31,13 +31,28 @@ mist_start: sta CURSOR_X sta CURSOR_Y - ; init location + ;================= + ; init vars + ; FIXME: we could be re-called from other books + ; so don't set location here lda #0 sta LOCATION lda #0 sta DIRECTION + + lda LOCATION + bne not_first_time + + ; first time init + lda #0 + sta CLOCK_MINUTE + sta CLOCK_HOUR + +not_first_time: + + ; set up initial location jsr change_location @@ -747,6 +762,10 @@ red_book_done: .include "graphics_island/mist_graphics.inc" + ; puzzles + + .include "clock_bridge_puzzle.s" + .include "common_sprites.inc" .include "leveldata_island.inc" diff --git a/mist/zp.inc b/mist/zp.inc index f9f94760..ceb4b80b 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -53,8 +53,8 @@ HOLDING_PAGE = $70 CLOCK_BRIDGE = $71 GEAR_OPEN = $72 MARKER_SWITCHES = $73 -CLOCK_H = $74 -CLOCK_M = $75 +CLOCK_HOUR = $74 +CLOCK_MINUTE = $75 GENERATOR_ON = $76 TREE_FURNACE_ON = $77 FIREPLACE_GRID0 = $78