tfv: update to match more modern vmw games

mostly using lzsa compression
This commit is contained in:
Vince Weaver 2020-09-27 22:03:01 -04:00
parent 65682ccf05
commit 8139c2520c
43 changed files with 1290 additions and 665 deletions

View File

@ -8,39 +8,15 @@ ARTDIR = ./art
all: tfv.dsk
$(PNG2RLE):
cd ../gr-utils && make
$(DOS33):
cd ../dos33fs-utils && make
tfv.dsk: $(DOS33) TFV
tfv.dsk: $(DOS33) TFV HELLO
$(DOS33) -y tfv.dsk SAVE A HELLO
$(DOS33) -y tfv.dsk BSAVE -a 0x1000 TFV
# $(DOS33) -y tfv.dsk BSAVE -a 0x2000 HIGHWIND.ED
# $(DOS33) -y tfv.dsk BSAVE -a 0x2000 FIGHTING.ED
tfv_backgrounds.inc: $(PNG2RLE) \
$(ARTDIR)/title.png $(ARTDIR)/map.png \
$(ARTDIR)/landing.png $(ARTDIR)/harfco.png \
$(ARTDIR)/belair.png \
$(ARTDIR)/math_office.png $(ARTDIR)/video_hr.png \
$(ARTDIR)/collegep.png \
$(ARTDIR)/umcp.png \
$(ARTDIR)/dining.png $(ARTDIR)/metro.png $(ARTDIR)/talbot.png
$(PNG2RLE) asm $(ARTDIR)/title.png title_rle > tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/map.png map_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/landing.png landing_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/harfco.png harfco_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/belair.png belair_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/math_office.png math_office_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/video_hr.png video_hr_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/collegep.png collegep_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/umcp.png umcp_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/dining.png dining_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/metro.png metro_rle >> tfv_backgrounds.inc
$(PNG2RLE) asm $(ARTDIR)/talbot.png talbot_rle >> tfv_backgrounds.inc
###
TFV: tfv.o
@ -49,9 +25,9 @@ TFV: tfv.o
tfv.o: tfv.s \
tfv_flying.s tfv_info.s tfv_opener.s tfv_title.s \
tfv_textentry.s tfv_worldmap.s \
tfv_backgrounds.inc tfv_sprites.inc tfv_zp.inc \
graphics_map/tfv_backgrounds.inc tfv_sprites.inc tfv_zp.inc \
../asm_routines/multiply_fast.s \
../asm_routines/gr_fast_clear.s \
gr_fast_clear.s \
../asm_routines/pageflip.s \
../asm_routines/gr_setpage.s \
../asm_routines/keypress.s \
@ -63,7 +39,16 @@ tfv.o: tfv.s \
../asm_routines/gr_unrle.s
ca65 -o tfv.o tfv.s -l tfv.lst
graphics_map/tfv_backgrounds.inc:
cd graphics_map && make
###
HELLO: hello.bas
../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO
###
clean:
rm -f *~ TITLE.GR *.o *.lst ED TFV

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

370
tfv/decompress_fast_v2.s Normal file
View 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

201
tfv/gr_fast_clear.s Normal file
View File

@ -0,0 +1,201 @@
clear_screens:
;===================================
; Clear top/bottom of page 0
;===================================
lda #$0
sta DRAW_PAGE
jsr clear_top
jsr clear_bottom
;===================================
; Clear top/bottom of page 1
;===================================
lda #$4
sta DRAW_PAGE
jsr clear_top
jsr clear_bottom
rts
;=========================================================
; clear_top
;=========================================================
; clear DRAW_PAGE
; original = 14,558 cycles(?) 15ms, 70Hz
; OPTIMIZED MAX (page0,48rows): 45*120+4+6 = 5410 = 5.4ms 185Hz
; (pageX,40rows): 50*120+4+6 = 6010 = 6.0ms 166Hz
; 50*120+4+6+37 = 6055 = 6.0ms 166Hz
clear_top:
lda #0 ; 2
clear_top_a:
sta COLOR ; 3
clc ; 2
lda DRAW_PAGE ; 3
adc #4 ; 2
sta __ctf+2 ; 3
sta __ctf+5 ; 3
adc #1 ; 2
sta __ctf+8 ; 3
sta __ctf+11 ; 3
adc #1 ; 2
sta __ctf2+2 ; 3
sta __ctf2+5 ; 3
adc #1 ; 2
sta __ctf2+8 ; 3
sta __ctf2+11 ; 3
ldy #120 ; 2
lda COLOR ; 3
clear_top_fast_loop:
__ctf:
sta $400,Y ; 5
sta $480,Y ; 5
sta $500,Y ; 5
sta $580,Y ; 5
cpy #80 ; 2
bpl no_draw_bottom ; 2nt/3
__ctf2:
sta $600,Y ; 5
sta $680,Y ; 5
sta $700,Y ; 5
sta $780,Y ; 5
no_draw_bottom:
dey ; 2
bpl clear_top_fast_loop ; 2nt/3
rts ; 6
;=========================================================
; clear_bottom
;=========================================================
; clear bottom of draw page
clear_bottom:
clc ; 2
lda DRAW_PAGE ; 3
adc #6 ; 2
sta __cbf2+2 ; 3
sta __cbf2+5 ; 3
adc #1 ; 2
sta __cbf2+8 ; 3
sta __cbf2+11 ; 3
ldy #120 ; 2
lda #$a0 ; Normal Space ; 2
clear_bottom_fast_loop:
__cbf2:
sta $600,Y ; 5
sta $680,Y ; 5
sta $700,Y ; 5
sta $780,Y ; 5
dey ; 2
cpy #80 ; 2
bpl clear_bottom_fast_loop ; 2nt/3
rts ; 6
;clear_screens_notext:
;===================================
; Clear top/bottom of page 0
;===================================
; lda #$0
; sta DRAW_PAGE
; jsr clear_all
;===================================
; Clear top/bottom of page 1
;===================================
; lda #$4
; sta DRAW_PAGE
; jsr clear_all
; rts
clear_bottoms:
lda DRAW_PAGE
pha
;===================================
; Clear bottom of page 0
;===================================
lda #$0
sta DRAW_PAGE
jsr clear_bottom
;===================================
; Clear bottom of page 1
;===================================
lda #$4
sta DRAW_PAGE
jsr clear_bottom
pla
sta DRAW_PAGE
rts
;=========================================================
; clear_all
;=========================================================
; clear 48 rows
clear_all:
clc ; 2
lda DRAW_PAGE ; 3
adc #4 ; 2
sta __caf+2 ; 3
sta __caf+5 ; 3
adc #1 ; 2
sta __caf+8 ; 3
sta __caf+11 ; 3
adc #1 ; 2
sta __caf2+2 ; 3
sta __caf2+5 ; 3
adc #1 ; 2
sta __caf2+8 ; 3
sta __caf2+11 ; 3
ldy #120 ; 2
clear_all_color:
lda #' '|$80 ; 2
clear_all_fast_loop:
__caf:
sta $400,Y ; 5
sta $480,Y ; 5
sta $500,Y ; 5
sta $580,Y ; 5
__caf2:
sta $600,Y ; 5
sta $680,Y ; 5
sta $700,Y ; 5
sta $780,Y ; 5
dey ; 2
bpl clear_all_fast_loop ; 2nt/3
rts ; 6

33
tfv/graphics_map/Makefile Normal file
View File

@ -0,0 +1,33 @@
include ../../Makefile.inc
PNG2RLE = ../../gr-utils/png2rle
PNG2GR = ../../gr-utils/png2gr
LZSA = ~/research/lzsa/lzsa/lzsa
tfv_backgrounds.inc: \
title.lzsa map.lzsa landing.lzsa harfco.lzsa \
belair.lzsa math_office.lzsa video_hr.lzsa \
collegep.lzsa umcp.lzsa dining.lzsa metro.lzsa \
talbot.lzsa
echo "title_lzsa: .incbin \"title.lzsa\"" > tfv_backgrounds.inc
echo "map_lzsa: .incbin \"map.lzsa\"" >> tfv_backgrounds.inc
echo "landing_lzsa: .incbin \"landing.lzsa\"" >> tfv_backgrounds.inc
echo "harfco_lzsa: .incbin \"harfco.lzsa\"" >> tfv_backgrounds.inc
echo "belair_lzsa: .incbin \"belair.lzsa\"" >> tfv_backgrounds.inc
echo "math_office_lzsa: .incbin \"math_office.lzsa\"" >> tfv_backgrounds.inc
echo "video_hr_lzsa: .incbin \"video_hr.lzsa\"" >> tfv_backgrounds.inc
echo "collegep_lzsa: .incbin \"collegep.lzsa\"" >> tfv_backgrounds.inc
echo "umcp_lzsa: .incbin \"umcp.lzsa\"" >> tfv_backgrounds.inc
echo "dining_lzsa: .incbin \"dining.lzsa\"" >> tfv_backgrounds.inc
echo "metro_lzsa: .incbin \"metro.lzsa\"" >> tfv_backgrounds.inc
echo "talbot_lzsa: .incbin \"talbot.lzsa\"" >> tfv_backgrounds.inc
%.gr: %.png
$(PNG2GR) $< $@
%.lzsa: %.gr
$(LZSA) -r -f2 $< $@
clean:
rm -f *~ tfv_backgrounds.inc

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 515 B

