mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-07 21:30:39 +00:00
double: add hi-res load
This commit is contained in:
parent
a50edb886d
commit
0cc56766d2
@ -60,7 +60,7 @@ not_a_iigs:
|
||||
|
||||
; set 80-store mode
|
||||
|
||||
sta EIGHTYSTORE ; PAGE2 selects AUX memory
|
||||
sta EIGHTYSTOREON ; PAGE2 selects AUX memory
|
||||
bit PAGE1
|
||||
|
||||
;===================
|
||||
@ -130,29 +130,19 @@ cp2_loop:
|
||||
bit PAGE1
|
||||
|
||||
|
||||
;===================
|
||||
; draw hi-res lines
|
||||
;============================
|
||||
; load hi-res image to PAGE2
|
||||
;============================
|
||||
|
||||
jsr HGR
|
||||
bit FULLGR ; make it 40x48
|
||||
lda #<image_hgr
|
||||
sta ZX0_src
|
||||
lda #>image_hgr
|
||||
sta ZX0_src+1
|
||||
|
||||
lda #$FF
|
||||
sta $E4 ; HCOLOR
|
||||
lda #$40
|
||||
|
||||
ldx #0
|
||||
ldy #0
|
||||
lda #96
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
jsr full_decomp
|
||||
|
||||
ldx #0
|
||||
lda #140
|
||||
ldy #191
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
ldx #1
|
||||
lda #23
|
||||
ldy #96
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
; draw double-hires lines
|
||||
|
||||
@ -182,6 +172,7 @@ color_loop:
|
||||
cmp #192
|
||||
bne color_loop
|
||||
|
||||
sta EIGHTYSTOREOFF
|
||||
|
||||
; wait for vblank on IIe
|
||||
; positive? during vblank
|
||||
@ -236,12 +227,12 @@ double_loop:
|
||||
|
||||
; 3 lines HIRES
|
||||
sta HIRES ; 4
|
||||
sta CLRAN3 ; 4
|
||||
sta PAGE2 ; 4
|
||||
jsr delay_1552
|
||||
|
||||
; 3 lines HIRES
|
||||
sta HIRES ; 4
|
||||
sta SETAN3 ; 4
|
||||
sta PAGE1 ; 4
|
||||
jsr delay_1552
|
||||
|
||||
; 3 line Double-HIRES
|
||||
@ -327,3 +318,8 @@ line_loop_it:
|
||||
.include "pt3_lib_detect_model.s"
|
||||
; .include "pt3_lib_mockingboard_setup.s"
|
||||
; .include "pt3_lib_mockingboard_detect.s"
|
||||
|
||||
.include "zx02_optim.s"
|
||||
|
||||
image_hgr:
|
||||
.incbin "graphics/sworg_hgr.hgr.zx02"
|
||||
|
@ -1,7 +1,9 @@
|
||||
; soft-switches
|
||||
; yes, I know these aren't necessary the "official" names
|
||||
|
||||
EIGHTYSTORE = $C001
|
||||
KEYBOARD = $C000 ; Read
|
||||
EIGHTYSTOREOFF = $C000 ; Write (turns off 80store)
|
||||
EIGHTYSTOREON = $C001 ; Write (page2 writes to AUX memory)
|
||||
CLR80COL = $C00C
|
||||
SET80COL = $C00D
|
||||
|
||||
|
@ -1,4 +1,18 @@
|
||||
;=========================
|
||||
; zero page
|
||||
;=========================
|
||||
|
||||
; ZX02 addresses
|
||||
|
||||
ZP=$00
|
||||
|
||||
offset = ZP+0
|
||||
ZX0_src = ZP+2
|
||||
ZX0_dst = ZP+4
|
||||
bitr = ZP+6
|
||||
pntr = ZP+7
|
||||
|
||||
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
V2 = $2D
|
||||
@ -13,3 +27,4 @@ MB_ADDR_H = $F7
|
||||
YPOS = $FE
|
||||
TCOLOR = $FF
|
||||
|
||||
|
||||
|
163
vaporlock/doubledouble/zx02_optim.s
Normal file
163
vaporlock/doubledouble/zx02_optim.s
Normal file
@ -0,0 +1,163 @@
|
||||
; De-compressor for ZX02 files
|
||||
; ----------------------------
|
||||
;
|
||||
; Decompress ZX02 data (6502 optimized format), optimized for speed and size
|
||||
; 138 bytes code, 58.0 cycles/byte in test file.
|
||||
;
|
||||
; Compress with:
|
||||
; zx02 input.bin output.zx0
|
||||
;
|
||||
; (c) 2022 DMSC
|
||||
; Code under MIT license, see LICENSE file.
|
||||
|
||||
|
||||
;ZP=$80
|
||||
|
||||
;offset = ZP+0
|
||||
;ZX0_src = ZP+2
|
||||
;ZX0_dst = ZP+4
|
||||
;bitr = ZP+6
|
||||
;pntr = ZP+7
|
||||
|
||||
; Initial values for offset, source, destination and bitr
|
||||
;zx0_ini_block:
|
||||
; .byte $00, $00 ; offset
|
||||
;comp_data:
|
||||
; .byte $0, $0 ; zx0_src
|
||||
;out_addr:
|
||||
; .byte $0, $0 ; zx0_dst
|
||||
; .byte $80 ; bitr
|
||||
|
||||
;--------------------------------------------------
|
||||
; Decompress ZX0 data (6502 optimized format)
|
||||
|
||||
; destination page in A
|
||||
full_decomp:
|
||||
sta ZX0_dst+1
|
||||
|
||||
ldy #$80
|
||||
sty bitr
|
||||
|
||||
ldy #0 ; always on page boundary
|
||||
sty ZX0_dst
|
||||
|
||||
sty offset
|
||||
sty offset+1
|
||||
|
||||
; Y needs to be 0 here
|
||||
|
||||
; Get initialization block
|
||||
; ldy #7
|
||||
|
||||
;copy_init: lda zx0_ini_block-1, y
|
||||
; sta offset-1, y
|
||||
; dey
|
||||
; bne copy_init
|
||||
|
||||
; Decode literal: Ccopy next N bytes from compressed file
|
||||
; Elias(length) byte[1] byte[2] ... byte[N]
|
||||
decode_literal:
|
||||
jsr get_elias
|
||||
|
||||
cop0: lda (ZX0_src), y
|
||||
inc ZX0_src
|
||||
bne plus1
|
||||
inc ZX0_src+1
|
||||
plus1: sta (ZX0_dst),y
|
||||
inc ZX0_dst
|
||||
bne plus2
|
||||
inc ZX0_dst+1
|
||||
plus2: dex
|
||||
bne cop0
|
||||
|
||||
asl bitr
|
||||
bcs dzx0s_new_offset
|
||||
|
||||
; Copy from last offset (repeat N bytes from last offset)
|
||||
; Elias(length)
|
||||
jsr get_elias
|
||||
dzx0s_copy:
|
||||
lda ZX0_dst
|
||||
sbc offset ; C=0 from get_elias
|
||||
sta pntr
|
||||
lda ZX0_dst+1
|
||||
sbc offset+1
|
||||
sta pntr+1
|
||||
|
||||
cop1:
|
||||
lda (pntr), y
|
||||
inc pntr
|
||||
bne plus3
|
||||
inc pntr+1
|
||||
plus3: sta (ZX0_dst),y
|
||||
inc ZX0_dst
|
||||
bne plus4
|
||||
inc ZX0_dst+1
|
||||
plus4: dex
|
||||
bne cop1
|
||||
|
||||
asl bitr
|
||||
bcc decode_literal
|
||||
|
||||
; Copy from new offset (repeat N bytes from new offset)
|
||||
; Elias(MSB(offset)) LSB(offset) Elias(length-1)
|
||||
dzx0s_new_offset:
|
||||
; Read elias code for high part of offset
|
||||
jsr get_elias
|
||||
beq exit ; Read a 0, signals the end
|
||||
; Decrease and divide by 2
|
||||
dex
|
||||
txa
|
||||
lsr ; @
|
||||
sta offset+1
|
||||
|
||||
; Get low part of offset, a literal 7 bits
|
||||
lda (ZX0_src), y
|
||||
inc ZX0_src
|
||||
bne plus5
|
||||
inc ZX0_src+1
|
||||
plus5:
|
||||
; Divide by 2
|
||||
ror ; @
|
||||
sta offset
|
||||
|
||||
; And get the copy length.
|
||||
; Start elias reading with the bit already in carry:
|
||||
ldx #1
|
||||
jsr elias_skip1
|
||||
|
||||
inx
|
||||
bcc dzx0s_copy
|
||||
|
||||
; Read an elias-gamma interlaced code.
|
||||
; ------------------------------------
|
||||
get_elias:
|
||||
; Initialize return value to #1
|
||||
ldx #1
|
||||
bne elias_start
|
||||
|
||||
elias_get: ; Read next data bit to result
|
||||
asl bitr
|
||||
rol ; @
|
||||
tax
|
||||
|
||||
elias_start:
|
||||
; Get one bit
|
||||
asl bitr
|
||||
bne elias_skip1
|
||||
|
||||
; Read new bit from stream
|
||||
lda (ZX0_src), y
|
||||
inc ZX0_src
|
||||
bne plus6
|
||||
inc ZX0_src+1
|
||||
plus6: ;sec ; not needed, C=1 guaranteed from last bit
|
||||
rol ;@
|
||||
sta bitr
|
||||
|
||||
elias_skip1:
|
||||
txa
|
||||
bcs elias_get
|
||||
; Got ending bit, stop reading
|
||||
exit:
|
||||
rts
|
Loading…
x
Reference in New Issue
Block a user