mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-22 14:29:00 +00:00
sb: urgh Y must be 0
This commit is contained in:
parent
7d3be99107
commit
e63b2977db
@ -32,7 +32,8 @@ DUCK_POND: duck_pond.o
|
||||
ld65 -o DUCK_POND duck_pond.o -C $(LINKER_SCRIPTS)/apple2_1000.inc
|
||||
|
||||
duck_pond.o: duck_pond.s zx02_optim.s \
|
||||
zp.inc hardware.inc
|
||||
zp.inc hardware.inc \
|
||||
gr_copy.s
|
||||
ca65 -o duck_pond.o duck_pond.s -l duck_pond.lst
|
||||
|
||||
|
||||
|
@ -31,6 +31,9 @@ duck_pond:
|
||||
bit SET_GR
|
||||
bit PAGE0
|
||||
|
||||
lda #$0
|
||||
sta DRAW_PAGE
|
||||
|
||||
|
||||
;===================
|
||||
; Load graphics
|
||||
@ -51,10 +54,12 @@ load_image:
|
||||
lda #>title_data
|
||||
sta ZX0_src+1
|
||||
|
||||
lda #$4
|
||||
lda #$C ; load at $c00
|
||||
|
||||
jsr full_decomp
|
||||
|
||||
jsr gr_copy_to_current
|
||||
|
||||
|
||||
wait_until_keypress:
|
||||
lda KEYPRESS ; 4
|
||||
@ -68,10 +73,11 @@ which_ok:
|
||||
lda #>main_data
|
||||
sta ZX0_src+1
|
||||
|
||||
lda #$4
|
||||
lda #$C
|
||||
|
||||
jsr full_decomp
|
||||
|
||||
jsr gr_copy_to_current
|
||||
|
||||
wait_until_keypress2:
|
||||
lda KEYPRESS ; 4
|
||||
@ -84,7 +90,8 @@ wait_until_keypress2:
|
||||
|
||||
|
||||
.include "zx02_optim.s"
|
||||
|
||||
.include "gr_copy.s"
|
||||
.include "gr_offsets.s"
|
||||
|
||||
title_data:
|
||||
.incbin "graphics/a2_duckpond_title.gr.zx02"
|
||||
|
161
games/sb/gr_copy.s
Normal file
161
games/sb/gr_copy.s
Normal file
@ -0,0 +1,161 @@
|
||||
;=========================================================
|
||||
; gr_copy_to_current, 40x48 version
|
||||
;=========================================================
|
||||
; copy 0xc00 to DRAW_PAGE
|
||||
;
|
||||
; 45 + 2 + 120*(8*9 + 5) -1 + 6 = 9292
|
||||
;.align $100
|
||||
gr_copy_to_current:
|
||||
|
||||
lda DRAW_PAGE ; 3
|
||||
clc ; 2
|
||||
adc #$4 ; 2
|
||||
sta gr_copy_line+5 ; 4
|
||||
sta gr_copy_line+11 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line+17 ; 4
|
||||
sta gr_copy_line+23 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line+29 ; 4
|
||||
sta gr_copy_line+35 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line+41 ; 4
|
||||
sta gr_copy_line+47 ; 4
|
||||
;===========
|
||||
; 45
|
||||
|
||||
ldy #119 ; for early ones, copy 120 bytes ; 2
|
||||
|
||||
gr_copy_line:
|
||||
lda $C00,Y ; load a byte (self modified) ; 4
|
||||
sta $400,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $C80,Y ; load a byte (self modified) ; 4
|
||||
sta $480,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $D00,Y ; load a byte (self modified) ; 4
|
||||
sta $500,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $D80,Y ; load a byte (self modified) ; 4
|
||||
sta $580,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $E00,Y ; load a byte (self modified) ; 4
|
||||
sta $600,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $E80,Y ; load a byte (self modified) ; 4
|
||||
sta $680,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $F00,Y ; load a byte (self modified) ; 4
|
||||
sta $700,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $F80,Y ; load a byte (self modified) ; 4
|
||||
sta $780,Y ; store a byte (self modified) ; 5
|
||||
|
||||
dey ; decrement pointer ; 2
|
||||
bpl gr_copy_line ; ; 2nt/3
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
||||
;=========================================================
|
||||
; gr_copy_to_current, 40x48 version
|
||||
;=========================================================
|
||||
; copy 0x1000 to DRAW_PAGE
|
||||
|
||||
gr_copy_to_current_1000:
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
;=========================================================
|
||||
; gr_copy_to_current_40x40
|
||||
;=========================================================
|
||||
; Take image in 0xc00
|
||||
; Copy to DRAW_PAGE
|
||||
; Actually copy lines 0..39
|
||||
; Don't over-write bottom 4 lines of text
|
||||
gr_copy_to_current_40x40:
|
||||
|
||||
ldx #0
|
||||
gc_40x40_loop:
|
||||
lda gr_offsets,x
|
||||
sta OUTL
|
||||
sta INL
|
||||
lda gr_offsets+1,x
|
||||
clc
|
||||
adc DRAW_PAGE
|
||||
sta OUTH
|
||||
|
||||
lda gr_offsets+1,x
|
||||
clc
|
||||
adc #$8
|
||||
sta INH
|
||||
|
||||
ldy #39
|
||||
gc_40x40_inner:
|
||||
lda (INL),Y
|
||||
sta (OUTL),Y
|
||||
|
||||
dey
|
||||
bpl gc_40x40_inner
|
||||
|
||||
inx
|
||||
inx
|
||||
|
||||
cpx #40
|
||||
bne gc_40x40_loop
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
||||
|
5
games/sb/gr_offsets.s
Normal file
5
games/sb/gr_offsets.s
Normal file
@ -0,0 +1,5 @@
|
||||
gr_offsets:
|
||||
.word $400,$480,$500,$580,$600,$680,$700,$780
|
||||
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
||||
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
||||
|
@ -1,22 +1,14 @@
|
||||
;; Zero Page
|
||||
|
||||
FRAMEBUFFER = $00 ; $00 - $0F
|
||||
;; ZX02 addresses
|
||||
|
||||
;; LZ4 addresses
|
||||
ZP=$00
|
||||
|
||||
FLAME_STATE = $00
|
||||
FLAME1 = $01
|
||||
FLAME2 = $02
|
||||
FLAME3 = $03
|
||||
FLAME4 = $04
|
||||
FLAME5 = $05
|
||||
|
||||
|
||||
LZ4_SRC = $00
|
||||
LZ4_DST = $02
|
||||
LZ4_END = $04
|
||||
COUNT = $06
|
||||
DELTA = $08
|
||||
offset = ZP+0
|
||||
ZX0_src = ZP+2
|
||||
ZX0_dst = ZP+4
|
||||
bitr = ZP+6
|
||||
pntr = ZP+7
|
||||
|
||||
;; Zero page monitor routines addresses
|
||||
|
||||
|
@ -11,22 +11,22 @@
|
||||
; Code under MIT license, see LICENSE file.
|
||||
|
||||
|
||||
ZP=$80
|
||||
;ZP=$80
|
||||
|
||||
offset = ZP+0
|
||||
ZX0_src = ZP+2
|
||||
ZX0_dst = ZP+4
|
||||
bitr = ZP+6
|
||||
pntr = ZP+7
|
||||
;offset = ZP+0
|
||||
;ZX0_src = ZP+2
|
||||
;ZX0_dst = ZP+4
|
||||
;bitr = ZP+6
|
||||
;pntr = ZP+7
|
||||
|
||||
; Initial values for offset, source, destination and bitr
|
||||
;zx0_ini_block:
|
||||
; .byte $00, $00
|
||||
; .byte $00, $00 ; offset
|
||||
;comp_data:
|
||||
; .byte $0, $0
|
||||
; .byte $0, $0 ; zx0_src
|
||||
;out_addr:
|
||||
; .byte $0, $0
|
||||
; .byte $80
|
||||
; .byte $0, $0 ; zx0_dst
|
||||
; .byte $80 ; bitr
|
||||
|
||||
;--------------------------------------------------
|
||||
; Decompress ZX0 data (6502 optimized format)
|
||||
@ -35,13 +35,16 @@ pntr = ZP+7
|
||||
full_decomp:
|
||||
sta ZX0_dst+1
|
||||
|
||||
lda #0
|
||||
sta ZX0_dst
|
||||
sta offset
|
||||
sta offset+1
|
||||
ldy #$80
|
||||
sty bitr
|
||||
|
||||
lda #$80
|
||||
sta bitr
|
||||
ldy #0 ; always on page boundary
|
||||
sty ZX0_dst
|
||||
|
||||
sty offset
|
||||
sty offset+1
|
||||
|
||||
; Y needs to be 0 here
|
||||
|
||||
; Get initialization block
|
||||
; ldy #7
|
||||
|
Loading…
x
Reference in New Issue
Block a user