mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-11-03 14:05:58 +00:00
mist: some work on lores part
This commit is contained in:
parent
4732a8c5c7
commit
bf6beefc21
@ -8,10 +8,11 @@ B2D = ../bmp2dhr/b2d
|
||||
|
||||
all: mist.dsk
|
||||
|
||||
mist.dsk: HELLO MIST MIST_TITLE.LZ4
|
||||
mist.dsk: HELLO MIST MIST_TITLE MIST_TITLE.LZ4
|
||||
cp empty.dsk mist.dsk
|
||||
$(DOS33) -y mist.dsk SAVE A HELLO
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x1000 MIST
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x1000 MIST_TITLE
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0xa000 MIST_TITLE.LZ4
|
||||
|
||||
###
|
||||
@ -21,15 +22,31 @@ HELLO: hello.bas
|
||||
|
||||
####
|
||||
|
||||
MIST_TITLE: mist_title.o
|
||||
ld65 -o MIST_TITLE mist_title.o -C ../linker_scripts/apple2_1000.inc
|
||||
|
||||
mist_title.o: mist_title.s zp.inc hardware.inc
|
||||
#gr_copy.s gr_unrle.s gr_unrle_large.s gr_copy_large.s
|
||||
ca65 -o mist_title.o mist_title.s -l mist_title.lst
|
||||
|
||||
####
|
||||
|
||||
MIST: mist.o
|
||||
ld65 -o MIST mist.o -C ../linker_scripts/apple2_1000.inc
|
||||
|
||||
mist.o: mist.s zp.inc hardware.inc
|
||||
mist.o: mist.s zp.inc hardware.inc \
|
||||
mist_graphics.inc
|
||||
#gr_copy.s gr_unrle.s gr_unrle_large.s gr_copy_large.s
|
||||
ca65 -o mist.o mist.s -l mist.lst
|
||||
|
||||
####
|
||||
|
||||
mist_graphics.inc: \
|
||||
m_link_book.png
|
||||
$(PNG2RLE) asm m_link_book.png link_book_rle > mist_graphics.inc
|
||||
|
||||
####
|
||||
|
||||
MIST_TITLE.LZ4: MIST_TITLEC.BIN
|
||||
lz4 -f -16 MIST_TITLEC.BIN
|
||||
dd if=MIST_TITLEC.BIN.lz4 of=MIST_TITLE.LZ4 bs=1 skip=11
|
||||
@ -41,4 +58,4 @@ MIST_TITLEC.BIN: mist_title.bmp
|
||||
####
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst MIST_TITLEC.BIN MIST
|
||||
rm -f *~ *.o *.lst MIST_TITLEC.BIN MIST MIST_TITLE
|
||||
|
161
mist/gr_copy.s
Normal file
161
mist/gr_copy.s
Normal file
@ -0,0 +1,161 @@
|
||||
;=========================================================
|
||||
; gr_copy_to_current, 40x48 version
|
||||
;=========================================================
|
||||
; copy 0xc00 to DRAW_PAGE
|
||||
;
|
||||
; 45 + 2 + 120*(8*9 + 5) -1 + 6 = 9292
|
||||
;.align $100
|
||||
gr_copy_to_current:
|
||||
|
||||
lda DRAW_PAGE ; 3
|
||||
clc ; 2
|
||||
adc #$4 ; 2
|
||||
sta gr_copy_line+5 ; 4
|
||||
sta gr_copy_line+11 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line+17 ; 4
|
||||
sta gr_copy_line+23 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line+29 ; 4
|
||||
sta gr_copy_line+35 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line+41 ; 4
|
||||
sta gr_copy_line+47 ; 4
|
||||
;===========
|
||||
; 45
|
||||
|
||||
ldy #119 ; for early ones, copy 120 bytes ; 2
|
||||
|
||||
gr_copy_line:
|
||||
lda $C00,Y ; load a byte (self modified) ; 4
|
||||
sta $400,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $C80,Y ; load a byte (self modified) ; 4
|
||||
sta $480,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $D00,Y ; load a byte (self modified) ; 4
|
||||
sta $500,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $D80,Y ; load a byte (self modified) ; 4
|
||||
sta $580,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $E00,Y ; load a byte (self modified) ; 4
|
||||
sta $600,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $E80,Y ; load a byte (self modified) ; 4
|
||||
sta $680,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $F00,Y ; load a byte (self modified) ; 4
|
||||
sta $700,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $F80,Y ; load a byte (self modified) ; 4
|
||||
sta $780,Y ; store a byte (self modified) ; 5
|
||||
|
||||
dey ; decrement pointer ; 2
|
||||
bpl gr_copy_line ; ; 2nt/3
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
||||
;=========================================================
|
||||
; gr_copy_to_current, 40x48 version
|
||||
;=========================================================
|
||||
; copy 0x1000 to DRAW_PAGE
|
||||
|
||||
gr_copy_to_current_1000:
|
||||
|
||||
lda DRAW_PAGE ; 3
|
||||
clc ; 2
|
||||
adc #$4 ; 2
|
||||
sta gr_copy_line_40+5 ; 4
|
||||
sta gr_copy_line_40+11 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line_40+17 ; 4
|
||||
sta gr_copy_line_40+23 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line_40+29 ; 4
|
||||
sta gr_copy_line_40+35 ; 4
|
||||
adc #$1 ; 2
|
||||
sta gr_copy_line_40+41 ; 4
|
||||
sta gr_copy_line_40+47 ; 4
|
||||
;===========
|
||||
; 45
|
||||
|
||||
ldy #119 ; for early ones, copy 120 bytes ; 2
|
||||
|
||||
gr_copy_line_40:
|
||||
lda $1000,Y ; load a byte (self modified) ; 4
|
||||
sta $400,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1080,Y ; load a byte (self modified) ; 4
|
||||
sta $480,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1100,Y ; load a byte (self modified) ; 4
|
||||
sta $500,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1180,Y ; load a byte (self modified) ; 4
|
||||
sta $580,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1200,Y ; load a byte (self modified) ; 4
|
||||
sta $600,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1280,Y ; load a byte (self modified) ; 4
|
||||
sta $680,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1300,Y ; load a byte (self modified) ; 4
|
||||
sta $700,Y ; store a byte (self modified) ; 5
|
||||
|
||||
lda $1380,Y ; load a byte (self modified) ; 4
|
||||
sta $780,Y ; store a byte (self modified) ; 5
|
||||
|
||||
dey ; decrement pointer ; 2
|
||||
bpl gr_copy_line_40 ; ; 2nt/3
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
||||
;=========================================================
|
||||
; gr_copy_to_current_40x40
|
||||
;=========================================================
|
||||
; Take image in 0xc00
|
||||
; Copy to DRAW_PAGE
|
||||
; Actually copy lines 0..39
|
||||
; Don't over-write bottom 4 lines of text
|
||||
gr_copy_to_current_40x40:
|
||||
|
||||
ldx #0
|
||||
gc_40x40_loop:
|
||||
lda gr_offsets,x
|
||||
sta OUTL
|
||||
sta INL
|
||||
lda gr_offsets+1,x
|
||||
clc
|
||||
adc DRAW_PAGE
|
||||
sta OUTH
|
||||
|
||||
lda gr_offsets+1,x
|
||||
clc
|
||||
adc #$8
|
||||
sta INH
|
||||
|
||||
ldy #39
|
||||
gc_40x40_inner:
|
||||
lda (INL),Y
|
||||
sta (OUTL),Y
|
||||
|
||||
dey
|
||||
bpl gc_40x40_inner
|
||||
|
||||
inx
|
||||
inx
|
||||
|
||||
cpx #40
|
||||
bne gc_40x40_loop
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
||||
|
5
mist/gr_offsets.s
Normal file
5
mist/gr_offsets.s
Normal file
@ -0,0 +1,5 @@
|
||||
gr_offsets:
|
||||
.word $400,$480,$500,$580,$600,$680,$700,$780
|
||||
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
||||
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
||||
|
24
mist/gr_pageflip.s
Normal file
24
mist/gr_pageflip.s
Normal file
@ -0,0 +1,24 @@
|
||||
;==========
|
||||
; page_flip
|
||||
;==========
|
||||
|
||||
page_flip:
|
||||
lda DISP_PAGE ; 3
|
||||
beq page_flip_show_1 ; 2nt/3
|
||||
page_flip_show_0:
|
||||
bit PAGE0 ; 4
|
||||
lda #4 ; 2
|
||||
sta DRAW_PAGE ; DRAW_PAGE=1 ; 3
|
||||
lda #0 ; 2
|
||||
sta DISP_PAGE ; DISP_PAGE=0 ; 3
|
||||
rts ; 6
|
||||
page_flip_show_1:
|
||||
bit PAGE1 ; 4
|
||||
sta DRAW_PAGE ; DRAW_PAGE=0 ; 3
|
||||
lda #1 ; 2
|
||||
sta DISP_PAGE ; DISP_PAGE=1 ; 3
|
||||
rts ; 6
|
||||
;====================
|
||||
; DISP_PAGE=0 26
|
||||
; DISP_PAGE=1 24
|
||||
|
353
mist/gr_putsprite_crop.s
Normal file
353
mist/gr_putsprite_crop.s
Normal file
@ -0,0 +1,353 @@
|
||||
;=============================================
|
||||
; put_sprite_crop
|
||||
;=============================================
|
||||
; Sprite to display in INH,INL
|
||||
; Location is XPOS,YPOS
|
||||
; Note, only works if YPOS is multiple of two
|
||||
|
||||
; transparent color is $A (grey #2)
|
||||
; this means we can have black ($0) in a sprite
|
||||
|
||||
; FIXME: force YPOS to be even?
|
||||
|
||||
put_sprite_crop:
|
||||
|
||||
ldy #0 ; byte 0 is xsize ; 2
|
||||
lda (INL),Y ; 5
|
||||
sta CH ; xsize is in CH ; 3
|
||||
iny ; 2
|
||||
clc
|
||||
adc XPOS
|
||||
sta XMAX
|
||||
|
||||
lda (INL),Y ; byte 1 is ysize ; 5
|
||||
sta CV ; ysize is in CV ; 3
|
||||
iny ; 2
|
||||
|
||||
lda YPOS ; make a copy of ypos ; 3
|
||||
sta TEMPY ; as we modify it ; 3
|
||||
;===========
|
||||
; 28
|
||||
put_sprite_crop_loop:
|
||||
sty TEMP ; save sprite pointer ; 3
|
||||
ldy TEMPY ; 3
|
||||
|
||||
bpl put_sprite_crop_pos ; if < 0, skip to next
|
||||
|
||||
clc ; skip line in sprite too
|
||||
lda TEMP
|
||||
adc CH
|
||||
tay
|
||||
|
||||
bne crop_increment_y
|
||||
|
||||
put_sprite_crop_pos:
|
||||
cpy #48 ; bge if >= 48, done sprite
|
||||
bcs crop_sprite_done
|
||||
|
||||
|
||||
lda gr_offsets,Y ; lookup low-res memory address ; 4
|
||||
clc ; 2
|
||||
adc XPOS ; add in xpos ; 3
|
||||
sta OUTL ; store out low byte of addy ; 3
|
||||
clc ; never wraps, handle negative
|
||||
lda gr_offsets+1,Y ; look up high byte ; 4
|
||||
adc DRAW_PAGE ; ; 3
|
||||
sta OUTH ; and store it out ; 3
|
||||
ldy TEMP ; restore sprite pointer ; 3
|
||||
|
||||
; OUTH:OUTL now points at right place
|
||||
|
||||
ldx XPOS ; load xposition into x ; 3
|
||||
;===========
|
||||
; 34
|
||||
crop_put_sprite_pixel:
|
||||
lda (INL),Y ; get sprite colors ; 5
|
||||
iny ; increment sprite pointer ; 2
|
||||
sty TEMP ; save sprite pointer ; 3
|
||||
|
||||
|
||||
cpx #0 ; if off-screen left, skip draw
|
||||
bmi skip_drawing
|
||||
cpx #40
|
||||
bcs skip_drawing ; if off-screen right, skip draw
|
||||
|
||||
ldy #$0 ; 2
|
||||
|
||||
; check if completely transparent
|
||||
; if so, skip
|
||||
|
||||
cmp #$aa ; if all zero, transparent ; 2
|
||||
beq crop_put_sprite_done_draw ; don't draw it ; 2nt/3
|
||||
;==============
|
||||
; 16/17
|
||||
|
||||
sta COLOR ; save color for later ; 3
|
||||
|
||||
; check if top pixel transparent
|
||||
|
||||
and #$f0 ; check if top nibble zero ; 2
|
||||
cmp #$a0
|
||||
bne crop_put_sprite_bottom ; if not skip ahead ; 2nt/3
|
||||
;==============
|
||||
; 7/8
|
||||
|
||||
lda COLOR
|
||||
and #$0f
|
||||
sta COLOR
|
||||
|
||||
lda #$f0 ; setup mask ; 2
|
||||
sta MASK ; 3
|
||||
bmi crop_put_sprite_mask ; always? ; 3
|
||||
;=============
|
||||
; 8
|
||||
|
||||
crop_put_sprite_bottom:
|
||||
lda COLOR ; re-load color ; 3
|
||||
and #$0f ; check if bottom nibble zero ; 2
|
||||
cmp #$0a
|
||||
bne crop_put_sprite_all ; if not, skip ahead ; 2nt/3
|
||||
;=============
|
||||
; 7/8
|
||||
|
||||
lda COLOR
|
||||
and #$f0
|
||||
sta COLOR
|
||||
lda #$0f ; 2
|
||||
sta MASK ; setup mask ; 3
|
||||
;===========
|
||||
; 5
|
||||
|
||||
crop_put_sprite_mask:
|
||||
lda (OUTL),Y ; get color at output ; 5
|
||||
and MASK ; mask off unneeded part ; 3
|
||||
ora COLOR ; or the color in ; 3
|
||||
sta (OUTL),Y ; store it back ; 6
|
||||
|
||||
jmp crop_put_sprite_done_draw ; we are done ; 3
|
||||
;===========
|
||||
; 20
|
||||
|
||||
crop_put_sprite_all:
|
||||
lda COLOR ; load color ; 3
|
||||
sta (OUTL),Y ; and write it out ; 6
|
||||
;============
|
||||
; 9
|
||||
|
||||
crop_put_sprite_done_draw:
|
||||
skip_drawing:
|
||||
|
||||
ldy TEMP ; restore sprite pointer ; 3
|
||||
|
||||
inc OUTL ; increment output pointer ; 5
|
||||
inx ; increment x counter ; 2
|
||||
cpx XMAX
|
||||
bne crop_put_sprite_pixel ; if not done, keep looping ; 2nt/3
|
||||
;==============
|
||||
; 12/13
|
||||
crop_increment_y:
|
||||
|
||||
inc TEMPY ; each line has two y vars ; 5
|
||||
inc TEMPY ; 5
|
||||
dec CV ; decemenet total y count ; 5
|
||||
bne put_sprite_crop_loop ; loop if not done ; 2nt/3
|
||||
;==============
|
||||
; 17/18
|
||||
crop_sprite_done:
|
||||
rts ; return ; 6
|
||||
|
||||
|
||||
|
||||
; 0,0 = 400+0
|
||||
; -1,0 = 400+ff=4ff, inc=400
|
||||
|
||||
; sprite: 5x4
|
||||
;
|
||||
; -2,0 Xstart=0, sprite_offset=2, xsize=3
|
||||
; -1,0, Xstart=0, sprite_offset=1, xsize=4
|
||||
; 0,0, Xstrat=0, sprite_offset=0, xsize=5
|
||||
; 1,0, Xstart=1, sprite_offset=0, xsize=5
|
||||
;
|
||||
; 39,0 Xstart=39, sprite_offset=0, xsize=1
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
|
||||
;=============================================
|
||||
; put_sprite_flipped_crop
|
||||
;=============================================
|
||||
; Sprite to display in INH,INL
|
||||
; Location is XPOS,YPOS
|
||||
; Note, only works if YPOS is multiple of two
|
||||
|
||||
; transparent color is $A (grey #2)
|
||||
; this means we can have black ($0) in a sprite
|
||||
|
||||
|
||||
put_sprite_flipped_crop:
|
||||
|
||||
ldy #0 ; byte 0 is xsize ; 2
|
||||
lda (INL),Y ; 5
|
||||
sta CH ; xsize is in CH ; 3
|
||||
iny ; 2
|
||||
|
||||
|
||||
lda (INL),Y ; byte 1 is ysize ; 5
|
||||
sta CV ; ysize is in CV ; 3
|
||||
dey ; make Y zero again ; 2
|
||||
|
||||
lda INH ; ???
|
||||
sta ppfc_smc+2
|
||||
clc
|
||||
lda INL
|
||||
adc #1 ; add one (not two) because X counts
|
||||
; from CH to 1 (not CH-1 to 0)
|
||||
sta ppfc_smc+1
|
||||
bcc psfc16
|
||||
inc ppfc_smc+2
|
||||
psfc16:
|
||||
|
||||
|
||||
lda YPOS ; make a copy of ypos ; 3
|
||||
|
||||
sta TEMPY ; as we modify it ; 3
|
||||
;===========
|
||||
; 28
|
||||
|
||||
|
||||
|
||||
put_spritefc_loop:
|
||||
; sty TEMP ; save sprite pointer ; 3
|
||||
ldy TEMPY ; 3
|
||||
|
||||
bmi fcrop_increment_y ; if < 0, skip to next
|
||||
cpy #48 ; bge if >= 48, done sprite
|
||||
bcs fcrop_sprite_done
|
||||
|
||||
|
||||
lda gr_offsets,Y ; lookup low-res memory address ; 4
|
||||
clc ; 2
|
||||
adc XPOS ; add in xpos ; 3
|
||||
sta OUTL ; store out low byte of addy ; 3
|
||||
lda gr_offsets+1,Y ; look up high byte ; 4
|
||||
clc
|
||||
adc DRAW_PAGE ; ; 3
|
||||
sta OUTH ; and store it out ; 3
|
||||
; ldy TEMP ; restore sprite pointer ; 3
|
||||
|
||||
; OUTH:OUTL now points at right place
|
||||
|
||||
ldx CH ; load xsize into x ; 3
|
||||
;===========
|
||||
; 34
|
||||
put_spritefc_pixel:
|
||||
|
||||
clc
|
||||
txa ; want (CH-X-1)+XPOS
|
||||
eor #$ff
|
||||
adc CH
|
||||
adc XPOS
|
||||
|
||||
bmi cskip_drawing
|
||||
cmp #40
|
||||
|
||||
bcs cskip_drawing ; if off-screen right, skip draw
|
||||
|
||||
ppfc_smc:
|
||||
lda $C000,X ; get sprite colors ; 5
|
||||
; iny ; increment sprite pointer ; 2
|
||||
; sty TEMP ; save sprite pointer ; 3
|
||||
ldy #$0 ; 2
|
||||
|
||||
; check if completely transparent
|
||||
; if so, skip
|
||||
|
||||
cmp #$aa ; if all zero, transparent ; 2
|
||||
beq put_spritefc_done_draw ; don't draw it ; 2nt/3
|
||||
;==============
|
||||
; 16/17
|
||||
|
||||
sta COLOR ; save color for later ; 3
|
||||
|
||||
; check if top pixel transparent
|
||||
|
||||
and #$f0 ; check if top nibble zero ; 2
|
||||
cmp #$a0
|
||||
bne put_spritefc_bottom ; if not skip ahead ; 2nt/3
|
||||
;==============
|
||||
; 7/8
|
||||
|
||||
lda COLOR
|
||||
and #$0f
|
||||
sta COLOR
|
||||
|
||||
lda #$f0 ; setup mask ; 2
|
||||
sta MASK ; 3
|
||||
bmi put_spritefc_mask ; always? ; 3
|
||||
;=============
|
||||
; 8
|
||||
|
||||
put_spritefc_bottom:
|
||||
lda COLOR ; re-load color ; 3
|
||||
and #$0f ; check if bottom nibble zero ; 2
|
||||
cmp #$0a
|
||||
bne put_spritefc_all ; if not, skip ahead ; 2nt/3
|
||||
;=============
|
||||
; 7/8
|
||||
|
||||
lda COLOR
|
||||
and #$f0
|
||||
sta COLOR
|
||||
lda #$0f ; 2
|
||||
sta MASK ; setup mask ; 3
|
||||
;===========
|
||||
; 5
|
||||
|
||||
put_spritefc_mask:
|
||||
lda (OUTL),Y ; get color at output ; 5
|
||||
and MASK ; mask off unneeded part ; 3
|
||||
ora COLOR ; or the color in ; 3
|
||||
sta (OUTL),Y ; store it back ; 6
|
||||
|
||||
jmp put_spritefc_done_draw ; we are done ; 3
|
||||
;===========
|
||||
; 20
|
||||
|
||||
put_spritefc_all:
|
||||
lda COLOR ; load color ; 3
|
||||
sta (OUTL),Y ; and write it out ; 6
|
||||
;============
|
||||
; 9
|
||||
|
||||
put_spritefc_done_draw:
|
||||
cskip_drawing:
|
||||
; ldy TEMP ; restore sprite pointer ; 3
|
||||
|
||||
inc OUTL ; increment output pointer ; 5
|
||||
dex ; decrement x counter ; 2
|
||||
bne put_spritefc_pixel ; if not done, keep looping ; 2nt/3
|
||||
;==============
|
||||
; 12/13
|
||||
fcrop_increment_y:
|
||||
inc TEMPY ; each line has two y vars ; 5
|
||||
inc TEMPY ; 5
|
||||
|
||||
lda CH
|
||||
clc
|
||||
adc ppfc_smc+1
|
||||
sta ppfc_smc+1
|
||||
bcc psfco
|
||||
inc ppfc_smc+2
|
||||
psfco:
|
||||
|
||||
dec CV ; decemenet total y count ; 5
|
||||
beq fcrop_sprite_done ; loop if not done ; 2nt/3
|
||||
jmp put_spritefc_loop
|
||||
;==============
|
||||
; 17/18
|
||||
|
||||
fcrop_sprite_done:
|
||||
rts ; return ; 6
|
||||
|
||||
|
112
mist/gr_unrle.s
Normal file
112
mist/gr_unrle.s
Normal file
@ -0,0 +1,112 @@
|
||||
;=================
|
||||
; load RLE image
|
||||
;=================
|
||||
; Output is A:00 (assume page aligned)
|
||||
; Input is in GBASH/GBASL
|
||||
|
||||
; format: first byte=xsize
|
||||
; A0,X,Y means run of X bytes of Y color
|
||||
; A1 means end of file
|
||||
; A2-AF,X means run of low nibble, X color
|
||||
; if high nibble not A: just display color
|
||||
|
||||
; CV = current Y
|
||||
; CH = max xsize (usually 40)
|
||||
; TEMP = page
|
||||
; TEMPY= current X
|
||||
|
||||
|
||||
load_rle_gr:
|
||||
sec
|
||||
sbc #4 ; adjust page to write to
|
||||
; to match gr_offsets
|
||||
sta TEMP
|
||||
|
||||
ldy #$0 ; init Y to 0
|
||||
sty CV
|
||||
|
||||
jsr load_and_increment ; load xsize
|
||||
sta CH
|
||||
|
||||
jsr unrle_new_y
|
||||
|
||||
|
||||
rle_loop:
|
||||
jsr load_and_increment
|
||||
|
||||
tax
|
||||
|
||||
cmp #$A1 ; if 0xa1
|
||||
beq rle_done ; we are done
|
||||
|
||||
and #$f0 ; mask
|
||||
cmp #$a0 ; see if special AX
|
||||
beq decompress_special
|
||||
|
||||
; not special, just color
|
||||
|
||||
txa ; put color back in A
|
||||
ldx #$1 ; only want to print 1
|
||||
bne decompress_run
|
||||
|
||||
decompress_special:
|
||||
txa ; put read value back in A
|
||||
|
||||
and #$0f ; check if was A0
|
||||
|
||||
bne decompress_color ; if A0 need to read run, color
|
||||
|
||||
decompress_large:
|
||||
jsr load_and_increment ; run length now in A
|
||||
|
||||
decompress_color:
|
||||
tax ; put runlen into X
|
||||
jsr load_and_increment ; get color into A
|
||||
|
||||
decompress_run:
|
||||
rle_run_loop:
|
||||
sta (BASL),y ; write out the value
|
||||
inc BASL
|
||||
dec TEMPY
|
||||
bne rle_not_eol ; if less then keep going
|
||||
|
||||
; if here, we are > max_X
|
||||
|
||||
inc CV
|
||||
inc CV
|
||||
pha
|
||||
jsr unrle_new_y
|
||||
pla
|
||||
|
||||
rle_not_eol:
|
||||
dex
|
||||
bne rle_run_loop ; if not zero, keep looping
|
||||
|
||||
beq rle_loop ; and branch always
|
||||
|
||||
rle_done:
|
||||
lda #$15 ; move the cursor somewhere sane
|
||||
sta CV
|
||||
rts
|
||||
|
||||
|
||||
load_and_increment:
|
||||
lda (GBASL),Y
|
||||
inc GBASL
|
||||
bne lai_no_oflo
|
||||
inc GBASH
|
||||
lai_no_oflo:
|
||||
rts
|
||||
|
||||
unrle_new_y:
|
||||
ldy CV
|
||||
lda gr_offsets,Y
|
||||
sta BASL
|
||||
lda gr_offsets+1,Y
|
||||
clc
|
||||
adc TEMP ; adjust for page
|
||||
sta BASH
|
||||
lda CH
|
||||
sta TEMPY
|
||||
ldy #0
|
||||
rts
|
BIN
mist/m_link_book.png
Normal file
BIN
mist/m_link_book.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 757 B |
234
mist/mist.s
234
mist/mist.s
@ -19,82 +19,184 @@ mist_start:
|
||||
|
||||
bit SET_GR
|
||||
bit PAGE0
|
||||
bit HIRES
|
||||
; bit HIRES
|
||||
bit FULLGR
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
|
||||
;===================
|
||||
; Init RTS disk code
|
||||
;===================
|
||||
|
||||
jsr rts_init
|
||||
|
||||
;===================
|
||||
; Load graphics
|
||||
;===================
|
||||
reload_everything:
|
||||
; load MIST_TITLE.LZ4 to $a000
|
||||
; then decompress it to $2000 (HGR PAGE0)
|
||||
|
||||
lda #<mist_title_filename
|
||||
sta OUTL
|
||||
lda #>mist_title_filename
|
||||
sta OUTH
|
||||
jsr opendir_filename ; open and read entire file into memory
|
||||
|
||||
; size in ldsizeh:ldsizel (f1/f0)
|
||||
|
||||
clc
|
||||
lda #<($a000)
|
||||
sta LZ4_SRC
|
||||
adc ldsizel
|
||||
sta LZ4_END
|
||||
|
||||
lda #>($a000)
|
||||
sta LZ4_SRC+1
|
||||
adc ldsizeh
|
||||
sta LZ4_END+1
|
||||
|
||||
; lda #<($a000+4103-8) ; skip checksum at end
|
||||
; sta LZ4_END
|
||||
; lda #>($a000+4103-8) ; skip checksum at end
|
||||
; sta LZ4_END+1
|
||||
|
||||
lda #<$2000
|
||||
sta LZ4_DST
|
||||
lda #>$2000
|
||||
sta LZ4_DST+1
|
||||
|
||||
jsr lz4_decode
|
||||
lda #20
|
||||
sta CURSOR_X
|
||||
sta CURSOR_Y
|
||||
|
||||
|
||||
;===================
|
||||
; set graphics mode
|
||||
;===================
|
||||
jsr HOME
|
||||
setup_room:
|
||||
|
||||
; load background
|
||||
lda #>(link_book_rle)
|
||||
sta GBASH
|
||||
lda #<(link_book_rle)
|
||||
sta GBASL
|
||||
lda #$c ; load to page $c00
|
||||
jsr load_rle_gr
|
||||
|
||||
|
||||
bit PAGE0
|
||||
game_loop:
|
||||
|
||||
blah:
|
||||
jmp blah
|
||||
;====================================
|
||||
; copy background to current page
|
||||
;====================================
|
||||
|
||||
jsr gr_copy_to_current
|
||||
|
||||
;====================================
|
||||
; draw pointer
|
||||
;====================================
|
||||
|
||||
lda CURSOR_X
|
||||
sta XPOS
|
||||
lda CURSOR_Y
|
||||
sta YPOS
|
||||
lda #<finger_point_sprite
|
||||
sta INL
|
||||
lda #>finger_point_sprite
|
||||
sta INH
|
||||
jsr put_sprite_crop
|
||||
|
||||
;====================================
|
||||
; page flip
|
||||
;====================================
|
||||
|
||||
jsr page_flip
|
||||
|
||||
;====================================
|
||||
; handle keypress/joystick
|
||||
;====================================
|
||||
|
||||
jsr handle_keypress
|
||||
|
||||
|
||||
;====================================
|
||||
; inc frame count
|
||||
;====================================
|
||||
|
||||
inc FRAMEL
|
||||
bne room_frame_no_oflo
|
||||
inc FRAMEH
|
||||
room_frame_no_oflo:
|
||||
|
||||
jmp game_loop
|
||||
|
||||
|
||||
;==============================
|
||||
; Handle Keypress
|
||||
;==============================
|
||||
handle_keypress:
|
||||
|
||||
lda KEYPRESS
|
||||
bmi keypress
|
||||
|
||||
jmp no_keypress
|
||||
|
||||
keypress:
|
||||
and #$7f ; clear high bit
|
||||
|
||||
check_left:
|
||||
cmp #'A'
|
||||
beq left_pressed
|
||||
cmp #8 ; left key
|
||||
bne check_right
|
||||
left_pressed:
|
||||
dec CURSOR_X
|
||||
jmp done_keypress
|
||||
|
||||
check_right:
|
||||
cmp #'D'
|
||||
beq right_pressed
|
||||
cmp #$15 ; right key
|
||||
bne check_up
|
||||
right_pressed:
|
||||
inc CURSOR_X
|
||||
jmp done_keypress
|
||||
|
||||
check_up:
|
||||
cmp #'W'
|
||||
beq up_pressed
|
||||
cmp #$0B ; up key
|
||||
bne check_down
|
||||
up_pressed:
|
||||
dec CURSOR_Y
|
||||
dec CURSOR_Y
|
||||
jmp done_keypress
|
||||
|
||||
check_down:
|
||||
cmp #'S'
|
||||
beq down_pressed
|
||||
cmp #$0A
|
||||
bne check_return
|
||||
down_pressed:
|
||||
inc CURSOR_Y
|
||||
inc CURSOR_Y
|
||||
jmp done_keypress
|
||||
|
||||
check_return:
|
||||
cmp #' '
|
||||
beq return_pressed
|
||||
cmp #13
|
||||
bne done_keypress
|
||||
|
||||
return_pressed:
|
||||
|
||||
jmp done_keypress
|
||||
|
||||
|
||||
|
||||
done_keypress:
|
||||
no_keypress:
|
||||
bit KEYRESET
|
||||
rts
|
||||
|
||||
|
||||
.include "gr_copy.s"
|
||||
.include "gr_unrle.s"
|
||||
.include "gr_offsets.s"
|
||||
.include "gr_pageflip.s"
|
||||
.include "gr_putsprite_crop.s"
|
||||
|
||||
.include "mist_graphics.inc"
|
||||
|
||||
|
||||
finger_point_sprite:
|
||||
.byte 5,5
|
||||
.byte $AA,$BB,$AA,$AA,$AA
|
||||
.byte $AA,$BB,$AA,$AA,$AA
|
||||
.byte $BA,$BB,$BB,$BB,$BB
|
||||
.byte $AB,$BB,$BB,$BB,$BB
|
||||
.byte $AA,$BB,$BB,$BB,$AA
|
||||
|
||||
finger_grab_sprite:
|
||||
.byte 5,5
|
||||
.byte $AA,$AA,$BB,$AA,$AA
|
||||
.byte $BB,$AA,$BB,$AA,$BB
|
||||
.byte $BB,$BA,$BB,$BA,$BB
|
||||
.byte $AB,$BB,$BB,$BB,$BB
|
||||
.byte $AA,$BB,$BB,$BB,$AA
|
||||
|
||||
finger_left_sprite:
|
||||
.byte 6,4
|
||||
.byte $AA,$AA,$AA,$AB,$BA,$AA
|
||||
.byte $BB,$BB,$BB,$BB,$BB,$BB
|
||||
.byte $AA,$AA,$BB,$BB,$BB,$BB
|
||||
.byte $AA,$AA,$AB,$BB,$BB,$AB
|
||||
|
||||
finger_right_sprite:
|
||||
.byte 6,4
|
||||
.byte $AA,$BA,$AB,$AA,$AA,$AA
|
||||
.byte $BB,$BB,$BB,$BB,$BB,$BB
|
||||
.byte $BA,$BB,$BB,$BB,$AA,$AA
|
||||
.byte $AB,$BB,$BB,$AB,$AA,$AA
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; .include "gr_putsprite.s"
|
||||
; .include "gr_offsets.s"
|
||||
; .include "gr_fast_clear.s"
|
||||
; .include "gr_hline.s"
|
||||
; .include "wait_keypress.s"
|
||||
.include "lz4_decode.s"
|
||||
.include "rts.s"
|
||||
|
||||
|
||||
; filename to open is 30-character Apple text:
|
||||
mist_title_filename: ; .byte "MIST_TITLE.LZ4",0
|
||||
.byte 'M'|$80,'I'|$80,'S'|$80,'T'|$80,'_'|$80,'T'|$80,'I'|$80,'T'|$80
|
||||
.byte 'L'|$80,'E'|$80,'.'|$80,'L'|$80,'Z'|$80,'4'|$80,$00
|
||||
|
||||
|
||||
|
44
mist/mist_graphics.inc
Normal file
44
mist/mist_graphics.inc
Normal file
@ -0,0 +1,44 @@
|
||||
link_book_rle: .byte $28 ; ysize=48
|
||||
.byte $A4,$00, $A0,$10,$F0, $00, $AE,$F0, $A9,$00, $FF, $00
|
||||
.byte $70, $55, $A7,$77, $A5,$70, $8F, $50, $AB,$70
|
||||
.byte $00, $FF, $A9,$00, $FF, $00, $77, $55
|
||||
.byte $AC,$77, $88, $55, $AB,$77, $00, $FF, $A9,$00
|
||||
.byte $FF, $00, $77, $55, $AC,$77, $88, $55
|
||||
.byte $AB,$77, $00, $FF, $A9,$00, $FF, $00, $77
|
||||
.byte $55, $AC,$77, $88, $55, $AB,$77, $00, $FF
|
||||
.byte $A9,$00, $FF, $88, $77, $55, $AC,$77, $88
|
||||
.byte $55, $77, $55, $A8,$66, $77, $00, $FF
|
||||
.byte $A9,$00, $FF, $88, $77, $55, $AC,$77, $88
|
||||
.byte $55, $77, $05, $66,$66, $56, $55, $56
|
||||
.byte $A3,$66, $77, $00, $FF, $A9,$00, $FF, $88
|
||||
.byte $77, $55, $AC,$77, $88, $55, $77, $00
|
||||
.byte $66, $88, $F8, $07, $88, $A3,$66, $77
|
||||
.byte $00, $FF, $A9,$00, $FF, $88, $77, $55
|
||||
.byte $AC,$77, $88, $55, $77, $00,$00, $48, $7F
|
||||
.byte $F8, $88, $55, $86, $26, $77, $00
|
||||
.byte $FF, $A9,$00, $FF, $88, $77, $55, $AC,$77
|
||||
.byte $88, $55, $77, $A3,$44, $57,$57, $58, $25
|
||||
.byte $28, $82, $77, $00, $FF, $A9,$00, $FF
|
||||
.byte $88, $77, $55, $AC,$77, $88, $55, $77
|
||||
.byte $44,$44, $54, $A3,$55, $22,$22, $28, $77, $00
|
||||
.byte $FF, $A9,$00, $FF, $88, $55, $AD,$77, $88
|
||||
.byte $55, $77, $74,$74, $A4,$75, $A3,$72, $77, $00
|
||||
.byte $FF, $A9,$00, $FF, $88, $55, $AD,$77, $88
|
||||
.byte $55, $AB,$77, $00, $FF, $A9,$00, $FF, $88
|
||||
.byte $55, $AD,$77, $88, $55, $AB,$77, $00, $FF
|
||||
.byte $A9,$00, $FF, $88, $55, $AD,$77, $88, $55
|
||||
.byte $AB,$77, $00, $FF, $A9,$00, $FF, $88, $55
|
||||
.byte $AD,$77, $88, $55, $AB,$77, $00, $FF, $A9,$00
|
||||
.byte $FF, $88, $55, $AD,$77, $88, $55, $AB,$77
|
||||
.byte $00, $FF, $A9,$00, $FF, $88, $55, $AD,$77
|
||||
.byte $88, $55, $AB,$77, $00, $FF, $A9,$00, $FF
|
||||
.byte $88, $55, $AD,$77, $88, $55, $AB,$77, $00
|
||||
.byte $FF, $A9,$00, $FF, $00, $55, $AD,$77, $88
|
||||
.byte $55, $AB,$77, $00, $FF, $A9,$00, $FF, $00
|
||||
.byte $55, $AD,$77, $88, $55, $AB,$77, $00, $FF
|
||||
.byte $A9,$00, $FF, $00, $55, $AD,$77, $88, $55
|
||||
.byte $AB,$77, $00, $FF, $A9,$00, $FF, $00, $A4,$05
|
||||
.byte $A4,$85, $A3,$87, $A3,$07, $08, $05, $AB,$07, $00
|
||||
.byte $FF, $A9,$00, $A0,$1F,$0F, $A5,$00
|
||||
.byte $A1
|
||||
; cycles=1154
|
99
mist/mist_title.s
Normal file
99
mist/mist_title.s
Normal file
@ -0,0 +1,99 @@
|
||||
; Mist Title
|
||||
|
||||
; loads a HGR version of the title
|
||||
|
||||
; by deater (Vince Weaver) <vince@deater.net>
|
||||
|
||||
; Zero Page
|
||||
.include "zp.inc"
|
||||
.include "hardware.inc"
|
||||
|
||||
|
||||
mist_start:
|
||||
;===================
|
||||
; init screen
|
||||
jsr TEXT
|
||||
jsr HOME
|
||||
bit KEYRESET
|
||||
|
||||
bit SET_GR
|
||||
bit PAGE0
|
||||
bit HIRES
|
||||
bit FULLGR
|
||||
|
||||
|
||||
;===================
|
||||
; Init RTS disk code
|
||||
;===================
|
||||
|
||||
jsr rts_init
|
||||
|
||||
;===================
|
||||
; Load graphics
|
||||
;===================
|
||||
reload_everything:
|
||||
; load MIST_TITLE.LZ4 to $a000
|
||||
; then decompress it to $2000 (HGR PAGE0)
|
||||
|
||||
lda #<mist_title_filename
|
||||
sta OUTL
|
||||
lda #>mist_title_filename
|
||||
sta OUTH
|
||||
jsr opendir_filename ; open and read entire file into memory
|
||||
|
||||
; size in ldsizeh:ldsizel (f1/f0)
|
||||
|
||||
clc
|
||||
lda #<($a000)
|
||||
sta LZ4_SRC
|
||||
adc ldsizel
|
||||
sta LZ4_END
|
||||
|
||||
lda #>($a000)
|
||||
sta LZ4_SRC+1
|
||||
adc ldsizeh
|
||||
sta LZ4_END+1
|
||||
|
||||
; lda #<($a000+4103-8) ; skip checksum at end
|
||||
; sta LZ4_END
|
||||
; lda #>($a000+4103-8) ; skip checksum at end
|
||||
; sta LZ4_END+1
|
||||
|
||||
lda #<$2000
|
||||
sta LZ4_DST
|
||||
lda #>$2000
|
||||
sta LZ4_DST+1
|
||||
|
||||
jsr lz4_decode
|
||||
|
||||
|
||||
;===================
|
||||
; set graphics mode
|
||||
;===================
|
||||
jsr HOME
|
||||
|
||||
|
||||
bit PAGE0
|
||||
|
||||
blah:
|
||||
jmp blah
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; .include "gr_putsprite.s"
|
||||
; .include "gr_offsets.s"
|
||||
; .include "gr_fast_clear.s"
|
||||
; .include "gr_hline.s"
|
||||
; .include "wait_keypress.s"
|
||||
.include "lz4_decode.s"
|
||||
.include "rts.s"
|
||||
|
||||
|
||||
; filename to open is 30-character Apple text:
|
||||
mist_title_filename: ; .byte "MIST_TITLE.LZ4",0
|
||||
.byte 'M'|$80,'I'|$80,'S'|$80,'T'|$80,'_'|$80,'T'|$80,'I'|$80,'T'|$80
|
||||
.byte 'L'|$80,'E'|$80,'.'|$80,'L'|$80,'Z'|$80,'4'|$80,$00
|
||||
|
||||
|
@ -33,6 +33,14 @@ COLOR = $30
|
||||
|
||||
SEEDL = $4e
|
||||
SEEDH = $4f
|
||||
XMAX = $50
|
||||
|
||||
FRAMEL = $60
|
||||
FRAMEH = $61
|
||||
CURSOR_X= $62
|
||||
CURSOR_Y= $63
|
||||
XPOS = $64
|
||||
YPOS = $65
|
||||
|
||||
DISP_PAGE = $ED ; ALL
|
||||
DRAW_PAGE = $EE ; ALL
|
||||
|
Loading…
Reference in New Issue
Block a user