View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 356 B

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 384 B

View File

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 368 B

View File

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

View File

Before

Width:  |  Height:  |  Size: 493 B

After

Width:  |  Height:  |  Size: 493 B

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B

BIN
tfv/graphics_map/title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 541 B

After

Width:  |  Height:  |  Size: 541 B

View File

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 508 B

View File

Before

Width:  |  Height:  |  Size: 548 B

After

Width:  |  Height:  |  Size: 548 B

98
tfv/hardware.inc Normal file
View File

@ -0,0 +1,98 @@
;; 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
;; BASIC ROUTINES
NORMAL = $F273
;; 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

351
tfv/multiply_fast.s Normal file
View File

@ -0,0 +1,351 @@
; Fast mutiply
; Note for our purposes we only care about 8.8 x 8.8 fixed point
; with 8.8 result, which means we only care about the middle two bytes
; of the 32 bit result. So we disable generation of the high and low byte
; to save some cycles.
;
; The old routine took around 700 cycles for a 16bitx16bit=32bit mutiply
; This routine, at an expense of 2kB of looku tables, takes around 250
; If you reuse a term the next time this drops closer to 200
; This routine was described by Stephen Judd and found
; in The Fridge and in the C=Hacking magazine
; http://codebase64.org/doku.php?id=base:seriously_fast_multiplication
; The key thing to note is that
; (a+b)^2 (a-b)^2
; a*b = ------- - --------
; 4 4
; So if you have tables of the squares of 0..511 you can lookup and subtract
; instead of multiplying.
; Table generation: I:0..511
; square1_lo = <((I*I)/4)
; square1_hi = >((I*I)/4)
; square2_lo = <(((I-255)*(I-255))/4)
; square2_hi = >(((I-255)*(I-255))/4)
; Note: DOS3.3 starts at $9600
.ifndef square1_lo
square1_lo = $8E00
square1_hi = $9000
square2_lo = $9200
square2_hi = $9400
.endif
; for(i=0;i<512;i++) {
; square1_lo[i]=((i*i)/4)&0xff;
; square1_hi[i]=(((i*i)/4)>>8)&0xff;
; square2_lo[i]=( ((i-255)*(i-255))/4)&0xff;
; square2_hi[i]=(( ((i-255)*(i-255))/4)>>8)&0xff;
; }
init_multiply_tables:
; Build the add tables
ldx #$00
txa
.byte $c9 ; CMP #immediate - skip TYA and clear carry flag
lb1: tya
adc #$00 ; 0
ml1: sta square1_hi,x ; square1_hi[0]=0
tay ; y=0
cmp #$40 ; subtract 64 and update flags (c=0)
txa ; a=0
ror ; rotate
ml9: adc #$00 ; add 0
sta ml9+1 ; update add value
inx ; x=1
ml0: sta square1_lo,x ; square1_lo[0]=1
bne lb1 ; if not zero, loop
inc ml0+2 ; increment values
inc ml1+2 ; increment values
clc ; c=0
iny ; y=1
bne lb1 ; loop
; Build the subtract tables based on the existing one
ldx #$00
ldy #$ff
second_table:
lda square1_hi+1,x
sta square2_hi+$100,x
lda square1_hi,x
sta square2_hi,y
lda square1_lo+1,x
sta square2_lo+$100,x
lda square1_lo,x
sta square2_lo,y
dey
inx
bne second_table
rts
; Fast 16x16 bit unsigned multiplication, 32-bit result
; Input: NUM1H:NUM1L * NUM2H:NUM2L
; Result: RESULT3:RESULT2:RESULT1:RESULT0
;
; Does self-modifying code to hard-code NUM1H:NUM1L into the code
; carry=0: re-use previous NUM1H:NUM1L
; carry=1: reload NUM1H:NUM1L (58 cycles slower)
;
; clobbered: RESULT, X, A, C
; Allocation setup: T1,T2 and RESULT preferably on Zero-page.
;
; NUM1H (x_i), NUM1L (x_f)
; NUM2H (y_i), NUM2L (y_f)
; NUM1L * NUM2L = AAaa
; NUM1L * NUM2H = BBbb
; NUM1H * NUM2L = CCcc
; NUM1H * NUM2H = DDdd
;
; AAaa
; BBbb
; CCcc
; + DDdd
; ----------
; RESULT
;fixed_16x16_mul_unsigned:
multiply:
bcc num1_same_as_last_time ; 2nt/3
;============================
; Set up self-modifying code
; this changes the code to be hard-coded to multiply by NUM1H:NUM1L
;============================
lda NUM1L ; load the low byte ; 3
sta sm1a+1 ; 3
sta sm3a+1 ; 3
sta sm5a+1 ; 3
sta sm7a+1 ; 3
eor #$ff ; invert the bits for subtracting ; 2
sta sm2a+1 ; 3
sta sm4a+1 ; 3
sta sm6a+1 ; 3
sta sm8a+1 ; 3
lda NUM1H ; load the high byte ; 3
sta sm1b+1 ; 3
sta sm3b+1 ; 3
sta sm5b+1 ; 3
; sta sm7b+1 ;
eor #$ff ; invert the bits for subtractin ; 2
sta sm2b+1 ; 3
sta sm4b+1 ; 3
sta sm6b+1 ; 3
; sta sm8b+1 ;
;===========
; 52
num1_same_as_last_time:
;==========================
; Perform NUM1L * NUM2L = AAaa
;==========================
ldx NUM2L ; (low le) ; 3
sec ; 2
sm1a:
lda square1_lo,x ; 4
sm2a:
sbc square2_lo,x ; 4
; a is _aa
; sta RESULT+0 ;
sm3a:
lda square1_hi,x ; 4
sm4a:
sbc square2_hi,x ; 4
; a is _AA
sta _AA+1 ; 3
;===========
; 24
; Perform NUM1H * NUM2L = CCcc
sec ; 2
sm1b:
lda square1_lo,x ; 4
sm2b:
sbc square2_lo,x ; 4
; a is _cc
sta _cc+1 ; 3
sm3b:
lda square1_hi,x ; 4
sm4b:
sbc square2_hi,x ; 4
; a is _CC
sta _CC+1 ; 3
;===========
; 24
;==========================
; Perform NUM1L * NUM2H = BBbb
;==========================
ldx NUM2H ; 3
sec ; 2
sm5a:
lda square1_lo,x ; 4
sm6a:
sbc square2_lo,x ; 4
; a is _bb
sta _bb+1 ; 3
sm7a:
lda square1_hi,x ; 4
sm8a:
sbc square2_hi,x ; 4
; a is _BB
sta _BB+1 ; 3
;===========
; 27
;==========================
; Perform NUM1H * NUM2H = DDdd
;==========================
sec ; 2
sm5b:
lda square1_lo,x ; 4
sm6b:
sbc square2_lo,x ; 4
; a is _dd
sta _dd+1 ; 3
;sm7b:
; lda square1_hi,x ;
;sm8b:
; sbc square2_hi,x ;
; a = _DD
; sta RESULT+3 ;
;===========
; 13
;===========================================
; Add the separate multiplications together
;===========================================
clc ; 2
_AA:
lda #0 ; loading _AA ; 2
_bb:
adc #0 ; adding in _bb ; 2
sta RESULT+1 ; 3
;==========
; 9
; product[2]=_BB+_CC+c
_BB:
lda #0 ; loading _BB ; 2
_CC:
adc #0 ; adding in _CC ; 2
sta RESULT+2 ; 3
;===========
; 7
; product[3]=_DD+c
; bcc dd_no_carry1 ;
; inc RESULT+3 ;
clc ; 2
;=============
; 2
dd_no_carry1:
; product[1]=_AA+_bb+_cc
_cc:
lda #0 ; load _cc ; 2
adc RESULT+1 ; 3
sta RESULT+1 ; 3
; product[2]=_BB+_CC+_dd+c
_dd:
lda #0 ; load _dd ; 2
adc RESULT+2 ; 3
sta RESULT+2 ; 3
;===========
; 16
; product[3]=_DD+c
; bcc dd_no_carry2 ;
; inc RESULT+3 ;
;=============
; 0
dd_no_carry2:
; *z_i=product[1];
; *z_f=product[0];
; rts ; 6
;=================
; Signed multiply
;=================
;multiply:
; jsr fixed_16x16_mul_unsigned ; 6
lda NUM1H ; x_i ; 3
;===========
; 12
bpl x_positive ;^3/2nt
sec ; 2
lda RESULT+2 ; 3
sbc NUM2L ; 3
sta RESULT+2 ; 3
; lda RESULT+3 ;
; sbc NUM2H ;
; sta RESULT+3 ;
;============
; 10
x_positive:
lda NUM2H ; y_i ; 3
;============
; ; 6
bpl y_positive ;^3/2nt
sec ; 2
lda RESULT+2 ; 3
sbc NUM1L ; 3
sta RESULT+2 ; 3
; lda RESULT+3 ;
; sbc NUM1H ;
; sta RESULT+3 ;
;===========
; 10
y_positive:
ldx RESULT+2 ; *z_i=product[2]; ; 3
lda RESULT+1 ; *z_f=product[1]; ; 3
rts ; 6
;==========
; 12

