mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-26 11:30:12 +00:00
ootw: add earthquake
This commit is contained in:
parent
27ae077ab5
commit
07476896d5
@ -8,17 +8,17 @@ all: ootw.dsk
|
||||
|
||||
ootw.dsk: HELLO OOTW
|
||||
$(DOS33) -y ootw.dsk SAVE A HELLO
|
||||
$(DOS33) -y ootw.dsk BSAVE -a 0x1000 OOTW
|
||||
$(DOS33) -y ootw.dsk BSAVE -a 0x2000 OOTW
|
||||
|
||||
####
|
||||
|
||||
OOTW: ootw.o
|
||||
ld65 -o OOTW ootw.o -C ../linker_scripts/apple2_1000.inc
|
||||
ld65 -o OOTW ootw.o -C ../linker_scripts/apple2_2000.inc
|
||||
|
||||
ootw.o: ootw.s \
|
||||
gr_copy.s gr_fast_clear.s gr_pageflip.s gr_unrle.s gr_putsprite.s \
|
||||
ootw_pool.s ootw_cavern.s physicist.s \
|
||||
ootw_pool.inc ootw_cavern.inc ootw_sprites.inc
|
||||
ootw_pool.s ootw_cavern.s physicist.s random16.s \
|
||||
ootw_pool.inc ootw_cavern.inc ootw_quake.inc ootw_sprites.inc
|
||||
ca65 -o ootw.o ootw.s -l ootw.lst
|
||||
####
|
||||
|
||||
@ -34,6 +34,9 @@ ootw_pool.inc: $(PNG2RLE) another.png
|
||||
ootw_cavern.inc: $(PNG2RLE) another_cave.png
|
||||
$(PNG2RLE) asm another_cave.png cavern_rle > ootw_cavern.inc
|
||||
|
||||
ootw_quake.inc: $(PNG2RLE) another_cave_shake.png
|
||||
$(PNG2RLE) asm another_cave_shake.png quake_rle > ootw_quake.inc
|
||||
|
||||
#####
|
||||
|
||||
clean:
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 8.3 KiB |
BIN
ootw/another_cave_shake.png
Normal file
BIN
ootw/another_cave_shake.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
@ -4,7 +4,7 @@
|
||||
; copy 0xc00 to DRAW_PAGE
|
||||
;
|
||||
; 45 + 2 + 120*(8*9 + 5) -1 + 6 = 9292
|
||||
.align $100
|
||||
;.align $100
|
||||
gr_copy_to_current:
|
||||
|
||||
lda DRAW_PAGE ; 3
|
||||
|
@ -12,6 +12,8 @@ ootw:
|
||||
|
||||
lda #0
|
||||
sta GAME_OVER
|
||||
sta EQUAKE_PROGRESS
|
||||
sta EARTH_OFFSET
|
||||
|
||||
lda #22
|
||||
sta PHYSICIST_Y
|
||||
@ -66,6 +68,8 @@ end_message:
|
||||
.include "gr_copy.s"
|
||||
.include "gr_putsprite.s"
|
||||
.include "gr_offsets.s"
|
||||
.include "random16.s"
|
||||
.include "ootw_pool.inc"
|
||||
.include "ootw_cavern.inc"
|
||||
.include "ootw_quake.inc"
|
||||
.include "ootw_sprites.inc"
|
||||
|
@ -39,6 +39,5 @@ cavern_rle: .byte $28 ; ysize=48
|
||||
.byte $25, $85, $22,$22, $85,$85, $A3,$82, $A5,$88, $82
|
||||
.byte $88,$88, $28, $88,$88, $28, $88,$88, $28, $88
|
||||
.byte $28, $A3,$88, $82, $A5,$88, $82,$82, $AC,$88, $A8,$28
|
||||
.byte $A0,$1B,$88, $28,$28, $A6,$88, $28, $22, $28, $88
|
||||
.byte $A3,$82, $A0,$1E,$88, $A0,$78,$00
|
||||
.byte $A0,$1B,$88, $28,$28, $A3,$88, $A0,$A0,$00
|
||||
.byte $A1
|
||||
|
@ -1,7 +1,5 @@
|
||||
; Cavern scene (with the slugs)
|
||||
|
||||
|
||||
|
||||
ootw_cavern:
|
||||
;===========================
|
||||
; Enable graphics
|
||||
@ -11,7 +9,6 @@ ootw_cavern:
|
||||
bit FULLGR
|
||||
|
||||
|
||||
|
||||
;===========================
|
||||
; Clear both bottoms
|
||||
|
||||
@ -43,6 +40,21 @@ ootw_cavern:
|
||||
sta GBASL
|
||||
jsr load_rle_gr
|
||||
|
||||
;=============================
|
||||
; Load quake background to $1000
|
||||
|
||||
lda #$10
|
||||
sta BASH
|
||||
lda #$00
|
||||
sta BASL ; load image off-screen $c00
|
||||
|
||||
lda #>(quake_rle)
|
||||
sta GBASH
|
||||
lda #<(quake_rle)
|
||||
sta GBASL
|
||||
jsr load_rle_gr
|
||||
|
||||
|
||||
;=================================
|
||||
; copy to both pages $400/$800
|
||||
|
||||
@ -53,21 +65,11 @@ ootw_cavern:
|
||||
|
||||
;=================================
|
||||
; setup vars
|
||||
; lda #22
|
||||
; sta PHYSICIST_Y
|
||||
; lda #20
|
||||
; sta PHYSICIST_X
|
||||
|
||||
; lda #1
|
||||
; sta DIRECTION
|
||||
|
||||
lda #0
|
||||
sta GAIT
|
||||
sta GAME_OVER
|
||||
|
||||
lda #30
|
||||
sta TENTACLE_PROGRESS
|
||||
|
||||
;============================
|
||||
; Cavern Loop (not a palindrome)
|
||||
;============================
|
||||
@ -77,10 +79,56 @@ cavern_loop:
|
||||
|
||||
jsr handle_keypress_cavern
|
||||
|
||||
|
||||
;==========================
|
||||
; check for earthquake
|
||||
|
||||
earthquake_handler:
|
||||
lda FRAMEH
|
||||
and #3
|
||||
bne earth_mover
|
||||
lda FRAMEL
|
||||
cmp #$ff
|
||||
bne earth_mover
|
||||
earthquake_init:
|
||||
lda #200
|
||||
sta EQUAKE_PROGRESS
|
||||
|
||||
earth_mover:
|
||||
lda EQUAKE_PROGRESS
|
||||
beq earth_still
|
||||
|
||||
and #$8
|
||||
bne earth_calm
|
||||
|
||||
lda #2
|
||||
bne earth_decrement
|
||||
|
||||
earth_calm:
|
||||
lda #0
|
||||
earth_decrement:
|
||||
sta EARTH_OFFSET
|
||||
dec EQUAKE_PROGRESS
|
||||
jmp earth_done
|
||||
|
||||
|
||||
earth_still:
|
||||
lda #0
|
||||
sta EARTH_OFFSET
|
||||
|
||||
earth_done:
|
||||
|
||||
;================================
|
||||
; copy background to current page
|
||||
|
||||
lda EARTH_OFFSET
|
||||
bne shake_shake
|
||||
no_shake:
|
||||
jsr gr_copy_to_current
|
||||
jmp done_shake
|
||||
shake_shake:
|
||||
jsr gr_copy_to_current_40
|
||||
done_shake:
|
||||
|
||||
|
||||
;===============
|
||||
@ -302,3 +350,63 @@ remove_slug:
|
||||
lda #0
|
||||
sta slugg0_out
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
;=========================================================
|
||||
; gr_copy_to_current, 40x48 version
|
||||
;=========================================================
|
||||
; copy 0x1000 to DRAW_PAGE
|
||||
|
||||
gr_copy_to_current_40:
|
||||
|
||||
lda DRAW_PAGE ; 3
|
||||
clc ; 2
|
||||
adc #$4 ; 2
|
||||
sta gr_copy_line_40+5 ; 4
|
||||
sta gr_copy_line_40+11 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line_40+17 ; 4
|
||||
sta gr_copy_line_40+23 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line_40+29 ; 4
|
||||
sta gr_copy_line_40+35 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line_40+41 ; 4
|
||||
sta gr_copy_line_40+47 ; 4
|
||||
;===========
|
||||
; 45
|
||||
|
||||
ldy #119 ; for early ones, copy 120 bytes ; 2
|
||||
|
||||
gr_copy_line_40:
|
||||
lda $1000,Y ; load a byte (self modified) ; 4
|
||||
sta $400,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1080,Y ; load a byte (self modified) ; 4
|
||||
sta $480,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1100,Y ; load a byte (self modified) ; 4
|
||||
sta $500,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1180,Y ; load a byte (self modified) ; 4
|
||||
sta $580,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1200,Y ; load a byte (self modified) ; 4
|
||||
sta $600,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1280,Y ; load a byte (self modified) ; 4
|
||||
sta $680,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1300,Y ; load a byte (self modified) ; 4
|
||||
sta $700,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1380,Y ; load a byte (self modified) ; 4
|
||||
sta $780,Y ; store a byte (self modified) ; 5
|
||||
|
||||
dey ; decrement pointer ; 2
|
||||
bpl gr_copy_line_40 ; ; 2nt/3
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
44
ootw/ootw_quake.inc
Normal file
44
ootw/ootw_quake.inc
Normal file
@ -0,0 +1,44 @@
|
||||
quake_rle: .byte $28 ; ysize=48
|
||||
.byte $A0,$11,$22, $A7,$62, $65, $A3,$55, $F5, $25, $A9,$22
|
||||
.byte $62, $22,$22, $62, $A6,$22, $62,$62, $A3,$22, $62
|
||||
.byte $AB,$66, $55, $6F, $FF, $F6, $66,$66, $62,$62
|
||||
.byte $A4,$22, $66,$66, $62, $66,$66, $62, $A3,$22, $62
|
||||
.byte $66, $6F,$6F, $F2, $22,$22, $AC,$66, $55, $66,$66
|
||||
.byte $6F, $FF, $F6, $A3,$66, $62, $66, $22
|
||||
.byte $A6,$66, $22,$22, $A6,$66, $22,$22, $6F, $F6,$F6, $AE,$66
|
||||
.byte $6F, $F6, $A4,$66, $22, $66,$66, $6F,$6F, $F6,$F6
|
||||
.byte $22,$22, $66, $26, $A4,$66, $22,$22, $A3,$66, $6F,$6F
|
||||
.byte $F6,$F6, $AC,$66, $6F, $F6, $66,$66, $22, $A6,$66
|
||||
.byte $22,$22, $6F, $2F, $7A, $A3,$F6, $22,$22, $A7,$66
|
||||
.byte $6F,$6F, $F6,$F6, $AA,$66, $6F, $F6, $A3,$66, $26
|
||||
.byte $56, $76, $66, $22,$22, $26, $52, $57
|
||||
.byte $76,$76, $66, $22,$22, $A3,$6F, $A3,$F6, $A5,$66, $6F,$6F
|
||||
.byte $F6,$F6, $A7,$66, $6F, $F6, $66,$66, $22, $A3,$55
|
||||
.byte $22,$22, $A4,$55, $27, $76, $22,$22, $66,$66, $26
|
||||
.byte $A3,$66, $A3,$6F, $A3,$F6, $A3,$66, $6F,$6F, $F6,$F6, $A5,$66
|
||||
.byte $6F, $F6, $22, $25, $55,$55, $22,$22, $A3,$55
|
||||
.byte $22, $55,$55, $22,$22, $56, $22, $77, $A0,$17,$66
|
||||
.byte $22,$22, $52, $55, $22,$22, $55,$55, $52, $A3,$55
|
||||
.byte $22,$22, $A4,$55, $76, $A0,$15,$66, $22, $25, $55,$55
|
||||
.byte $22,$22, $A6,$55, $22,$22, $55, $52, $22, $55
|
||||
.byte $77, $7F, $6F,$6F, $7F, $6F,$6F, $88, $A3,$6F
|
||||
.byte $7F,$7F, $76, $77, $76, $A6,$66, $22, $55
|
||||
.byte $25, $55, $22,$22, $25, $A5,$55, $22,$22, $A5,$55
|
||||
.byte $77, $A5,$87, $88, $87, $88, $A3,$87, $A3,$77
|
||||
.byte $A6,$87, $22, $25, $22, $55, $A3,$22, $A5,$55
|
||||
.byte $22,$22, $55,$55, $25, $52, $A3,$57, $58,$58, $78
|
||||
.byte $58, $AA,$88, $58, $78, $A3,$88, $A4,$72, $A3,$22
|
||||
.byte $A5,$55, $22,$22, $55, $25, $22, $A8,$55, $58,$58
|
||||
.byte $88,$88, $22, $88,$88, $58,$58, $A4,$55, $58, $22
|
||||
.byte $55,$55, $75,$75, $A3,$22, $27, $55, $25, $55,$55
|
||||
.byte $A3,$22, $55, $57, $AC,$55, $22, $A4,$55, $25
|
||||
.byte $A4,$55, $22, $27, $57, $55, $A5,$22, $55
|
||||
.byte $22, $55, $25, $A4,$22, $25, $AC,$55, $22
|
||||
.byte $A3,$55, $25, $22, $A3,$55, $A3,$22, $25, $85
|
||||
.byte $A5,$22, $55, $A9,$22, $A7,$82, $A3,$85, $25, $22,$22
|
||||
.byte $25, $85, $22,$22, $85,$85, $A3,$82, $A5,$88, $82
|
||||
.byte $88,$88, $28, $88,$88, $28, $88,$88, $28, $88
|
||||
.byte $28, $A3,$88, $82, $A5,$88, $82,$82, $AC,$88, $A8,$28
|
||||
.byte $A0,$1B,$88, $28,$28, $A6,$88, $28, $22, $28, $88
|
||||
.byte $A3,$82, $A0,$1E,$88, $A0,$A0,$00
|
||||
.byte $A1
|
@ -17,7 +17,10 @@ draw_physicist:
|
||||
|
||||
lda PHYSICIST_X
|
||||
sta XPOS
|
||||
|
||||
lda PHYSICIST_Y
|
||||
sec
|
||||
sbc EARTH_OFFSET ; adjust for earthquakes
|
||||
sta YPOS
|
||||
|
||||
lda DIRECTION
|
||||
|
119
ootw/random16.s
Normal file
119
ootw/random16.s
Normal file
@ -0,0 +1,119 @@
|
||||
; 16-bit 6502 Random Number Generator (cycle-invariant version)
|
||||
|
||||
; Linear feedback shift register PRNG by White Flame
|
||||
; http://codebase64.org/doku.php?id=base:small_fast_16-bit_prng
|
||||
|
||||
; The Apple II KEYIN routine increments SEEDL:SEEDH
|
||||
; while waiting for keypress
|
||||
|
||||
;SEEDL = $4E
|
||||
;SEEDH = $4F
|
||||
|
||||
XOR_MAGIC = $7657 ; "vW"
|
||||
|
||||
;=============================
|
||||
; random16
|
||||
;=============================
|
||||
; takes:
|
||||
; not 0, cs = 6(r16)+12(lnz)+5(nop)+ 19(deo) = 42
|
||||
; not 0, cc = 6(r16)+14(lnz)+2(nop)+ 20(neo) = 42
|
||||
|
||||
; $0000 = 6(r16)+ 6(loz)+11nops+ 19(deo) = 42
|
||||
; $8000 = 6(r16)+ 6(loz)+ 4(ceo) + 6nops+ 20(neo) = 42
|
||||
|
||||
; $XX00 cc = 6(r16)+ 6(loz)+4(ceo)+2(cep) +4nops+ 20(neo) = 42
|
||||
; $XX00 cs = 6(r16)+ 6(loz)+4(ceo)+4(cep) +3nops+ 19(deo) = 42*
|
||||
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 five_cycle_do_eor ; 3
|
||||
;===========
|
||||
; 12
|
||||
|
||||
bcc two_cycle_no_eor ; 3
|
||||
;==========
|
||||
; 12+3-1 = 14
|
||||
|
||||
|
||||
;===================================================================
|
||||
|
||||
eleven_cycle_do_eor:
|
||||
nop ; 2
|
||||
nop ; 2
|
||||
nop ; 2
|
||||
five_cycle_do_eor:
|
||||
nop ; 2
|
||||
three_cycle_do_eor:
|
||||
sta SEEDH ; nop ; 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
|
||||
;===========
|
||||
; 19
|
||||
|
||||
;=========================================================================
|
||||
|
||||
six_cycles_no_eor:
|
||||
nop ; 2
|
||||
four_cycle_no_eor:
|
||||
nop ; 2
|
||||
two_cycle_no_eor:
|
||||
nop ; 2
|
||||
no_eor:
|
||||
nop ; 2
|
||||
nop ; 2
|
||||
nop ; 2
|
||||
nop ; 2
|
||||
sta SEEDH ; 3
|
||||
jmp eor_rts ; 3+6
|
||||
;===========
|
||||
; 20
|
||||
|
||||
|
||||
;======================================================================
|
||||
;======================================================================
|
||||
|
||||
low_zero:
|
||||
lda SEEDH ; 3
|
||||
beq eleven_cycle_do_eor ; High byte is also zero ; 3
|
||||
; so apply the EOR
|
||||
;============
|
||||
; 6
|
||||
ceo:
|
||||
|
||||
; -1
|
||||
; wasn't zero, check for $8000
|
||||
asl ; 2
|
||||
beq six_cycles_no_eor ; if $00 is left after the shift; 3
|
||||
; then it was $80
|
||||
;===========
|
||||
; 4
|
||||
|
||||
; else, do the EOR based on the carry
|
||||
cep:
|
||||
; -1
|
||||
bcc four_cycle_no_eor ; 3
|
||||
;============
|
||||
; 2
|
||||
|
||||
bcs three_cycle_do_eor ; 2+3-1 = 4
|
||||
|
||||
|
||||
|
||||
|
@ -24,6 +24,10 @@ H2 = $2C
|
||||
V2 = $2D
|
||||
MASK = $2E
|
||||
COLOR = $30
|
||||
|
||||
SEEDL = $4e
|
||||
SEEDH = $4f
|
||||
|
||||
;INVFLG = $32
|
||||
|
||||
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d
|
||||
@ -132,6 +136,8 @@ XX = $E3
|
||||
YY = $E4
|
||||
HGR_COLOR = $E4
|
||||
GAME_OVER = $E5
|
||||
EQUAKE_PROGRESS = $E6
|
||||
EARTH_OFFSET = $E7
|
||||
;SHIPY = $E4
|
||||
;YADD = $E5
|
||||
;LOOP = $E6
|
||||
|
Loading…
Reference in New Issue
Block a user