Skip to content

Commit

Permalink
ootw: ending: update to use newew version of pt3_lib
Browse files Browse the repository at this point in the history
should now detect mockingboard (though still hardcodes slot #4)

also at end of ending does cold-reset back to menu
  • Loading branch information
deater committed Jan 27, 2020
1 parent f144b30 commit da2d2dd
Show file tree
Hide file tree
Showing 9 changed files with 393 additions and 450 deletions.
4 changes: 2 additions & 2 deletions ootw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ ENDING: ending.o
ld65 -o ENDING ending.o -C ../linker_scripts/apple2_1700.inc

ending.o: ending.s \
pt3_lib_core.s pt3_lib_init.s pt3_lib_mockingboard.s \
pt3_setup.s pt3_lib_irq_handler.s interrupt_handler.s \
pt3_lib_core.s pt3_lib_init.s pt3_lib_mockingboard_detect.s \
pt3_lib_mockingboard_setup.s pt3_lib_irq_handler.s interrupt_handler.s \
ootw_graphics/l15final/ootw_c15_final.inc \
ootw_graphics/l16end/ootw_c16_end.inc \
ootw_audio/ootw_outro.pt3
Expand Down
73 changes: 62 additions & 11 deletions ootw/ending.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; ootw
; quick demo of what the ending might be like
; ootw -- It's the End of the Game as We Know It

; TODO: missing a bunch of frames


; by Vince "Deater" Weaver <[email protected]>
Expand All @@ -12,16 +13,54 @@ ending:
;=========================
; set up sound
;=========================

jsr pt3_setup
lda #0
sta DONE_PLAYING

lda #1
sta LOOP

; detect mockingboard

; jmp quit_level
jsr mockingboard_detect

; jsr wait_until_keypressed
bcc mockingboard_notfound

mockingboard_found:

; jsr mockingboard_patch ; patch to work in slots other than 4?

;=======================
; Set up 50Hz interrupt
;========================

jsr mockingboard_init
jsr mockingboard_setup_interrupt

;============================
; Init the Mockingboard
;============================

jsr reset_ay_both
jsr clear_ay_both

;==================
; init song
;==================

jsr pt3_init_song


jmp done_setup_sound

mockingboard_notfound:
; patch out cli/sei calls

lda #$EA
sta cli_smc
sta sei_smc


done_setup_sound:

repeat_ending:

Expand Down Expand Up @@ -132,11 +171,12 @@ repeat_ending:
jsr gr_overlay
jsr page_flip

jsr wait_until_keypressed
; jsr wait_until_keypressed


; start music

cli_smc:
cli ; enable interrupts

ldx #240
Expand Down Expand Up @@ -691,7 +731,19 @@ print_loop:

jsr wait_until_keypressed

jmp repeat_ending
; disable music

jsr clear_ay_both
sei_smc:
sei

; reboot to title

lda #$ff ; force cold reboot
sta $03F4
jmp ($FFFC)

; jmp repeat_ending


; 0123456789012345678901234567890123456789
Expand Down Expand Up @@ -798,9 +850,8 @@ long_wait:
.include "pt3_lib_core.s"
.include "pt3_lib_init.s"
.include "interrupt_handler.s"
.include "pt3_lib_mockingboard.s"

.include "pt3_setup.s"
.include "pt3_lib_mockingboard_detect.s"
.include "pt3_lib_mockingboard_setup.s"



Expand Down
6 changes: 3 additions & 3 deletions ootw/pt3_lib_core.s
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ NOTE_TONE_SLIDE_TO_STEP =39

NOTE_STRUCT_SIZE=40

.ifdef USE_ZERO_PAGE
.ifdef PT3_USE_ZERO_PAGE
note_a = $80
note_b = $80+(NOTE_STRUCT_SIZE*1)
note_c = $80+(NOTE_STRUCT_SIZE*2)
Expand All @@ -100,7 +100,7 @@ begin_vars=$80
end_vars=$80+(NOTE_STRUCT_SIZE*3)


.else ; !USE_ZERO_PAGE
.else ; !PT3_USE_ZERO_PAGE
begin_vars:

note_a: ; reset?
Expand Down Expand Up @@ -829,7 +829,7 @@ do_onoff:
do_offon:
ldy note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
put_offon:
.ifdef USE_ZERO_PAGE
.ifdef PT3_USE_ZERO_PAGE
sty note_a+NOTE_ONOFF,X
.else
lda note_a+NOTE_ONOFF,X
Expand Down
2 changes: 1 addition & 1 deletion ootw/pt3_lib_init.s
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ note_table_propogate_loop:

;================================================
; propogation isn't enough, various values
; are ofte off by one, so adjust using a bitmask
; are often off by one, so adjust using a bitmask
;================================================
NoteTableAdjust:

Expand Down
11 changes: 9 additions & 2 deletions ootw/pt3_lib_irq_handler.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

pt3_irq_handler:

bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4
pt3_irq_smc1:
bit MOCK_6522_T1CL ; clear 6522 interrupt by reading T1C-L ; 4

lda DONE_PLAYING ; 3
beq pt3_play_music ; if song done, don't play music ; 3/2nt
Expand Down Expand Up @@ -74,22 +75,28 @@ mb_not_13:


; address
pt3_irq_smc2:
stx MOCK_6522_ORA1 ; put address on PA1 ; 4
stx MOCK_6522_ORA2 ; put address on PA2 ; 4
ldy #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
pt3_irq_smc3:
sty MOCK_6522_ORB1 ; latch_address on PB1 ; 4
sty MOCK_6522_ORB2 ; latch_address on PB2 ; 4
ldy #MOCK_AY_INACTIVE ; go inactive ; 2
pt3_irq_smc4:
sty MOCK_6522_ORB1 ; 4
sty MOCK_6522_ORB2 ; 4

; value
pt3_irq_smc5:
sta MOCK_6522_ORA1 ; put value on PA1 ; 4
sta MOCK_6522_ORA2 ; put value on PA2 ; 4
lda #MOCK_AY_WRITE ; ; 2
pt3_irq_smc6:
sta MOCK_6522_ORB1 ; write on PB1 ; 4
sta MOCK_6522_ORB2 ; write on PB2 ; 4
sty MOCK_6522_ORB1 ; 4
pt3_irq_smc7:
sta MOCK_6522_ORB2 ; write on PB2 ; 4
sty MOCK_6522_ORB2 ; 4
;===========
; 56
Expand Down
Loading

0 comments on commit da2d2dd

Please sign in to comment.