View File

@ -1,4 +1,5 @@
.include "tfv_zp.inc"
.include "hardware.inc"
;================================
; Clear screen and setup graphics
@ -90,7 +91,7 @@ exit:
.include "tfv_worldmap.s"
.include "tfv_info.s"
.include "../asm_routines/gr_fast_clear.s"
.include "gr_fast_clear.s"
.include "../asm_routines/gr_hlin.s"
.include "../asm_routines/pageflip.s"
.include "../asm_routines/gr_setpage.s"
@ -100,7 +101,8 @@ exit:
.include "../asm_routines/memset.s"
.include "../asm_routines/gr_vlin.s"
.include "../asm_routines/gr_copy.s"
.include "../asm_routines/gr_unrle.s"
;.include "../asm_routines/gr_unrle.s"
.include "decompress_fast_v2.s"
.include "../asm_routines/gr_offsets.s"
;===============================================
@ -115,4 +117,4 @@ name:
.include "tfv_sprites.inc"
.include "tfv_backgrounds.inc"
.include "graphics_map/tfv_backgrounds.inc"

View File

@ -1,419 +0,0 @@
title_rle: .byte $28 ; ysize=40
.byte $00, $A0,$19,$20, $AF,$00, $22, $A3,$66, $22, $62
.byte $66, $62, $22, $66, $A3,$22, $66, $26
.byte $62, $22, $62, $26, $62, $22, $A3,$66
.byte $22, $55, $00, $A3,$11, $44, $A3,$22, $44
.byte $A3,$22, $00,$00, $22,$22, $66, $22,$22, $66, $62
.byte $66, $22, $66, $A3,$22, $66, $26, $62
.byte $22, $66, $22, $66, $22,$22, $66, $22,$22
.byte $55, $00, $01, $11, $41, $44, $42
.byte $22, $42, $44, $42, $22, $02, $00,$00
.byte $22,$22, $66, $22,$22, $66, $22, $66, $22
.byte $A3,$66, $22, $66, $62, $26, $22, $26
.byte $62, $26, $22,$22, $66, $22,$22, $55, $00,$00
.byte $11, $A3,$44, $22, $A3,$44, $22, $A3,$00, $02
.byte $A0,$18,$52, $55, $AE,$00, $A0,$1E,$60, $AA,$00, $66, $A3,$22
.byte $66, $26, $22, $26, $66, $22, $26
.byte $66, $22, $66, $A3,$22, $66, $26, $22
.byte $26, $66, $26, $62,$62, $66, $22, $66
.byte $22, $66, $55, $A9,$00, $66, $22, $26
.byte $66,$66, $22, $26, $22, $66, $22, $62
.byte $26, $22, $66,$66, $22, $66,$66, $22, $26
.byte $22, $66, $22, $26,$26, $66, $62, $26
.byte $62, $66, $55, $A9,$00, $66, $22, $A3,$66
.byte $22, $66, $22, $66, $22, $66, $62
.byte $22, $66,$66, $22, $66,$66, $22, $66, $22
.byte $66, $26,$26, $22, $66,$66, $22, $66,$66, $55
.byte $A9,$00, $06, $A0,$1D,$56, $55, $A3,$00, $10, $A0,$24,$00
.byte $10, $00, $10, $11, $01, $A5,$00, $A8,$CC
.byte $40, $A9,$00, $D0, $0D, $00, $D0, $0D
.byte $00, $D0, $A5,$00, $11, $AA,$00, $04, $A4,$54
.byte $CC,$CC, $44, $55, $A6,$00, $D0, $DD, $D0,$D0
.byte $DD, $D0,$D0, $DD, $D0, $A3,$00, $01,$01, $11
.byte $01,$01, $AC,$00, $CC,$CC, $44, $54, $55, $A6,$00
.byte $DD, $A7,$BB, $DD, $A4,$00, $10, $11, $10
.byte $AC,$00, $CC,$CC, $44, $54, $55, $A7,$00, $DD
.byte $BB, $BF, $B0, $BB, $BF, $B0, $BB
.byte $DD, $A3,$00, $10, $A3,$11, $10, $AA,$00, $CC,$CC
.byte $44, $54, $55, $A8,$00, $DD, $DB, $BB
.byte $3B, $33, $BB,$BB, $DB, $DD, $A3,$00, $01,$01
.byte $11, $01,$01, $AA,$00, $CC,$CC, $44, $55, $A9,$00
.byte $DD,$DD, $A5,$BB, $DD,$DD, $A5,$00, $11, $AC,$00, $CC,$CC
.byte $44, $55, $A9,$00, $0D, $00, $BB, $A3,$B1
.byte $BB, $00, $0D, $A4,$00, $BB,$BB, $AC,$00, $0C
.byte $4C, $44, $55, $AC,$00, $BB,$BB, $A6,$00, $20
.byte $22, $2B, $0B, $AE,$00, $05,$05, $A9,$00, $20
.byte $A6,$22, $A3,$20, $22,$22, $02, $A9,$00
.byte $A1
map_rle: .byte $28 ; ysize=40
.byte $A0,$23,$66, $46, $06, $A5,$66, $56, $AE,$66, $E6
.byte $A4,$66, $77, $FF, $F6, $A8,$66, $46, $A3,$44
.byte $A3,$66, $E6, $56, $55, $56, $E6, $AB,$66
.byte $6E, $66, $6E, $66,$66, $67, $A4,$6F, $A7,$66
.byte $4F, $47, $4F, $44, $AB,$66, $A0,$17,$D6, $A3,$66
.byte $64, $A3,$44, $46, $A8,$66, $DD, $A7,$FF, $4F
.byte $A5,$FF, $8F, $88, $8F, $FF, $7F, $77
.byte $07, $77, $07, $77, $DD, $A3,$66, $E6
.byte $A3,$E4, $E6, $A7,$66, $DD, $A6,$FF, $F4, $84
.byte $F4, $A4,$FF, $8F, $A3,$FF, $7F, $77, $A3,$75
.byte $77, $DD, $AF,$66, $DD, $AC,$CF, $A3,$C8, $A3,$CF
.byte $A5,$C7, $DD, $AA,$66, $E6, $A4,$66, $DD, $CC,$CC
.byte $4C, $A3,$CC, $77, $A6,$CC, $8C, $88, $8C
.byte $CC, $4C, $A5,$44, $DD, $A9,$66, $6E, $66
.byte $6E, $A3,$66, $DD, $CC, $4C, $44, $4C
.byte $CC, $22, $A3,$FF, $22, $A3,$CC, $8C, $A3,$CC
.byte $C4, $A5,$44, $DD, $AC,$66, $E6, $66,$66, $DD
.byte $CC,$CC, $C8, $CC,$CC, $C2, $C7,$C7, $CF, $C2,$C2
.byte $CC, $A3,$C8, $A3,$CC, $C8, $CC, $C8, $CC
.byte $C8, $DD, $AB,$66, $6E, $66, $6E, $66
.byte $DD, $4C, $84, $C4, $AA,$CC, $8C, $88
.byte $8C, $CC, $4C, $A5,$44, $DD, $AF,$66, $DD
.byte $C4, $CC, $88, $AA,$CC, $8C, $A3,$CC, $A6,$44
.byte $DD, $66,$66, $55, $56, $66,$66, $55, $A8,$66
.byte $DD, $A5,$CC, $A5,$9C, $CC, $1C, $A3,$C8, $1C
.byte $CC,$CC, $84, $C4, $84, $C4, $84, $DD
.byte $66,$66, $55, $66, $65, $56, $55, $A8,$66
.byte $DD, $A3,$CC, $4C,$4C, $99, $49, $44, $99,$99
.byte $CC, $11, $C1, $1C, $C1, $11, $A7,$CC
.byte $DD, $66,$66, $65, $A3,$66, $65, $66,$66, $6E
.byte $E6, $6E, $A3,$66, $DD, $CC,$CC, $44, $C8
.byte $8C, $99, $94, $44, $94, $99, $CC
.byte $C1, $A3,$CC, $C1, $A7,$CC, $DD, $A3,$66, $16
.byte $91, $16, $A4,$66, $EE, $A4,$66, $6D, $A4,$DC
.byte $D8, $D9,$D9, $D4, $D9,$D9, $DC,$DC, $8C, $88
.byte $8E, $EE, $A7,$DC, $6D, $A3,$66, $69, $99
.byte $69, $A3,$66, $05, $55, $66, $55, $65
.byte $A0,$1C,$66, $86, $96, $99, $96, $86, $66,$66
.byte $A4,$65, $A0,$1F,$66, $99, $A0,$1B,$66, $E6, $6E, $E6
.byte $A9,$66, $69, $A0,$2B,$66
.byte $A1
landing_rle: .byte $28 ; ysize=40
.byte $A3,$66, $56, $A0,$27,$66, $55, $F5, $A0,$26,$66, $55
.byte $FF, $F5, $A0,$25,$66, $55, $FF,$FF, $F5, $A0,$24,$66
.byte $55, $A3,$FF, $F5, $A0,$20,$66, $CC, $2C, $CC
.byte $55, $AF,$F5, $A4,$22, $A0,$12,$CC, $62, $22, $55
.byte $FF, $A3,$11, $44, $A3,$22, $44, $A3,$22, $A3,$FF
.byte $A5,$22, $A0,$11,$CC, $22, $26, $55, $FF,$FF, $11
.byte $A3,$44, $22, $A3,$44, $22, $A4,$FF, $A6,$22, $A0,$10,$CC
.byte $26,$26, $55, $FF,$FF, $F1, $A3,$F4, $F2, $A3,$F4
.byte $F2, $FF, $8F,$8F, $FF, $A7,$22, $AF,$CC, $62
.byte $26, $55, $AA,$5F, $FF,$FF, $88,$88, $FF, $A8,$22
.byte $AE,$CC, $22, $C2, $55, $A9,$FF, $55, $FF,$FF
.byte $88,$88, $AA,$FF, $AF,$CC, $A3,$C5, $85, $A9,$C5, $85,$85
.byte $A4,$C5, $85, $A5,$C5, $A0,$11,$CC, $C8, $A9,$CC, $A4,$85
.byte $A4,$CC, $C8, $A0,$1E,$CC, $A6,$85, $A0,$FF,$CC, $A5,$CC
.byte $A1
harfco_rle: .byte $28 ; ysize=40
.byte $A5,$00, $A0,$1D,$5A, $77, $A9,$00, $F0, $00, $A0,$1B,$5A
.byte $77, $A3,$00, $F0, $A3,$00, $F0, $A0,$17,$00, $F0
.byte $A0,$15,$00, $0F, $A0,$19,$00, $F0, $A0,$16,$00, $0F, $A0,$17,$00
.byte $A0,$28,$22, $A0,$1D,$77, $72, $AA,$22, $A0,$1F,$77, $72, $A8,$22
.byte $A0,$21,$77, $72, $A6,$22, $A0,$11,$77, $07, $77, $A5,$07
.byte $77, $00, $77, $07, $A7,$77, $A5,$22, $AC,$77
.byte $57, $00, $57, $00, $57, $00, $57
.byte $A5,$00, $57, $00, $57, $00, $57, $A7,$77
.byte $A4,$22, $AB,$77, $75, $55, $50, $A3,$55, $50
.byte $A9,$55, $50, $55, $75, $A7,$77, $A3,$22, $A0,$25,$77
.byte $A3,$22, $A0,$24,$77, $27, $A3,$22, $A0,$24,$77, $A4,$22, $A0,$22,$77
.byte $27, $A5,$22, $A0,$21,$77, $27, $A6,$22, $A0,$20,$77, $27
.byte $A7,$22, $A0,$1F,$77, $27, $A8,$22, $A0,$1E,$77, $27, $A9,$22
.byte $A1
belair_rle: .byte $28 ; ysize=40
.byte $AA,$00, $05, $57, $75, $57, $75, $57
.byte $75, $57, $75, $57, $75, $57, $75
.byte $57, $75, $57, $75, $57, $75, $57
.byte $05, $AB,$00, $70, $A9,$00, $05, $AF,$57, $05
.byte $A5,$00, $0D, $D0, $A5,$00, $07, $7F, $07
.byte $A5,$00, $70, $F7, $70, $A0,$17,$00, $DD, $AE,$00
.byte $07, $A0,$17,$00, $0D, $AD,$00, $70, $A0,$1C,$00, $60
.byte $E6, $60, $A7,$00, $07, $7F, $07, $A6,$00
.byte $50, $A6,$85, $50, $AE,$00, $06, $AC,$00, $A5,$50
.byte $A8,$88, $A0,$10,$00, $50,$50, $20, $A3,$22, $92, $D9
.byte $A3,$50, $88, $98, $88, $98, $55, $88
.byte $89, $88, $08,$08, $88, $89, $88, $A3,$50
.byte $A6,$40, $A7,$50, $20, $A3,$22, $92, $D9, $0D
.byte $D9, $A3,$00, $A4,$88, $55, $A3,$88, $00,$00, $A3,$88
.byte $A3,$00, $A6,$74, $A7,$00, $22,$22, $92, $D9, $0D
.byte $D9, $9D, $D9, $A9,$00, $08, $88, $00,$00
.byte $88, $08, $A4,$00, $77, $07, $E7,$E7, $07
.byte $77, $A7,$00, $88, $D9, $0D, $D9, $9D
.byte $D9, $0D, $D9, $A0,$13,$00, $77, $00, $EE,$EE
.byte $00, $77, $A7,$00, $88, $D9, $9D, $D9
.byte $0D, $D9, $9D, $09, $A0,$13,$00, $77,$77, $EE,$EE
.byte $77,$77, $A4,$00, $D0, $10, $00, $88, $D9
.byte $0D, $D9, $00, $09, $A0,$1F,$00, $DD, $11
.byte $01, $88, $D9, $9D, $09, $A0,$21,$00, $DD
.byte $00,$00, $08, $09, $A0,$20,$00, $40, $44, $04
.byte $DD, $04, $44, $A0,$23,$00, $A5,$04, $A0,$A0,$00
.byte $A1
math_office_rle: .byte $28 ; ysize=40
.byte $A0,$19,$00, $AF,$44, $A0,$19,$00, $44, $FF, $4F, $F4
.byte $44,$44, $F4, $FF, $F4, $44,$44, $FF, $F4
.byte $44, $FF, $A0,$19,$00, $44, $FF, $4F, $F4
.byte $44, $4F, $44, $FF, $44, $4F, $44
.byte $FF, $44, $4F, $FF, $A0,$19,$00, $44, $4F,$4F
.byte $A4,$44, $4F, $A3,$44, $4F, $44,$44, $4F, $A0,$19,$00
.byte $AF,$44, $AB,$00, $80,$80, $A7,$00, $B8, $88, $00,$00
.byte $0A, $AF,$07, $AB,$00, $88, $BB, $B0, $A5,$00
.byte $0B, $BB, $88, $A4,$00, $B8, $88, $AE,$00
.byte $88, $B8, $A7,$00, $88, $FB, $A7,$00, $2B
.byte $A4,$00, $0B, $BB, $88, $AE,$00, $88, $BB
.byte $0B, $A6,$00, $F8, $FF, $F0, $A5,$00, $44
.byte $22, $A5,$00, $FF, $08, $80, $AD,$00, $88
.byte $F0, $A7,$00, $7F, $11, $7F, $A4,$70, $11
.byte $74, $72, $A3,$70, $11, $7F,$7F, $A6,$70, $A9,$00
.byte $77, $7F, $B0, $A4,$00, $70, $77,$77, $71
.byte $A5,$77, $71, $A5,$77, $71, $A6,$77, $57, $55
.byte $A9,$00, $4F,$4F, $A4,$00, $A0,$16,$57, $55, $05, $55
.byte $A8,$00, $04, $B4, $04,$04, $A3,$00, $55, $05,$05
.byte $55, $05, $B5, $A4,$05, $D5, $A5,$05, $B5
.byte $A4,$05, $55, $00,$00, $55, $A9,$00, $8F, $80
.byte $A4,$00, $55, $00,$00, $55, $00, $08,$08, $00,$00
.byte $08,$08, $A4,$00, $08,$08, $A4,$00, $55, $00,$00, $55
.byte $AF,$00, $55, $00,$00, $55, $A0,$11,$00, $55, $00,$00
.byte $55, $AF,$00, $55, $A0,$14,$00, $55, $A0,$12,$00, $05
.byte $A0,$14,$00, $05, $A0,$82,$00
.byte $A1
video_hr_rle: .byte $28 ; ysize=40
.byte $A0,$20,$00, $77, $A6,$57, $77, $A0,$20,$00, $77, $55,$55
.byte $15, $A3,$55, $77, $A0,$20,$00, $77, $55, $51
.byte $11, $A3,$55, $77, $A0,$20,$00, $77, $55,$55, $11
.byte $A3,$55, $77, $A0,$13,$00, $50, $55,$55, $50, $A9,$00
.byte $77, $55, $A3,$51, $55,$55, $77, $A3,$00, $A6,$70
.byte $A3,$00, $DD, $BD, $A5,$00, $B0, $BB, $88
.byte $A4,$00, $80,$80, $A4,$00, $77, $7C, $A6,$77, $00,$00
.byte $70, $A4,$77, $87, $88, $A3,$00, $DD, $BB
.byte $0B, $A5,$00, $BB, $08, $A3,$00, $B0, $BB
.byte $88, $A9,$00, $05, $50, $00,$00, $74, $47
.byte $44, $77,$77, $87, $00, $88, $A3,$00, $DD
.byte $FF, $A6,$00, $22,$22, $A4,$00, $BB, $08, $AB,$00
.byte $05, $77, $99,$99, $74, $77, $87, $00,$00
.byte $88, $A3,$00, $DD, $FF, $0F, $0B, $00,$00
.byte $B0, $20, $22,$22, $A4,$00, $11, $AD,$00, $77
.byte $79,$79, $77, $87, $00, $E0,$E0, $88, $A3,$00
.byte $0D, $8F, $A6,$00, $52,$52, $00,$00, $0B, $01
.byte $11, $AD,$00, $A3,$77, $87, $00, $D0, $DE
.byte $EE, $88, $A4,$07, $88, $A6,$07, $55,$55, $A4,$07
.byte $44, $AD,$07, $77,$77, $87, $00, $30, $3D
.byte $DD, $8E, $08, $A3,$00, $08, $B8, $08
.byte $A5,$00, $55,$55, $A4,$00, $44, $A9,$00, $B6,$B6, $E0
.byte $00, $77, $08, $00, $22,$22, $33, $8D
.byte $08, $A5,$00, $BB, $A6,$00, $55,$55, $A4,$00, $44
.byte $A8,$00, $0B, $BB,$BB, $EE, $00, $08, $00
.byte $10, $12, $22, $83, $08, $A6,$00, $08,$08
.byte $A4,$00, $A3,$08, $A3,$00, $08,$08, $A9,$00, $60, $6B
.byte $0E, $00,$00, $40, $41, $11, $82, $08
.byte $A0,$19,$00, $78, $A3,$88, $80, $A3,$66, $00, $19
.byte $99, $44, $11, $88, $A0,$1A,$00, $88, $87
.byte $78, $A3,$88, $86, $66, $00, $11, $99
.byte $44, $88, $A0,$1B,$00, $A3,$88, $87, $78, $8B
.byte $86, $88, $80, $11, $99, $88, $A0,$1C,$00
.byte $A5,$88, $77, $A3,$87, $11, $88, $A0,$1D,$00, $A5,$88
.byte $77, $A4,$88, $A0,$1F,$00, $08, $A3,$88, $77, $A3,$88
.byte $A1
collegep_rle: .byte $28 ; ysize=40
.byte $A0,$21,$66, $F6,$F6, $A8,$66, $F6,$F6, $A3,$FF, $F6, $A0,$15,$66
.byte $F6, $A5,$FF, $F6, $A6,$66, $6F, $5F, $FF
.byte $F5, $A3,$FF, $A5,$66, $76, $A4,$56, $76, $A4,$56
.byte $76, $A3,$66, $5F,$5F, $A3,$FF, $5F,$5F, $6F, $A8,$66
.byte $A4,$65, $A5,$66, $A3,$17, $1A,$1A, $17, $F7, $17
.byte $1A,$1A, $A3,$17, $A3,$66, $65,$65, $6F,$6F, $A0,$14,$66, $1F
.byte $FF, $1F, $4F, $1F, $FF, $1F, $FF
.byte $1F, $4F, $1F, $FF, $1F, $AD,$66, $AE,$CC
.byte $11, $FF, $11, $84, $11, $FF, $00
.byte $FF, $11, $84, $11, $FF, $11, $A0,$1B,$CC
.byte $C7, $CF, $C7, $C8, $C7, $CF, $C0
.byte $CF, $C7, $C8, $C7, $CF, $C7, $A0,$1E,$CC
.byte $5C, $15,$15, $55, $15,$15, $5C, $A0,$21,$CC, $55
.byte $11, $55, $51, $55, $11, $55, $A0,$21,$CC
.byte $C5, $51, $A3,$55, $51, $C5, $A5,$CC, $5C
.byte $AA,$88, $AB,$CC, $FC, $FF, $5C, $CC, $DC
.byte $A8,$8C, $A5,$CC, $88, $77, $7E, $A8,$EE, $AA,$CC
.byte $8F, $FF,$FF, $85, $ED, $A9,$EE, $E8,$E8, $DC
.byte $CC,$CC, $88, $77,$77, $85, $58, $98, $A5,$88
.byte $A9,$CC, $9C, $88,$88, $48, $58, $88, $8E
.byte $AA,$EE, $ED, $DC, $CC, $88, $77,$77, $88
.byte $85, $A3,$58, $55, $58,$58, $A8,$CC, $8C, $98
.byte $A3,$88, $48, $88, $58, $8E, $AA,$EE, $DD
.byte $CC, $C8, $77,$77, $88,$88, $55, $88,$88, $85
.byte $88,$88, $A7,$CC, $8C, $89, $88,$88, $89, $A4,$88
.byte $85, $88, $AB,$EE, $A3,$C7, $C8, $88, $55
.byte $A3,$88, $48,$48, $A6,$CC, $8C, $89, $98, $88
.byte $98, $88, $84, $A3,$88, $85, $88, $58
.byte $A6,$EE, $DE, $CE, $A7,$CC, $55, $48, $44,$44
.byte $49, $44, $A8,$CC, $A5,$C8, $A6,$88, $A5,$EE, $DD
.byte $CD, $A7,$CC, $4C, $44,$44, $49, $A3,$44, $A0,$11,$DD
.byte $ED, $A5,$EE, $A0,$11,$DD, $A0,$10,$77, $E7, $A5,$EE, $A0,$12,$77
.byte $A0,$28,$22
.byte $A1
umcp_rle: .byte $28 ; ysize=40
.byte $A0,$1D,$66, $A3,$F6, $76, $A3,$56, $A0,$10,$66, $96,$96, $AD,$66
.byte $F6, $7F, $FF, $7F, $57, $75, $57
.byte $77, $55, $AF,$66, $99, $DD,$DD, $99, $A8,$66
.byte $F6, $7F, $F7, $7F, $A3,$77, $75, $57
.byte $75, $55,$55, $65, $AB,$66, $F6, $76, $56
.byte $66, $99, $DD,$DD, $99, $A8,$66, $6F, $F7
.byte $A3,$77, $57, $55,$55, $A3,$65, $AA,$66, $FF, $7F
.byte $FF, $77, $55, $65, $66,$66, $69,$69, $A0,$2B,$66
.byte $A7,$46, $A0,$1C,$66, $44, $A3,$66, $A9,$D4, $A0,$12,$66, $16
.byte $66, $F6, $66, $16, $A3,$66, $A3,$44, $66,$66
.byte $DD, $5D, $DD,$DD, $5D, $DD,$DD, $5D, $DD
.byte $66,$66, $86,$86, $46, $A8,$66, $D6,$D6, $A3,$66, $51
.byte $56, $5F, $56, $51, $66,$66, $64,$64, $84
.byte $64,$64, $66, $DD, $D5, $DD, $4D, $44
.byte $4D, $DD, $D5, $DD, $66, $86, $88
.byte $84, $44,$44, $A5,$66, $6D,$6D, $1D,$1D, $CC, $5C
.byte $A7,$55, $5C, $CC,$CC, $88, $A3,$CC, $DD, $5D
.byte $DD,$DD, $8D, $DD,$DD, $5D, $DD, $CC, $C8
.byte $88, $A3,$44, $C0, $08, $58, $50, $0C
.byte $CC,$CC, $11,$11, $CC, $1F, $FF, $A5,$1F, $FF
.byte $1F, $CC,$CC, $88, $A3,$CC, $DD, $D5, $DD,$DD
.byte $88, $DD,$DD, $D5, $DD, $CC,$CC, $C8,$C8, $C4
.byte $CC,$CC, $C0, $08, $58, $50, $05, $55
.byte $11, $10, $CC, $11, $FF, $10, $11
.byte $10, $11, $10, $FF, $11, $A0,$17,$CC, $00
.byte $08, $58, $50, $05, $51, $11, $CC
.byte $11, $FF, $10, $11, $88, $11, $10
.byte $FF, $11, $A0,$18,$CC, $00, $58,$58, $50, $00
.byte $51, $CC, $11, $7F, $71,$71, $78, $71,$71
.byte $7F, $11, $A0,$19,$CC, $00, $88,$88, $00, $05
.byte $CC, $A9,$C7, $A9,$CC, $A3,$5C, $AD,$CC, $C0, $05
.byte $85,$85, $00, $A0,$11,$CC, $5C, $E5, $A3,$EE, $E5
.byte $5C, $AC,$CC, $00, $58,$58, $50, $A0,$11,$CC, $FF
.byte $75,$75, $A4,$55, $AC,$CC, $C0, $00, $88,$88, $A0,$10,$CC
.byte $44,$44, $47,$47, $A3,$45, $44,$44, $AC,$CC, $00, $05
.byte $85, $A0,$10,$CC, $44, $D4, $9D, $D4, $44
.byte $34, $D3, $34, $44, $AD,$CC, $00, $08
.byte $AF,$CC, $A3,$44, $CD, $A3,$44, $C3, $A3,$44, $AC,$CC
.byte $C0, $00
.byte $A1
dining_rle: .byte $28 ; ysize=40
.byte $88, $A3,$98, $88,$88, $98, $88,$88, $98,$98, $88,$88
.byte $A3,$98, $88, $98,$98, $88, $A3,$98, $A4,$88, $98
.byte $88, $98, $88, $A3,$98, $88, $98, $88
.byte $98, $88, $98, $88,$88, $99, $88,$88, $99
.byte $88, $99, $88, $99, $98, $89, $88
.byte $99, $88, $98, $88, $99, $98, $88,$88
.byte $99, $A5,$88, $89, $98, $89, $88, $99
.byte $88, $99, $88, $99, $88, $99, $88
.byte $99, $88,$88, $99, $88,$88, $99, $89, $99
.byte $88, $99, $88, $99, $88, $99, $98
.byte $99, $88, $99, $98, $88,$88, $99, $A6,$88
.byte $99, $88,$88, $99, $98, $99, $88, $99
.byte $98, $99, $88, $99, $A5,$88, $08, $D8
.byte $08, $D8, $F8, $18, $F8, $18, $A7,$88
.byte $A3,$98, $88, $A3,$98, $88, $A3,$98, $88, $98
.byte $88,$88, $98, $88, $A3,$98, $A5,$88, $DD, $00
.byte $DD, $0D, $F1,$F1, $1F,$1F, $A7,$88, $99, $98
.byte $99, $88, $99, $88, $99, $88,$88, $99
.byte $88,$88, $99,$99, $98, $99, $88,$88, $99, $A6,$88
.byte $00, $DD, $00, $D0, $11, $FF, $11
.byte $FF, $A7,$88, $99, $A3,$88, $99, $98, $99
.byte $88, $98, $99, $98, $88, $99, $88
.byte $89, $99, $88,$88, $99, $A0,$2C,$88, $58,$58, $A8,$88
.byte $00, $B0, $A0,$1B,$88, $58, $55, $BB, $B8
.byte $A7,$88, $00, $BB, $8B, $88, $68, $A3,$88
.byte $78, $A3,$88, $08,$08, $A4,$88, $08,$08, $A9,$88, $85,$85
.byte $BB, $A3,$88, $66, $A4,$88, $00, $22, $88,$88
.byte $FF, $A3,$88, $77, $57,$57, $B7, $BB, $00
.byte $A3,$57, $B7, $BB, $00, $A7,$57, $A3,$08, $11,$11
.byte $08, $77, $66,$66, $77, $A4,$08, $22, $02
.byte $A3,$05, $08,$08, $77, $A3,$5A, $FB, $F0, $55
.byte $A3,$5A, $2B, $00, $A7,$5A, $A3,$00, $11,$11, $A4,$77
.byte $A5,$00, $52, $A7,$00, $0A,$0A, $7A, $7F,$7F, $75
.byte $7A, $6A, $72,$72, $70, $A3,$5A, $B8, $88
.byte $5A,$5A, $A3,$00, $81, $A4,$77, $A6,$00, $5A, $A7,$00
.byte $70, $87, $88,$88, $78, $77,$77, $99, $77,$77
.byte $66, $77, $70, $0B, $BB, $88, $A5,$00
.byte $A4,$57, $A7,$00, $08,$08, $A5,$00, $07, $AA,$77, $7F
.byte $77, $7B, $04, $44, $08, $70, $A4,$00
.byte $55, $88, $A0,$12,$00, $07, $87, $A7,$07, $87
.byte $07, $00, $20, $24, $00, $77, $A4,$00
.byte $55, $08,$08, $A0,$12,$00, $88, $A7,$00, $88, $00,$00
.byte $22, $77, $07, $77, $A4,$00, $55, $A0,$14,$00
.byte $08, $A7,$00, $08, $00, $08,$08, $07, $00
.byte $07, $A0,$79,$00
.byte $A1
metro_rle: .byte $28 ; ysize=40
.byte $A0,$1F,$66, $A9,$55, $A3,$66, $A4,$F6, $AA,$66, $11, $66
.byte $16,$16, $66, $76, $A8,$66, $55, $22,$22, $25,$25
.byte $A4,$55, $66,$66, $6F, $A4,$7F, $77, $A9,$66, $69,$69
.byte $19,$19, $69, $77, $A8,$66, $55, $A5,$22, $25
.byte $55,$55, $66,$66, $46, $A0,$1C,$66, $55, $A7,$22, $55
.byte $66, $46, $44, $46, $A8,$66, $A7,$86, $AC,$66
.byte $55, $A7,$22, $55, $C6, $C4, $84, $C4
.byte $A3,$C6, $76, $86,$86, $76, $C6, $55, $15
.byte $A3,$55, $15, $55, $C6, $AA,$56, $C6, $95
.byte $DD, $A6,$22, $55, $CC,$CC, $C8, $A3,$CC, $77
.byte $80,$80, $77, $CC,$CC, $55, $11, $51, $15
.byte $51, $11, $55, $AC,$CC, $55, $DD, $A6,$22
.byte $55, $A4,$CC, $7C, $77, $80,$80, $77, $FF,$FF
.byte $0C, $55, $51, $A3,$55, $51, $55, $AC,$0C
.byte $55, $DD, $A4,$D2, $22,$22, $55, $A3,$CC, $7C
.byte $77, $08,$08, $78, $F7, $FF, $0F, $A0,$14,$00
.byte $55, $0D, $DD,$DD, $0D, $A3,$02, $55, $CC,$CC
.byte $7C, $87, $A3,$80, $77, $FF, $0F, $00
.byte $55, $85, $A0,$14,$00, $99, $A5,$00, $55, $CC
.byte $7C, $07, $A3,$08, $77, $FF,$FF, $00,$00, $55
.byte $88, $08, $A0,$13,$00, $F9, $30,$30, $F0, $80,$80
.byte $55, $7C, $87, $A3,$80, $70, $F7, $1F
.byte $FF, $00,$00, $FF,$FF, $00, $80, $A0,$10,$00, $30
.byte $FF, $F0, $F3,$F3, $FF,$FF, $88, $55, $07
.byte $A3,$08, $78, $77, $FF, $F1, $FF, $00,$00
.byte $FF,$FF, $0F, $08, $A0,$10,$00, $0F, $A6,$FF, $88
.byte $55, $A4,$80, $77, $FF, $1F, $FF, $A3,$00
.byte $1F,$1F, $A0,$14,$00, $3F,$3F, $0F,$0F, $3F, $38, $55
.byte $A3,$08, $77, $F7, $FF, $F1, $0F, $A3,$00
.byte $11,$11, $A0,$1A,$00, $55, $00,$00, $70, $77, $A3,$FF
.byte $A4,$00, $11,$11, $A0,$17,$00, $80, $08, $89, $55
.byte $88,$88, $77, $FF, $11, $FF, $A5,$00, $A3,$88
.byte $A0,$16,$00, $08, $88,$88, $55, $00, $77, $F7
.byte $FF,$FF, $0F, $A0,$21,$00, $55, $70, $77, $A3,$FF
.byte $A0,$22,$00, $55, $77, $A3,$FF, $A0,$23,$00, $55
.byte $A1
talbot_rle: .byte $28 ; ysize=40
.byte $22, $66,$66, $77,$77, $FF, $AC,$77, $55, $00
.byte $66, $00,$00, $55, $AB,$77, $FF, $A4,$77, $A3,$66
.byte $77,$77, $FF, $AB,$77, $87, $55, $50,$50, $53,$53
.byte $55, $87, $AA,$77, $FF, $A4,$77, $A3,$66, $77,$77
.byte $FF, $A6,$77, $07, $00, $07, $77, $88,$88
.byte $A4,$85, $8C, $85, $88,$88, $77,$77, $87,$87, $A5,$77
.byte $FF, $A4,$77, $66, $33, $66, $77,$77, $FF
.byte $A6,$77, $88, $BB, $B7, $77, $88, $77
.byte $88, $77, $27,$27, $77, $88, $77, $88
.byte $77, $B7, $BB, $88, $A5,$77, $FF, $A4,$77
.byte $66,$66, $76, $77,$77, $FF, $A6,$77, $78, $1B
.byte $77,$77, $88, $87, $88, $57, $85,$85, $57
.byte $88, $87, $88, $77,$77, $5B, $78, $A5,$77
.byte $FF, $A4,$77, $66,$66, $77,$77, $FF, $A8,$0F, $11
.byte $1F, $BF, $58, $05,$05, $A4,$0F, $05, $5F
.byte $58, $BF, $5F, $55, $A5,$0F, $B8, $88
.byte $A4,$77, $66, $A3,$77, $44, $A8,$00, $41, $00,$00
.byte $88, $A8,$00, $88, $00,$00, $25, $A4,$00, $B7
.byte $B5, $88, $A4,$77, $66, $77,$77, $47, $C4
.byte $40, $00,$00, $55, $B5, $A3,$00, $44, $00,$00
.byte $08, $A6,$00, $90, $95, $08, $00,$00, $22
.byte $A5,$00, $2B, $00, $FF, $A3,$77, $66, $77,$77
.byte $44, $CC, $44, $80, $00, $55, $BB
.byte $0B, $00,$00, $08,$08, $A8,$00, $09, $99, $55
.byte $99, $09, $95, $A3,$00, $B0, $20, $22
.byte $00, $FF, $A5,$77, $44, $CC, $4C, $C4,$C4
.byte $40, $00, $4B, $40, $B0, $AC,$00, $99
.byte $00, $99, $00, $09, $A5,$00, $82, $00
.byte $FF, $A5,$77, $44, $4C, $C4, $CC, $4C
.byte $04, $00, $44, $A0,$18,$00, $88, $00, $FF
.byte $F7, $A4,$77, $84,$84, $8C,$8C, $44, $00,$00, $55
.byte $A0,$17,$00, $50, $58, $00,$00, $FF, $A4,$77, $88
.byte $44,$44, $88, $00, $80,$80, $05,$05, $A0,$18,$00, $5D
.byte $DD, $FF, $A4,$77, $88, $00,$00, $88, $00
.byte $88, $BB, $B0, $A0,$18,$00, $0B, $BB, $0D
.byte $FF, $A3,$77, $FF, $88, $80,$80, $88, $00
.byte $88, $4B, $A9,$00, $D0,$D0, $80,$80, $D0,$D0, $AB,$00
.byte $6B, $00, $0F, $FF, $77,$77, $FF, $A5,$00
.byte $88, $44, $04, $0B, $A5,$00, $D0, $DD
.byte $A6,$88, $DD, $D0, $A7,$00, $0B, $06, $66
.byte $00,$00, $FF, $77,$77, $FF, $A6,$00, $22, $A9,$00
.byte $A6,$0D, $AB,$00, $22, $00,$00, $FF, $77, $FF,$FF
.byte $A6,$00, $82, $80, $A0,$18,$00, $50, $52, $00,$00
.byte $0F, $F7, $FF, $0F, $A0,$25,$00, $FF,$FF, $A0,$26,$00, $FF
.byte $A1

