mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-20 17:29:28 +00:00
peasant: some commands actually work
This commit is contained in:
parent
5e9d39fad3
commit
56ace09b86
|
@ -6,6 +6,7 @@
|
||||||
; TODO: when backspacing, erase old char not XOR
|
; TODO: when backspacing, erase old char not XOR
|
||||||
|
|
||||||
hgr_input:
|
hgr_input:
|
||||||
|
bit KEYRESET
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
ldy #184
|
ldy #184
|
||||||
|
@ -23,20 +24,26 @@ hgr_input_loop:
|
||||||
|
|
||||||
and #$7f ; trim off top?
|
and #$7f ; trim off top?
|
||||||
|
|
||||||
cmp #13
|
cmp #13 ; if return, then done
|
||||||
beq done_hgr_input
|
beq done_hgr_input
|
||||||
|
|
||||||
cmp #$7f
|
cmp #$7f ; check if backspace
|
||||||
beq hgr_input_backspace
|
beq hgr_input_backspace
|
||||||
cmp #8
|
cmp #8
|
||||||
beq hgr_input_backspace
|
beq hgr_input_backspace
|
||||||
|
|
||||||
ldy #184
|
ldx INPUT_X
|
||||||
|
sta input_buffer-1,X ; store to buffer
|
||||||
|
|
||||||
|
ldy #184 ; print char
|
||||||
ldx INPUT_X
|
ldx INPUT_X
|
||||||
jsr hgr_put_char
|
jsr hgr_put_char
|
||||||
|
|
||||||
|
ldx INPUT_X
|
||||||
|
cpx #38
|
||||||
|
bcs input_too_big ; FIXME this is a hack
|
||||||
inc INPUT_X
|
inc INPUT_X
|
||||||
|
input_too_big:
|
||||||
jmp hgr_input_loop
|
jmp hgr_input_loop
|
||||||
|
|
||||||
hgr_input_backspace:
|
hgr_input_backspace:
|
||||||
|
@ -44,12 +51,25 @@ hgr_input_backspace:
|
||||||
cpx #1 ; don't backspace too far
|
cpx #1 ; don't backspace too far
|
||||||
beq hgr_input_loop
|
beq hgr_input_loop
|
||||||
|
|
||||||
lda #' '
|
|
||||||
ldy #184
|
|
||||||
jsr hgr_put_char
|
|
||||||
|
|
||||||
dec INPUT_X
|
dec INPUT_X
|
||||||
|
ldx INPUT_X
|
||||||
|
|
||||||
|
lda input_buffer-1,X ; load old char
|
||||||
|
ldy #184
|
||||||
|
jsr hgr_put_char ; xor it on top
|
||||||
|
|
||||||
jmp hgr_input_loop
|
jmp hgr_input_loop
|
||||||
|
|
||||||
done_hgr_input:
|
done_hgr_input:
|
||||||
|
|
||||||
|
ldx INPUT_X ; NUL terminate
|
||||||
|
lda #0
|
||||||
|
sta input_buffer-1,X
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
input_buffer:
|
||||||
|
.byte 0,0,0,0,0,0,0,0,0,0
|
||||||
|
.byte 0,0,0,0,0,0,0,0,0,0
|
||||||
|
.byte 0,0,0,0,0,0,0,0,0,0
|
||||||
|
.byte 0,0,0,0,0,0,0,0,0,0
|
||||||
|
|
|
@ -10,8 +10,12 @@
|
||||||
.include "qload.inc"
|
.include "qload.inc"
|
||||||
|
|
||||||
|
|
||||||
|
ENDING_COPY = 1
|
||||||
|
|
||||||
|
|
||||||
peasant_quest:
|
peasant_quest:
|
||||||
|
lda #0
|
||||||
|
sta GAME_OVER
|
||||||
|
|
||||||
jsr hgr_make_tables
|
jsr hgr_make_tables
|
||||||
|
|
||||||
|
@ -70,32 +74,7 @@ peasant_quest:
|
||||||
|
|
||||||
; draw rectangle on bottom
|
; draw rectangle on bottom
|
||||||
|
|
||||||
; draw rectangle
|
jsr clear_bottom
|
||||||
|
|
||||||
lda #$00 ; color is black1
|
|
||||||
sta VGI_RCOLOR
|
|
||||||
|
|
||||||
lda #0
|
|
||||||
sta VGI_RX1
|
|
||||||
lda #183
|
|
||||||
sta VGI_RY1
|
|
||||||
lda #140
|
|
||||||
sta VGI_RXRUN
|
|
||||||
lda #9
|
|
||||||
sta VGI_RYRUN
|
|
||||||
|
|
||||||
jsr vgi_simple_rectangle
|
|
||||||
|
|
||||||
lda #140
|
|
||||||
sta VGI_RX1
|
|
||||||
lda #183
|
|
||||||
sta VGI_RY1
|
|
||||||
lda #140
|
|
||||||
sta VGI_RXRUN
|
|
||||||
lda #9
|
|
||||||
sta VGI_RYRUN
|
|
||||||
|
|
||||||
jsr vgi_simple_rectangle
|
|
||||||
|
|
||||||
jsr hgr_save
|
jsr hgr_save
|
||||||
|
|
||||||
|
@ -172,10 +151,24 @@ peasant_the_same:
|
||||||
|
|
||||||
jsr check_keyboard
|
jsr check_keyboard
|
||||||
|
|
||||||
|
lda GAME_OVER
|
||||||
|
bne game_over
|
||||||
|
|
||||||
jmp game_loop
|
jmp game_loop
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; copy protection check
|
||||||
|
;************************
|
||||||
|
game_over:
|
||||||
|
exit_copy_check:
|
||||||
|
lda #LOAD_COPY_CHECK
|
||||||
|
sta WHICH_LOAD
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
check_keyboard:
|
check_keyboard:
|
||||||
|
|
||||||
|
@ -207,7 +200,7 @@ check_up:
|
||||||
cmp #'W'
|
cmp #'W'
|
||||||
bne check_down
|
bne check_down
|
||||||
|
|
||||||
lda #$1
|
lda #$FF
|
||||||
sta PEASANT_YADD
|
sta PEASANT_YADD
|
||||||
jmp done_check_keyboard
|
jmp done_check_keyboard
|
||||||
|
|
||||||
|
@ -215,7 +208,7 @@ check_down:
|
||||||
cmp #'S'
|
cmp #'S'
|
||||||
bne check_enter
|
bne check_enter
|
||||||
|
|
||||||
lda #$FF
|
lda #$1
|
||||||
sta PEASANT_YADD
|
sta PEASANT_YADD
|
||||||
jmp done_check_keyboard
|
jmp done_check_keyboard
|
||||||
|
|
||||||
|
@ -225,7 +218,12 @@ check_enter:
|
||||||
cmp #' '
|
cmp #' '
|
||||||
bne done_check_keyboard
|
bne done_check_keyboard
|
||||||
enter_pressed:
|
enter_pressed:
|
||||||
|
jsr clear_bottom
|
||||||
|
jsr hgr_input
|
||||||
|
|
||||||
|
jsr parse_input
|
||||||
|
|
||||||
|
jsr clear_bottom
|
||||||
|
|
||||||
done_check_keyboard:
|
done_check_keyboard:
|
||||||
|
|
||||||
|
@ -235,14 +233,6 @@ done_check_keyboard:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; read input
|
|
||||||
|
|
||||||
jsr hgr_input
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
peasant_text:
|
peasant_text:
|
||||||
.byte 25,2,"Peasant's Quest",0
|
.byte 25,2,"Peasant's Quest",0
|
||||||
|
|
||||||
|
@ -250,16 +240,53 @@ score_text:
|
||||||
.byte 0,2,"Score: 0 of 150",0
|
.byte 0,2,"Score: 0 of 150",0
|
||||||
|
|
||||||
|
|
||||||
;************************
|
|
||||||
; copy protection check
|
|
||||||
;************************
|
parse_input:
|
||||||
exit_copy_check:
|
jsr hgr_save
|
||||||
lda #LOAD_COPY_CHECK
|
|
||||||
sta WHICH_LOAD
|
lda input_buffer ; get first char FIXME
|
||||||
|
and #$DF ; make uppercase 0110 0001 -> 0100 0001
|
||||||
|
|
||||||
|
parse_copy:
|
||||||
|
cmp #'C'
|
||||||
|
bne parse_version
|
||||||
|
|
||||||
|
; want copy
|
||||||
|
lda #ENDING_COPY
|
||||||
|
sta GAME_OVER
|
||||||
|
jmp done_parse_message
|
||||||
|
|
||||||
|
|
||||||
|
parse_version:
|
||||||
|
cmp #'V'
|
||||||
|
bne parse_help
|
||||||
|
|
||||||
|
lda #<version_message
|
||||||
|
sta OUTL
|
||||||
|
lda #>version_message
|
||||||
|
jmp finish_parse_message
|
||||||
|
|
||||||
|
parse_help:
|
||||||
|
lda #<help_message
|
||||||
|
sta OUTL
|
||||||
|
lda #>help_message
|
||||||
|
|
||||||
|
finish_parse_message:
|
||||||
|
sta OUTH
|
||||||
|
jsr hgr_text_box
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
done_parse_message:
|
||||||
|
jsr hgr_restore
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.include "decompress_fast_v2.s"
|
.include "decompress_fast_v2.s"
|
||||||
.include "wait_keypress.s"
|
.include "wait_keypress.s"
|
||||||
|
|
||||||
|
@ -284,3 +311,40 @@ help_message:
|
||||||
.byte 0,43,24, 0,253,82
|
.byte 0,43,24, 0,253,82
|
||||||
.byte 8,41,"I don't understand. Type",13
|
.byte 8,41,"I don't understand. Type",13
|
||||||
.byte "HELP for assistances.",0
|
.byte "HELP for assistances.",0
|
||||||
|
|
||||||
|
version_message:
|
||||||
|
.byte 0,43,24, 0,253,82
|
||||||
|
.byte 8,41,"APPLE ][ PEASANT'S QUEST",13
|
||||||
|
.byte "version 0.2",0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
clear_bottom:
|
||||||
|
; draw rectangle
|
||||||
|
|
||||||
|
lda #$00 ; color is black1
|
||||||
|
sta VGI_RCOLOR
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta VGI_RX1
|
||||||
|
lda #183
|
||||||
|
sta VGI_RY1
|
||||||
|
lda #140
|
||||||
|
sta VGI_RXRUN
|
||||||
|
lda #9
|
||||||
|
sta VGI_RYRUN
|
||||||
|
|
||||||
|
jsr vgi_simple_rectangle
|
||||||
|
|
||||||
|
lda #140
|
||||||
|
sta VGI_RX1
|
||||||
|
lda #183
|
||||||
|
sta VGI_RY1
|
||||||
|
lda #140
|
||||||
|
sta VGI_RXRUN
|
||||||
|
lda #9
|
||||||
|
sta VGI_RYRUN
|
||||||
|
|
||||||
|
jsr vgi_simple_rectangle
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
|
@ -28,7 +28,7 @@ ALTH = $68
|
||||||
SAVED_X = $69
|
SAVED_X = $69
|
||||||
PEASANT_XADD = $6A
|
PEASANT_XADD = $6A
|
||||||
PEASANT_YADD = $6B
|
PEASANT_YADD = $6B
|
||||||
|
GAME_OVER = $6C
|
||||||
|
|
||||||
; pt3 player registers
|
; pt3 player registers
|
||||||
AY_REGISTERS = $70
|
AY_REGISTERS = $70
|
||||||
|
|
Loading…
Reference in New Issue
Block a user