Skip to content
On This Day:

Not Applicable · Assembly

Compression - DTE Packer

By g8z et al

About this project

Possible method to improve DTE performance.

Original game requirements

See the release instructions.

Creator credits

g8z et al
Listed creator

RELEASE 2.0

Readme & instructions

[271]DTE_packer.txt

Context: Game has 256 symbols ($00-ff) to map codes and font characters. We can get $40-90 unmapped codes on average, contiguous if lucky. Often placed with DTE.

Read moreRead less
Context:
Game has 256 symbols ($00-ff) to map codes and font characters.

We can get $40-90 unmapped codes on average, contiguous if lucky.
Often placed with DTE.

2-byte symbols are typically seen for MTE entries.
Small dictionary entries aren't great for encoders.

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Upgrade:
Include an 8-bit 'header' packet for every 8 bytes.

ex.
[00011111] = 3 non-DTE bytes + 5 DTE bytes

Overhead is 'ceil( script_codes / 8 )' or 12.5% increase.

Theoretical maximum is now 16 per (8+1) bytes or 16:9 = 56.25% size.

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The advantage is that we now have 256 DTE entries ($00-ff).
On top of the original 256 alphabet.

So the unmapped region can be used for additional DTE strings.
Or MTE phrases like ' the'.

No icky Huffman bitmath or logarithmic speed penalties.
And it should approach Huffman levels.


Bad:
- Doesn't work with Atlas
 * Custom inserter or upgraded version needed

- DTE tables ($200+)
- Code overhead ($100-200)

- Packet overhead
- Not experimentally verified

- Branching opcodes
 * Use 'on/off' control flags or a 'reset' code

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Pseudocode:

; Init

lda #$80		; 'empty' packet
sta DTE_PACKET

lda #$00		; no DTE used
sta DTE_FLAG

; -------------------------------------------------------------
; -------------------------------------------------------------

; Execute

Start_Script:
asl DTE_PACKET		; check for empty header
bne Script_Path

jsr Script_Load		; reload header
rol a			; check path (recycle old bit)
sta DTE_PACKET

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Script_Path:
bcs Script_DTE		; 0 = Raw, 1 = DTE


Script_Raw:
jmp Script_Load

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Script_DTE:
lda DTE_FLAG		; check 1 or 2

php
jsr Script_Load		; load DTE byte
tay
plp

bne Script_DTE_2


Script_DTE_1:
dex			; restore ptr
bcc Script_DTE_1a
dec $01

Script_DTE_1a:
lda #$80		; raise flag
sta DTE_FLAG

lda $fe00,y		; load script symbol
rts


Script_DTE_2:
lda #$00		; lower flag
sta DTE_FLAG

lda $ff00,y		; load script symbol
rts

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Script_Load:
lda ($00),x		; load script byte

inx			; bump ptr
bcc Script_Load_2	; 8-bit overflow
inc $01

Script_Load_2:
rts

Download [271]DTE_packer.txt ↓

FROM THE COMMUNITY

Player reviews

0 reviews
No ratings yet

Played this project? Tell other players how it holds up.

Your take on Compression - DTE Packer

Spam has been overwhelming. To help us approve your review, sign up and introduce yourself in the Introductions forum so we know you’re not a bot.

Sign in with your Retro Replay account to rate this project and share your experience.

Sign in to review