riven_hgr: re-arrange zero page and clear it

maybe inadvised at this juncture, but was trying to sort out occasional
keyboard issue that might have been due to some zero page values not
being initialized
This commit is contained in:
Vince Weaver 2024-05-28 14:37:12 -04:00
parent 5ff2f532f8
commit 2b8f1ac1af
4 changed files with 100 additions and 126 deletions

View File

@ -113,6 +113,7 @@ MOVIE1: movie1.o
ld65 -o MOVIE1 movie1.o -C $(LINKER_SCRIPTS)/apple2_4000.inc
movie1.o: movie1.s \
zp.inc hardware.inc \
movie1/movie1.inc
ca65 -o movie1.o movie1.s -l movie1.lst
@ -122,6 +123,7 @@ MOVIE2: movie2.o
ld65 -o MOVIE2 movie2.o -C $(LINKER_SCRIPTS)/apple2_4000.inc
movie2.o: movie2.s \
zp.inc hardware.inc \
movie2/movie2.inc
ca65 -o movie2.o movie2.s -l movie2.lst

View File

@ -79,10 +79,13 @@ keypress:
handle_input:
pha
pha ; save keypress info
jsr restore_bg_14x14 ; restore old background
inc UPDATE_POINTER
pla
inc UPDATE_POINTER ; keypress so assume need move pointer
pla ; restore keypress info
check_sound:
cmp #$14 ; control-T
@ -97,26 +100,26 @@ check_sound:
check_joystick:
; cmp #$10 ; control-P
cmp #'J'
bne check_load
bne check_left
lda JOYSTICK_ENABLED
eor #1
sta JOYSTICK_ENABLED
jmp done_keypress
check_load:
cmp #$C ; control-L
bne check_save
;check_load:
; cmp #$C ; control-L
; bne check_save
; jsr load_game
jmp done_keypress
; jmp done_keypress
check_save:
cmp #$13 ; control-S
bne check_left
;check_save:
; cmp #$13 ; control-S
; bne check_left
; jsr save_game
jmp done_keypress
; jmp done_keypress
check_left:
cmp #'A'
@ -124,15 +127,13 @@ check_left:
cmp #8 ; left key
bne check_right
left_pressed:
lda CURSOR_X ; if x>0
; cmp #41
; bcc do_dec_cursor_x
; cmp #$FE
beq done_left_pressed
lda CURSOR_X ; check Xpos
beq done_left_pressed ; if Xpos==0 don't move left
do_dec_cursor_x:
dec CURSOR_X
dec CURSOR_X ; move left one 3.5 pixel column
done_left_pressed:
jmp done_keypress
jmp done_keypress ; done checking input
check_right:
cmp #'D'
@ -140,15 +141,15 @@ check_right:
cmp #$15 ; right key
bne check_up
right_pressed:
lda CURSOR_X ; if 40<x<$FE don't increment
cmp #38
bcc do_inc_cursor_x
cmp #$FE
bcc done_right_pressed
lda CURSOR_X ; load Xpos
cmp #38 ; if Xpos > 38 don't increment
bcc do_inc_cursor_x ; blt
; cmp #$FE
; bcc done_right_pressed
do_inc_cursor_x:
inc CURSOR_X
inc CURSOR_X ; move right one 3.5 pixel column
done_right_pressed:
jmp done_keypress
jmp done_keypress ; done checking input
check_up:
cmp #'W'
@ -156,19 +157,17 @@ check_up:
cmp #$0B ; up key
bne check_down
up_pressed:
lda CURSOR_Y ; if > 4 then decrement
cmp #4
; bcs do_dec_cursor_y ; bge
; cmp #$F0
lda CURSOR_Y ; load YPos
cmp #4 ; is YPos>4 then we can decrement
bcc done_up_pressed ; blt
do_dec_cursor_y:
dec CURSOR_Y
dec CURSOR_Y
dec CURSOR_Y ; subtract 4
dec CURSOR_Y ; 1 byte shorter to sec/lda/sbc/sta?
dec CURSOR_Y
dec CURSOR_Y
done_up_pressed:
jmp done_keypress
jmp done_keypress ; done checking input
check_down:
cmp #'S'
@ -178,16 +177,14 @@ check_down:
down_pressed:
lda CURSOR_Y ; if y<177 (14 high)
cmp #177
; bcc do_inc_cursor_y
; cmp #$EE
bcs done_down_pressed
do_inc_cursor_y:
inc CURSOR_Y
inc CURSOR_Y ; add 4
inc CURSOR_Y
inc CURSOR_Y
inc CURSOR_Y
done_down_pressed:
jmp done_keypress
jmp done_keypress ; done checking input
;check_escape:
; cmp #27

View File

