riven: clean up some of the common code

This commit is contained in:
Vince Weaver 2024-07-24 16:08:14 -04:00
parent 6f42fabb94
commit 9a88435c9d
3 changed files with 129 additions and 118 deletions

View File

@ -60,8 +60,8 @@ final movie roto procedure:
Disk00 Map (disk has 35 tracks, each 4k in size) Disk00 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$~~~~~~~
T 0 = Qboot T 0 = Qboot
T 0.5 = TITLE 1823 bytes 8S = 0T8S (2048) 400B free T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2346 bytes 16S = 1T00S (4096) 2k free T 1 = QLOAD 2314 bytes 16S = 1T00S (4096) 2k free
T 2 = CYAN 32459 bytes = 7T15S (32512) 0k free T 2 = CYAN 32459 bytes = 7T15S (32512) 0k free
T 10 = ATRUS 32493 bytes = 7T15S (32512) 0k free T 10 = ATRUS 32493 bytes = 7T15S (32512) 0k free
T 18 = CAPTURED 16696 bytes = 5T (20480) 4k free T 18 = CAPTURED 16696 bytes = 5T (20480) 4k free
@ -72,19 +72,57 @@ T 31 = START 4107 bytes = 4T (16384) 12k free
Disk01 Map (disk has 35 tracks, each 4k in size) Disk01 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot T 0 = Qboot
T 0.5 = TITLE 1823 bytes 8S = 0T8S (2048) 400B free T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2393 bytes 16S= 1T0S (4096) 2k free T 1 = QLOAD 2314 bytes 16S= 1T0S (4096) 2k free
T 2 = ARRIVAL 27040 bytes = 7T0S (28672) 1k free T 2 = ARRIVAL 27040 bytes = 7T0S (28672) 1k free
T 9 = ARRIVAL2 15920 bytes = 4T0S (16384) 400B free T 9 = ARRIVAL2 15920 bytes = 4T0S (16384) 400B free
T 13 = TELESCOPE 19484 bytes = 6T0S (24576) 5k free T 13 = TELESCOPE 19482 bytes = 6T0S (24576) 5k free
T 19 = ARRIVAL3 30786 bytes = 7T15S (32512) 2k free T 19 = ARRIVAL3 30786 bytes = 7T15S (32512) 2k free
T 27 = STEPS 29647 bytes = 7T15S (32512) 3k free T 27 = PATH 29647 bytes = 7T15S (32512) 3k free
Disk02 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot
T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2314 bytes 16S= 1T0S (4096) 2k free
T 2 = STEPS1 9172 bytes = 6T0S (24576) 15k free
T 9 = STEPS3 ???? bytes = 6T0S (24576) ?? free
T 16 = STEPS5 ???? bytes = 6T0S (24576) ?? free
T 22 = TOP 15658 bytes = 5T0S (20480) 5k free
Disk03 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot
T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2314 bytes 16S= 1T0S (4096) 2k free
T 2 = STEPS1 ???? bytes = 6T0S (24576) 15k free
T 9 = STEPS3 ???? bytes = 6T0S (24576) ?? free
T 16 = OUTSIDE 9582 bytes = 6T0S (24576) ?? free
Disk04 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot
T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2314 bytes 16S= 1T0S (4096) 2k free
T 2 = BRIDGE2 ???? bytes = 5T0S (20480) 15k free
T 7 = BRIDGE3 ???? bytes = 5T0S (20480) ?? free
T 12 = BRIDGE4 ???? bytes = 5T0S (20480) ?? free
T 17 = TUNNEL1 ???? bytes = 5T0S (20480) ?? free
T 22 = TUNNEL2 ???? bytes = 5T0S (20480) ?? free
T 27 = TUNNEL3 17217 bytes = 5T0S (20480) 3k free
Disk05 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot
T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2314 bytes 16S= 1T0S (4096) 2k free
T 2 = CHAIR 1195 bytes = 6T0S (24576) 23k free
Disk38 Map (disk has 35 tracks, each 4k in size) Disk38 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot T 0 = Qboot
T 0.5 = TITLE 1823 bytes 8S = 0T8S (2048) 400B free T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2393 bytes 16S = 1T0S (4096) 2k free T 1 = QLOAD 2314 bytes 16S = 1T0S (4096) 2k free
T 2 = PROJECTOR 12057 bytes = 7T0S (28672) 16k free T 2 = PROJECTOR 12057 bytes = 7T0S (28672) 16k free
; NOTE: save room for creepy animation, alternate door closed code ; NOTE: save room for creepy animation, alternate door closed code
@ -92,8 +130,8 @@ T 2 = PROJECTOR 12057 bytes = 7T0S (28672) 16k free
Disk39 Map (disk has 35 tracks, each 4k in size) Disk39 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot T 0 = Qboot
T 0.5 = TITLE 1823 bytes 8S = 0T8S (2048) 400B free T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2393 bytes 16S = 1T0S (4096) 2k free T 1 = QLOAD 2314 bytes 16S = 1T0S (4096) 2k free
T 2 = PROJECTOR 23707 bytes 96S = 6T0S (24576) 1k free T 2 = PROJECTOR 23707 bytes 96S = 6T0S (24576) 1k free
T 8 = OUTSIDE 26029 bytes 124S = 7T15S (32512) 6k free T 8 = OUTSIDE 26029 bytes 124S = 7T15S (32512) 6k free
T 17 = MAGSTEPS 11537 bytes 64S = 4T0S (16384) 5k free T 17 = MAGSTEPS 11537 bytes 64S = 4T0S (16384) 5k free
@ -104,8 +142,8 @@ T 27 = MOVIE_MAG 32184 bytes 128S = 7T15S (32512)300B free
Disk40 Map (disk has 35 tracks, each 4k in size) Disk40 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot T 0 = Qboot
T 0.5 = TITLE 1823 bytes 8S = 0T8S (2048) 400B free T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2393 bytes 8S = 0T8S (2048) 300B free T 1 = QLOAD 2314 bytes 8S = 0T8S (2048) 300B free
T 2 = MAGLEV 30502 bytes = 8T11S (32768) 2k free T 2 = MAGLEV 30502 bytes = 8T11S (32768) 2k free
T 10 = OUTSIDE 18917 bytes = 5T (20480) 2k free T 10 = OUTSIDE 18917 bytes = 5T (20480) 2k free
T 15 = TUNNEL 20983 bytes = 6T (24576) 4k free T 15 = TUNNEL 20983 bytes = 6T (24576) 4k free
@ -116,8 +154,8 @@ T 27 = MOVIE_MAG 32275 bytes 127S = 7T15S (32512)300B free
Disk41 Map (disk has 35 tracks, each 4k in size) Disk41 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot T 0 = Qboot
T 0.5 = TITLE 1823 bytes 8S = 0T8S (2048) 400B free T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2393 bytes 8S = 0T8S (2048) 300B free T 1 = QLOAD 2314 bytes 8S = 0T8S (2048) 300B free
T 2 = TUNNEL 30669 bytes 127S= 8T (32512) 2k free T 2 = TUNNEL 30669 bytes 127S= 8T (32512) 2k free
T 10 = STAIRS 25624 = 7T (28672) 3k free T 10 = STAIRS 25624 = 7T (28672) 3k free
T 17 = COVE 26422 = 7T (28672) 2k free T 17 = COVE 26422 = 7T (28672) 2k free
@ -127,14 +165,30 @@ T 31 = MOVIE_COVE 8299 = 3T (12288) 4k free
Disk43 Map (disk has 35 tracks, each 4k in size) Disk43 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot T 0 = Qboot
T 0.5 = TITLE 1823 bytes 8S = 0T8S (2048) 400B free T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2393 bytes 8S = 0T8S (2048) 300B free T 1 = QLOAD 2314 bytes 8S = 0T8S (2048) 300B free
T 2 = CART 23280 bytes = 7T0S (28672) 5k free T 2 = CART 23280 bytes = 7T0S (28672) 5k free
T 9 = BRIDGE 18609 bytes = 7T0S (28672) 10k free T 9 = BRIDGE 18609 bytes = 7T0S (28672) 10k free
T 16 = LOGGED 17570 bytes = 6T0S (24576) 7k free T 16 = LOGGED 17570 bytes = 6T0S (24576) 7k free
T 22 = LOGGED2 17584 bytes = 5T0S (20480) 3k free T 22 = LOGGED2 17584 bytes = 5T0S (20480) 3k free
T 27 = MOVIE_CART32275 bytes 128S = 8T0S (32512)500B free T 27 = MOVIE_CART32275 bytes 128S = 8T0S (32512)500B free
Disk44 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot
T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2314 bytes 8S = 0T8S (2048) 300B free
T 2 = FISH 4891 bytes = 7T0S (28672) 5k free
Disk50 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot
T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2314 bytes 8S = 0T8S (2048) 300B free
T 2 = CHIPPER 12329 bytes = 7T0S (28672) 5k free
graphics notes: graphics notes:
in dark areas, use the shadow tool at 80 or so? in dark areas, use the shadow tool at 80 or so?