View File

@ -1,19 +1,19 @@
;===========
; CONSTANTS
;===========
CONST_SHIPX EQU 15
CONST_TILE_W EQU 64
CONST_TILE_H EQU 64
CONST_MAP_MASK_X EQU (CONST_TILE_W - 1)
CONST_MAP_MASK_Y EQU (CONST_TILE_H - 1)
CONST_LOWRES_W EQU 40
CONST_LOWRES_H EQU 40
CONST_BETA_I EQU $ff
CONST_BETA_F EQU $80
CONST_SCALE_I EQU $14
CONST_SCALE_F EQU $00
CONST_LOWRES_HALF_I EQU $ec ; -(LOWRES_W/2)
CONST_LOWRES_HALF_F EQU $00
CONST_SHIPX = 15
CONST_TILE_W = 64
CONST_TILE_H = 64
CONST_MAP_MASK_X = (CONST_TILE_W - 1)
CONST_MAP_MASK_Y = (CONST_TILE_H - 1)
CONST_LOWRES_W = 40
CONST_LOWRES_H = 40
CONST_BETA_I = $ff
CONST_BETA_F = $80
CONST_SCALE_I = $14
CONST_SCALE_F = $00
CONST_LOWRES_HALF_I = $ec ; -(LOWRES_W/2)
CONST_LOWRES_HALF_F = $00
flying_start:
@ -1171,7 +1171,7 @@ water_map:
.byte $22,$22,$22,$22, $22,$22,$22,$22
.byte $22,$22,$22,$22, $ee,$22,$22,$22
.include "../asm_routines/multiply_fast.s"
.include "multiply_fast.s"
; 8.8 fixed point

