trogdor: more or less working?

This commit is contained in:
Vince Weaver 2024-01-29 22:53:37 -05:00
parent efd07a89ef
commit 4fa7d38942
8 changed files with 235 additions and 13 deletions

View File

@ -43,7 +43,7 @@ qload.o: zp.inc hardware.inc music.inc qload.s \
horiz_scroll_skip.s \
hgr_copy_magnify.s \
vertical_scroll.s \
hgr_copy_part.s \
hgr_copy_part.s flame.s \
gr_offsets.s vertical_scroll_down.s \
wait.s wait_a_bit.s do_flames.s \
lc_detect.s \
@ -83,8 +83,8 @@ qload.inc: generate_common QLOAD
./generate_common -a 0x1200 -s hgr_copy_part qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_draw_sprite_big_mask qload.lst >> qload.inc
./generate_common -a 0x1200 -s horiz_pan qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_vertical_scroll_right qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_vertical_scroll_left qload.lst >> qload.inc
# ./generate_common -a 0x1200 -s hgr_vertical_scroll_right qload.lst >> qload.inc
# ./generate_common -a 0x1200 -s hgr_vertical_scroll_left qload.lst >> qload.inc
./generate_common -a 0x1200 -s horiz_pan_skip qload.lst >> qload.inc
./generate_common -a 0x1200 -s horiz_pan_skip_short qload.lst >> qload.inc
./generate_common -a 0x1200 -s hgr_copy_magnify qload.lst >> qload.inc

202
demos/trogdor/flame.s Normal file
View File

@ -0,0 +1,202 @@
; flames -- Apple II Hires
flames:
;==================================================
; clear both graphics screens, set to display page1
; lda #$20
; sta HGR_PAGE
;=============================================
; setup (draw white line at bottom of screen)
ldy #39
lda #$f
white_line_loop:
sta $5DD0,Y
dey
bpl white_line_loop
;====================
;====================
; main loop
;====================
;====================
fire_loop:
lda #$20
sta DRAW_PAGE
;====================
; move fire
;====================
move_fire:
ldx #159 ; start at bottom of screen
burn_loop:
;======================
; input in BASL/BASH
lda hposn_low,X
sta BASL
lda hposn_high,X
clc
adc DRAW_PAGE
sta BASH
;========================
; output in GBASL:GBASH
dex ; point to line above
stx XSAVE
lda hposn_low,X
sta GBASL ; put the line address into input
lda hposn_high,X
clc
adc DRAW_PAGE
sta GBASH
ldy #39 ; 39 columns across screen
burn_inner:
random_smc:
lda $900 ; our "RANDOM" numbers
; lda $E000 ; our "RANDOM" numbers
bpl dont_invert_dex ; is top bit random enough?
lda dex_smc
eor #$20
sta dex_smc
dont_invert_dex:
;burn_in_smc:
lda (BASL),Y
tax
; ldx $4000,Y
beq skip_if_zero
dex_smc: ; DEX = $CA, NOP = $EA
dex
skip_if_zero:
txa
;burn_out_smc:
; sta $4000,Y
sta (GBASL),Y
inc random_smc+1 ; update "RNG"
bne no_oflo
inc random_smc+2
lda random_smc+2
cmp #$0c
bne no_oflo
lda #$09 ; wrap to "ROM"
sta random_smc+2
no_oflo:
dey
bpl burn_inner
ldx XSAVE ; finish early as top of screen empty
cpx #120
bne burn_loop
;====================
; copy to visible
copy_to_page1:
; X should already be 150 here
; ldx #150 ; only on bottom of screen
copy_loop:
; txa
; jsr HPOSN ; puts addr of line in A into GBASL:GBASH
lda hposn_low,X ; output on page1
sta BASL
sta GBASL
lda hposn_high,X
sta BASH
clc
adc #$20
sta GBASH
stx XSAVE
; lda GBASL
; sta BASL
; sta copy_inner_smc+1
; lda GBASH
; eor #$60 ; flip to page 1
; sta BASH
; sta copy_inner_smc+2
ldy #39
copy_inner:
lda (GBASL),Y
tax
lda color_lookup,X
; sec ; or ora $80?
ror_smc:
; ror ; ROR = $6A 0110 1010
; NOP = $EA 1110 1010
copy_inner_smc:
sta (BASL),Y
; lda ror_smc
; eor $80
; sta ror_smc
dey
bpl copy_inner
ldx XSAVE
inx
cpx #160
bne copy_loop
;====================
; loop forever
check_flame_keypress:
lda KEYPRESS
bmi done_flames
jmp fire_loop ; bra
done_flames:
bit KEYRESET
rts
;=====================
color_lookup:
.byte $00 ; 1 0 00 00 00 BBBB 0
.byte $84 ; 1 0 00 01 00 BB0B 1
.byte $90 ; 1 0 01 00 00 BOBB 2
.byte $81 ; 1 0 00 00 01 BBBO 3
.byte $91 ; 1 0 01 00 01 BOBO 4
.byte $C4 ; 1 1 00 01 00 OBOB 5
.byte $D1 ; 1 1 01 00 01 OOBO 6
.byte $DA ; 1 1 01 01 01 OOOO 7
.byte $F5 ; 1 1 11 01 01 OWOO 8
.byte $DD ; 1 1 01 11 01 WOWO 9
.byte $FE ; 1 1 11 01 11 OWOW 10
.byte $DF ; 1 1 01 11 11 OOWW 11
.byte $F5 ; 1 1 11 01 01 WWOO 12
.byte $FD ; 1 1 11 11 01 WWWO 13
.byte $DF ; 1 1 01 11 11 WOWW 14
.byte $ff ; 1 1 11 11 11 WWWW 15