@ -161,15 +161,27 @@ done_setup_sound:
; init
;===================================
; clear out zero page values to 0
; clear everything from $80 .. $A0?
lda #0
ldx #$20
clear_loop:
sta $80,X
dex
bpl clear_loop
lda #$20
sta HGR_PAGE
jsr hgr_make_tables
lda #0
sta JOYSTICK_ENABLED
sta UPDATE_POINTER
sta HOLDING_ITEM
sta HOLDING_PAGE
; lda #0
; sta JOYSTICK_ENABLED
; sta UPDATE_POINTER
; sta HOLDING_ITEM
; sta HOLDING_PAGE
lda #20
sta CURSOR_X

View File

@ -36,52 +36,7 @@ SEEDH = $4f
XMAX = $50
; MIST zero page addresses
FRAMEL = $60
FRAMEH = $61
;CURSOR_X = $62
;CURSOR_Y = $63
XPOS = $64
YPOS = $65
LOCATION_STRUCT_L = $66
LOCATION_STRUCT_H = $67
IN_SPECIAL = $68
CURSOR_VISIBLE = $69
IN_LEFT = $6A
IN_RIGHT = $6B
BTC_L = $6C
BTC_H = $6D
; pt3 player registers
REGISTER_DUMP = $70
AY_REGISTERS = $70
A_FINE_TONE = $70
A_COARSE_TONE = $71
B_FINE_TONE = $72
B_COARSE_TONE = $73
C_FINE_TONE = $74
C_COARSE_TONE = $75
NOISE = $76
ENABLE = $77
PT3_MIXER_VAL = $77
A_VOLUME = $78
B_VOLUME = $79
C_VOLUME = $7A
ENVELOPE_FINE = $7B
ENVELOPE_COARSE = $7C
ENVELOPE_SHAPE = $7D
COPY_OFFSET = $7E
DECODER_STATE = $7F
PATTERN_L = $7E
PATTERN_H = $7F
; note 70-7f also used by disk code
; note: rest are up at $f0
; note 70-7f used by disk code (?) do we need to preserve?
; We have to save/restore the following values
; when loading/storing from disk
@ -99,54 +54,62 @@ DIRECTION = $81
LOCATION = $82
HOLDING_PAGE = $90
HOLDING_RED_PAGE = $80
HOLDING_BLUE_PAGE = $40
HOLDING_WHITE_PAGE = $C0
HOLDING_ITEM = $91
HOLDING_KEY = $04
HOLDING_LIT_MATCH = $02
HOLDING_MATCH = $01
JS_BUTTON_STATE = $83
CURRENT_DISK = $84
JOYSTICK_ENABLED = $85
SOUND_STATUS = $86
SOUND_DISABLED = $80
SOUND_IN_LC = $01 ; $01 sound effects in language card
SOUND_MOCKINGBOARD = $02 ; mockingboard detected
SCENE_COUNT = $87
ANIMATE_FRAME = $88
LEVEL_OVER = $89
GAME_OVER = $FF
TOUCHED_ENEMY = $80
NEXT_LEVEL = $01
LOCATIONS_L = $8A
LOCATIONS_H = $8B
DISP_PAGE = $8C
DRAW_PAGE = $8D
WHICH_OVERLAY = $8E
;HOLDING_PAGE = $90
; HOLDING_RED_PAGE = $80
; HOLDING_BLUE_PAGE = $40
; HOLDING_WHITE_PAGE = $C0
;HOLDING_ITEM = $91
; HOLDING_KEY = $04
; HOLDING_LIT_MATCH = $02
; HOLDING_MATCH = $01
CURSOR_X = $BC
CURSOR_Y = $BD
UPDATE_POINTER = $BE
APPLEII_MODEL = $D8
HGR_PAGE = $D9
WHICH_SLOT = $DA
JS_BUTTON_STATE = $DB
CURRENT_DISK = $DC
JOYSTICK_ENABLED= $DD
SOUND_STATUS = $DE
SOUND_DISABLED = $80
SOUND_IN_LC = $01 ; $01 sound effects in language card
SOUND_MOCKINGBOARD = $02 ; mockingboard detected
; Riven zero page addresses
SCENE_COUNT = $DF
ANIMATE_FRAME = $E0
LEVEL_OVER = $E1
GAME_OVER = $FF
TOUCHED_ENEMY = $80
NEXT_LEVEL = $01
LOCATIONS_L = $E2
LOCATIONS_H = $E3
FRAMEL = $90
FRAMEH = $91
CURSOR_X = $92
CURSOR_Y = $93
XPOS = $94
YPOS = $95
LOCATION_STRUCT_L = $96
LOCATION_STRUCT_H = $97
IN_SPECIAL = $98
CURSOR_VISIBLE = $99
IN_LEFT = $9A
IN_RIGHT = $9B
; temp var per-world define
LONG_FRAME = $E4 ; nibel
CURRENT_DISPLAY = $E4 ; selena
LAST_PLAYED = $E4 ; selena
UPDATE_POINTER = $9C
APPLEII_MODEL = $9D
HGR_PAGE = $9E
STAR_CYCLE = $E5
DISP_PAGE = $ED ; ALL
DRAW_PAGE = $EE ; ALL
WHICH_OVERLAY = $F8
TEMP = $F9
;TEMPY = $FB
MASKL = $FA
MASKH = $FB
INL = $FC