riven: hook up orb sound

This commit is contained in:
Vince Weaver 2024-06-21 17:05:56 -04:00
parent f9d5992e62
commit 8b090686c3
12 changed files with 310 additions and 36 deletions

View File

@ -51,7 +51,8 @@ riven_disk39.dsk: QBOOT QLOAD TITLE_39 \
riven_disk40.dsk: QBOOT QLOAD TITLE_40 \
disk40_files/DISK40 \
disk40_files/LEVEL_MAGLEV \
disk40_files/LEVEL_OUTSIDE
disk40_files/LEVEL_OUTSIDE \
disk40_files/LEVEL_ORB
cp $(EMPTY_DISK)/empty.dsk riven_disk40.dsk
$(DOS33_RAW) riven_disk40.dsk 0 0 QBOOT 0 1
$(DOS33_RAW) riven_disk40.dsk 0 2 QBOOT 1 1
@ -61,6 +62,7 @@ riven_disk40.dsk: QBOOT QLOAD TITLE_40 \
$(DOS33_RAW) riven_disk40.dsk 1 9 TITLE_40 0 0
$(DOS33_RAW) riven_disk40.dsk 2 0 disk40_files/LEVEL_MAGLEV 0 0
$(DOS33_RAW) riven_disk40.dsk 9 0 disk40_files/LEVEL_OUTSIDE 0 0
$(DOS33_RAW) riven_disk40.dsk 17 0 disk40_files/LEVEL_ORB 0 0
riven_disk43.dsk: QBOOT QLOAD TITLE_43 \
disk43_files/DISK43 \

View File

@ -3,7 +3,7 @@ include ../../../Makefile.inc
LINKER_SCRIPTS = ../../../linker_scripts/
all: DISK40 LEVEL_MAGLEV LEVEL_OUTSIDE
all: DISK40 LEVEL_MAGLEV LEVEL_OUTSIDE LEVEL_ORB
###
@ -38,6 +38,19 @@ level_outside.o: level_outside.s \
graphics_outside/outside_graphics.inc
ca65 -o level_outside.o level_outside.s -l level_outside.lst
####
LEVEL_ORB: level_orb.o
ld65 -o LEVEL_ORB level_orb.o -C $(LINKER_SCRIPTS)/apple2_4000.inc
level_orb.o: level_orb.s \
../zp.inc ../hardware.inc ../qload.inc \
../common_defines.inc disk40_defines.inc \
leveldata_orb.inc \
graphics_orb1/orb1_graphics.inc
ca65 -o level_orb.o level_orb.s -l level_orb.lst
####
@ -46,11 +59,14 @@ graphics_maglev/maglev_graphics.inc:
graphics_outside/outside_graphics.inc:
cd graphics_outside && make
graphics_orb1/orb1_graphics.inc:
cd graphics_orb1 && make
####
clean:
rm -f *~ *.o *.lst \
LEVEL_MAGLEV LEVEL_OUTSIDE
LEVEL_MAGLEV LEVEL_OUTSIDE LEVEL_ORB
####

View File

