From 46e173ab8da4dcf75ee37a6c72b5b7c94a0eef39 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Fri, 19 Jun 2020 15:46:28 -0400 Subject: [PATCH] mist: start adding for load-game support --- mist/Makefile | 2 +- mist/TODO | 1 + mist/common_routines.inc | 14 +++---- mist/hello.bas | 8 +++- mist/keyboard.s | 14 +++++++ mist/loader.s | 1 + mist/loadstore.s | 88 ++++++++++++++++++++++++++++++++++++++++ mist/mist_title.s | 9 ---- 8 files changed, 118 insertions(+), 19 deletions(-) create mode 100644 mist/loadstore.s diff --git a/mist/Makefile b/mist/Makefile index f0aeae31..5fef0a44 100644 --- a/mist/Makefile +++ b/mist/Makefile @@ -44,7 +44,7 @@ LOADER: loader.o loader.o: loader.s \ gr_copy.s gr_offsets.s gr_pageflip.s gr_putsprite_crop.s \ text_print.s gr_fast_clear.s decompress_fast_v2.s \ - keyboard.s draw_pointer.s end_level.s audio.s + keyboard.s draw_pointer.s end_level.s audio.s loadstore.s ca65 -o loader.o loader.s -l loader.lst ### diff --git a/mist/TODO b/mist/TODO index b132a1b1..f5cbb002 100644 --- a/mist/TODO +++ b/mist/TODO @@ -4,6 +4,7 @@ For release 1.0 -- save/load games -- sound loader + MIST (split off ship-up/ship-down?) + -- fix catherine letter (bg, grab from other side) -- constellation puzzle/ship raising -- marker switches + DENTIST diff --git a/mist/common_routines.inc b/mist/common_routines.inc index 8997921f..d7aa1406 100644 --- a/mist/common_routines.inc +++ b/mist/common_routines.inc @@ -35,17 +35,17 @@ put_sprite_crop =$18a8 ; keyboard.s handle_keypress =$19e4 -change_location =$1ab1 +change_location =$1ac5 ; text_print.s -move_and_print =$1b49 +move_and_print =$1b5d ; page_sprites.inc -blue_page_sprite =$1c44 -red_page_sprite =$1c90 -white_page_sprite =$1ca6 -blue_page_small_sprite =$1cbc -red_page_small_sprite =$1cc4 +blue_page_sprite =$1cf4 +red_page_sprite =$1d40 +white_page_sprite =$1d56 +blue_page_small_sprite =$1d6c +red_page_small_sprite =$1d74 ; audio files linking_noise = $9000 diff --git a/mist/hello.bas b/mist/hello.bas index bf4b01cb..b0a3b035 100644 --- a/mist/hello.bas +++ b/mist/hello.bas @@ -1,8 +1,12 @@ 5 HOME 10 PRINT "LOADING MIST V0.86" 20 PRINT:PRINT -40 PRINT "CONTROLS: ARROWS OR WASD" -50 PRINT " ENTER MOVES/ACTION" +40 PRINT "CONTROLS: " +42 PRINT " MOVE CURSOR : ARROWS OR WASD" +44 PRINT " FORWARD/ACTION : ENTER" +45 PRINT " ENABLE JOYSTICK: CONTROL-J" +46 PRINT " LOAD GAME : CONTROL-L" +48 PRINT " SAVE GAME : CONTROL-S" 60 PRINT:PRINT 70 PRINT "BASED ON MYST BY CYAN INC" 80 PRINT "APPLE II PORT: VINCE WEAVER" diff --git a/mist/keyboard.s b/mist/keyboard.s index 7715cdd3..0798c463 100644 --- a/mist/keyboard.s +++ b/mist/keyboard.s @@ -12,6 +12,20 @@ handle_keypress: keypress: and #$7f ; clear high bit +check_load: + cmp #$C ; control-L + bne check_save + + jsr load_game + jmp done_keypress + +check_save: + cmp #$13 ; control-S + bne check_left + + jsr save_game + jmp done_keypress + check_left: cmp #'A' beq left_pressed diff --git a/mist/loader.s b/mist/loader.s index 52a17b75..278b426f 100644 --- a/mist/loader.s +++ b/mist/loader.s @@ -731,6 +731,7 @@ sectbl: .byte $00,$0d,$0b,$09,$07,$05,$03,$01,$0e,$0c,$0a,$08,$06,$04,$02,$0f .include "gr_putsprite_crop.s" .include "keyboard.s" .include "text_print.s" + .include "loadstore.s" .include "common_sprites.inc" .include "page_sprites.inc" diff --git a/mist/loadstore.s b/mist/loadstore.s new file mode 100644 index 00000000..81a96c6e --- /dev/null +++ b/mist/loadstore.s @@ -0,0 +1,88 @@ + + ;=================================== + ;=================================== + ; load the game + ;=================================== + ;=================================== + +load_game: + bit KEYRESET ; clear keyboard buffer + + bit SET_TEXT ; set text mode + + jsr clear_all ; clear screen + + lda #load_message + sta OUTH + jsr move_and_print + + lda #are_you_sure + sta OUTH + jsr move_and_print + + jsr page_flip + +wait_load_confirmation: + lda KEYPRESS + bpl wait_load_confirmation + + bit KEYRESET ; clear keypress + + bit SET_GR ; turn graphics back on + + rts + + ;=================================== + ;=================================== + ; save the game + ;=================================== + ;=================================== + +save_game: + bit KEYRESET ; clear keyboard buffer + + bit SET_TEXT ; set text mode + + jsr clear_all ; clear screen + + lda #save_message + sta OUTH + jsr move_and_print + + lda #are_you_sure + sta OUTH + jsr move_and_print + + jsr page_flip + +wait_save_confirmation: + lda KEYPRESS + bpl wait_save_confirmation + + bit KEYRESET ; clear keypress + + bit SET_GR ; turn graphics back on + + rts + + + + + +load_message: +.byte 10,5,"LOAD GAME FROM DISK",0 + +save_message: +.byte 11,5,"SAVE GAME TO DISK",0 + +are_you_sure: +.byte 10,7,"ARE YOU SURE? (Y/N)",0 + diff --git a/mist/mist_title.s b/mist/mist_title.s index 10cdf556..85e70380 100644 --- a/mist/mist_title.s +++ b/mist/mist_title.s @@ -95,15 +95,6 @@ done_keyloop: bit LORES bit FULLGR - ;================= - ; set up location - ;================= - - lda #locations - sta LOCATIONS_H - lda #0 sta DRAW_PAGE