mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-12 11:29:37 +00:00
hgr: sprites: first sprite attempt
This commit is contained in:
parent
069d90dd0b
commit
9e26691bfd
8
games/mist_hgr/graphics_title/cyan1.vgi
Normal file
8
games/mist_hgr/graphics_title/cyan1.vgi
Normal file
|
@ -0,0 +1,8 @@
|
|||
; Cyan logo 1
|
||||
CLS 0x80 ; black2 background
|
||||
FCIRC 6 140 91 22 ; blue circle
|
||||
RECT 7 7 118 88 161 95 ; white bar
|
||||
FCIRC 5 140 82 8 ; orange circle
|
||||
LINE 4 140 92 129 109 ; left of pyramid
|
||||
VTRI 4 140 92 145 154 114 ; pyramid
|
||||
END
|
21
games/mist_hgr/graphics_title/cyan2.vgi
Normal file
21
games/mist_hgr/graphics_title/cyan2.vgi
Normal file
|
@ -0,0 +1,21 @@
|
|||
; Cyan logo 2
|
||||
FCIRC 7 140 91 22 ; white circle
|
||||
FCIRC 4 140 91 9 ; black circle
|
||||
LINE 4 140 91 157 74 ; radius
|
||||
LINE 4 140 91 159 77
|
||||
LINE 4 140 91 161 80
|
||||
LINE 6 124 115 122 115 ; C
|
||||
LINETO 118 118
|
||||
LINETO 118 121
|
||||
LINETO 122 123
|
||||
LINETO 124 123
|
||||
LINE 6 131 115 134 121 ; Y
|
||||
LINETO 134 123
|
||||
LINE 6 137 115 134 121
|
||||
LINE 6 144 115 140 123 ; A
|
||||
LINE 6 144 115 148 123
|
||||
LINE 6 143 119 147 119
|
||||
LINE 6 152 123 152 115 ; N
|
||||
LINETO 162 123
|
||||
LINETO 162 115
|
||||
END
|
51
graphics/hgr/amiga_ball/Makefile
Normal file
51
graphics/hgr/amiga_ball/Makefile
Normal file
|
@ -0,0 +1,51 @@
|
|||
include ../../../Makefile.inc
|
||||
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKER_SCRIPTS = ../../../linker_scripts
|
||||
EMPTY_DISK = ../../../empty_disk/empty.dsk
|
||||
|
||||
all: sprite.dsk
|
||||
|
||||
sprite.dsk: HELLO BALL PATTERN TINY
|
||||
cp $(EMPTY_DISK) sprite.dsk
|
||||
$(DOS33) -y sprite.dsk SAVE A HELLO
|
||||
$(DOS33) -y sprite.dsk BSAVE -a 0x0300 BALL
|
||||
$(DOS33) -y sprite.dsk BSAVE -a 0x036B PATTERN
|
||||
$(DOS33) -y sprite.dsk BSAVE -a 0x070 TINY
|
||||
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
|
||||
###
|
||||
|
||||
BALL: ball.o
|
||||
ld65 -o BALL ball.o -C $(LINKER_SCRIPTS)/apple2_300.inc
|
||||
|
||||
ball.o: ball.s
|
||||
ca65 -o ball.o ball.s -l ball.lst
|
||||
|
||||
###
|
||||
|
||||
PATTERN: pattern.o
|
||||
ld65 -o PATTERN pattern.o -C $(LINKER_SCRIPTS)/apple2_3f5.inc
|
||||
|
||||
pattern.o: pattern.s
|
||||
ca65 -o pattern.o pattern.s -l pattern.lst
|
||||
|
||||
###
|
||||
|
||||
TINY: tiny.o
|
||||
ld65 -o TINY tiny.o -C $(LINKER_SCRIPTS)/apple2_70_zp.inc
|
||||
|
||||
tiny.o: tiny.s
|
||||
ca65 -o tiny.o tiny.s -l tiny.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO BALL PATTERN TINY
|
2
graphics/hgr/amiga_ball/hello.bas
Normal file
2
graphics/hgr/amiga_ball/hello.bas
Normal file
|
@ -0,0 +1,2 @@
|
|||
5 HOME
|
||||
10 PRINT CHR$(4);"CATALOG"
|
|
@ -1,51 +1,32 @@
|
|||
include ../../../Makefile.inc
|
||||
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
DOS33_RAW = ../../../utils/dos33fs-utils/dos33_raw
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKER_SCRIPTS = ../../../linker_scripts
|
||||
EMPTY_DISK = ../../../empty_disk/empty.dsk
|
||||
EMPTY_DISK = ../../../empty_disk
|
||||
|
||||
all: sprite.dsk
|
||||
|
||||
sprite.dsk: HELLO BALL PATTERN TINY
|
||||
cp $(EMPTY_DISK) sprite.dsk
|
||||
sprite.dsk: HELLO SPRITE
|
||||
cp $(EMPTY_DISK)/empty.dsk sprite.dsk
|
||||
$(DOS33) -y sprite.dsk SAVE A HELLO
|
||||
$(DOS33) -y sprite.dsk BSAVE -a 0x0300 BALL
|
||||
$(DOS33) -y sprite.dsk BSAVE -a 0x036B PATTERN
|
||||
$(DOS33) -y sprite.dsk BSAVE -a 0x070 TINY
|
||||
|
||||
$(DOS33) -y sprite.dsk BSAVE -a 0x6000 SPRITE
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
|
||||
###
|
||||
|
||||
BALL: ball.o
|
||||
ld65 -o BALL ball.o -C $(LINKER_SCRIPTS)/apple2_300.inc
|
||||
|
||||
ball.o: ball.s
|
||||
ca65 -o ball.o ball.s -l ball.lst
|
||||
|
||||
###
|
||||
|
||||
PATTERN: pattern.o
|
||||
ld65 -o PATTERN pattern.o -C $(LINKER_SCRIPTS)/apple2_3f5.inc
|
||||
|
||||
pattern.o: pattern.s
|
||||
ca65 -o pattern.o pattern.s -l pattern.lst
|
||||
|
||||
###
|
||||
|
||||
TINY: tiny.o
|
||||
ld65 -o TINY tiny.o -C $(LINKER_SCRIPTS)/apple2_70_zp.inc
|
||||
|
||||
tiny.o: tiny.s
|
||||
ca65 -o tiny.o tiny.s -l tiny.lst
|
||||
SPRITE: sprite.o
|
||||
ld65 -o SPRITE sprite.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
|
||||
|
||||
sprite.o: sprite.s graphics/graphics.inc
|
||||
ca65 -o sprite.o sprite.s -l sprite.lst
|
||||
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO BALL PATTERN TINY
|
||||
rm -f *~ *.o *.lst HELLO SPRITE
|
||||
|
||||
|
|
370
graphics/hgr/sprite/decompress_fast_v2.s
Normal file
370
graphics/hgr/sprite/decompress_fast_v2.s
Normal file
|
@ -0,0 +1,370 @@
|
|||
; note -- modified by Vince Weaver to assemble with ca65
|
||||
; in this case, A = page to decompress to
|
||||
; getsrc_smc+1, getsrc_smc+2 is src location
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Decompress raw LZSA2 block.
|
||||
; Create one with lzsa -r -f2 <original_file> <compressed_file>
|
||||
;
|
||||
; in:
|
||||
; * LZSA_SRC_LO and LZSA_SRC_HI contain the compressed raw block address
|
||||
; * LZSA_DST_LO and LZSA_DST_HI contain the destination buffer address
|
||||
;
|
||||
; out:
|
||||
; * LZSA_DST_LO and LZSA_DST_HI contain the last decompressed byte address, +1
|
||||
;
|
||||
; -----------------------------------------------------------------------------
|
||||
; Backward decompression is also supported, use lzsa -r -b -f2 <original_file> <compressed_file>
|
||||
; To use it, also define BACKWARD_DECOMPRESS=1 before including this code!
|
||||
;
|
||||
; in:
|
||||
; * LZSA_SRC_LO/LZSA_SRC_HI must contain the address of the last byte of compressed data
|
||||
; * LZSA_DST_LO/LZSA_DST_HI must contain the address of the last byte of the destination buffer
|
||||
;
|
||||
; out:
|
||||
; * LZSA_DST_LO/LZSA_DST_HI contain the last decompressed byte address, -1
|
||||
;
|
||||
; -----------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (C) 2019 Emmanuel Marty, Peter Ferrie
|
||||
;
|
||||
; This software is provided 'as-is', without any express or implied
|
||||
; warranty. In no event will the authors be held liable for any damages
|
||||
; arising from the use of this software.
|
||||
;
|
||||
; Permission is granted to anyone to use this software for any purpose,
|
||||
; including commercial applications, and to alter it and redistribute it
|
||||
; freely, subject to the following restrictions:
|
||||
;
|
||||
; 1. The origin of this software must not be misrepresented; you must not
|
||||
; claim that you wrote the original software. If you use this software
|
||||
; in a product, an acknowledgment in the product documentation would be
|
||||
; appreciated but is not required.
|
||||
; 2. Altered source versions must be plainly marked as such, and must not be
|
||||
; misrepresented as being the original software.
|
||||
; 3. This notice may not be removed or altered from any source distribution.
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
;NIBCOUNT = $FC ; zero-page location for temp offset
|
||||
|
||||
decompress_lzsa2_fast:
|
||||
|
||||
sta LZSA_DST_HI
|
||||
|
||||
ldy #$00
|
||||
sty LZSA_DST_LO
|
||||
sty NIBCOUNT
|
||||
|
||||
decode_token:
|
||||
jsr getsrc ; read token byte: XYZ|LL|MMM
|
||||
pha ; preserve token on stack
|
||||
|
||||
and #$18 ; isolate literals count (LL)
|
||||
beq no_literals ; skip if no literals to copy
|
||||
cmp #$18 ; LITERALS_RUN_LEN_V2?
|
||||
bcc prepare_copy_literals ; if less, count is directly embedded in token
|
||||
|
||||
jsr getnibble ; get extra literals length nibble
|
||||
; add nibble to len from token
|
||||
adc #$02 ; (LITERALS_RUN_LEN_V2) minus carry
|
||||
cmp #$12 ; LITERALS_RUN_LEN_V2 + 15 ?
|
||||
bcc prepare_copy_literals_direct ; if less, literals count is complete
|
||||
|
||||
jsr getsrc ; get extra byte of variable literals count
|
||||
; the carry is always set by the CMP above
|
||||
; GETSRC doesn't change it
|
||||
sbc #$EE ; overflow?
|
||||
jmp prepare_copy_literals_direct
|
||||
|
||||
prepare_copy_literals_large:
|
||||
; handle 16 bits literals count
|
||||
; literals count = directly these 16 bits
|
||||
jsr getlargesrc ; grab low 8 bits in X, high 8 bits in A
|
||||
tay ; put high 8 bits in Y
|
||||
bcs prepare_copy_literals_high ; (*same as JMP PREPARE_COPY_LITERALS_HIGH but shorter)
|
||||
|
||||
prepare_copy_literals:
|
||||
lsr ; shift literals count into place
|
||||
lsr
|
||||
lsr
|
||||
|
||||
prepare_copy_literals_direct:
|
||||
tax
|
||||
bcs prepare_copy_literals_large ; if so, literals count is large
|
||||
|
||||
prepare_copy_literals_high:
|
||||
txa
|
||||
beq copy_literals
|
||||
iny
|
||||
|
||||
copy_literals:
|
||||
jsr getput ; copy one byte of literals
|
||||
dex
|
||||
bne copy_literals
|
||||
dey
|
||||
bne copy_literals
|
||||
|
||||
no_literals:
|
||||
pla ; retrieve token from stack
|
||||
pha ; preserve token again
|
||||
asl
|
||||
bcs repmatch_or_large_offset ; 1YZ: rep-match or 13/16 bit offset
|
||||
|
||||
asl ; 0YZ: 5 or 9 bit offset
|
||||
bcs offset_9_bit
|
||||
|
||||
; 00Z: 5 bit offset
|
||||
|
||||
ldx #$FF ; set offset bits 15-8 to 1
|
||||
|
||||
jsr getcombinedbits ; rotate Z bit into bit 0, read nibble for bits 4-1
|
||||
ora #$E0 ; set bits 7-5 to 1
|
||||
bne got_offset_lo ; go store low byte of match offset and prepare match
|
||||
|
||||
offset_9_bit: ; 01Z: 9 bit offset
|
||||
;;asl ; shift Z (offset bit 8) in place
|
||||
rol
|
||||
rol
|
||||
and #$01
|
||||
eor #$FF ; set offset bits 15-9 to 1
|
||||
bne got_offset_hi ; go store high byte, read low byte of match offset and prepare match
|
||||
; (*same as JMP GOT_OFFSET_HI but shorter)
|
||||
|
||||
repmatch_or_large_offset:
|
||||
asl ; 13 bit offset?
|
||||
bcs repmatch_or_16bit ; handle rep-match or 16-bit offset if not
|
||||
|
||||
; 10Z: 13 bit offset
|
||||
|
||||
jsr getcombinedbits ; rotate Z bit into bit 8, read nibble for bits 12-9
|
||||
adc #$DE ; set bits 15-13 to 1 and substract 2 (to substract 512)
|
||||
bne got_offset_hi ; go store high byte, read low byte of match offset and prepare match
|
||||
; (*same as JMP GOT_OFFSET_HI but shorter)
|
||||
|
||||
repmatch_or_16bit: ; rep-match or 16 bit offset
|
||||
;;ASL ; XYZ=111?
|
||||
bmi rep_match ; reuse previous offset if so (rep-match)
|
||||
|
||||
; 110: handle 16 bit offset
|
||||
jsr getsrc ; grab high 8 bits
|
||||
got_offset_hi:
|
||||
tax
|
||||
jsr getsrc ; grab low 8 bits
|
||||
got_offset_lo:
|
||||
sta OFFSLO ; store low byte of match offset
|
||||
stx OFFSHI ; store high byte of match offset
|
||||
|
||||
rep_match:
|
||||
.ifdef BACKWARD_DECOMPRESS
|
||||
|
||||
; Backward decompression - substract match offset
|
||||
|
||||
sec ; add dest + match offset
|
||||
lda putdst+1 ; low 8 bits
|
||||
OFFSLO = *+1
|
||||
sbc #$AA
|
||||
sta copy_match_loop+1 ; store back reference address
|
||||
lda putdst+2
|
||||
OFFSHI = *+1
|
||||
sbc #$AA ; high 8 bits
|
||||
sta copy_match_loop+2 ; store high 8 bits of address
|
||||
sec
|
||||
|
||||
.else
|
||||
|
||||
; Forward decompression - add match offset
|
||||
|
||||
clc ; add dest + match offset
|
||||
lda putdst+1 ; low 8 bits
|
||||
OFFSLO = *+1
|
||||
adc #$AA
|
||||
sta copy_match_loop+1 ; store back reference address
|
||||
OFFSHI = *+1
|
||||
lda #$AA ; high 8 bits
|
||||
adc putdst+2
|
||||
sta copy_match_loop+2 ; store high 8 bits of address
|
||||
.endif
|
||||
|
||||
pla ; retrieve token from stack again
|
||||
and #$07 ; isolate match len (MMM)
|
||||
adc #$01 ; add MIN_MATCH_SIZE_V2 and carry
|
||||
cmp #$09 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2?
|
||||
bcc prepare_copy_match ; if less, length is directly embedded in token
|
||||
|
||||
jsr getnibble ; get extra match length nibble
|
||||
; add nibble to len from token
|
||||
adc #$08 ; (MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2) minus carry
|
||||
cmp #$18 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + 15?
|
||||
bcc prepare_copy_match ; if less, match length is complete
|
||||
|
||||
jsr getsrc ; get extra byte of variable match length
|
||||
; the carry is always set by the CMP above
|
||||
; GETSRC doesn't change it
|
||||
sbc #$E8 ; overflow?
|
||||
|
||||
prepare_copy_match:
|
||||
tax
|
||||
bcc prepare_copy_match_y ; if not, the match length is complete
|
||||
beq decompression_done ; if EOD code, bail
|
||||
|
||||
; Handle 16 bits match length
|
||||
jsr getlargesrc ; grab low 8 bits in X, high 8 bits in A
|
||||
tay ; put high 8 bits in Y
|
||||
|
||||
prepare_copy_match_y:
|
||||
txa
|
||||
beq copy_match_loop
|
||||
iny
|
||||
|
||||
copy_match_loop:
|
||||
lda $AAAA ; get one byte of backreference
|
||||
jsr putdst ; copy to destination
|
||||
|
||||
.ifdef BACKWARD_DECOMPRESS
|
||||
|
||||
; Backward decompression -- put backreference bytes backward
|
||||
|
||||
lda copy_match_loop+1
|
||||
beq getmatch_adj_hi
|
||||
getmatch_done:
|
||||
dec copy_match_loop+1
|
||||
|
||||
.else
|
||||
|
||||
; Forward decompression -- put backreference bytes forward
|
||||
|
||||
inc copy_match_loop+1
|
||||
beq getmatch_adj_hi
|
||||
getmatch_done:
|
||||
|
||||
.endif
|
||||
|
||||
dex
|
||||
bne copy_match_loop
|
||||
dey
|
||||
bne copy_match_loop
|
||||
jmp decode_token
|
||||
|
||||
.ifdef BACKWARD_DECOMPRESS
|
||||
|
||||
getmatch_adj_hi:
|
||||
dec copy_match_loop+2
|
||||
jmp getmatch_done
|
||||
|
||||
.else
|
||||
|
||||
getmatch_adj_hi:
|
||||
inc copy_match_loop+2
|
||||
jmp getmatch_done
|
||||
.endif
|
||||
|
||||
getcombinedbits:
|
||||
eor #$80
|
||||
asl
|
||||
php
|
||||
|
||||
jsr getnibble ; get nibble into bits 0-3 (for offset bits 1-4)
|
||||
plp ; merge Z bit as the carry bit (for offset bit 0)
|
||||
combinedbitz:
|
||||
rol ; nibble -> bits 1-4; carry(!Z bit) -> bit 0 ; carry cleared
|
||||
decompression_done:
|
||||
rts
|
||||
|
||||
getnibble:
|
||||
NIBBLES = *+1
|
||||
lda #$AA
|
||||
lsr NIBCOUNT
|
||||
bcc need_nibbles
|
||||
and #$0F ; isolate low 4 bits of nibble
|
||||
rts
|
||||
|
||||
need_nibbles:
|
||||
inc NIBCOUNT
|
||||
jsr getsrc ; get 2 nibbles
|
||||
sta NIBBLES
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sec
|
||||
rts
|
||||
|
||||
.ifdef BACKWARD_DECOMPRESS
|
||||
|
||||
; Backward decompression -- get and put bytes backward
|
||||
|
||||
getput:
|
||||
jsr getsrc
|
||||
putdst:
|
||||
LZSA_DST_LO = *+1
|
||||
LZSA_DST_HI = *+2
|
||||
sta $AAAA
|
||||
lda putdst+1
|
||||
beq putdst_adj_hi
|
||||
dec putdst+1
|
||||
rts
|
||||
|
||||
putdst_adj_hi:
|
||||
dec putdst+2
|
||||
dec putdst+1
|
||||
rts
|
||||
|
||||
getlargesrc:
|
||||
jsr getsrc ; grab low 8 bits
|
||||
tax ; move to X
|
||||
; fall through grab high 8 bits
|
||||
|
||||
getsrc:
|
||||
LZSA_SRC_LO = *+1
|
||||
LZSA_SRC_HI = *+2
|
||||
lda $AAAA
|
||||
pha
|
||||
lda getsrc+1
|
||||
beq getsrc_adj_hi
|
||||
dec getsrc+1
|
||||
pla
|
||||
rts
|
||||
|
||||
getsrc_adj_hi:
|
||||
dec getsrc+2
|
||||
dec getsrc+1
|
||||
pla
|
||||
rts
|
||||
|
||||
.else
|
||||
|
||||
; Forward decompression -- get and put bytes forward
|
||||
|
||||
getput:
|
||||
jsr getsrc
|
||||
putdst:
|
||||
LZSA_DST_LO = *+1
|
||||
LZSA_DST_HI = *+2
|
||||
sta $AAAA
|
||||
inc putdst+1
|
||||
beq putdst_adj_hi
|
||||
rts
|
||||
|
||||
putdst_adj_hi:
|
||||
inc putdst+2
|
||||
rts
|
||||
|
||||
getlargesrc:
|
||||
jsr getsrc ; grab low 8 bits
|
||||
tax ; move to X
|
||||
; fall through grab high 8 bits
|
||||
|
||||
getsrc:
|
||||
getsrc_smc:
|
||||
LZSA_SRC_LO = *+1
|
||||
LZSA_SRC_HI = *+2
|
||||
lda $AAAA
|
||||
inc getsrc+1
|
||||
beq getsrc_adj_hi
|
||||
rts
|
||||
|
||||
getsrc_adj_hi:
|
||||
inc getsrc+2
|
||||
rts
|
||||
.endif
|
||||
|
29
graphics/hgr/sprite/graphics/Makefile
Normal file
29
graphics/hgr/sprite/graphics/Makefile
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
PNG2RLE = ../../../../utils/gr-utils/png2rle
|
||||
PNG2GR = ../../../../utils/gr-utils/png2gr
|
||||
PNG2HGR = ../../../../utils/hgr-utils/png2hgr
|
||||
LZSA = ~/research/lzsa/lzsa/lzsa
|
||||
B2D = ../../../../utils/bmp2dhr/b2d
|
||||
|
||||
all: graphics.inc
|
||||
|
||||
|
||||
graphics.inc: \
|
||||
mona.lzsa
|
||||
echo "mona_lzsa: .incbin \"mona.lzsa\"" > graphics.inc
|
||||
|
||||
|
||||
###
|
||||
|
||||
mona.lzsa: mona.hgr
|
||||
$(LZSA) -r -f2 mona.hgr mona.lzsa
|
||||
|
||||
mona.hgr: mona.png
|
||||
$(PNG2HGR) mona.png > mona.hgr
|
||||
|
||||
###
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ outline.inc *.lzsa *.gr *.hgr
|
||||
|
1
graphics/hgr/sprite/graphics/README
Normal file
1
graphics/hgr/sprite/graphics/README
Normal file
|
@ -0,0 +1 @@
|
|||
mona.png: by JiskeyJasket on twitter
|
1
graphics/hgr/sprite/graphics/graphics.inc
Normal file
1
graphics/hgr/sprite/graphics/graphics.inc
Normal file
|
@ -0,0 +1 @@
|
|||
mona_lzsa: .incbin "mona.lzsa"
|
BIN
graphics/hgr/sprite/graphics/mona.png
Normal file
BIN
graphics/hgr/sprite/graphics/mona.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
71
graphics/hgr/sprite/hardware.inc
Normal file
71
graphics/hgr/sprite/hardware.inc
Normal file
|
@ -0,0 +1,71 @@
|
|||
; HARDWARE LOCATIONS
|
||||
|
||||
KEYPRESS = $C000
|
||||
KEYRESET = $C010
|
||||
|
||||
; SOFT SWITCHES
|
||||
CLR80COL = $C000 ; PAGE0/PAGE1 normal
|
||||
SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
|
||||
EIGHTYCOLOFF = $C00C
|
||||
EIGHTYCOLON = $C00D
|
||||
TBCOLOR = $C022 ; IIgs text foreground / background colors
|
||||
NEWVIDEO = $C029 ; IIgs graphics modes
|
||||
SPEAKER = $C030
|
||||
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
|
||||
SET_GR = $C050
|
||||
SET_TEXT = $C051
|
||||
FULLGR = $C052
|
||||
TEXTGR = $C053
|
||||
PAGE0 = $C054
|
||||
PAGE1 = $C055
|
||||
LORES = $C056 ; Enable LORES graphics
|
||||
HIRES = $C057 ; Enable HIRES graphics
|
||||
AN3 = $C05E ; Annunciator 3
|
||||
|
||||
PADDLE_BUTTON0 = $C061
|
||||
PADDLE_BUTTON1 = $C062
|
||||
PADDL0 = $C064
|
||||
PTRIG = $C070
|
||||
|
||||
; BASIC ROUTINES
|
||||
|
||||
|
||||
NORMAL = $F273
|
||||
HGR2 = $F3D8 ; clear PAGE2 to 0
|
||||
HGR = $F3E2 ; set hires page1 and clear $2000-$3fff
|
||||
BKGND0 = $F3F4 ; clear current page to A
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
HPLOT0 = $F457 ; plot at (Y,X), (A)
|
||||
COLOR_SHIFT = $F47E
|
||||
HLINRL = $F530 ; (X,A),(Y)
|
||||
HGLIN = $F53A ; line to (X,A),(Y)
|
||||
COLORTBL = $F6F6
|
||||
|
||||
|
||||
; MONITOR ROUTINES
|
||||
|
||||
HLINE = $F819 ; HLINE Y,$2C at A
|
||||
VLINE = $F828 ; VLINE A,$2D at Y
|
||||
CLRSCR = $F832 ; Clear low-res screen
|
||||
CLRTOP = $F836 ; clear only top of low-res screen
|
||||
SETCOL = $F864 ; COLOR=A
|
||||
ROM_TEXT2COPY = $F962 ; iigs
|
||||
TEXT = $FB36
|
||||
SETGR = $FB40 ; init lores and clear screen
|
||||
TABV = $FB5B ; VTAB to A
|
||||
ROM_MACHINEID = $FBB3 ; iigs
|
||||
BELL = $FBDD ; ring the bell
|
||||
BASCALC = $FBC1 ;
|
||||
VTAB = $FC22 ; VTAB to CV
|
||||
HOME = $FC58 ; Clear the text screen
|
||||
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||
GETLN = $FD6A
|
||||
GETLN1 = $FD6F
|
||||
CROUT1 = $FD8B
|
||||
SETINV = $FE80 ; INVERSE
|
||||
SETNORM = $FE84 ; NORMAL
|
||||
COUT = $FDED ; output A to screen
|
||||
COUT1 = $FDF0 ; output A to screen
|
||||
|
||||
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
5 HOME
|
||||
10 PRINT CHR$(4);"CATALOG"
|
||||
20 PRINT CHR$(4)"CATALOG"
|
||||
|
||||
|
|
296
graphics/hgr/sprite/sprite.s
Normal file
296
graphics/hgr/sprite/sprite.s
Normal file
|
@ -0,0 +1,296 @@
|
|||
|
||||
.include "hardware.inc"
|
||||
|
||||
XX = $00
|
||||
YY = $01
|
||||
NIBCOUNT = $09
|
||||
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
|
||||
sprite_test:
|
||||
|
||||
jsr HGR ; Hi-res graphics
|
||||
bit FULLGR ; full screen
|
||||
|
||||
|
||||
lda #<(mona_lzsa)
|
||||
sta getsrc_smc+1
|
||||
lda #>(mona_lzsa)
|
||||
sta getsrc_smc+2
|
||||
|
||||
lda #$20
|
||||
|
||||
jsr decompress_lzsa2_fast
|
||||
|
||||
|
||||
|
||||
;==================
|
||||
; sprite stuff
|
||||
|
||||
lda #10
|
||||
sta XX
|
||||
lda #10
|
||||
sta YY
|
||||
|
||||
forever:
|
||||
jsr save_bg ; save bg
|
||||
|
||||
jsr draw_sprite ; draw sprite
|
||||
|
||||
keyloop:
|
||||
lda KEYPRESS
|
||||
bpl keyloop
|
||||
|
||||
pha
|
||||
jsr restore_bg ; restore bg
|
||||
pla
|
||||
|
||||
check_right:
|
||||
cmp #'D'|$80
|
||||
bne check_left
|
||||
|
||||
inc XX
|
||||
jmp done_key
|
||||
|
||||
check_left:
|
||||
cmp #'A'|$80
|
||||
bne check_up
|
||||
|
||||
dec XX
|
||||
jmp done_key
|
||||
|
||||
check_up:
|
||||
cmp #'W'|$80
|
||||
bne check_down
|
||||
|
||||
dec YY
|
||||
dec YY
|
||||
dec YY
|
||||
dec YY
|
||||
dec YY
|
||||
|
||||
jmp done_key
|
||||
|
||||
check_down:
|
||||
cmp #'S'|$80
|
||||
bne done_key
|
||||
|
||||
inc YY
|
||||
inc YY
|
||||
inc YY
|
||||
inc YY
|
||||
inc YY
|
||||
|
||||
jmp done_key
|
||||
|
||||
done_key:
|
||||
lda KEYRESET
|
||||
nokey:
|
||||
|
||||
jmp forever
|
||||
|
||||
|
||||
;======================
|
||||
; draw sprite
|
||||
;======================
|
||||
|
||||
draw_sprite:
|
||||
|
||||
ldx #0
|
||||
sprite_yloop:
|
||||
txa
|
||||
pha
|
||||
|
||||
clc
|
||||
adc YY
|
||||
|
||||
ldx #0
|
||||
ldy #0
|
||||
|
||||
; calc GBASL/GBASH
|
||||
jsr HPOSN ; (Y,X),(A) (values stored in HGRX,XH,Y)
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
ldy XX
|
||||
|
||||
lda (GBASL),Y
|
||||
and hand_mask_l,X
|
||||
ora hand_sprite_l,X
|
||||
sta (GBASL),Y
|
||||
|
||||
iny
|
||||
|
||||
lda (GBASL),Y
|
||||
and hand_mask_r,X
|
||||
ora hand_sprite_r,X
|
||||
sta (GBASL),Y
|
||||
|
||||
inx
|
||||
cpx #14
|
||||
bne sprite_yloop
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;======================
|
||||
; save bg
|
||||
;======================
|
||||
|
||||
save_bg:
|
||||
|
||||
ldx #0
|
||||
save_yloop:
|
||||
txa
|
||||
pha
|
||||
|
||||
clc
|
||||
adc YY
|
||||
|
||||
ldx #0
|
||||
ldy #0
|
||||
|
||||
; calc GBASL/GBASH
|
||||
jsr HPOSN ; (Y,X),(A) (values stored in HGRX,XH,Y)
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
ldy XX
|
||||
|
||||
lda (GBASL),Y
|
||||
sta save_left,X
|
||||
|
||||
iny
|
||||
|
||||
lda (GBASL),Y
|
||||
sta save_right,X
|
||||
|
||||
inx
|
||||
cpx #14
|
||||
bne save_yloop
|
||||
|
||||
rts
|
||||
|
||||
;======================
|
||||
; restore bg
|
||||
;======================
|
||||
|
||||
restore_bg:
|
||||
|
||||
ldx #0
|
||||
restore_yloop:
|
||||
txa
|
||||
pha
|
||||
|
||||
clc
|
||||
adc YY
|
||||
|
||||
ldx #0
|
||||
ldy #0
|
||||
|
||||
; calc GBASL/GBASH
|
||||
jsr HPOSN ; (Y,X),(A) (values stored in HGRX,XH,Y)
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
ldy XX
|
||||
|
||||
lda save_left,X
|
||||
sta (GBASL),Y
|
||||
|
||||
iny
|
||||
|
||||
lda save_right,X
|
||||
sta (GBASL),Y
|
||||
|
||||
|
||||
inx
|
||||
cpx #14
|
||||
bne restore_yloop
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
.include "decompress_fast_v2.s"
|
||||
|
||||
.include "graphics/graphics.inc"
|
||||
|
||||
|
||||
; hand sprite
|
||||
|
||||
hand_mask_l: ; X 654 3 210
|
||||
.byte $9f ; 1 001 1 111
|
||||
.byte $8f ; 1 000 1 111
|
||||
.byte $8f ; 1 000 1 111
|
||||
.byte $8f ; 1 000 1 111
|
||||
.byte $88 ; 1 000 1 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $81 ; 1 000 0 001
|
||||
.byte $81 ; 1 000 0 001
|
||||
.byte $83 ; 1 000 0 011
|
||||
.byte $87 ; 1 000 0 111
|
||||
.byte $8f ; 1 000 1 111
|
||||
.byte $8f ; 1 000 1 111
|
||||
|
||||
hand_sprite_l: ; X 654 3 210
|
||||
.byte $00 ; 0 000 0 000
|
||||
.byte $60 ; 0 110 0 000
|
||||
.byte $60 ; 0 110 0 000
|
||||
.byte $60 ; 0 110 0 000
|
||||
.byte $60 ; 0 110 0 000
|
||||
.byte $63 ; 0 110 0 011
|
||||
.byte $66 ; 0 110 0 110
|
||||
.byte $2c ; 0 010 1 100
|
||||
.byte $6c ; 0 110 1 100
|
||||
.byte $78 ; 0 111 1 000
|
||||
.byte $70 ; 0 111 0 000
|
||||
.byte $70 ; 0 111 0 000
|
||||
.byte $60 ; 0 110 0 000
|
||||
.byte $60 ; 0 110 0 000
|
||||
|
||||
hand_mask_r: ; X 654 3 210
|
||||
.byte $ff ; 1 111 1 111
|
||||
.byte $fe ; 1 111 1 110
|
||||
.byte $fe ; 1 111 1 110
|
||||
.byte $fe ; 1 111 1 110
|
||||
.byte $e0 ; 1 110 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $80 ; 1 000 0 000
|
||||
.byte $c0 ; 1 100 0 000
|
||||
.byte $c0 ; 1 100 0 000
|
||||
|
||||
hand_sprite_r: ; X 654 3 210
|
||||
.byte $00 ; 0 000 0 000
|
||||
.byte $00 ; 0 000 0 000
|
||||
.byte $00 ; 0 000 0 000
|
||||
.byte $00 ; 0 000 0 000
|
||||
.byte $00 ; 0 000 0 000
|
||||
.byte $0A ; 0 000 1 010
|
||||
.byte $2A ; 0 010 1 010
|
||||
.byte $2D ; 0 010 1 101
|
||||
.byte $37 ; 0 011 0 111
|
||||
.byte $3F ; 0 011 1 111
|
||||
.byte $3F ; 0 011 1 111
|
||||
.byte $1F ; 0 001 1 111
|
||||
.byte $1F ; 0 001 1 111
|
||||
.byte $1F ; 0 001 1 111
|
||||
|
||||
|
||||
save_right:
|
||||
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
|
||||
save_left:
|
||||
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
Loading…
Reference in New Issue
Block a user