hgr: doom flame for hgr

This commit is contained in:
Vince Weaver 2021-11-29 15:39:39 -05:00
parent 48ad4692c6
commit 4c36e768f7
7 changed files with 626 additions and 1 deletions

View File

@ -19,7 +19,8 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
GATOR.BAS CURSOR.BAS STARGATE.BAS TUNNEL.BAS STARFIELD.BAS \
STAROOPS.BAS HGRSTARFIELD.BAS COOL_BOT.BAS WEB.BAS ORB.BAS \
FIREWORKS.BAS THINKING.BAS ARCS.BAS WIRE_HGR.BAS STATIC.BAS \
OVAL.BAS OVAL_HGR.BAS MOVING.BAS THICK_SINE.BAS TURKEY.BAS
OVAL.BAS OVAL_HGR.BAS MOVING.BAS THICK_SINE.BAS TURKEY.BAS \
FLAME_HGR.BAS
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
@ -103,6 +104,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
$(DOS33) -y appleiibot.dsk SAVE A MOVING.BAS
$(DOS33) -y appleiibot.dsk SAVE A THICK_SINE.BAS
$(DOS33) -y appleiibot.dsk SAVE A TURKEY.BAS
$(DOS33) -y appleiibot.dsk SAVE A FLAME_HGR.BAS
####
@ -583,5 +585,10 @@ FIREWORKS.BAS: fireworks.bas
####
FLAME_HGR.BAS: flame_hgr.bas
$(TOKENIZE) < flame_hgr.bas > FLAME_HGR.BAS
####
clean:
rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back convert_tgreene LOAD *.BAS

View File