View File

@ -4,6 +4,8 @@
;============================== ;==============================
handle_keypress: handle_keypress:
.if 0
; first handle joystick ; first handle joystick
lda JOYSTICK_ENABLED lda JOYSTICK_ENABLED
beq actually_handle_keypress beq actually_handle_keypress
@ -61,16 +63,22 @@ js_check_down:
done_joystick: done_joystick:
.endif
actually_handle_keypress: actually_handle_keypress:
; check for keypress
lda KEYPRESS lda KEYPRESS
bmi keypress bmi keypress
jmp no_keypress jmp no_keypress
keypress: keypress:
; adjust weird Apple II stuff
and #$7f ; clear high bit and #$7f ; clear high bit
cmp #' ' cmp #' '
beq handle_input ; make sure not to lose space beq handle_input ; make sure not to lose space
@ -79,6 +87,10 @@ keypress:
handle_input: handle_input:
;==============================
; assume pointer will be moved
; so restore background
pha ; save keypress info pha ; save keypress info
jsr restore_bg_14x14 ; restore old background jsr restore_bg_14x14 ; restore old background
@ -88,8 +100,10 @@ handle_input:
pla ; restore keypress info pla ; restore keypress info
check_sound: check_sound:
cmp #$14 ; control-T cmp #$13 ; control-S
bne check_joystick bne check_left
; toggle sound
lda SOUND_STATUS lda SOUND_STATUS
eor #SOUND_DISABLED eor #SOUND_DISABLED
@ -97,30 +111,16 @@ check_sound:
jmp done_keypress jmp done_keypress
; can't be ^J as that's the same as down ; can't be ^J as that's the same as down
check_joystick: ;check_joystick:
; cmp #$10 ; control-P ; cmp #'J'
cmp #'J'
bne check_left
lda JOYSTICK_ENABLED
eor #1
sta JOYSTICK_ENABLED
jmp done_keypress
;check_load:
; cmp #$C ; control-L
; bne check_save
; jsr load_game
; jmp done_keypress
;check_save:
; cmp #$13 ; control-S
; bne check_left ; bne check_left
; jsr save_game ; lda JOYSTICK_ENABLED
; eor #1
; sta JOYSTICK_ENABLED
; jmp done_keypress ; jmp done_keypress
check_left: check_left:
cmp #'A' cmp #'A'
beq left_pressed beq left_pressed
@ -135,6 +135,8 @@ do_dec_cursor_x:
done_left_pressed: done_left_pressed:
jmp done_keypress ; done checking input jmp done_keypress ; done checking input
check_right: check_right:
cmp #'D' cmp #'D'
beq right_pressed beq right_pressed
@ -143,9 +145,8 @@ check_right:
right_pressed: right_pressed:
lda CURSOR_X ; load Xpos lda CURSOR_X ; load Xpos
cmp #38 ; if Xpos > 38 don't increment cmp #38 ; if Xpos > 38 don't increment
bcc do_inc_cursor_x ; blt ; bcc do_inc_cursor_x ; blt
; cmp #$FE bcs done_right_pressed ; bge
bcs done_right_pressed
do_inc_cursor_x: do_inc_cursor_x:
inc CURSOR_X ; move right one 3.5 pixel column inc CURSOR_X ; move right one 3.5 pixel column
done_right_pressed: done_right_pressed:
@ -200,6 +201,11 @@ check_return:
cmp #13 cmp #13
bne done_keypress bne done_keypress
;======================================
; extra action if space/return pressed
;======================================
return_pressed: return_pressed:
lda IN_SPECIAL lda IN_SPECIAL

