fire_tiny: load in zero page
This commit is contained in:
parent
cfb81b0ec6
commit
c8e0be4dab
|
@ -9,7 +9,7 @@ all: fire.dsk
|
||||||
fire.dsk: FIRE FIRE_TINY HELLO
|
fire.dsk: FIRE FIRE_TINY HELLO
|
||||||
$(DOS33) -y fire.dsk SAVE A HELLO
|
$(DOS33) -y fire.dsk SAVE A HELLO
|
||||||
$(DOS33) -y fire.dsk BSAVE -a 0x1000 FIRE
|
$(DOS33) -y fire.dsk BSAVE -a 0x1000 FIRE
|
||||||
$(DOS33) -y fire.dsk BSAVE -a 0x1000 FIRE_TINY
|
$(DOS33) -y fire.dsk BSAVE -a 0x70 FIRE_TINY
|
||||||
|
|
||||||
####
|
####
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ fire.o: fire.s gr_fast_clear.s vapor_lock.s \
|
||||||
####
|
####
|
||||||
|
|
||||||
FIRE_TINY: fire_tiny.o
|
FIRE_TINY: fire_tiny.o
|
||||||
ld65 -o FIRE_TINY fire_tiny.o -C ../linker_scripts/apple2_1000.inc
|
ld65 -o FIRE_TINY fire_tiny.o -C ../linker_scripts/apple2_70.inc
|
||||||
|
|
||||||
fire_tiny.o: fire_tiny.s
|
fire_tiny.o: fire_tiny.s
|
||||||
ca65 -o fire_tiny.o fire_tiny.s -l fire_tiny.lst
|
ca65 -o fire_tiny.o fire_tiny.s -l fire_tiny.lst
|
||||||
|
|
141
fire/fire_tiny.s
141
fire/fire_tiny.s
|
@ -5,43 +5,51 @@
|
||||||
; based on code described here http://fabiensanglard.net/doom_fire_psx/
|
; based on code described here http://fabiensanglard.net/doom_fire_psx/
|
||||||
|
|
||||||
; 611 bytes at first
|
; 611 bytes at first
|
||||||
; 601 bytes -- strip out some unused code6
|
; 601 bytes -- strip out some unused code
|
||||||
; 592 bytes -- don't init screen
|
; 592 bytes -- don't init screen
|
||||||
; 443 bytes -- remove more dead code
|
; 443 bytes -- remove more dead code
|
||||||
; 206 bytes -- no need to clear screen
|
; 206 bytes -- no need to clear screen
|
||||||
; 193 bytes -- un-cycle exact the random16 code
|
; 193 bytes -- un-cycle exact the random16 code
|
||||||
|
; 189 bytes -- more optimization of random16 code
|
||||||
|
; 161 bytes -- move to 8-bit RNG
|
||||||
|
; 152 bytes -- reduce lookup to top half colors (had to remove brown)
|
||||||
|
; also changed maroon to pink
|
||||||
|
; 149 bytes -- use monitor GR
|
||||||
|
|
||||||
; Zero Page
|
; Zero Page
|
||||||
SEEDL = $4E
|
SEEDL = $4E
|
||||||
SEEDH = $4F
|
TEMP = $00
|
||||||
TEMP = $FA
|
TEMPY = $01
|
||||||
TEMPY = $FB
|
|
||||||
|
|
||||||
XOR_MAGIC = $7657 ; "vW"
|
; 100 = $64
|
||||||
|
|
||||||
; Soft Switches
|
; Soft Switches
|
||||||
SET_GR = $C050 ; Enable graphics
|
SET_GR = $C050 ; Enable graphics
|
||||||
FULLGR = $C052 ; Full screen, no text
|
FULLGR = $C052 ; Full screen, no text
|
||||||
LORES = $C056 ; Enable LORES graphics
|
LORES = $C056 ; Enable LORES graphics
|
||||||
|
|
||||||
|
; monitor routines
|
||||||
|
GR = $F390
|
||||||
|
|
||||||
fire_demo:
|
fire_demo:
|
||||||
|
|
||||||
; GR part
|
; GR part
|
||||||
bit LORES ; 4
|
jsr GR ; 3
|
||||||
bit SET_GR ; 4
|
bit FULLGR ; 3
|
||||||
bit FULLGR ; 4
|
;==========
|
||||||
|
; 6
|
||||||
|
|
||||||
|
|
||||||
; Setup white line on bottom
|
; Setup white line on bottom
|
||||||
|
|
||||||
lda #$ff
|
lda #$ff ; 2
|
||||||
ldx #39
|
ldx #39 ; 2
|
||||||
white_loop:
|
white_loop:
|
||||||
sta $7d0,X ; hline 24 (46+47)
|
sta $7d0,X ; hline 24 (46+47) ; 3
|
||||||
dex
|
dex ; 1
|
||||||
bpl white_loop
|
bpl white_loop ; 2
|
||||||
|
;============
|
||||||
|
; 10
|
||||||
|
|
||||||
fire_loop:
|
fire_loop:
|
||||||
|
|
||||||
|
@ -65,11 +73,27 @@ xloop:
|
||||||
smc1:
|
smc1:
|
||||||
lda $7d0,X
|
lda $7d0,X
|
||||||
sta TEMP
|
sta TEMP
|
||||||
and #$f ; mask off
|
and #$7 ; mask off
|
||||||
tay
|
tay
|
||||||
|
|
||||||
jsr random16
|
;=============================
|
||||||
|
; random8
|
||||||
|
;=============================
|
||||||
|
; 8-bit 6502 Random Number Generator
|
||||||
|
; Linear feedback shift register PRNG by White Flame
|
||||||
|
; http://codebase64.org/doku.php?id=base:small_fast_8-bit_prng
|
||||||
|
|
||||||
|
random8:
|
||||||
lda SEEDL
|
lda SEEDL
|
||||||
|
beq doEor
|
||||||
|
asl
|
||||||
|
beq noEor ; if the input was $80, skip the EOR
|
||||||
|
bcc noEor
|
||||||
|
doEor: eor #$1d
|
||||||
|
noEor: sta SEEDL
|
||||||
|
|
||||||
|
; end inlined RNG
|
||||||
|
|
||||||
and #$1
|
and #$1
|
||||||
beq no_change
|
beq no_change
|
||||||
|
|
||||||
|
@ -91,88 +115,21 @@ smc2:
|
||||||
dey
|
dey
|
||||||
bpl yloop
|
bpl yloop
|
||||||
|
|
||||||
|
bmi fire_loop
|
||||||
jmp fire_loop
|
|
||||||
|
|
||||||
|
|
||||||
color_progression:
|
color_progression:
|
||||||
.byte 0 ; 0->0
|
.byte $00 ; 8->0 ; 1000 0101
|
||||||
.byte $88 ; 1->8
|
.byte $bb ; 9->11 ; 1001 0001
|
||||||
.byte 0 ; 2->0
|
.byte 0 ; 10->0 ; 1010 0000
|
||||||
.byte 0 ; 3->0
|
.byte $aa ; 11->10 ; 1011 0000
|
||||||
.byte 0 ; 4->0
|
.byte 0 ; 12->0 ; 1100 0000
|
||||||
.byte 0 ; 5->0
|
.byte $99 ; 13->9 ; 1101 1001
|
||||||
.byte 0 ; 6->0
|
.byte $00 ; 14->0 ; 1110 0000
|
||||||
.byte 0 ; 7->0
|
.byte $dd ; 15->13 ; 1111 1101
|
||||||
.byte $55 ; 8->5
|
|
||||||
.byte $11 ; 9->1
|
|
||||||
.byte 0 ; 10->0
|
|
||||||
.byte 0 ; 11->0
|
|
||||||
.byte 0 ; 12->0
|
|
||||||
.byte $99 ; 13->9
|
|
||||||
.byte 0 ; 14->0
|
|
||||||
.byte $dd ; 15->13
|
|
||||||
|
|
||||||
|
|
||||||
; 16-bit 6502 Random Number Generator
|
|
||||||
; Linear feedback shift register PRNG by White Flame
|
|
||||||
; http://codebase64.org/doku.php?id=base:small_fast_16-bit_prng
|
|
||||||
|
|
||||||
;=============================
|
|
||||||
; random16
|
|
||||||
;=============================
|
|
||||||
random16:
|
|
||||||
|
|
||||||
lda SEEDL ; 3
|
|
||||||
beq low_zero ; $0000 and $8000 are special values ; 3
|
|
||||||
;==========
|
|
||||||
; 6
|
|
||||||
lownz:
|
|
||||||
; -1
|
|
||||||
asl SEEDL ; Do a normal shift ; 5
|
|
||||||
lda SEEDH ; 3
|
|
||||||
rol ; 2
|
|
||||||
bcs do_eor ; 3
|
|
||||||
bcc no_eor ; 3
|
|
||||||
do_eor:
|
|
||||||
; high byte is in A
|
|
||||||
eor #>XOR_MAGIC ; 2
|
|
||||||
sta SEEDH ; 3
|
|
||||||
lda SEEDL ; 3
|
|
||||||
eor #<XOR_MAGIC ; 2
|
|
||||||
sta SEEDL ; 3
|
|
||||||
eor_rts:
|
|
||||||
rts ; 6
|
|
||||||
|
|
||||||
no_eor:
|
|
||||||
sta SEEDH ; 3
|
|
||||||
jmp eor_rts ; 3+6
|
|
||||||
;===========
|
|
||||||
; 20
|
|
||||||
low_zero:
|
|
||||||
lda SEEDH ; 3
|
|
||||||
beq do_eor ; High byte is also zero ; 3
|
|
||||||
; so apply the EOR
|
|
||||||
|
|
||||||
ceo: ; -1
|
|
||||||
; wasn't zero, check for $8000
|
|
||||||
asl ; 2
|
|
||||||
beq no_eor ; if $00 is left after the shift; 3
|
|
||||||
; then it was $80
|
|
||||||
|
|
||||||
; else, do the EOR based on the carry
|
|
||||||
cep:
|
|
||||||
bcc no_eor
|
|
||||||
bcs do_eor
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gr_offsets:
|
gr_offsets:
|
||||||
.word $400,$480,$500,$580,$600,$680,$700,$780
|
.word $400,$480,$500,$580,$600,$680,$700,$780
|
||||||
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
||||||
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
MEMORY {
|
||||||
|
ZP: start = $00, size = $1A, type = rw;
|
||||||
|
RAM: start = $70, size = $8E00, file = %O;
|
||||||
|
}
|
||||||
|
|
||||||
|
SEGMENTS {
|
||||||
|
CODE: load = RAM, type = ro;
|
||||||
|
RODATA: load = RAM, type = ro;
|
||||||
|
DATA: load = RAM, type = rw;
|
||||||
|
BSS: load = RAM, type = bss, define = yes;
|
||||||
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
|
}
|
Loading…
Reference in New Issue