@ -0,0 +1,2 @@
1FORI=0TO139:POKE1013+I,4*PEEK(2126+I)-192+(PEEK(2266+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"*el,cl;E`Q8Z2WdEb4`U_N74dW9M8Y4P9QfbN74aU9[0h01[80B3R<0\9Vk0\QT7k8)b2j81_0Z_R81R4dYhfUd]R80lY8Q9R8BCP9Q8\3Y_H0T9R4kYhjh`bglU0QOOTXbfdeoblodo[S#A*.]5G4:E5S$347'5=-C)77#++,4)@7?=4#,#+&7GH:2

View File

@ -0,0 +1,40 @@
include ../../../Makefile.inc
DOS33 = ../../../utils/dos33fs-utils/dos33
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
LINKER_SCRIPTS = ../../../linker_scripts
EMPTY_DISK = ../../../empty_disk
all: flame.dsk
flame.dsk: HELLO FLAME FLAMING_CHECKERS
cp $(EMPTY_DISK)/empty.dsk flame.dsk
$(DOS33) -y flame.dsk SAVE A HELLO
$(DOS33) -y flame.dsk BSAVE -a 0x03f5 FLAME
$(DOS33) -y flame.dsk BSAVE -a 0x0C00 FLAMING_CHECKERS
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
####
FLAME: flame.o
ld65 -o FLAME flame.o -C $(LINKER_SCRIPTS)/apple2_3f5.inc
flame.o: flame.s
ca65 -o flame.o flame.s -l flame.lst
####
FLAMING_CHECKERS: flaming_checkers.o
ld65 -o FLAMING_CHECKERS flaming_checkers.o -C $(LINKER_SCRIPTS)/apple2_c00.inc
flaming_checkers.o: flaming_checkers.s
ca65 -o flaming_checkers.o flaming_checkers.s -l flaming_checkers.lst
#####
clean:
rm -f *~ *.o *.lst FLAME FLAMING_CHECKERS

218
graphics/hgr/flame/flame.s Normal file
View File

@ -0,0 +1,218 @@
; flames -- Apple II Hires
; 158 bytes -- original
; 163 bytes -- limit to part of screen for frame rate
; 155 bytes -- inline functions
; 147 bytes -- rip out broken wind support
; 146 bytes -- move jmp to branch-always
; 135 bytes -- use (GBASL) instead of self-modifying
; 147 bytes -- use larger pool of random numbers
; 142 bytes -- use (BASL),Y addressing instead of self-modifying code
; 140 bytes -- use high bit for randomness
; D0+ used by HGR routines
HGR_COLOR = $E4
HGR_PAGE = $E6
BASL = $24
BASH = $25
GBASL = $26
GBASH = $27
HGR_X = $E0
; soft-switches
PAGE1 = $C054
; ROM routines
HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff
HGR = $F3E2 ; set hires page1 and clear $2000-$3fff
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
flamees:
;==================================================
; clear both graphics screens, set to display page1
jsr HGR
jsr HGR2
bit PAGE1 ; display page1 while leaving $E6 set to page2
;=============================================
; setup (draw white line at bottom of screen)
ldx #39
lda #$f
white_line_loop:
sta $5FD0,X
dex
bpl white_line_loop
;====================
;====================
; main loop
;====================
;====================
fire_loop:
; first time through loop, X = FF
; other times through loop, X = 192
;====================
; move fire
;====================
move_fire:
ldx #191 ; start at bottom of screen
burn_loop:
txa
jsr HPOSN ; puts addr of line in A into GBASL:GBASH
lda GBASL ; put the line address into input
sta BASL
lda GBASH
sta BASH
; input now in GBASL:GBASH
ldx HGR_X ; restore X
dex ; point to line above
txa ; put in A
jsr HPOSN ; put addr of line in A into GBASL:GBASH
; output now in GBASL:GBASH
ldy #39 ; 39 columns across screen
burn_inner:
random_smc:
lda $E000 ; our "RANDOM" numbers
; and #$1
; bne dont_invert_dex
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
bne no_oflo
lda #$d0
sta random_smc+2
no_oflo:
dey
bpl burn_inner
ldx HGR_X ; finish early as top of screen empty
cpx #150
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 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 HGR_X
inx
cpx #192
bne copy_loop
;====================
; loop forever
beq fire_loop ; bra
;=====================
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

@ -0,0 +1,197 @@
; flames -- Apple II Hires
; D0+ used by HGR routines
HGR_COLOR = $E4
HGR_PAGE = $E6
GBASL = $26
GBASH = $27
HGR_X = $E0
GBASL_SAVED = $FF
; soft-switches
PAGE1 = $C054
; ROM routines
HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
flamees:
jsr HGR2
bit PAGE1
;==================
; setup
ldx #39
lda #$f
white_line_loop:
sta $5FD0,X
dex
bpl white_line_loop
fire_loop:
;====================
; move fire
jsr move_fire
;====================
; copy to visible
jsr copy_to_page1
;====================
; loop forever
jmp fire_loop
move_fire:
ldx #191
burn_loop:
txa
jsr HPOSN ; puts addr of line in A into GBASL:GBASH
lda GBASL
sta GBASL_SAVED
lda GBASH
sta burn_in_smc+2
ldx HGR_X
dex
txa
jsr HPOSN
lda GBASL
sta burn_out_smc+1
lda GBASH
sta burn_out_smc+2
ldy #39
burn_inner:
random_smc:
lda $D000 ; RANDOM?
pha
; and #$3
; sbc #$2
; adc GBASL_SAVED
; sta burn_in_smc+1
lda GBASL_SAVED
sta burn_in_smc+1
pla
no_wind:
and #$1
bne dont_invert_dex
lda dex_smc
eor #$20
sta dex_smc
dont_invert_dex:
burn_in_smc:
ldx $4000,Y
beq skip_if_zero
dex_smc: ; DEX = $CA, NOP = $EA
dex
skip_if_zero:
txa
burn_out_smc:
sta $4000,Y
inc random_smc+1
dey
bpl burn_inner
ldx HGR_X
bne burn_loop
rts
;=====================
copy_to_page1:
ldx #0
copy_loop:
txa
jsr HPOSN ; puts addr of line in A into GBASL:GBASH
; ldx HGR_X
lda GBASL
sta copy_inner_smc+1
lda GBASH
eor #$60
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 $2000,Y
; lda ror_smc
; eor $80
; sta ror_smc
dey
bpl copy_inner
ldx HGR_X
inx
cpx #192
bne copy_loop
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

@ -0,0 +1,159 @@
; flames -- Apple II Hires
; D0+ used by HGR routines
HGR_COLOR = $E4
HGR_PAGE = $E6
GBASL = $26
GBASH = $27
HGR_X = $E0
COUNT = $FE
FRAME = $FF
; soft-switches
PAGE1 = $C054
; ROM routines
HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
flamees:
jsr HGR2
bit PAGE1
;==================
; setup
ldx #39
lda #$9
white_line_loop:
sta $5FD0,X
dex
bpl white_line_loop
fire_loop:
;====================
; move fire
jsr move_fire
;====================
; copy to visible
jsr copy_to_page1
;====================
; loop forever
jmp fire_loop
move_fire:
ldx #191
burn_loop:
txa
jsr HPOSN ; puts addr of line in A into GBASL:GBASH
lda GBASL
sta burn_in_smc+1
lda GBASH
sta burn_in_smc+2
ldx HGR_X
dex
txa
jsr HPOSN
lda GBASL
sta burn_out_smc+1
lda GBASH
sta burn_out_smc+2
ldy #39
burn_inner:
burn_in_smc:
ldx $4000,Y
beq skip_zero
dex
skip_zero:
txa
ror_smc:
ror ; ROR = $6A 0110 1010
; NOP = $EA 1110 1010
burn_out_smc:
sta $4000,Y
; lda ror_smc
; eor $80
; sta ror_smc
dey
bpl burn_inner
ldx HGR_X
bne burn_loop
rts
;=====================
copy_to_page1:
ldx #0
copy_loop:
txa
jsr HPOSN ; puts addr of line in A into GBASL:GBASH
; ldx HGR_X
lda GBASL
sta copy_inner_smc+1
lda GBASH
eor #$60
sta copy_inner_smc+2
ldy #39
copy_inner:
lda (GBASL),Y
tax
lda color_lookup,X
copy_inner_smc:
sta $2000,Y
dey
bpl copy_inner
ldx HGR_X
inx
cpx #192
bne copy_loop
rts
color_lookup:
.byte $00 ; 1 0 00 00 00 BBBB 0
.byte $90 ; 1 0 01 00 00 BOBB 1
.byte $81 ; 1 0 00 00 01 BBBO 2
.byte $91 ; 1 0 01 00 01 BOBO 3
.byte $C4 ; 1 1 00 01 00 OBOB 4
.byte $DD ; 1 1 01 11 01 WOWO 5
.byte $FE ; 1 1 11 01 11 OWOW 6
.byte $DF ; 1 1 01 11 11 OOWW 7
.byte $F5 ; 1 1 11 01 01 WWOO 8
.byte $ff ; 1 1 11 11 11 WWWW 9

View File

@ -0,0 +1,2 @@
5 HOME
10 PRINT CHR$(4);"CATALOG"