View File

@ -31,16 +31,19 @@ show_map:
lda DRAW_PAGE
clc
adc #$4
sta BASH
lda #$00
sta BASL
adc #$4 ; page to load at?
; FIXME: really need to load at 0xc and
; copy
pha
lda #>(map_rle)
sta GBASH
lda #<(map_rle)
sta GBASL
jsr load_rle_gr
lda #<(map_lzsa)
sta getsrc_smc+1
lda #>(map_lzsa)
sta getsrc_smc+2
pla
jsr decompress_lzsa2_fast
; basic_plot(8+((map_x&0x3)*6)+(tfv_x/6),

View File

@ -5,27 +5,19 @@ title_screen:
;===========================
; Clear both bottoms
lda #$0
sta DRAW_PAGE
jsr clear_bottom
lda #$4
sta DRAW_PAGE
jsr clear_bottom
jsr clear_bottoms
;=============================
; Load title_rle
; Load title
lda #<(title_lzsa)
sta getsrc_smc+1
lda #>(title_lzsa)
sta getsrc_smc+2
lda #$0c
sta BASH
lda #$00
sta BASL ; load image off-screen 0xc00
lda #>(title_rle)
sta GBASH
lda #<(title_rle)
sta GBASL
jsr load_rle_gr
jsr decompress_lzsa2_fast
;=================================
; copy to both pages

View File

@ -766,11 +766,6 @@ load_map_bg:
; Set target for the background drawing
lda #$0c
sta BASH
lda #$00
sta BASL ; load image off-screen 0xc00
; Check for special cases
lda MAP_X
@ -778,33 +773,44 @@ map_harfco:
cmp #3 ; if map_x==3, harfco
bne map_landing
lda #>(harfco_rle)
sta GBASH
lda #<(harfco_rle)
sta GBASL
jsr load_rle_gr
lda #<(harfco_lzsa)
sta getsrc_smc+1
lda #>(harfco_lzsa)
sta getsrc_smc+2
lda #$c
jsr decompress_lzsa2_fast
rts
map_landing:
cmp #5 ; if map_x==5, landing site
bne map_collegep
lda #>(landing_rle)
sta GBASH
lda #<(landing_rle)
sta GBASL
jsr load_rle_gr
lda #<(landing_lzsa)
sta getsrc_smc+1
lda #>(landing_lzsa)
sta getsrc_smc+2
lda #$c
jsr decompress_lzsa2_fast
rts
map_collegep:
cmp #14 ; if map_x==14, collegep
bne map_custom
lda #>(collegep_rle)
sta GBASH
lda #<(collegep_rle)
sta GBASL
jsr load_rle_gr
lda #<(collegep_lzsa)
sta getsrc_smc+1
lda #>(collegep_lzsa)
sta getsrc_smc+2
lda #$c
jsr decompress_lzsa2_fast
rts
;============================

View File

@ -1,190 +1,193 @@
.define EQU =
;; Zero page monitor routines addresses
WNDLFT EQU $20
WNDWDTH EQU $21
WNDTOP EQU $22
WNDBTM EQU $23
CH EQU $24
CV EQU $25
GBASL EQU $26
GBASH EQU $27
BASL EQU $28
BASH EQU $29
H2 EQU $2C
V2 EQU $2D
MASK EQU $2E
COLOR EQU $30
INVFLG EQU $32
;; LZSA addresses
NIBCOUNT = $00
WNDLFT = $20
WNDWDTH = $21
WNDTOP = $22
WNDBTM = $23
CH = $24
CV = $25
GBASL = $26
GBASH = $27
BASL = $28
BASH = $29
H2 = $2C
V2 = $2D
MASK = $2E
COLOR = $30
INVFLG = $32
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
COLOR1 EQU $E0
COLOR2 EQU $E1
MATCH EQU $E2
XX EQU $E3
YY EQU $E4
YADD EQU $E5
LOOP EQU $E6
MEMPTRL EQU $E7
MEMPTRH EQU $E8
NAMEL EQU $E9
NAMEH EQU $EA
NAMEX EQU $EB
CHAR EQU $EC
DISP_PAGE EQU $ED
DRAW_PAGE EQU $EE
COLOR1 = $E0
COLOR2 = $E1
MATCH = $E2
XX = $E3
YY = $E4
YADD = $E5
LOOP = $E6
MEMPTRL = $E7
MEMPTRH = $E8
NAMEL = $E9
NAMEH = $EA
NAMEX = $EB
CHAR = $EC
DISP_PAGE = $ED
DRAW_PAGE = $EE
FIRST EQU $F0
LASTKEY EQU $F1
PADDLE_STATUS EQU $F2
XPOS EQU $F3
YPOS EQU $F4
TEMP EQU $FA
RUN EQU $FA
TEMP2 EQU $FB
TEMPY EQU $FB
INL EQU $FC
INH EQU $FD
OUTL EQU $FE
OUTH EQU $FF
FIRST = $F0
LASTKEY = $F1
PADDLE_STATUS = $F2
XPOS = $F3
YPOS = $F4
TEMP = $FA
RUN = $FA
TEMP2 = $FB
TEMPY = $FB
INL = $FC
INH = $FD
OUTL = $FE
OUTH = $FF
;; Flying Routine Only
TURNING EQU $60
;SCREEN_X EQU $61 ; not used?
SCREEN_Y EQU $62
ANGLE EQU $63
HORIZ_SCALE_I EQU $64
HORIZ_SCALE_F EQU $65
FACTOR_I EQU $66
FACTOR_F EQU $67
DX_I EQU $68
DX_F EQU $69
SPACEX_I EQU $6A
SPACEX_F EQU $6B
CX_I EQU $6C
CX_F EQU $6D
DY_I EQU $6E
DY_F EQU $6F
SPACEY_I EQU $70
SPACEY_F EQU $71
CY_I EQU $72
CY_F EQU $73
TEMP_I EQU $74
TEMP_F EQU $75
DISTANCE_I EQU $76
DISTANCE_F EQU $77
SPACEZ_I EQU $78
SPACEZ_F EQU $79
DRAW_SPLASH EQU $7A
SPEED EQU $7B
SPLASH_COUNT EQU $7C
OVER_LAND EQU $7D
NUM1L EQU $7E
NUM1H EQU $7F
NUM2L EQU $80
NUM2H EQU $81
RESULT EQU $82 ; 83,84,85
NEGATE EQU $86 ; UNUSED?
LAST_SPACEX_I EQU $87
LAST_SPACEY_I EQU $88
LAST_MAP_COLOR EQU $89
DRAW_SKY EQU $8A
COLOR_MASK EQU $8B
TURNING = $60
;SCREEN_X = $61 ; not used?
SCREEN_Y = $62
ANGLE = $63
HORIZ_SCALE_I = $64
HORIZ_SCALE_F = $65
FACTOR_I = $66
FACTOR_F = $67
DX_I = $68
DX_F = $69
SPACEX_I = $6A
SPACEX_F = $6B
CX_I = $6C
CX_F = $6D
DY_I = $6E
DY_F = $6F
SPACEY_I = $70
SPACEY_F = $71
CY_I = $72
CY_F = $73
TEMP_I = $74
TEMP_F = $75
DISTANCE_I = $76
DISTANCE_F = $77
SPACEZ_I = $78
SPACEZ_F = $79
DRAW_SPLASH = $7A
SPEED = $7B
SPLASH_COUNT = $7C
OVER_LAND = $7D
NUM1L = $7E
NUM1H = $7F
NUM2L = $80
NUM2H = $81
RESULT = $82 ; 83,84,85
NEGATE = $86 ; UNUSED?
LAST_SPACEX_I = $87
LAST_SPACEY_I = $88
LAST_MAP_COLOR = $89
DRAW_SKY = $8A
COLOR_MASK = $8B
SHIPY EQU $E4
SHIPY = $E4
;; World Map Only
ODD EQU $7B
DIRECTION EQU $7C
REFRESH EQU $7D
ON_BIRD EQU $7E
MOVED EQU $7F
STEPS EQU $80
TFV_X EQU $81
TFV_Y EQU $82
NEWX EQU $83
NEWY EQU $84
MAP_X EQU $85
GROUND_COLOR EQU $86
ODD = $7B
DIRECTION = $7C
REFRESH = $7D
ON_BIRD = $7E
MOVED = $7F
STEPS = $80
TFV_X = $81
TFV_Y = $82
NEWX = $83
NEWY = $84
MAP_X = $85
GROUND_COLOR = $86
.if 0
KEYPRESS EQU $C000
KEYRESET EQU $C010
KEYPRESS = $C000
KEYRESET = $C010
;; SOFT SWITCHES
SET_GR EQU $C050
SET_TEXT EQU $C051
FULLGR EQU $C052
TEXTGR EQU $C053
PAGE0 EQU $C054
PAGE1 EQU $C055
LORES EQU $C056
HIRES EQU $C057
SET_GR = $C050
SET_TEXT = $C051
FULLGR = $C052
TEXTGR = $C053
PAGE0 = $C054
PAGE1 = $C055
LORES = $C056
HIRES = $C057
PADDLE_BUTTON0 EQU $C061
PADDL0 EQU $C064
PTRIG EQU $C070
PADDLE_BUTTON0 = $C061
PADDL0 = $C064
PTRIG = $C070
;; BASIC ROUTINES
NORMAL EQU $F273
NORMAL = $F273
;; MONITOR ROUTINES
HLINE EQU $F819 ;; HLINE Y,$2C at A
VLINE EQU $F828 ;; VLINE A,$2D at Y
CLRSCR EQU $F832 ;; Clear low-res screen
CLRTOP EQU $F836 ;; clear only top of low-res screen
SETCOL EQU $F864 ;; COLOR=A
TEXT EQU $FB36
TABV EQU $FB5B ;; VTAB to A
BASCALC EQU $FBC1 ;;
VTAB EQU $FC22 ;; VTAB to CV
HOME EQU $FC58 ;; Clear the text screen
WAIT EQU $FCA8 ;; delay 1/2(26+27A+5A^2) us
SETINV EQU $FE80 ;; INVERSE
SETNORM EQU $FE84 ;; NORMAL
COUT EQU $FDED ;; output A to screen
COUT1 EQU $FDF0 ;; output A to screen
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
TEXT = $FB36
TABV = $FB5B ;; VTAB to A
BASCALC = $FBC1 ;;
VTAB = $FC22 ;; VTAB to CV
HOME = $FC58 ;; Clear the text screen
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
SETINV = $FE80 ;; INVERSE
SETNORM = $FE84 ;; NORMAL
COUT = $FDED ;; output A to screen
COUT1 = $FDF0 ;; output A to screen
COLOR_BLACK EQU 0
COLOR_RED EQU 1
COLOR_DARKBLUE EQU 2
COLOR_PURPLE EQU 3
COLOR_DARKGREEN EQU 4
COLOR_GREY EQU 5
COLOR_MEDIUMBLUE EQU 6
COLOR_LIGHTBLUE EQU 7
COLOR_BROWN EQU 8
COLOR_ORANGE EQU 9
COLOR_GREY2 EQU 10
COLOR_PINK EQU 11
COLOR_LIGHTGREEN EQU 12
COLOR_YELLOW EQU 13
COLOR_AQUA EQU 14
COLOR_WHITE EQU 15
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_RED EQU $11
COLOR_BOTH_DARKBLUE EQU $22
COLOR_BOTH_DARKGREEN EQU $44
COLOR_BOTH_GREY EQU $55
COLOR_BOTH_MEDIUMBLUE EQU $66
COLOR_BOTH_LIGHTBLUE EQU $77
COLOR_BOTH_BROWN EQU $88
COLOR_BOTH_ORANGE EQU $99
COLOR_BOTH_LIGHTGREEN EQU $CC
COLOR_BOTH_YELLOW EQU $DD
COLOR_BOTH_WHITE EQU $FF
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_LIGHTGREEN = $CC
COLOR_BOTH_YELLOW = $DD
COLOR_BOTH_WHITE = $FF
.endif