peasant: yet another silly project
32
games/peasant/Makefile
Normal file
|
@ -0,0 +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
|
||||||
|
|
||||||
|
all: peasant.dsk
|
||||||
|
|
||||||
|
peasant.dsk: HELLO PEASANT
|
||||||
|
cp $(EMPTY_DISK)/empty.dsk peasant.dsk
|
||||||
|
$(DOS33) -y peasant.dsk SAVE A HELLO
|
||||||
|
$(DOS33) -y peasant.dsk BSAVE -a 0x6000 PEASANT
|
||||||
|
###
|
||||||
|
|
||||||
|
HELLO: hello.bas
|
||||||
|
$(TOKENIZE) < hello.bas > HELLO
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
PEASANT: peasant.o
|
||||||
|
ld65 -o PEASANT peasant.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
|
||||||
|
|
||||||
|
peasant.o: peasant.s graphics/graphics.inc
|
||||||
|
ca65 -o peasant.o peasant.s -l peasant.lst
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ *.o *.lst HELLO PEASANT
|
||||||
|
|
32
games/peasant/NOTES
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
280x192
|
||||||
|
*4
|
||||||
|
1120x768
|
||||||
|
|
||||||
|
Our capture: 300x142 roughly
|
||||||
|
292x142 to center it
|
||||||
|
|
||||||
|
Odd is Orange
|
||||||
|
Even is blue
|
||||||
|
|
||||||
|
EO EO EO EO EO if draw black at odd, nothing
|
||||||
|
blue 10 10 10 10 10 if draw black at even, two-wide(?) black
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
10 10 10 10 10 blue
|
||||||
|
01 01 01 01 01 orange
|
||||||
|
|
||||||
|
EO EO
|
||||||
|
10 01 blue->orange has black gap
|
||||||
|
|
||||||
|
01 10 orange->blue has white gap
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
10 10 01 01 = blue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
6|----c>>>-----------c------c-------|
|
||||||
|
5|-aaa----aaab>>>aaa---a-b-a---------|
|
||||||
|
|
370
games/peasant/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
|
||||||
|
|
101
games/peasant/graphics/Makefile
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
|
||||||
|
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: \
|
||||||
|
videlectrix.lzsa \
|
||||||
|
peasant_title.lzsa \
|
||||||
|
tips.lzsa \
|
||||||
|
cottage.lzsa \
|
||||||
|
lake_e.lzsa \
|
||||||
|
lake_w.lzsa \
|
||||||
|
river.lzsa \
|
||||||
|
knight.lzsa
|
||||||
|
echo "videlectrix_lzsa: .incbin \"videlectrix.lzsa\"" > graphics.inc
|
||||||
|
echo "title_lzsa: .incbin \"peasant_title.lzsa\"" >> graphics.inc
|
||||||
|
echo "tips_lzsa: .incbin \"tips.lzsa\"" >> graphics.inc
|
||||||
|
echo "cottage_lzsa: .incbin \"cottage.lzsa\"" >> graphics.inc
|
||||||
|
echo "lake_e_lzsa: .incbin \"lake_e.lzsa\"" >> graphics.inc
|
||||||
|
echo "lake_w_lzsa: .incbin \"lake_w.lzsa\"" >> graphics.inc
|
||||||
|
echo "river_lzsa: .incbin \"river.lzsa\"" >> graphics.inc
|
||||||
|
echo "knight_lzsa: .incbin \"knight.lzsa\"" >> graphics.inc
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
videlectrix.lzsa: videlectrix.hgr
|
||||||
|
$(LZSA) -r -f2 videlectrix.hgr videlectrix.lzsa
|
||||||
|
|
||||||
|
videlectrix.hgr: videlectrix.png
|
||||||
|
$(PNG2HGR) videlectrix.png > videlectrix.hgr
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
peasant_title.lzsa: peasant_title.hgr
|
||||||
|
$(LZSA) -r -f2 peasant_title.hgr peasant_title.lzsa
|
||||||
|
|
||||||
|
peasant_title.hgr: peasant_title.png
|
||||||
|
$(PNG2HGR) peasant_title.png > peasant_title.hgr
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
tips.lzsa: tips.hgr
|
||||||
|
$(LZSA) -r -f2 tips.hgr tips.lzsa
|
||||||
|
|
||||||
|
tips.hgr: tips.png
|
||||||
|
$(PNG2HGR) tips.png > tips.hgr
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
cottage.lzsa: cottage.hgr
|
||||||
|
$(LZSA) -r -f2 cottage.hgr cottage.lzsa
|
||||||
|
|
||||||
|
cottage.hgr: cottage.png
|
||||||
|
$(PNG2HGR) cottage.png > cottage.hgr
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
lake_w.lzsa: lake_w.hgr
|
||||||
|
$(LZSA) -r -f2 lake_w.hgr lake_w.lzsa
|
||||||
|
|
||||||
|
lake_w.hgr: lake_w.png
|
||||||
|
$(PNG2HGR) lake_w.png > lake_w.hgr
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
lake_e.lzsa: lake_e.hgr
|
||||||
|
$(LZSA) -r -f2 lake_e.hgr lake_e.lzsa
|
||||||
|
|
||||||
|
lake_e.hgr: lake_e.png
|
||||||
|
$(PNG2HGR) lake_e.png > lake_e.hgr
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
river.lzsa: river.hgr
|
||||||
|
$(LZSA) -r -f2 river.hgr river.lzsa
|
||||||
|
|
||||||
|
river.hgr: river.png
|
||||||
|
$(PNG2HGR) river.png > river.hgr
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
knight.lzsa: knight.hgr
|
||||||
|
$(LZSA) -r -f2 knight.hgr knight.lzsa
|
||||||
|
|
||||||
|
knight.hgr: knight.png
|
||||||
|
$(PNG2HGR) knight.png > knight.hgr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ outline.inc *.lzsa *.gr *.hgr
|
||||||
|
|
BIN
games/peasant/graphics/cottage.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
games/peasant/graphics/knight.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
games/peasant/graphics/lake_e.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
games/peasant/graphics/lake_w.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
games/peasant/graphics/peasant_title.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
games/peasant/graphics/river.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
games/peasant/graphics/tips.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
games/peasant/graphics/videlectrix.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
101
games/peasant/hardware.inc
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
; 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
|
||||||
|
PADDL0 = $C064
|
||||||
|
PTRIG = $C070
|
||||||
|
|
||||||
|
; APPLESOFT BASIC ROUTINES
|
||||||
|
|
||||||
|
NORMAL = $F273
|
||||||
|
HGR2 = $F3D8
|
||||||
|
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
|
||||||
|
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
|
||||||
|
CROUT1 = $FD8B
|
||||||
|
SETINV = $FE80 ; INVERSE
|
||||||
|
SETNORM = $FE84 ; NORMAL
|
||||||
|
COUT = $FDED ; output A to screen
|
||||||
|
COUT1 = $FDF0 ; output A to screen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
COLOR_BLACK = 0
|
||||||
|
COLOR_RED = 1
|
||||||
|
COLOR_DARKBLUE = 2
|
||||||
|
COLOR_PURPLE = 3
|
||||||
|
COLOR_DARKGREEN = 4
|
||||||
|
COLOR_GREY = 5
|
||||||
|
COLOR_MEDIUMBLUE = 6
|
||||||
|
COLOR_LIGHTBLUE = 7
|
||||||
|
COLOR_BROWN = 8
|
||||||
|
COLOR_ORANGE = 9
|
||||||
|
COLOR_GREY2 = 10
|
||||||
|
COLOR_PINK = 11
|
||||||
|
COLOR_LIGHTGREEN = 12
|
||||||
|
COLOR_YELLOW = 13
|
||||||
|
COLOR_AQUA = 14
|
||||||
|
COLOR_WHITE = 15
|
||||||
|
|
||||||
|
COLOR_BOTH_BLACK = $00
|
||||||
|
COLOR_BOTH_RED = $11
|
||||||
|
COLOR_BOTH_DARKBLUE = $22
|
||||||
|
COLOR_BOTH_DARKGREEN = $44
|
||||||
|
COLOR_BOTH_GREY = $55
|
||||||
|
COLOR_BOTH_MEDIUMBLUE = $66
|
||||||
|
COLOR_BOTH_LIGHTBLUE = $77
|
||||||
|
COLOR_BOTH_BROWN = $88
|
||||||
|
COLOR_BOTH_ORANGE = $99
|
||||||
|
COLOR_BOTH_PINK = $BB
|
||||||
|
COLOR_BOTH_LIGHTGREEN = $CC
|
||||||
|
COLOR_BOTH_YELLOW = $DD
|
||||||
|
COLOR_BOTH_AQUA = $EE
|
||||||
|
COLOR_BOTH_WHITE = $FF
|
||||||
|
|
3
games/peasant/hello.bas
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
5 HOME
|
||||||
|
20 PRINT CHR$(4)"BRUN PEASANT"
|
||||||
|
|
150
games/peasant/peasant.s
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
; A Peasant's Quest????
|
||||||
|
|
||||||
|
; by Vince `deater` Weaver vince@deater.net
|
||||||
|
|
||||||
|
; with apologies to everyone
|
||||||
|
|
||||||
|
.include "hardware.inc"
|
||||||
|
|
||||||
|
NIBCOUNT = $09
|
||||||
|
|
||||||
|
|
||||||
|
hgr_display:
|
||||||
|
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||||
|
; Y=0, A=0 after this called
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; Opening
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(videlectrix_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(videlectrix_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; Title
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(title_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(title_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; Tips
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(tips_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(tips_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; Cottage
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(cottage_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(cottage_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; Lake West
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(lake_w_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(lake_w_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; Lake East
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(lake_e_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(lake_e_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; River
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(river_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(river_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
|
||||||
|
;************************
|
||||||
|
; Knight
|
||||||
|
;************************
|
||||||
|
|
||||||
|
lda #<(knight_lzsa)
|
||||||
|
sta getsrc_smc+1
|
||||||
|
lda #>(knight_lzsa)
|
||||||
|
sta getsrc_smc+2
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
|
||||||
|
jsr decompress_lzsa2_fast
|
||||||
|
|
||||||
|
jsr wait_until_keypress
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
forever:
|
||||||
|
jmp forever
|
||||||
|
|
||||||
|
|
||||||
|
.include "decompress_fast_v2.s"
|
||||||
|
.include "wait_keypress.s"
|
||||||
|
|
||||||
|
.include "graphics/graphics.inc"
|
5
games/peasant/wait_keypress.s
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
wait_until_keypress:
|
||||||
|
lda KEYPRESS ; 4
|
||||||
|
bpl wait_until_keypress ; 3
|
||||||
|
bit KEYRESET ; clear the keyboard buffer
|
||||||
|
rts ; 6
|