mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-03 18:29:53 +00:00
lovebyte: work on dont
This commit is contained in:
parent
0fb6ec1d14
commit
264764a0ca
59
demos/lovebyte2024/d2v/Makefile
Normal file
59
demos/lovebyte2024/d2v/Makefile
Normal file
@ -0,0 +1,59 @@
|
||||
include ../../../Makefile.inc
|
||||
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
EMPTYDISK = ../../../empty_disk/empty.dsk
|
||||
LINKERSCRIPTS = ../../../linker_scripts/
|
||||
|
||||
all: dont.dsk
|
||||
|
||||
dont.dsk: HELLO DONT DONT2
|
||||
cp $(EMPTYDISK) dont.dsk
|
||||
$(DOS33) -y dont.dsk SAVE A HELLO
|
||||
$(DOS33) -y dont.dsk BSAVE -a 0xc00 DONT
|
||||
$(DOS33) -y dont.dsk BSAVE -a 0xc00 DONT2
|
||||
|
||||
###
|
||||
|
||||
submit: dont.zip
|
||||
|
||||
dont.zip: DONT dont.s file_id.diz dont.dsk
|
||||
mkdir -p lovebyte2023_dont
|
||||
cp DONT ./lovebyte2023_dont
|
||||
cp dont.s ./lovebyte2023_dont
|
||||
cp file_id.diz ./lovebyte2023_dont
|
||||
cp dont.dsk ./lovebyte2023_dont
|
||||
cp monitor.txt ./lovebyte2023_dont
|
||||
cp dont_screen.png ./lovebyte2023_dont
|
||||
cp dont_720p.mp4 ./lovebyte2023_dont
|
||||
zip -r dont.zip lovebyte2023_dont
|
||||
|
||||
####
|
||||
|
||||
|
||||
####
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
###
|
||||
|
||||
DONT: dont.o
|
||||
ld65 -o DONT dont.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
dont.o: dont.s
|
||||
ca65 -o dont.o dont.s -l dont.lst
|
||||
|
||||
###
|
||||
|
||||
DONT2: dont2.o
|
||||
ld65 -o DONT2 dont2.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
dont2.o: dont2.s
|
||||
ca65 -o dont2.o dont2.s -l dont2.lst
|
||||
|
||||
|
||||
####
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO DONT DONT2 *.zip
|
49
demos/lovebyte2024/d2v/dont.s
Normal file
49
demos/lovebyte2024/d2v/dont.s
Normal file
@ -0,0 +1,49 @@
|
||||
; Don't Tell Valve
|
||||
|
||||
; by Vince `deater` Weaver / DsR
|
||||
|
||||
; zero page locations
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
HGR_SCALE = $E7
|
||||
HGR_ROTATION = $F9
|
||||
|
||||
ZP=$80
|
||||
offset = ZP+0
|
||||
ZX0_src = ZP+2
|
||||
ZX0_dst = ZP+4
|
||||
bitr = ZP+6
|
||||
pntr = ZP+7
|
||||
|
||||
|
||||
; ROM locations
|
||||
HGR2 = $F3D8
|
||||
HGR = $F3E2
|
||||
HPOSN = $F411
|
||||
XDRAW0 = $F65D
|
||||
XDRAW1 = $F661
|
||||
HPLOT0 = $F457
|
||||
|
||||
dont:
|
||||
|
||||
jsr HGR ; Hi-res, full screen ; 3
|
||||
; Y=0, A=0 after this call
|
||||
|
||||
|
||||
lda #<scene
|
||||
sta zx_src_l+1
|
||||
lda #>scene
|
||||
sta zx_src_h+1
|
||||
|
||||
lda #$20
|
||||
|
||||
jsr zx02_full_decomp
|
||||
|
||||
|
||||
ending:
|
||||
jmp ending
|
||||
|
||||
.include "zx02_optim.s"
|
||||
|
||||
scene:
|
||||
.incbin "graphics/scene.hgr.zx02"
|
202
demos/lovebyte2024/d2v/dont2.s
Normal file
202
demos/lovebyte2024/d2v/dont2.s
Normal file
@ -0,0 +1,202 @@
|
||||
; Don't Tell Valve
|
||||
|
||||
; by Vince `deater` Weaver / DsR
|
||||
|
||||
|
||||
; 147 bytes = initial block code
|
||||
; 144 bytes = optimize color pick
|
||||
; 137 bytes = optimize table generation
|
||||
; 135 bytes = more optimization
|
||||
|
||||
; zero page locations
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_Y = $E2
|
||||
HGR_SCALE = $E7
|
||||
|
||||
TEMPY = $F0
|
||||
HGR_ROTATION = $F9
|
||||
|
||||
INL = $FE
|
||||
INH = $FF
|
||||
|
||||
; ROM locations
|
||||
HGR2 = $F3D8
|
||||
HGR = $F3E2
|
||||
HPOSN = $F411
|
||||
XDRAW0 = $F65D
|
||||
XDRAW1 = $F661
|
||||
HPLOT0 = $F457
|
||||
|
||||
hposn_low = $6000
|
||||
hposn_high = $6100
|
||||
|
||||
dont:
|
||||
|
||||
jsr HGR ; Hi-res, full screen ; 3
|
||||
; Y=0, A=0 after this call
|
||||
|
||||
;==========================
|
||||
; make table
|
||||
|
||||
; ldy #0
|
||||
table_loop:
|
||||
; sty TEMPY
|
||||
; lda #0 ; we are out of bounds, does it matter?
|
||||
; tax
|
||||
tya
|
||||
jsr HPOSN
|
||||
ldy HGR_Y ; HPOSN saves this
|
||||
lda GBASL
|
||||
sta hposn_low,Y
|
||||
lda GBASH
|
||||
sta hposn_high,Y
|
||||
iny
|
||||
; cpy #192 ; what happens if we run 192..255?
|
||||
bne table_loop
|
||||
|
||||
ldx #8
|
||||
draw_loop:
|
||||
jsr draw_box
|
||||
dex
|
||||
bpl draw_loop
|
||||
|
||||
ldx #37
|
||||
lda #<companion_cube
|
||||
sta INL
|
||||
lda #>companion_cube
|
||||
sta INH
|
||||
jsr draw_sprite
|
||||
|
||||
ldx #34
|
||||
lda #<companion_cube
|
||||
sta INL
|
||||
lda #>companion_cube
|
||||
sta INH
|
||||
jsr draw_sprite
|
||||
|
||||
lda #101
|
||||
sta draw_sprite_y_smc+1
|
||||
|
||||
ldx #38
|
||||
lda #<companion_cube
|
||||
sta INL
|
||||
lda #>companion_cube
|
||||
sta INH
|
||||
jsr draw_sprite
|
||||
|
||||
|
||||
ending:
|
||||
jmp ending
|
||||
|
||||
|
||||
box_color_odd:
|
||||
.byte $2A,$55,$AA,$7F,$7F,$7F,$60,$03,$E0
|
||||
box_color_even:
|
||||
.byte $55,$2A,$D5,$7F,$7F,$7F,$60,$03,$E0
|
||||
box_x1:
|
||||
.byte 16, 33, 0, 0, 24, 16, 15, 24, 39
|
||||
box_x2:
|
||||
.byte 24, 40, 34, 16, 40, 24, 16, 25, 40
|
||||
box_y1:
|
||||
.byte 130, 50, 42,120,120,159,121,121,101
|
||||
box_y2:
|
||||
.byte 159, 57, 43,121,121,160,160,160,120
|
||||
|
||||
|
||||
;==========================
|
||||
; draw box
|
||||
;==========================
|
||||
; which to draw in X
|
||||
; X preserved?
|
||||
|
||||
draw_box:
|
||||
lda box_y1,X ; 3
|
||||
draw_box_outer:
|
||||
sta TEMPY ; 2
|
||||
tay ; 1
|
||||
lda hposn_low,Y ; 3
|
||||
sta GBASL ; 2
|
||||
lda hposn_high,Y ; 3
|
||||
sta GBASH ; 2
|
||||
ldy box_x1,X ; 3
|
||||
draw_box_inner:
|
||||
tya ; 1
|
||||
lsr ; 1
|
||||
lda box_color_odd,X ; 3
|
||||
bcc draw_color_odd ; 2 ; we might have these flipped
|
||||
draw_color_even:
|
||||
lda box_color_even,X ; 3
|
||||
draw_color_odd:
|
||||
sta (GBASL),Y ; 2
|
||||
iny ; 1
|
||||
tya ; 1
|
||||
cmp box_x2,X ; 3
|
||||
bne draw_box_inner ; 2
|
||||
|
||||
inc TEMPY ; 2
|
||||
lda TEMPY ; 2
|
||||
cmp box_y2,X ; 3
|
||||
bne draw_box_outer ; 2
|
||||
|
||||
rts ; 1
|
||||
|
||||
|
||||
companion_cube:
|
||||
.byte $6F,$3D ; .@@@@.@@ @.@@@@..
|
||||
.byte $07,$38 ; .@@@.... ...@@@..
|
||||
.byte $03,$38 ; .@@..... ....@@..
|
||||
.byte $30,$03 ; .....@@. @@......
|
||||
.byte $73,$33 ; .@@..@@@ @@..@@..
|
||||
.byte $73,$33 ; .@@..@@@ @@..@@..
|
||||
.byte $60,$01 ; ......@@ @.......
|
||||
.byte $43,$30 ; .@@....@ ....@@..
|
||||
.byte $07,$38 ; .@@@.... ...@@@..
|
||||
.byte $6F,$3D ; .@@@@.@@ @.@@@@..
|
||||
.byte $00,$00
|
||||
|
||||
|
||||
;==========================
|
||||
; draw sprite
|
||||
;==========================
|
||||
; INL/INH is sprite
|
||||
; X is X location
|
||||
|
||||
draw_sprite:
|
||||
stx draw_sprite_xpos+1
|
||||
draw_sprite_y_smc:
|
||||
lda #50 ; 2 ; Y position
|
||||
sta draw_sprite_y_end_smc+1
|
||||
sec
|
||||
sbc #11
|
||||
draw_sprite_outer:
|
||||
sta TEMPY ; 2
|
||||
tay ; 1
|
||||
lda hposn_low,Y ; 3
|
||||
clc
|
||||
draw_sprite_xpos:
|
||||
adc #37 ; Xpos=37
|
||||
sta GBASL ; 2
|
||||
lda hposn_high,Y ; 3
|
||||
sta GBASH ; 2
|
||||
|
||||
ldy #0 ; 2
|
||||
|
||||
lda (INL),Y
|
||||
sta (GBASL),Y
|
||||
iny
|
||||
lda (INL),Y
|
||||
sta (GBASL),Y
|
||||
|
||||
inc INL
|
||||
inc INL
|
||||
|
||||
inc TEMPY ; 2
|
||||
lda TEMPY ; 2
|
||||
draw_sprite_y_end_smc:
|
||||
cmp #50 ; 3
|
||||
bne draw_sprite_outer ; 2
|
||||
|
||||
rts ; 1
|
21
demos/lovebyte2024/d2v/graphics/Makefile
Normal file
21
demos/lovebyte2024/d2v/graphics/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
include ../../../../Makefile.inc
|
||||
|
||||
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
|
||||
PNG_TO_HGR = ../../../../utils/hgr-utils/png2hgr
|
||||
PNG2GR = ../../../../utils/gr-utils/png2gr
|
||||
|
||||
all: scene.hgr.zx02
|
||||
|
||||
|
||||
####
|
||||
|
||||
scene.hgr: scene.png
|
||||
$(PNG_TO_HGR) scene.png > scene.hgr
|
||||
|
||||
scene.hgr.zx02: scene.hgr
|
||||
$(ZX02) scene.hgr scene.hgr.zx02
|
||||
|
||||
####
|
||||
|
||||
clean:
|
||||
rm -f *~
|
BIN
demos/lovebyte2024/d2v/graphics/scene.png
Normal file
BIN
demos/lovebyte2024/d2v/graphics/scene.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
7
demos/lovebyte2024/d2v/hello.bas
Normal file
7
demos/lovebyte2024/d2v/hello.bas
Normal file
@ -0,0 +1,7 @@
|
||||
5 HOME
|
||||
10 PRINT " DONT"
|
||||
20 PRINT CHR$(4)"CATALOG"
|
||||
25 PRINT:PRINT "PRESS ANY KEY TO 'BRUN DONT'"
|
||||
30 GET A$
|
||||
35 PRINT
|
||||
'40 PRINT CHR$(4)"BRUN DONT"
|
159
demos/lovebyte2024/d2v/zx02_optim.s
Normal file
159
demos/lovebyte2024/d2v/zx02_optim.s
Normal file
@ -0,0 +1,159 @@
|
||||
; 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, <comp_data, >comp_data, <out_addr, >out_addr, $80
|
||||
|
||||
;--------------------------------------------------
|
||||
; Decompress ZX0 data (6502 optimized format)
|
||||
|
||||
zx02_full_decomp:
|
||||
; ; Get initialization block
|
||||
; ldy #7
|
||||
;
|
||||
;copy_init: lda zx0_ini_block-1, y
|
||||
; sta offset-1, y
|
||||
; dey
|
||||
; bne copy_init
|
||||
|
||||
|
||||
sta ZX0_dst+1 ; page to output to in A
|
||||
zx_src_l:
|
||||
ldy #$dd
|
||||
sty ZX0_src
|
||||
zx_src_h:
|
||||
ldy #$dd
|
||||
sty ZX0_src+1
|
||||
ldy #$80
|
||||
sty bitr
|
||||
ldy #0
|
||||
sty offset
|
||||
sty offset+1
|
||||
sty ZX0_dst ; always on even page
|
||||
|
||||
; 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…
Reference in New Issue
Block a user