diff --git a/games/peasant/Makefile b/games/peasant/Makefile index a3e514da..cb1e4af4 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -68,7 +68,7 @@ PEASANT: peasant.o peasant.o: peasant.s graphics/graphics.inc sprites/peasant_sprite.inc \ draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ - hgr_7x30_sprite.s \ + hgr_7x30_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \ title.s directions.s \ cottage.s lake_w.s lake_e.s river.s knight.s \ ending.s diff --git a/games/peasant/graphics/lake_e.png b/games/peasant/graphics/lake_e.png index ae6f656f..889aa494 100644 Binary files a/games/peasant/graphics/lake_e.png and b/games/peasant/graphics/lake_e.png differ diff --git a/games/peasant/hgr_save_restore.c b/games/peasant/hgr_save_restore.c deleted file mode 100644 index f519c444..00000000 --- a/games/peasant/hgr_save_restore.c +++ /dev/null @@ -1,300 +0,0 @@ - ;======================= - ; HGR Overlay - ;======================= - ; loads from DRAW_PAGE - ; OR with $9000 - ; store back to DRAW_PAGE - -hgr_overlay: - lda DRAW_PAGE - cmp #$20 - beq hgr_overlay_page1 - jmp hgr_overlay_page2 - -hgr_overlay_page1: - - ldy #0 -hgr_overlay_page1_loop: - - lda $9000,Y - ora $2000,Y - sta $2000,Y - - lda $9100,Y - ora $2100,Y - sta $2100,Y - - lda $9200,Y - ora $2200,Y - sta $2200,Y - - lda $9300,Y - ora $2300,Y - sta $2300,Y - - lda $9400,Y - ora $2400,Y - sta $2400,Y - - lda $9500,Y - ora $2500,Y - sta $2500,Y - - lda $9600,Y - ora $2600,Y - sta $2600,Y - - lda $9700,Y - ora $2700,Y - sta $2700,Y - - lda $9800,Y - ora $2800,Y - sta $2800,Y - - lda $9900,Y - ora $2900,Y - sta $2900,Y - - lda $9A00,Y - ora $2A00,Y - sta $2A00,Y - - lda $9B00,Y - ora $2B00,Y - sta $2B00,Y - - lda $9C00,Y - ora $2C00,Y - sta $2C00,Y - - lda $9D00,Y - ora $2D00,Y - sta $2D00,Y - - lda $9E00,Y - ora $2E00,Y - sta $2E00,Y - - lda $9F00,Y - ora $2F00,Y - sta $2F00,Y - - - - lda $A000,Y - ora $3000,Y - sta $3000,Y - - lda $A100,Y - ora $3100,Y - sta $3100,Y - - lda $A200,Y - ora $3200,Y - sta $3200,Y - - lda $A300,Y - ora $3300,Y - sta $3300,Y - - lda $A400,Y - ora $3400,Y - sta $3400,Y - - lda $A500,Y - ora $3500,Y - sta $3500,Y - - lda $A600,Y - ora $3600,Y - sta $3600,Y - - lda $A700,Y - ora $3700,Y - sta $3700,Y - - lda $A800,Y - ora $3800,Y - sta $3800,Y - - lda $A900,Y - ora $3900,Y - sta $3900,Y - - lda $AA00,Y - ora $3A00,Y - sta $3A00,Y - - lda $AB00,Y - ora $3B00,Y - sta $3B00,Y - - lda $AC00,Y - ora $3C00,Y - sta $3C00,Y - - lda $AD00,Y - ora $3D00,Y - sta $3D00,Y - - lda $AE00,Y - ora $3E00,Y - sta $3E00,Y - - lda $AF00,Y - ora $3F00,Y - sta $3F00,Y - - - iny - beq hgr_page1_overlay_done - jmp hgr_overlay_page1_loop - -hgr_page1_overlay_done: - rts - - -hgr_overlay_page2: - - ldy #0 -hgr_overlay_page2_loop: - - lda $9000,Y - ora $4000,Y - sta $4000,Y - - lda $9100,Y - ora $4100,Y - sta $4100,Y - - lda $9200,Y - ora $4200,Y - sta $4200,Y - - lda $9300,Y - ora $4300,Y - sta $4300,Y - - lda $9400,Y - ora $4400,Y - sta $4400,Y - - lda $9500,Y - ora $4500,Y - sta $4500,Y - - lda $9600,Y - ora $4600,Y - sta $4600,Y - - lda $9700,Y - ora $4700,Y - sta $4700,Y - - lda $9800,Y - ora $4800,Y - sta $4800,Y - - lda $9900,Y - ora $4900,Y - sta $4900,Y - - lda $9A00,Y - ora $4A00,Y - sta $4A00,Y - - lda $9B00,Y - ora $4B00,Y - sta $4B00,Y - - lda $9C00,Y - ora $4C00,Y - sta $4C00,Y - - lda $9D00,Y - ora $4D00,Y - sta $4D00,Y - - lda $9E00,Y - ora $4E00,Y - sta $4E00,Y - - lda $9F00,Y - ora $4F00,Y - sta $4F00,Y - - - - lda $A000,Y - ora $5000,Y - sta $5000,Y - - lda $A100,Y - ora $5100,Y - sta $5100,Y - - lda $A200,Y - ora $5200,Y - sta $5200,Y - - lda $A300,Y - ora $5300,Y - sta $5300,Y - - lda $A400,Y - ora $5400,Y - sta $5400,Y - - lda $A500,Y - ora $5500,Y - sta $5500,Y - - lda $A600,Y - ora $5600,Y - sta $5600,Y - - lda $A700,Y - ora $5700,Y - sta $5700,Y - - lda $A800,Y - ora $5800,Y - sta $5800,Y - - lda $A900,Y - ora $5900,Y - sta $5900,Y - - lda $AA00,Y - ora $5A00,Y - sta $5A00,Y - - lda $AB00,Y - ora $5B00,Y - sta $5B00,Y - - lda $AC00,Y - ora $5C00,Y - sta $5C00,Y - - lda $AD00,Y - ora $5D00,Y - sta $5D00,Y - - lda $AE00,Y - ora $5E00,Y - sta $5E00,Y - - lda $AF00,Y - ora $5F00,Y - sta $5F00,Y - - - iny - beq hgr_page2_overlay_done - jmp hgr_overlay_page2_loop - -hgr_page2_overlay_done: - rts - diff --git a/games/peasant/hgr_save_restore.s b/games/peasant/hgr_save_restore.s new file mode 100644 index 00000000..799a089a --- /dev/null +++ b/games/peasant/hgr_save_restore.s @@ -0,0 +1,233 @@ + ;======================= + ; HGR Save + ;======================= + ; loads from $40 + ; save to $20 + +hgr_save: + + ldy #0 +hgr_save_loop: + lda $4000,Y + sta $2000,Y + + lda $4100,Y + sta $2100,Y + + lda $4200,Y + sta $2200,Y + + lda $4300,Y + sta $2300,Y + + lda $4400,Y + sta $2400,Y + + lda $4500,Y + sta $2500,Y + + lda $4600,Y + sta $2600,Y + + lda $4700,Y + sta $2700,Y + + lda $4800,Y + sta $2800,Y + + lda $4900,Y + sta $2900,Y + + lda $4A00,Y + sta $2A00,Y + + lda $4B00,Y + sta $2B00,Y + + lda $4C00,Y + sta $2C00,Y + + lda $4D00,Y + sta $2D00,Y + + lda $4E00,Y + sta $2E00,Y + + lda $4F00,Y + sta $2F00,Y + + ; + + lda $5000,Y + sta $3000,Y + + lda $5100,Y + sta $3100,Y + + lda $5200,Y + sta $3200,Y + + lda $5300,Y + sta $3300,Y + + lda $5400,Y + sta $3400,Y + + lda $5500,Y + sta $3500,Y + + lda $5600,Y + sta $3600,Y + + lda $5700,Y + sta $3700,Y + + lda $5800,Y + sta $3800,Y + + lda $5900,Y + sta $3900,Y + + lda $5A00,Y + sta $3A00,Y + + lda $5B00,Y + sta $3B00,Y + + lda $5C00,Y + sta $3C00,Y + + lda $5D00,Y + sta $3D00,Y + + lda $5E00,Y + sta $3E00,Y + + lda $5F00,Y + sta $3F00,Y + + iny + beq hgr_save_done + jmp hgr_save_loop + +hgr_save_done: + rts + + + + + ;======================= + ; HGR Restore + ;======================= + ; loads from $20 + ; save to $40 + +hgr_restore: + + ldy #0 +hgr_restore_loop: + lda $2000,Y + sta $4000,Y + + lda $2100,Y + sta $4100,Y + + lda $2200,Y + sta $4200,Y + + lda $2300,Y + sta $4300,Y + + lda $2400,Y + sta $4400,Y + + lda $2500,Y + sta $4500,Y + + lda $2600,Y + sta $4600,Y + + lda $2700,Y + sta $4700,Y + + lda $2800,Y + sta $4800,Y + + lda $2900,Y + sta $4900,Y + + lda $2A00,Y + sta $4A00,Y + + lda $2B00,Y + sta $4B00,Y + + lda $2C00,Y + sta $4C00,Y + + lda $2D00,Y + sta $4D00,Y + + lda $2E00,Y + sta $4E00,Y + + lda $2F00,Y + sta $4F00,Y + + ; + + lda $3000,Y + sta $5000,Y + + lda $3100,Y + sta $5100,Y + + lda $3200,Y + sta $5200,Y + + lda $3300,Y + sta $5300,Y + + lda $3400,Y + sta $5400,Y + + lda $3500,Y + sta $5500,Y + + lda $3600,Y + sta $5600,Y + + lda $3700,Y + sta $5700,Y + + lda $3800,Y + sta $5800,Y + + lda $3900,Y + sta $5900,Y + + lda $3A00,Y + sta $5A00,Y + + lda $3B00,Y + sta $5B00,Y + + lda $3C00,Y + sta $5C00,Y + + lda $3D00,Y + sta $5D00,Y + + lda $3E00,Y + sta $5E00,Y + + lda $3F00,Y + sta $5F00,Y + + iny + beq hgr_restore_done + jmp hgr_restore_loop + +hgr_restore_done: + rts + diff --git a/games/peasant/lake_e.s b/games/peasant/lake_e.s index f0ac97be..ed319c95 100644 --- a/games/peasant/lake_e.s +++ b/games/peasant/lake_e.s @@ -4,6 +4,22 @@ ; Lake East ;************************ lake_east: + lda #0 + sta FRAME + + ;========================= + ; init peasant position + ; draw at 7,152 + + lda #7 + sta PEASANT_X + lda #152 + sta PEASANT_Y + + lda #PEASANT_DIR_RIGHT + sta PEASANT_DIR + + lda #<(lake_e_lzsa) sta getsrc_smc+1 lda #>(lake_e_lzsa) @@ -20,17 +36,284 @@ lake_east: jsr hgr_put_string + jsr hgr_save + + + ;==================== + ; save background + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + + ;======================= + ; walking + + jsr save_bg_7x30 + +lake_e_walk_loop: + jsr restore_bg_7x30 + + lda FRAME +check_lake_e_action1: + cmp #10 + bne check_lake_e_action2 + jsr display_lake_e_text1 + jmp done_lake_e_action + +check_lake_e_action2: + cmp #27 + bne done_lake_e_action + jsr hgr_restore + lda #PEASANT_DIR_UP + sta PEASANT_DIR + +done_lake_e_action: + + jsr update_bubbles_e + + + lda FRAME + asl + tax + + lda lake_e_path,X + bmi done_lake_e + sta PEASANT_X + sta CURSOR_X + + inx + lda lake_e_path,X + sta PEASANT_Y + sta CURSOR_Y + + jsr save_bg_7x30 + + jsr draw_peasant jsr wait_until_keypress - rts + inc FRAME + jmp lake_e_walk_loop + + + ;=================== + ; done + +done_lake_e: + + rts ; walk sideways, near corner lake_e_message1: - .byte 0,0,"That's a nice looking lake.",0 + .byte 7,49,"That's a nice looking lake.",0 ; nearly hit head on sign, it goes away, walk off screen + + ;============================ + ; display lake_e text 1 + ;============================ +display_lake_e_text1: + + ;==================== + ; draw text box + + lda #0 + sta BOX_X1H + lda #35 + sta BOX_X1L + lda #34 + sta BOX_Y1 + + lda #0 + sta BOX_X2H + lda #253 + sta BOX_X2L + lda #72 + sta BOX_Y2 + + jsr draw_box + + lda #lake_e_message1 + sta OUTH + jsr hgr_put_string + + rts + +lake_e_path: + .byte 7,151 + .byte 8,151 + .byte 9,151 + .byte 10,151 + .byte 11,151 + .byte 12,151 + .byte 13,151 + .byte 14,151 + .byte 15,151 + .byte 16,151 + .byte 17,151 + .byte 18,151 + .byte 19,151 + .byte 20,151 + .byte 21,151 + .byte 22,151 + .byte 23,151 + .byte 24,151 + .byte 25,151 + .byte 26,151 + .byte 27,151 + .byte 28,151 + .byte 29,141 + .byte 30,131 + .byte 31,121 + .byte 32,111 + .byte 33,101 + .byte 34,91 + .byte 35,81 + .byte 35,71 + .byte 35,61 + .byte 35,51 + .byte 35,41 + .byte $FF,$FF + + + ;================ + ; update bubbles E +update_bubbles_e: + + ; 5,94 + ; 15,103 + ; 13,130 + + ; bubble 1 + + lda FRAME + and #7 + asl + tax + + lda bubble_progress_e,X + sta INL + inx + lda bubble_progress_e,X + sta INH + + lda #5 + sta CURSOR_X + lda #94 + sta CURSOR_Y + + jsr hgr_draw_sprite_1x5 + + + ; bubble 2 + + lda FRAME + adc #3 + and #7 + asl + tax + + lda bubble_progress_e,X + sta INL + inx + lda bubble_progress_e,X + sta INH + + lda #15 + sta CURSOR_X + lda #103 + sta CURSOR_Y + + jsr hgr_draw_sprite_1x5 + + ; bubble 3 + + lda FRAME + adc #5 + and #7 + asl + tax + + lda bubble_progress_e,X + sta INL + inx + lda bubble_progress_e,X + sta INH + + lda #13 + sta CURSOR_X + lda #130 + sta CURSOR_Y + + jsr hgr_draw_sprite_1x5 + + rts + + +bubble_progress_e: + .word bubble_e_sprite0 + .word bubble_e_sprite0 + .word bubble_e_sprite1 + .word bubble_e_sprite0 + .word bubble_e_sprite2 + .word bubble_e_sprite3 + .word bubble_e_sprite4 + .word bubble_e_sprite5 + + +bubble_e_sprite0: + .byte $AA + .byte $AA + .byte $AA + .byte $80 ; 1 000 0000 + .byte $AA + +bubble_e_sprite1: + .byte $AA + .byte $AA + .byte $AA + .byte $88 ; 1 XXX 10XX + .byte $A2 ; 0 010 XX10 + +bubble_e_sprite2: + .byte $AA + .byte $AA + .byte $A2 ; 0 010 XX10 + .byte $88 ; 1 XXX 10XX + .byte $AA + +bubble_e_sprite3: + .byte $AA + .byte $A2 ; 101X XX10 + .byte $88 ; 00XX 1XX0 + .byte $88 ; 1XX0 10XX + .byte $AA + +bubble_e_sprite4: + .byte $88 ; 0xx0 10xx + .byte $A2 ; 101x xx10 + .byte $88 ; 00xx 1xx0 + .byte $88 ; 1xx0 10XX + .byte $AA ; 0010 1010 + +bubble_e_sprite5: + .byte $AA ; 0010 1010 + .byte $88 ; 1XX0 10XX + .byte $A2 ; 001X XX10 + .byte $88 ; 1XX0 10XX + .byte $AA ; 0010 1010 + + + + + + + diff --git a/games/peasant/peasant.s b/games/peasant/peasant.s index 0fa8b53f..46df6fc7 100644 --- a/games/peasant/peasant.s +++ b/games/peasant/peasant.s @@ -28,7 +28,7 @@ peasant_quest: ; Lake West ;************************ - jsr lake_west +; jsr lake_west ;************************ ; Lake East @@ -72,5 +72,6 @@ peasant_quest: .include "hgr_rectangle.s" .include "hgr_7x30_sprite.s" .include "hgr_1x5_sprite.s" +.include "hgr_save_restore.s" .include "graphics/graphics.inc"