@ -4,19 +4,19 @@ which_disk:
.byte $40 ; BCD
load_address_array:
.byte $40,$40,$40,$00 ; TITLE, MAGLEV, OUTSIDE
.byte $40,$40,$40,$40 ; TITLE, MAGLEV, OUTSIDE, ORB
.byte $00,$00,$00,$00
track_array:
.byte 1, 2, 9,17 ; TITLE, MAGLEV, OUTSIDE
.byte 1, 2, 9,17 ; TITLE, MAGLEV, OUTSIDE, ORB
.byte 0, 0, 0, 0
sector_array:
.byte 9, 0, 0, 0 ; TITLE, MAGLEV, OUTSIDE
.byte 9, 0, 0, 0 ; TITLE, MAGLEV, OUTSIDE, ORB
.byte 0,0,0,0
length_array:
.byte 8, 96,112, 64 ; TITLE, MAGLEV, OUTSIDE
.byte 8, 96,112, 64 ; TITLE, MAGLEV, OUTSIDE, ORB
.byte 0,0,0,0
disk_exit_disk: ; note: BCD (yes I'm lazy)

View File

@ -1,8 +1,9 @@
LOAD_TITLE = 0
LOAD_MAGLEV = 1
LOAD_OUTSIDE = 2
LOAD_MOVIE1 = 3
LOAD_MOVIE2 = 4
LOAD_ORB = 3
LOAD_MOVIE1 = 4
LOAD_MOVIE2 = 5
;================================
; Level definitions
@ -20,3 +21,7 @@ RIVEN_OUTSIDE_PATH = 0
RIVEN_OUTSIDE_PLAZA = 1
RIVEN_CAVE_ENTRANCE = 2
; Orb
RIVEN_ORB1 = 0

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,186 @@
; Riven -- Jungle Island -- Looking at the first orb
; by deater (Vince Weaver) <vince@deater.net>
; Zero Page
.include "../zp.inc"
.include "../hardware.inc"
.include "../common_defines.inc"
.include "../qload.inc"
.include "disk40_defines.inc"
riven_jungle_orb:
;===================
; init screen
;===================
; jsr TEXT
; jsr HOME
bit KEYRESET
bit SET_GR
bit PAGE1
bit HIRES
bit FULLGR
;===============================
; load sound into language card
;===============================
lda SOUND_STATUS
and #SOUND_IN_LC
beq do_not_load_audio
; load sounds into LC
; read ram, write ram, use $d000 bank1
bit $C08B
bit $C08B
lda #<orb_audio
sta ZX0_src
lda #>orb_audio
sta ZX0_src+1
lda #$D0 ; decompress to $D000
jsr full_decomp
; read rom, nowrite, use $d000 bank1
bit $C08A
do_not_load_audio:
;========================
; set up location
;========================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
lda #0
sta JOYSTICK_ENABLED
sta UPDATE_POINTER
lda #1
sta CURSOR_VISIBLE
lda #20
sta CURSOR_X
sta CURSOR_Y
;===================================
; init
;===================================
jsr change_location
jsr save_bg_14x14 ; save old bg
game_loop:
;===================================
; draw pointer
;===================================
jsr draw_pointer
;===================================
; handle keypress/joystick
;===================================
jsr handle_keypress
;===================================
; increment frame count
;===================================
inc FRAMEL
bne frame_no_oflo
inc FRAMEH
frame_no_oflo:
;====================================
; check level over
;====================================
lda LEVEL_OVER
bne really_exit
jmp game_loop
really_exit:
rts
;=====================================
; handle orb being clicked
;=====================================
orb_clicked:
; only play sound if language card
lda SOUND_STATUS
and #SOUND_IN_LC
bne do_play_audio
; wait a bit instead
ldx #20
jsr wait_50xms
do_play_audio:
; switch in language card
; read/write RAM $d000 bank 1
bit $C08B
bit $C08B
; call the btc player
lda #$00
sta BTC_L
lda #$D0
sta BTC_H
ldx #45 ; length
jsr play_audio
; read ROM/no-write
bit $c08A ; restore language card
done_play_audio:
rts
;==========================
; includes
;==========================
.include "graphics_orb1/orb1_graphics.inc"
.include "leveldata_orb.inc"
.include "../audio.s"
orb_audio:
.incbin "audio/ball1.btc.zx02"

View File

@ -0,0 +1,32 @@
;===============================================
; level data for 1st Orb
;===============================================
locations:
.word location0
; technically in the actual game you can look south/west to slightly
; different backgrounds, but for various reasons we're going to just
; back out when given the chance
; RIVEN_ORB1 -- first orb
location0:
.byte LOAD_OUTSIDE<<4|RIVEN_OUTSIDE_PLAZA ; north exit
.byte $FF ; south exit
.byte $FF ; east exit
.byte $FF ; west exit
.byte DIRECTION_N ; north exit_dir
.byte $ff ; south exit_dir
.byte $ff ; east exit_dir
.byte $ff ; west exit_dir
.word orb_n_zx02 ; north bg
.word $0000 ; south bg
.word $0000 ; east bg
.word $0000 ; west bg
.byte BG_NORTH
.byte DIRECTION_N ; special exit
.byte 15,23 ; special x
.byte 64,118 ; special y
.word orb_clicked-1 ; special function

View File

@ -25,7 +25,7 @@ location0:
; RIVEN_OUTSIDE_PLAZA -- plaza near maglev
location1:
.byte $ff ; TODO: ball ; north exit
.byte LOAD_ORB<<4|RIVEN_ORB1 ; north exit
.byte RIVEN_CAVE_ENTRANCE ; south exit
.byte RIVEN_OUTSIDE_PATH ; east exit
.byte $FF ; west exit

View File

@ -0,0 +1,40 @@
; Code from TotalReplay by 4am and qkumba
;------------------------------------------------------------------------------
; Has64K
; Checks whether computer has functioning language card (64K)
;
; in: none
; out: C clear if 64K detected
; C set if 64K not detected
; all other flags and registers clobbered
; ROM in memory (not LC RAM bank)
;------------------------------------------------------------------------------
detect_language_card:
; enable language card
; READ_RAM1_WRITE_RAM1
bit $C08B
bit $C08B
lda #$AA ; test #1 for $D0 page
sta $D000
eor $D000
bne no_lc
lsr $D000 ; test #2 for $D0 page
lda #$55
eor $D000
bne no_lc
clc
bcc done_detect
no_lc:
sec
done_detect:
; READ_ROM_NO_WRITE
bit $C08A
rts

View File

@ -27,18 +27,7 @@
riven_title:
;============================
; check to see if new game
; if so print title screen
; otherwise we get here after flipping disks
; so skip all the init
; lda NEW_GAME
; bne new_game
; jmp disk_change
new_game:
;===========================
; print the title message that used to be
; in hello.bas
@ -193,16 +182,16 @@ reload_everything:
; and load sound into it if possible
;===================================
; lda #0
; sta SOUND_STATUS ; clear out, sound enabled
lda #0
sta SOUND_STATUS ; clear out, sound enabled
; jsr detect_language_card
; bcs no_language_card
jsr detect_language_card
bcs no_language_card
; update sound status
; lda SOUND_STATUS
; ora #SOUND_IN_LC
; sta SOUND_STATUS
lda SOUND_STATUS
ora #SOUND_IN_LC
sta SOUND_STATUS
; load sounds into LC
@ -282,13 +271,16 @@ done_setup_sound:
; 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 #0
; ldx #$20
;clear_loop:
; sta $80,X
; dex
; bpl clear_loop
lda #0
sta LEVEL_OVER
; init hi-res graphics
@ -377,7 +369,7 @@ clear_loop:
; .include "gr_offsets.s"
; .include "lc_detect.s"
.include "lc_detect.s"
model_string:
.byte "DETECTED APPLE II",0,0,0

View File

@ -19,7 +19,8 @@ DRIVE2_DISK = $0C
DRIVE1_TRACK = $0D
DRIVE2_TRACK = $0E
NEW_DISK = $0F
BTC_L = $10
BTC_H = $11
;; Zero page monitor routines addresses