diff --git a/games/peasant/Makefile b/games/peasant/Makefile index caa9399f..72c0188e 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -67,7 +67,7 @@ PEASANT: peasant.o ld65 -o PEASANT peasant.o -C $(LINKER_SCRIPTS)/apple2_6000.inc peasant.o: peasant.s graphics/graphics.inc \ - draw_box.s hgr_rectangle.s hgr_font.s \ + draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ title.s directions.s \ cottage.s lake_w.s lake_e.s river.s knight.s \ ending.s @@ -79,6 +79,7 @@ ENDING: ending.o ld65 -o ENDING ending.o -C $(LINKER_SCRIPTS)/apple2_6000.inc ending.o: ending.s graphics_end/end_graphics.inc \ + hgr_input.s \ draw_box.s hgr_rectangle.s hgr_font.s \ ending.s ca65 -o ending.o ending.s -l ending.lst diff --git a/games/peasant/ending.s b/games/peasant/ending.s index 87e1d2c6..9ba96b8a 100644 --- a/games/peasant/ending.s +++ b/games/peasant/ending.s @@ -28,7 +28,20 @@ trogdor_question: jsr decompress_lzsa2_fast - jsr wait_until_keypress + lda #copy_protection_text + sta OUTH + + jsr hgr_put_string + jsr hgr_put_string + jsr hgr_put_string + + jsr hgr_input + + ;============================= + ; game over man + ;============================= game_over: @@ -64,6 +77,7 @@ forever: .include "hgr_font.s" .include "draw_box.s" .include "hgr_rectangle.s" +.include "hgr_input.s" .include "graphics_end/end_graphics.inc" @@ -72,3 +86,11 @@ peasant_text: score_text: .byte 0,2,"Score: 0 of 150",0 + + + ; 0123456789012345678901234567890123456789 +copy_protection_text: + .byte 0,160,"Before proceeding, don thy red glasses",0 + .byte 0,168,"spin the wheel on p27 and answer this:",0 + .byte 0,176,"+ Who is Trogdor's cousin's brother?",0 + diff --git a/games/peasant/hgr_font.s b/games/peasant/hgr_font.s index 062d6c09..3e8208d7 100644 --- a/games/peasant/hgr_font.s +++ b/games/peasant/hgr_font.s @@ -42,7 +42,7 @@ outl_no_oflo: rts ;================== - ; in X + ; X in X ; Y in Y ; Char in A hgr_put_char: diff --git a/games/peasant/hgr_input.s b/games/peasant/hgr_input.s new file mode 100644 index 00000000..ca65a154 --- /dev/null +++ b/games/peasant/hgr_input.s @@ -0,0 +1,55 @@ + ;==================== + ; hgr input + ;==================== + ; TODO: save to string + ; TODO: arbitrary Y location + ; TODO: when backspacing, erase old char not XOR + +hgr_input: + + ldx #0 + ldy #184 + lda #'>' + jsr hgr_put_char + + ldx #1 + stx INPUT_X + +hgr_input_loop: + lda KEYPRESS + bpl hgr_input_loop + + bit KEYRESET + + and #$7f ; trim off top? + + cmp #13 + beq done_hgr_input + + cmp #$7f + beq hgr_input_backspace + cmp #8 + beq hgr_input_backspace + + ldy #184 + ldx INPUT_X + jsr hgr_put_char + + inc INPUT_X + + jmp hgr_input_loop + +hgr_input_backspace: + ldx INPUT_X + cpx #1 ; don't backspace too far + beq hgr_input_loop + + lda #' ' + ldy #184 + jsr hgr_put_char + + dec INPUT_X + jmp hgr_input_loop + +done_hgr_input: + rts diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index 9448abda..182885e0 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -17,9 +17,12 @@ CURSOR_Y = $63 WHICH_LOAD=$80 +INPUT_X = $D0 WHICH_SLOT = $DA CURRENT_DISK = $DC HGR_COLOR = $E4 +HGR_PAGE = $E6 + P0 = $F1