View File

@ -1,3 +1,4 @@
.if 0
clear_screens:
;===================================
; Clear top/bottom of page 0
@ -18,7 +19,7 @@ clear_screens:
jsr clear_bottom
rts
.endif

View File

@ -1,3 +1,4 @@
.if 0
;============================
; wait for music pattern
; also check for keypress
@ -58,13 +59,19 @@ done_check_pattern_done:
done_check_timeout_done:
sec
rts
.endif
;==========================
; busy wait A * 1 50Hz tick
;==========================
wait_ticks:
sta IRQ_COUNTDOWN
ldx SOUND_STATUS
bne mockingboard_wait
jmp wait
mockingboard_wait:
sta IRQ_COUNTDOWN
wait_tick_loop:
lda IRQ_COUNTDOWN
bne wait_tick_loop
@ -72,6 +79,7 @@ wait_tick_done:
rts
.if 0
;====================
; busy wait A seconds
;====================
@ -92,3 +100,4 @@ wait_seconds_loop:
wait_seconds_done:
bit KEYRESET
rts
.endif

View File

@ -213,7 +213,7 @@ hposn_high = $1f00
.include "horiz_scroll_simple.s"
.include "horiz_scroll_skip.s"
.include "hgr_copy_magnify.s"
.include "vertical_scroll.s"
; .include "vertical_scroll.s"
.include "hgr_copy_part.s"
.include "vertical_scroll_down.s"
@ -223,4 +223,4 @@ hposn_high = $1f00
qload_end:
.assert (>qload_end - >qload_start) < $e , error, "loader too big"
.assert (>qload_end - >qload_start) < $c , error, "loader too big"

Binary file not shown.

View File

@ -197,11 +197,11 @@ load_trogdor:
jsr move_and_print
; do blue flames
jsr wait_until_keypress
bit KEYRESET
jsr flames
;===================
@ -216,6 +216,7 @@ restart:
lda #0
sta DONE_PLAYING
sta DRAW_PAGE
lda #0
sta LOOP
@ -342,3 +343,4 @@ trog_message2:
.include "pt3_lib_mockingboard_patch.s"
.include "hardware_detect.s"
.include "flame.s"

View File

@ -1132,9 +1132,13 @@ finished:
jsr wait_ticks
wait_till_done:
lda SOUND_STATUS
beq finished_no_mb
lda DONE_PLAYING
beq wait_till_done
finished_no_mb:
rts
@ -1151,8 +1155,6 @@ trog04_graphics:
.incbin "graphics/actual02_updown_cottage.hgr.zx02"
.include "wait_keypress.s"
peasant_data_x1:
@ -1255,3 +1257,9 @@ common_cottage:
jsr wait_ticks
rts
;.include "wait_keypress.s"
;.include "hgr_copy_part.s"
.include "vertical_scroll.s"