From 2ef17c2948f2761675973ff6d051a39de0d36900 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 14 Jul 2020 00:03:01 -0400 Subject: [PATCH] mist: cabin/viewer, split out the number sprites for common use --- mist/Makefile | 23 ++++++- mist/cabin.s | 1 + mist/cabin_boiler_puzzle.s | 122 +++++++++++++++++++++++++++++++++++ mist/number_sprites.inc | 124 ++++++++++++++++++++++++++++++++++++ mist/viewer.s | 17 +---- mist/viewer_controls.s | 126 ------------------------------------- 6 files changed, 269 insertions(+), 144 deletions(-) create mode 100644 mist/number_sprites.inc diff --git a/mist/Makefile b/mist/Makefile index bf42a3a2..07816325 100644 --- a/mist/Makefile +++ b/mist/Makefile @@ -216,6 +216,7 @@ viewer.o: viewer.s zp.inc hardware.inc common_defines.inc \ common_routines.inc \ common_sprites.inc \ page_sprites.inc \ + number_sprites.inc \ leveldata_viewer.inc \ viewer_controls.s \ keyboard.s \ @@ -276,7 +277,8 @@ cabin.o: cabin.s zp.inc hardware.inc common_defines.inc \ draw_pointer.s \ link_book_channel.s \ marker_switch.s \ - cabin_boiler_puzzle.s + cabin_boiler_puzzle.s \ + number_sprites.inc ca65 -o cabin.o cabin.s -l cabin.lst @@ -391,8 +393,25 @@ graphics_ship/ship_graphics.inc: #### clean: - rm -f *~ *.o *.lst HELLO HELLO_DISK2 \ + rm -f *~ *.o *.lst HELLO HELLO_DISK2 \ LOADER MIST_TITLE \ MIST OCTAGON VIEWER DENTIST \ MECHE SELENA SHIP STONEY CHANNEL ARBOR NIBEL \ GENERATOR + cd graphics_title && make clean + cd graphics_mist && make clean + cd graphics_octagon && make clean + cd books && make clean + cd graphics_viewer && make clean + cd graphics_meche && make clean + cd graphics_selena && make clean + cd graphics_cabin && make clean + cd graphics_channel && make clean + cd graphics_stoney && make clean + cd graphics_dentist && make clean + cd graphics_generator && make clean + cd graphics_arbor && make clean + cd graphics_nibel && make clean + cd graphics_dni && make clean + cd graphics_ship && make clean + diff --git a/mist/cabin.s b/mist/cabin.s index 60ebc7af..7ebecf22 100644 --- a/mist/cabin.s +++ b/mist/cabin.s @@ -242,6 +242,7 @@ exit_to_mist: ; level graphics .include "graphics_cabin/cabin_graphics.inc" + .include "number_sprites.inc" ; puzzles .include "marker_switch.s" diff --git a/mist/cabin_boiler_puzzle.s b/mist/cabin_boiler_puzzle.s index fe0ae3ea..49894ae8 100644 --- a/mist/cabin_boiler_puzzle.s +++ b/mist/cabin_boiler_puzzle.s @@ -4,3 +4,125 @@ goto_safe: lda #CABIN_SAFE sta LOCATION jmp change_location + + + +control_panel_pressed: + + lda CURSOR_Y + cmp #26 ; blt + bcc panel_inc + cmp #30 ; blt + bcc panel_dec + +panel_latch: + + lda VIEWER_CHANNEL + sta VIEWER_LATCHED ; latch value into pool state + + lda #VIEWER_POOL + sta LOCATION + + lda #DIRECTION_W + sta DIRECTION + jmp change_location + +panel_inc: + lda CURSOR_X + cmp #18 + bcs right_arrow_pressed + + ; 19-23 left arrow + + lda VIEWER_CHANNEL + and #$f0 + cmp #$90 + bcs done_panel_press ; bge + lda VIEWER_CHANNEL + clc + adc #$10 + sta VIEWER_CHANNEL + rts + +right_arrow_pressed: + ; 13-17 right arrow + + lda VIEWER_CHANNEL + and #$f + cmp #9 + bcs done_panel_press ; bge + inc VIEWER_CHANNEL + rts + +panel_dec: + lda CURSOR_X + cmp #18 + bcs right_arrow_pressed_dec + + ; 19-23 left arrow + + lda VIEWER_CHANNEL + and #$f0 + beq done_panel_press + lda VIEWER_CHANNEL + sec + sbc #$10 + sta VIEWER_CHANNEL + rts + +right_arrow_pressed_dec: + ; 13-17 right arrow + + lda VIEWER_CHANNEL + and #$f + beq done_panel_press + dec VIEWER_CHANNEL + +done_panel_press: + rts + + +display_panel_code: + + ; ones digit + + lda VIEWER_CHANNEL + and #$f + asl + tay + + lda number_sprites,Y + sta INL + lda number_sprites+1,Y + sta INH + + lda #21 + sta XPOS + lda #8 + sta YPOS + + jsr put_sprite_crop + + ; tens digit + + lda VIEWER_CHANNEL + and #$f0 + lsr + lsr + lsr + tay + + lda number_sprites,Y + sta INL + lda number_sprites+1,Y + sta INH + + lda #15 + sta XPOS + lda #8 + sta YPOS + + jsr put_sprite_crop + + rts + diff --git a/mist/number_sprites.inc b/mist/number_sprites.inc new file mode 100644 index 00000000..e4d1f9ab --- /dev/null +++ b/mist/number_sprites.inc @@ -0,0 +1,124 @@ +number_sprites: +.word sprite_0,sprite_1,sprite_2,sprite_3,sprite_4 +.word sprite_5,sprite_6,sprite_7,sprite_8,sprite_9 + +; . . . . . . +; O O ^O ^ O ^ O O O +; O O O O ^O ^^O +; ^.^ .O. O.. ..^ O + +sprite_0: + .byte 3,4 + .byte $AA,$0A,$AA ; + .byte $00,$AA,$00 ; + .byte $00,$AA,$00 ; + .byte $A0,$0A,$A0 ; + +; . . . . . . +; O O ^O ^ O ^ O O O +; O O O O ^O ^^O +; ^.^ .O. O.. ..^ O + +sprite_1: + .byte 3,4 + .byte $AA,$0A,$AA + .byte $A0,$00,$AA + .byte $AA,$00,$AA + .byte $0A,$00,$0A + +; . . . . . . +; O O ^O ^ O ^ O O O +; O O O O ^O ^^O +; ^.^ .O. O.. ..^ O + +sprite_2: + .byte 3,4 + .byte $AA,$0A,$AA + .byte $A0,$AA,$00 + .byte $AA,$00,$AA + .byte $00,$0A,$0A + +; . . . . . . +; O O ^O ^ O ^ O O O +; O O O O ^O ^^O +; ^.^ .O. O.. ..^ O + +sprite_3: + .byte 3,4 + .byte $AA,$0A,$AA + .byte $A0,$AA,$00 + .byte $AA,$A0,$00 + .byte $0A,$0A,$A0 + +; . . . . . . +; O O ^O ^ O ^ O O O +; O O O O ^O ^^O +; ^.^ .O. O.. ..^ O + +sprite_4: + .byte 3,4 + .byte $0A,$AA,$0A + .byte $00,$AA,$00 + .byte $A0,$A0,$00 + .byte $AA,$AA,$00 + +; ... .. ... . . +; O O O O O O O +; ^^. O^. O .^. ^O +; ..^ ^.^ O ^.^ ..O + +sprite_5: + .byte 3,4 + .byte $0A,$0A,$0A + .byte $00,$AA,$AA + .byte $A0,$A0,$0A + .byte $0A,$0A,$A0 + +; ... .. ... . . +; O O O O O O O +; ^^. O^. O .^. ^O +; ..^ ^.^ O ^.^ ..O + +sprite_6: + .byte 3,4 + .byte $AA,$0A,$0A + .byte $00,$AA,$AA + .byte $00,$A0,$0A + .byte $A0,$0A,$A0 + +; ... .. ... . . +; O O O O O O O +; ^^. O^. O .^. ^O +; ..^ ^.^ O ^.^ ..O + +sprite_7: + .byte 3,4 + .byte $0A,$0A,$0A + .byte $AA,$AA,$00 + .byte $AA,$00,$AA + .byte $00,$AA,$AA + +; ... .. ... . . +; O O O O O O O +; ^^. O^. O .^. ^O +; ..^ ^.^ O ^.^ ..O + +sprite_8: + .byte 3,4 + .byte $AA,$0A,$AA + .byte $00,$AA,$00 + .byte $0A,$A0,$0A + .byte $A0,$0A,$A0 + +; ... .. ... . . +; O O O O O O O +; ^^. O^. O .^. ^O +; ..^ ^.^ O ^.^ ..^ + +sprite_9: + .byte 3,4 + .byte $AA,$0A,$AA + .byte $00,$AA,$00 + .byte $AA,$A0,$00 + .byte $0A,$0A,$A0 + diff --git a/mist/viewer.s b/mist/viewer.s index 0b2b384c..a9028128 100644 --- a/mist/viewer.s +++ b/mist/viewer.s @@ -156,24 +156,9 @@ back_to_mist: ; includes ;========================== -.if 0 - .include "gr_copy.s" - .include "gr_offsets.s" - .include "gr_pageflip.s" - .include "gr_putsprite_crop.s" - .include "text_print.s" - .include "gr_fast_clear.s" - .include "decompress_fast_v2.s" - .include "keyboard.s" - .include "draw_pointer.s" - .include "end_level.s" - .include "common_sprites.inc" - .include "page_sprites.inc" - -.endif - ; graphics .include "graphics_viewer/viewer_graphics.inc" + .include "number_sprites.inc" ; puzzles .include "viewer_controls.s" diff --git a/mist/viewer_controls.s b/mist/viewer_controls.s index 4370cabc..a02916c5 100644 --- a/mist/viewer_controls.s +++ b/mist/viewer_controls.s @@ -358,132 +358,6 @@ display_panel_code: -number_sprites: -.word sprite_0,sprite_1,sprite_2,sprite_3,sprite_4 -.word sprite_5,sprite_6,sprite_7,sprite_8,sprite_9 - -; . . . . . . -; O O ^O ^ O ^ O O O -; O O O O ^O ^^O -; ^.^ .O. O.. ..^ O - -sprite_0: - .byte 3,4 - .byte $AA,$0A,$AA ; - .byte $00,$AA,$00 ; - .byte $00,$AA,$00 ; - .byte $A0,$0A,$A0 ; - -; . . . . . . -; O O ^O ^ O ^ O O O -; O O O O ^O ^^O -; ^.^ .O. O.. ..^ O - -sprite_1: - .byte 3,4 - .byte $AA,$0A,$AA - .byte $A0,$00,$AA - .byte $AA,$00,$AA - .byte $0A,$00,$0A - -; . . . . . . -; O O ^O ^ O ^ O O O -; O O O O ^O ^^O -; ^.^ .O. O.. ..^ O - -sprite_2: - .byte 3,4 - .byte $AA,$0A,$AA - .byte $A0,$AA,$00 - .byte $AA,$00,$AA - .byte $00,$0A,$0A - -; . . . . . . -; O O ^O ^ O ^ O O O -; O O O O ^O ^^O -; ^.^ .O. O.. ..^ O - -sprite_3: - .byte 3,4 - .byte $AA,$0A,$AA - .byte $A0,$AA,$00 - .byte $AA,$A0,$00 - .byte $0A,$0A,$A0 - -; . . . . . . -; O O ^O ^ O ^ O O O -; O O O O ^O ^^O -; ^.^ .O. O.. ..^ O - -sprite_4: - .byte 3,4 - .byte $0A,$AA,$0A - .byte $00,$AA,$00 - .byte $A0,$A0,$00 - .byte $AA,$AA,$00 - -; ... .. ... . . -; O O O O O O O -; ^^. O^. O .^. ^O -; ..^ ^.^ O ^.^ ..O - -sprite_5: - .byte 3,4 - .byte $0A,$0A,$0A - .byte $00,$AA,$AA - .byte $A0,$A0,$0A - .byte $0A,$0A,$A0 - -; ... .. ... . . -; O O O O O O O -; ^^. O^. O .^. ^O -; ..^ ^.^ O ^.^ ..O - -sprite_6: - .byte 3,4 - .byte $AA,$0A,$0A - .byte $00,$AA,$AA - .byte $00,$A0,$0A - .byte $A0,$0A,$A0 - -; ... .. ... . . -; O O O O O O O -; ^^. O^. O .^. ^O -; ..^ ^.^ O ^.^ ..O - -sprite_7: - .byte 3,4 - .byte $0A,$0A,$0A - .byte $AA,$AA,$00 - .byte $AA,$00,$AA - .byte $00,$AA,$AA - -; ... .. ... . . -; O O O O O O O -; ^^. O^. O .^. ^O -; ..^ ^.^ O ^.^ ..O - -sprite_8: - .byte 3,4 - .byte $AA,$0A,$AA - .byte $00,$AA,$00 - .byte $0A,$A0,$0A - .byte $A0,$0A,$A0 - -; ... .. ... . . -; O O O O O O O -; ^^. O^. O .^. ^O -; ..^ ^.^ O ^.^ ..^ - -sprite_9: - .byte 3,4 - .byte $AA,$0A,$AA - .byte $00,$AA,$00 - .byte $AA,$A0,$00 - .byte $0A,$0A,$A0 - - - nothing_animation: .word empty,empty,na_frame0,na_frame1,na_frame0,empty