View File

@ -63,12 +63,6 @@
riven_title: riven_title:
;===========================
; print the title message that used to be
; in hello.bas
;=================== ;===================
; init screen ; init screen
;=================== ;===================
@ -77,18 +71,14 @@ riven_title:
jsr HOME jsr HOME
bit KEYRESET bit KEYRESET
; set disk# ; set disk# (DISK provided at compile time)
lda #48+(DISK/10) lda #48+(DISK/10)
sta title_text+28 sta title_text+28
lda #48+(DISK-((DISK/10)*10)) lda #48+(DISK-((DISK/10)*10))
sta title_text+29 sta title_text+29
; setup text screen
; clear text screen
; jsr clear_all
lda #0 lda #0
sta DRAW_PAGE sta DRAW_PAGE
@ -97,45 +87,40 @@ riven_title:
jsr set_normal jsr set_normal
; print messages ; print the title screen text
lda #<title_text lda #<title_text
sta OUTL sta OUTL
lda #>title_text lda #>title_text
sta OUTH sta OUTH
; print the text
jsr move_and_print_list jsr move_and_print_list
loader_start:
;===================
; detect hardware
jsr hardware_detect jsr hardware_detect
;=============================
; set up model string to print
lda #<model_string lda #<model_string
sta OUTL sta OUTL
lda #>model_string lda #>model_string
sta OUTH sta OUTH
lda APPLEII_MODEL lda APPLEII_MODEL
sta model_string+17 sta model_string+19
; special case IIgs, need to print two characters
cmp #'g' cmp #'g'
bne go_print bne go_print
lda #'s' lda #'s'
sta model_string+18 sta model_string+20
go_print: go_print:
ldy #0 jsr move_and_print
print_model:
lda (OUTL),Y
beq print_model_done
ora #$80
sta $7d0,Y
iny
jmp print_model
print_model_done:
;=========================== ;===========================
; patch lowercase printing ; patch lowercase printing
@ -208,7 +193,7 @@ no_patch_uppercase:
not_a_iigs: not_a_iigs:
;=================== ;===================
; Load hires graphics ; Load title graphic
;=================== ;===================
reload_everything: reload_everything:
@ -223,7 +208,7 @@ reload_everything:
;=================================== ;===================================
; detect if we have a language card ; detect if we have a language card
; and load sound into it if possible ; we will use it for sound later if detected
;=================================== ;===================================
lda #0 lda #0
@ -237,28 +222,10 @@ reload_everything:
ora #SOUND_IN_LC ora #SOUND_IN_LC
sta SOUND_STATUS sta SOUND_STATUS
; load sounds into LC
; read ram, write ram, use $d000 bank1
; bit $C08B
; bit $C08B
; lda #<linking_noise_compressed
; sta getsrc_smc+1
; lda #>linking_noise_compressed
; sta getsrc_smc+2
; lda #$D0 ; decompress to $D000
; jsr decompress_lzsa2_fast
;blah:
; read rom, nowrite, use $d000 bank1
; bit $C08A
no_language_card: no_language_card:
; currently no music so no need for Mockingboard code
;=================================== ;===================================
; Setup Mockingboard ; Setup Mockingboard
;=================================== ;===================================
@ -311,6 +278,9 @@ done_setup_sound:
; init ; init
;=================================== ;===================================
; we currently don't do this as we were over-writing
; things that shouldn't. It is living dangerously
; not clearing things out though
; clear out zero page values to 0 ; clear out zero page values to 0
; clear everything from $80 .. $A0? ; clear everything from $80 .. $A0?
@ -325,6 +295,7 @@ done_setup_sound:
lda #0 lda #0
sta LEVEL_OVER sta LEVEL_OVER
sta BEACH_ANIMALS_SEEN sta BEACH_ANIMALS_SEEN
; sta JOYSTICK_ENABLED
; init hi-res graphics ; init hi-res graphics
@ -332,19 +303,14 @@ done_setup_sound:
sta HGR_PAGE sta HGR_PAGE
jsr hgr_make_tables jsr hgr_make_tables
; initial cursor location
; lda #0
; sta JOYSTICK_ENABLED
; sta UPDATE_POINTER
; sta HOLDING_ITEM
; sta HOLDING_PAGE
lda #20 lda #20
sta CURSOR_X sta CURSOR_X
sta CURSOR_Y sta CURSOR_Y
;=================================== ;===================================
; Do Intro Sequence ; Wait a bit
;=================================== ;===================================
; wait a bit at LOAD screen ; wait a bit at LOAD screen
@ -360,14 +326,11 @@ done_setup_sound:
jsr clear_bottom jsr clear_bottom
bit TEXTGR bit TEXTGR
; print messages ; print text
lda #<menu_text lda #<menu_text
sta OUTL sta OUTL
lda #>menu_text lda #>menu_text
sta OUTH sta OUTH
; print the text
jsr move_and_print_list jsr move_and_print_list
lda #0 lda #0
@ -425,17 +388,8 @@ done_pointer_loop:
; we ever implement save game support ; we ever implement save game support
game_new: game_new:
; FIXME: how to convince other disks to swap to DISK0 ; there must be a way to do this better, but for now waste
; without wasting a disk-exit spot ; a disk change slot on each disk with the opener
; lda #$E0|3 ; LOAD_CYAN
; sta WHICH_LOAD ; CYAN opener
; lda #0 ; not needed...
; sta LOCATION
; lda #DIRECTION_N
; sta DIRECTION
lda #$E0|3 lda #$E0|3
sta LEVEL_OVER sta LEVEL_OVER
@ -606,10 +560,7 @@ game_continue:
.include "lc_detect.s" .include "lc_detect.s"
model_string: model_string:
.byte "DETECTED APPLE II",0,0,0 .byte 0,23,"DETECTED APPLE II",0,0,0
riven_title_image: riven_title_image:
.incbin "graphics_title/riven_title.hgr.zx02" .incbin "graphics_title/riven_title.hgr.zx02"