mirror of
https://github.com/robmcmullen/asmgen.git
synced 2024-09-28 06:57:46 +00:00
Fixed background save/restore for 6-byte sprites
Also added interesting background test image and utility functions
This commit is contained in:
parent
7eb3f6fdd7
commit
56e75f426e
@ -123,10 +123,8 @@ def layoutSpriteChunk(pixeldata,width,height,shift):
|
|||||||
for chunkIndex in range(len(byteSplits)):
|
for chunkIndex in range(len(byteSplits)):
|
||||||
|
|
||||||
# Store byte into video memory
|
# Store byte into video memory
|
||||||
if (not byteSplits[chunkIndex].endswith("0000000")): # Optimization- don't render all-black bytes
|
|
||||||
spriteChunks[chunkIndex][row] = \
|
spriteChunks[chunkIndex][row] = \
|
||||||
"\tlda #%%%s\n" % byteSplits[chunkIndex] + \
|
"\tlda #%%%s\n" % byteSplits[chunkIndex] + \
|
||||||
"\tora (SCRATCH0),y\n" + \
|
|
||||||
"\tsta (SCRATCH0),y\n";
|
"\tsta (SCRATCH0),y\n";
|
||||||
|
|
||||||
# Increment indices
|
# Increment indices
|
||||||
|
BIN
KOLTitle.bin
Normal file
BIN
KOLTitle.bin
Normal file
Binary file not shown.
BIN
boxw_mix.png
BIN
boxw_mix.png
Binary file not shown.
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 242 B |
102
graphics.s
102
graphics.s
@ -43,11 +43,15 @@ saveBackground_loop:
|
|||||||
sta saveBackground_smc1+2
|
sta saveBackground_smc1+2
|
||||||
sta saveBackground_smc2+2
|
sta saveBackground_smc2+2
|
||||||
sta saveBackground_smc3+2
|
sta saveBackground_smc3+2
|
||||||
|
sta saveBackground_smc4+2
|
||||||
|
sta saveBackground_smc5+2
|
||||||
lda HGRROWS_L,x
|
lda HGRROWS_L,x
|
||||||
sta saveBackground_smc0+1
|
sta saveBackground_smc0+1
|
||||||
sta saveBackground_smc1+1
|
sta saveBackground_smc1+1
|
||||||
sta saveBackground_smc2+1
|
sta saveBackground_smc2+1
|
||||||
sta saveBackground_smc3+1
|
sta saveBackground_smc3+1
|
||||||
|
sta saveBackground_smc4+1
|
||||||
|
sta saveBackground_smc5+1
|
||||||
|
|
||||||
ldx PARAM0 ; Compute hires column
|
ldx PARAM0 ; Compute hires column
|
||||||
lda DIV7_2,x
|
lda DIV7_2,x
|
||||||
@ -72,6 +76,16 @@ saveBackground_smc3:
|
|||||||
lda $2000,x
|
lda $2000,x
|
||||||
sta (PARAM2),y
|
sta (PARAM2),y
|
||||||
iny
|
iny
|
||||||
|
inx
|
||||||
|
saveBackground_smc4:
|
||||||
|
lda $2000,x
|
||||||
|
sta (PARAM2),y
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
saveBackground_smc5:
|
||||||
|
lda $2000,x
|
||||||
|
sta (PARAM2),y
|
||||||
|
iny
|
||||||
|
|
||||||
pla
|
pla
|
||||||
inc
|
inc
|
||||||
@ -112,11 +126,15 @@ restoreBackground_loop:
|
|||||||
sta restoreBackground_smc1+2
|
sta restoreBackground_smc1+2
|
||||||
sta restoreBackground_smc2+2
|
sta restoreBackground_smc2+2
|
||||||
sta restoreBackground_smc3+2
|
sta restoreBackground_smc3+2
|
||||||
|
sta restoreBackground_smc4+2
|
||||||
|
sta restoreBackground_smc5+2
|
||||||
lda HGRROWS_L,x
|
lda HGRROWS_L,x
|
||||||
sta restoreBackground_smc0+1
|
sta restoreBackground_smc0+1
|
||||||
sta restoreBackground_smc1+1
|
sta restoreBackground_smc1+1
|
||||||
sta restoreBackground_smc2+1
|
sta restoreBackground_smc2+1
|
||||||
sta restoreBackground_smc3+1
|
sta restoreBackground_smc3+1
|
||||||
|
sta restoreBackground_smc4+1
|
||||||
|
sta restoreBackground_smc5+1
|
||||||
|
|
||||||
ldx PARAM0 ; Compute hires column
|
ldx PARAM0 ; Compute hires column
|
||||||
lda DIV7_2,x
|
lda DIV7_2,x
|
||||||
@ -144,6 +162,18 @@ restoreBackground_smc2:
|
|||||||
restoreBackground_smc3:
|
restoreBackground_smc3:
|
||||||
sta $2000,x
|
sta $2000,x
|
||||||
iny
|
iny
|
||||||
|
inx
|
||||||
|
|
||||||
|
lda (PARAM2),y
|
||||||
|
restoreBackground_smc4:
|
||||||
|
sta $2000,x
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
|
||||||
|
lda (PARAM2),y
|
||||||
|
restoreBackground_smc5:
|
||||||
|
sta $2000,x
|
||||||
|
iny
|
||||||
|
|
||||||
pla
|
pla
|
||||||
inc
|
inc
|
||||||
@ -203,3 +233,75 @@ venetianFill_inner:
|
|||||||
bne venetianFill_outer
|
bne venetianFill_outer
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
INBUF = $0200
|
||||||
|
DOSCMD = $be03
|
||||||
|
KBD = $c000
|
||||||
|
KBDSTRB = $c010
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; CommandLine
|
||||||
|
;
|
||||||
|
; PARAM0: Command line string (LSB)
|
||||||
|
; PARAM1: Command line string (MSB)
|
||||||
|
;
|
||||||
|
CommandLine:
|
||||||
|
SAVE_AXY
|
||||||
|
ldx #0
|
||||||
|
ldy #0
|
||||||
|
|
||||||
|
CommandLine_loop:
|
||||||
|
lda (PARAM0),y
|
||||||
|
beq CommandLine_done
|
||||||
|
sta $0200,x ; Keyboard input buffer
|
||||||
|
inx
|
||||||
|
iny
|
||||||
|
bra CommandLine_loop
|
||||||
|
|
||||||
|
CommandLine_done:
|
||||||
|
lda #$8d ; Terminate with return and null
|
||||||
|
sta $0200,x
|
||||||
|
inx
|
||||||
|
lda #0
|
||||||
|
sta $0200,x
|
||||||
|
|
||||||
|
jsr $be03 ; ProDOS 8 entry point
|
||||||
|
|
||||||
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; BloadHires
|
||||||
|
;
|
||||||
|
; PARAM0: Filename (LSB)
|
||||||
|
; PARAM1: Filename (MSB)
|
||||||
|
;
|
||||||
|
; Max filename length: 16 chars!
|
||||||
|
;
|
||||||
|
BloadHires:
|
||||||
|
SAVE_AXY
|
||||||
|
ldx #0
|
||||||
|
ldy #0
|
||||||
|
|
||||||
|
BloadHires_loop:
|
||||||
|
lda (PARAM0),y ; Copy filename into BLOAD buffer
|
||||||
|
beq BloadHires_done
|
||||||
|
sta BloadHires_buffer+6,x
|
||||||
|
inx
|
||||||
|
iny
|
||||||
|
bra BloadHires_loop
|
||||||
|
|
||||||
|
BloadHires_done:
|
||||||
|
lda #<BloadHires_buffer
|
||||||
|
sta PARAM0
|
||||||
|
lda #>BloadHires_buffer
|
||||||
|
sta PARAM1
|
||||||
|
jsr CommandLine
|
||||||
|
|
||||||
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
||||||
|
BloadHires_buffer:
|
||||||
|
.byte "BLOAD ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
BIN
hisprite.dsk
BIN
hisprite.dsk
Binary file not shown.
42
hisprite.s
42
hisprite.s
@ -64,24 +64,31 @@ SCRATCH1 = $1a
|
|||||||
main:
|
main:
|
||||||
jsr EnableHires
|
jsr EnableHires
|
||||||
|
|
||||||
lda #$00
|
; lda #$00
|
||||||
jsr VenetianFill
|
; jsr VenetianFill
|
||||||
|
|
||||||
|
lda #<bgFilename
|
||||||
|
sta PARAM0
|
||||||
|
lda #>bgFilename
|
||||||
|
sta PARAM1
|
||||||
|
jsr BloadHires
|
||||||
|
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
;;;;
|
;;;;
|
||||||
stz PARAM0
|
; stz PARAM0
|
||||||
stz PARAM1
|
; stz PARAM1
|
||||||
jsr BOXW_MAG
|
; jsr BOXW_MAG
|
||||||
|
;
|
||||||
lda #10
|
; lda #10
|
||||||
sta PARAM1
|
; sta PARAM1
|
||||||
jsr BOXW_MIX
|
; jsr BOXW_MIX
|
||||||
|
;
|
||||||
lda #20
|
; lda #20
|
||||||
sta PARAM1
|
; sta PARAM1
|
||||||
jsr BOXW_ORG
|
; jsr BOXW_ORG
|
||||||
|
;
|
||||||
rts
|
; rts
|
||||||
;;;;
|
;;;;
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
@ -104,7 +111,7 @@ loop:
|
|||||||
|
|
||||||
inx
|
inx
|
||||||
cpx #133
|
cpx #133
|
||||||
; bne loop
|
bne loop
|
||||||
rts
|
rts
|
||||||
|
|
||||||
bgBuffer:
|
bgBuffer:
|
||||||
@ -157,6 +164,9 @@ bgBuffer:
|
|||||||
.byte 0
|
.byte 0
|
||||||
.byte 0
|
.byte 0
|
||||||
|
|
||||||
|
bgFilename:
|
||||||
|
.byte "KOL",0
|
||||||
|
|
||||||
.include "graphics.s"
|
.include "graphics.s"
|
||||||
.include "hgrtableX.s"
|
.include "hgrtableX.s"
|
||||||
.include "hgrtableY.s"
|
.include "hgrtableY.s"
|
||||||
|
554
spritegen0.s
554
spritegen0.s
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user