compress RWTS to save a couple of pages

This commit is contained in:
Peter Ferrie 2017-08-17 21:45:46 -07:00
parent 760650802f
commit c24598a4d3
4 changed files with 289 additions and 144 deletions

10
src/nibtable.a Normal file
View File

@ -0,0 +1,10 @@
nibtable=*-$96
!byte $00,$01,$98,$99,$02,$03,$9C,$04,$05,$06,$A0,$A1,$A2,$A3,$A4,$A5
!byte $07,$08,$A8,$A9,$AA,$09,$0A,$0B,$0C,$0D,$B0,$B1,$0E,$0F,$10,$11
!byte $12,$13,$B8,$14,$15,$16,$17,$18,$19,$1A,$C0,$C1,$C2,$C3,$C4,$C5
!byte $C6,$C7,$C8,$C9,$CA,$1B,$CC,$1C,$1D,$1E,$D0,$D1,$D2,$1F,$D4,$D5
!byte $20,$21,$D8,$22,$23,$24,$25,$26,$27,$28,$E0,$E1,$E2,$E3,$E4,$29
!byte $2A,$2B,$E8,$2C,$2D,$2E,$2F,$30,$31,$32,$F0,$F1,$33,$34,$35,$36
!byte $37,$38,$F8,$39,$3A,$3B,$3C,$3D,$3E
nibtableff
!byte $3F

View File

@ -75,6 +75,13 @@ IN0 = $FE93
; Zero-page addresses we use for variables
!ifdef PASS2 {
} else {
;unpacker variables, no need to change these
src = $3c ; word
dst = $3e ; word
ecx = $40 ; word
last = $42 ; word
tmpu = $44 ; word
nibsrcindex = $EC ; byte
nibdestindex = $ED ; byte
prbuf = $EE ; word
@ -95,7 +102,7 @@ flag = $FF ; byte
}
; Application constants (not zero addresses)
RELBASE = $5700 ; address to move Passport code
RELBASE = $5900 ; address to move Passport code
; so that it's out of the way
LOWPOINT = $4300 ; lowest available address for code
BASEPAGE = $10 ; Special Delivery tracer assumes
@ -501,13 +508,22 @@ StartWithUniv
CopyUniversal
lda #>universalrwts
ldx #$B8
ldy #$08
jsr CopyMemory
lda #$00
sta src+1
lda #<universalrwts
sta src
lda #$B8
sta dst+1
lda #0
sta dst
jsr Unpack
sta callrwts+1
lda #$BD
sta callrwts+2
ldy #$96
- lda nibtable,y
sta $BA00,y
iny
bne -
rts
Cancel
@ -850,6 +866,8 @@ gRAMDiskRef
; non-zero if open
!source "universalrwts.a"
!source "unpack.a"
!source "nibtable.a"
}
LastMover

View File

@ -24,143 +24,83 @@ UNIV_D1 = $B8E7
UNIV_D2 = $B8F1
UNIV_D3 = $B8FC
;;!align 255, 0 ;ACME bug ignores second parm
!if (* & 255) > 0 {
!fill 256-(* & 255), 0
}
universalrwts
!byte $A2,$00,$A0,$02,$88,$B1,$3E,$4A,$3E,$00,$BC,$4A,$3E,$00,$BC,$99
!byte $00,$BB,$E8,$E0,$56,$90,$ED,$A2,$00,$98,$D0,$E8,$A2,$55,$BD,$00
!byte $BC,$29,$3F,$9D,$00,$BC,$CA,$10,$F5,$60,$38,$86,$27,$8E,$78,$06
!byte $BD,$8D,$C0,$BD,$8E,$C0,$30,$7C,$AD,$00,$BC,$85,$26,$A9,$FF,$9D
!byte $8F,$C0,$1D,$8C,$C0,$48,$68,$EA,$A0,$04,$48,$68,$20,$B9,$B8,$88
!byte $D0,$F8,$A9,$D5,$20,$B8,$B8,$A9,$AA,$20,$B8,$B8,$A9,$AD,$20,$B8
!byte $B8,$98,$A0,$56,$D0,$03,$B9,$00,$BC,$59,$FF,$BB,$AA,$BD,$29,$BA
!byte $A6,$27,$9D,$8D,$C0,$BD,$8C,$C0,$88,$D0,$EB,$A5,$26,$EA,$59,$00
!byte $BB,$AA,$BD,$29,$BA,$AE,$78,$06,$9D,$8D,$C0,$BD,$8C,$C0,$B9,$00
!byte $BB,$C8,$D0,$EA,$AA,$BD,$29,$BA,$A6,$27,$20,$BB,$B8,$A9,$DE,$20
!byte $B8,$B8,$A9,$AA,$20,$B8,$B8,$A9,$EB,$20,$B8,$B8,$A9,$FF,$20,$B8
!byte $B8,$BD,$8E,$C0,$BD,$8C,$C0,$60,$18,$48,$68,$9D,$8D,$C0,$1D,$8C
!byte $C0,$60,$A0,$00,$A2,$56,$CA,$30,$FB,$B9,$00,$BB,$5E,$00,$BC,$2A
!byte $5E,$00,$BC,$2A,$91,$3E,$C8,$C4,$26,$D0,$EB,$60,$A0,$20,$88,$F0
!byte $61,$BD,$8C,$C0,$10,$FB,$49,$D5,$D0,$F4,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9,$AA,$D0,$F2,$A0,$56,$BD,$8C,$C0,$10,$FB,$C9,$AD,$D0,$E7,$A9
!byte $00,$88,$84,$26,$BC,$8C,$C0,$10,$FB,$59,$00,$BA,$A4,$26,$99,$00
!byte $BC,$D0,$EE,$84,$26,$BC,$8C,$C0,$10,$FB,$59,$00,$BA,$A4,$26,$99
!byte $00,$BB,$C8,$D0,$EE,$BC,$8C,$C0,$10,$FB,$D9,$00,$BA,$D0,$13,$BD
!byte $8C,$C0,$10,$FB,$C9,$00,$D0,$00,$EA,$BD,$8C,$C0,$10,$FB,$C9,$00
!byte $D0,$5C,$38,$60,$A0,$F7,$84,$26,$C8,$D0,$04,$E6,$26,$F0,$F3,$BD
!byte $8C,$C0,$10,$FB,$4A,$C9,$6A,$D0,$EF,$BD,$8C,$C0,$10,$FB,$C9,$AA
!byte $D0,$F2,$BD,$8C,$C0,$10,$FB,$C9,$96,$D0,$E7,$A0,$03,$A9,$00,$85
!byte $27,$BD,$8C,$C0,$10,$FB,$2A,$85,$26,$BD,$8C,$C0,$10,$FB,$25,$26
!byte $99,$2C,$00,$45,$27,$88,$10,$E7,$A8,$D0,$B7,$BD,$8C,$C0,$10,$FB
!byte $C9,$00,$D0,$00,$EA,$BD,$8C,$C0,$10,$FB,$C9,$00,$D0,$00,$18,$60
!byte $86,$2B,$85,$2A,$CD,$78,$04,$F0,$53,$A9,$00,$85,$26,$AD,$78,$04
!byte $85,$27,$38,$E5,$2A,$F0,$33,$B0,$07,$49,$FF,$EE,$78,$04,$90,$05
!byte $69,$FE,$CE,$78,$04,$C5,$26,$90,$02,$A5,$26,$C9,$0C,$B0,$01,$A8
!byte $38,$20,$EE,$B9,$B9,$11,$BA,$20,$00,$BA,$A5,$27,$18,$20,$F1,$B9
!byte $B9,$1D,$BA,$20,$00,$BA,$E6,$26,$D0,$C3,$20,$00,$BA,$18,$AD,$78
!byte $04,$29,$03,$2A,$05,$2B,$AA,$BD,$80,$C0,$A6,$2B,$60,$AA,$A0,$A0
nibtable
!byte $A2,$11,$CA,$D0,$FD,$E6,$46,$D0,$02,$E6,$47,$38,$E9,$01,$D0,$F0
!byte $60,$01,$30,$28,$24,$20,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$70,$2C,$26
!byte $22,$1F,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$96,$97,$9A,$9B,$9D,$9E,$9F
!byte $A6,$A7,$AB,$AC,$AD,$AE,$AF,$B2,$B3,$B4,$B5,$B6,$B7,$B9,$BA,$BB
!byte $BC,$BD,$BE,$BF,$CB,$CD,$CE,$CF,$D3,$D6,$D7,$D9,$DA,$DB,$DC,$DD
!byte $DE,$DF,$E5,$E6,$E7,$E9,$EA,$EB,$EC,$ED,$EE,$EF,$F2,$F3,$F4,$F5
!byte $F6,$F7,$F9,$FA,$FB,$FC,$FD,$FE,$FF,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
; these $FF bytes (at $BA80..$BA95) are used by the
; routine that checks whether a track is formatted
!byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
!byte $FF,$FF,$FF,$FF,$FF,$FF,$00,$01,$98,$99,$02,$03,$9C,$04,$05,$06
!byte $A0,$A1,$A2,$A3,$A4,$A5,$07,$08,$A8,$A9,$AA,$09,$0A,$0B,$0C,$0D
!byte $B0,$B1,$0E,$0F,$10,$11,$12,$13,$B8,$14,$15,$16,$17,$18,$19,$1A
!byte $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7,$C8,$C9,$CA,$1B,$CC,$1C,$1D,$1E
!byte $D0,$D1,$D2,$1F,$D4,$D5,$20,$21,$D8,$22,$23,$24,$25,$26,$27,$28
!byte $E0,$E1,$E2,$E3,$E4,$29,$2A,$2B,$E8,$2C,$2D,$2E,$2F,$30,$31,$32
!byte $F0,$F1,$33,$34,$35,$36,$37,$38,$F8,$39,$3A,$3B,$3C,$3D,$3E
nibtableff
!byte $3F
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
; write support is disabled here ($BC56 is a BRK instruction)
; set $BC56 to #$38 to re-enable
!byte $00,$00,$00,$00,$00,$00,$00,$BD,$8D,$C0,$BD,$8E,$C0,$30,$5E,$A9
!byte $FF,$9D,$8F,$C0,$DD,$8C,$C0,$48,$68,$20,$C3,$BC,$20,$C3,$BC,$9D
!byte $8D,$C0,$DD,$8C,$C0,$EA,$88,$D0,$F0,$A9,$D5,$20,$D5,$BC,$A9,$AA
!byte $20,$D5,$BC,$A9,$96,$20,$D5,$BC,$A5,$41,$20,$C4,$BC,$A5,$44,$20
!byte $C4,$BC,$A5,$3F,$20,$C4,$BC,$A5,$41,$45,$44,$45,$3F,$48,$4A,$05
!byte $3E,$9D,$8D,$C0,$BD,$8C,$C0,$68,$09,$AA,$20,$D4,$BC,$A9,$DE,$20
!byte $D5,$BC,$A9,$AA,$20,$D5,$BC,$A9,$EB,$20,$D5,$BC,$18,$BD,$8E,$C0
!byte $BD,$8C,$C0,$60,$48,$4A,$05,$3E,$9D,$8D,$C0,$DD,$8C,$C0,$68,$EA
!byte $EA,$EA,$09,$AA,$EA,$EA,$48,$68,$9D,$8D,$C0,$DD,$8C,$C0,$60,$88
!byte $A5,$E8,$91,$A0,$94,$88,$96,$E8,$91,$A0,$94,$88,$96,$91,$91,$C8
!byte $94,$D0,$96,$91,$91,$C8,$94,$D0,$96,$91,$A3,$C8,$A0,$A5,$85,$A4
!byte $84,$48,$85,$49,$A0,$02,$8C,$F8,$06,$A0,$04,$8C,$F8,$04,$A0,$01
!byte $B1,$48,$AA,$A0,$0F,$D1,$48,$F0,$1B,$8A,$48,$B1,$48,$AA,$68,$48
!byte $91,$48,$BD,$8E,$C0,$A0,$08,$BD,$8C,$C0,$DD,$8C,$C0,$D0,$F6,$88
!byte $D0,$F8,$68,$AA,$BD,$8E,$C0,$BD,$8C,$C0,$A0,$08,$BD,$8C,$C0,$48
!byte $68,$48,$68,$8E,$F8,$05,$DD,$8C,$C0,$D0,$03,$88,$D0,$EE,$08,$BD
!byte $89,$C0,$A0,$06,$B1,$48,$99,$36,$00,$C8,$C0,$0A,$D0,$F6,$A0,$03
!byte $B1,$3C,$85,$47,$A0,$02,$B1,$48,$A0,$10,$D1,$48,$F0,$06,$91,$48
!byte $28,$A0,$00,$08,$6A,$90,$05,$BD,$8A,$C0,$B0,$03,$BD,$8B,$C0,$66
!byte $35,$28,$08,$D0,$0B,$A0,$07,$20,$00,$BA,$88,$D0,$FA,$AE,$F8,$05
!byte $A0,$04,$B1,$48,$20,$5A,$BE,$28,$D0,$11,$A4,$47,$10,$0D,$A0,$12
!byte $88,$D0,$FD,$E6,$46,$D0,$F7,$E6,$47,$D0,$F3,$A0,$0C,$B1,$48,$F0
!byte $5A,$C9,$04,$F0,$58,$6A,$08,$B0,$03,$20,$00,$B8,$A0,$30,$8C,$78
!byte $05,$AE,$F8,$05,$20,$44,$B9,$90,$24,$CE,$78,$05,$10,$F3,$AD,$78
!byte $04,$48,$A9,$60,$20,$95,$BE,$CE,$F8,$06,$F0,$28,$A9,$04,$8D,$F8
!byte $04,$A9,$00,$20,$5A,$BE,$68,$20,$5A,$BE,$4C,$BC,$BD,$A4,$2E,$CC
!byte $78,$04,$F0,$1C,$AD,$78,$04,$48,$98,$20,$95,$BE,$68,$CE,$F8,$04
!byte $D0,$E5,$F0,$CA,$68,$A9,$40,$28,$4C,$48,$BE,$F0,$39,$4C,$AF,$BE
!byte $A0,$03,$A9,$00,$48,$A5,$2F,$A0,$0E,$91,$48,$68,$F0,$08,$C5,$2F
!byte $F0,$04,$A9,$20,$D0,$E1,$A0,$05,$B1,$48,$A8,$B9,$B8,$BF,$C5,$2D
!byte $D0,$97,$28,$90,$1C,$20,$DC,$B8,$08,$B0,$8E,$28,$A2,$00,$86,$26
!byte $20,$C2,$B8,$AE,$F8,$05,$18,$24,$38,$A0,$0D,$91,$48,$BD,$88,$C0
!byte $60,$20,$2A,$B8,$90,$F0,$A9,$10,$B0,$EE,$48,$A0,$01,$B1,$3C,$6A
!byte $68,$90,$08,$0A,$20,$6B,$BE,$4E,$78,$04,$60,$85,$2A,$20,$8E,$BE
!byte $B9,$78,$04,$24,$35,$30,$03,$B9,$F8,$04,$8D,$78,$04,$A5,$2A,$24
!byte $35,$30,$05,$99,$F8,$04,$10,$03,$99,$78,$04,$4C,$A0,$B9,$8A,$4A
!byte $4A,$4A,$4A,$A8,$60,$48,$A0,$02,$B1,$48,$6A,$66,$35,$20,$8E,$BE
!byte $68,$0A,$24,$35,$30,$05,$99,$F8,$04,$10,$03,$99,$78,$04,$60,$A0
!byte $03,$B1,$48,$85,$41,$A9,$AA,$85,$3E,$A0,$56,$A9,$00,$85,$44,$99
!byte $FF,$BB,$88,$D0,$FA,$99,$00,$BB,$88,$D0,$FA,$A9,$50,$20,$95,$BE
!byte $A9,$28,$85,$45,$A5,$44,$20,$5A,$BE,$20,$0D,$BF,$A9,$08,$B0,$24
!byte $A9,$30,$8D,$78,$05,$38,$CE,$78,$05,$F0,$19,$20,$44,$B9,$B0,$F5
!byte $A5,$2D,$D0,$F1,$20,$DC,$B8,$B0,$EC,$E6,$44,$A5,$44,$C9,$23,$90
!byte $D3,$18,$90,$05,$A0,$0D,$91,$48,$38,$BD,$88,$C0,$60,$A9,$00,$85
!byte $3F,$A0,$80,$D0,$02,$A4,$45,$20,$56,$BC,$B0,$6B,$20,$2A,$B8,$B0
!byte $66,$E6,$3F,$A5,$3F,$C9,$10,$90,$EC,$A0,$0F,$84,$3F,$A9,$30,$8D
!byte $78,$05,$99,$A8,$BF,$88,$10,$FA,$A4,$45,$20,$87,$BF,$20,$87,$BF
!byte $20,$87,$BF,$48,$68,$EA,$88,$D0,$F1,$20,$44,$B9,$B0,$23,$A5,$2D
!byte $F0,$15,$A9,$10,$C5,$45,$A5,$45,$E9,$01,$85,$45,$C9,$05,$B0,$11
!byte $38,$60,$20,$44,$B9,$B0,$05,$20,$DC,$B8,$90,$1C,$CE,$78,$05,$D0
!byte $F1,$20,$44,$B9,$B0,$0B,$A5,$2D,$C9,$0F,$D0,$05,$20,$DC,$B8,$90
!byte $8C,$CE,$78,$05,$D0,$EB,$38,$60,$A4,$2D,$B9,$A8,$BF,$30,$DD,$A9
!byte $FF,$99,$A8,$BF,$C6,$3F,$10,$CA,$A5,$44,$D0,$0A,$A5,$45,$C9,$10
!byte $90,$E5,$C6,$45,$C6,$45,$18,$60,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
!byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$00,$0D,$0B,$09,$07,$05,$03,$01
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F,$20,$93,$FE,$AD,$81,$C0,$AD,$81
!byte $C0,$A9,$00,$8D,$00,$E0,$4C,$44,$B7,$00,$00,$00,$8D,$63,$AA,$8D
!byte $70,$AA,$8D,$71,$AA,$60,$20,$5B,$A7,$8C,$B7,$AA,$60,$20,$7E,$AE
!byte $AE,$9B,$B3,$9A,$20,$16,$A3,$BA,$8E,$9B,$B3,$A9,$09,$4C,$85,$B3
!byte $A2,$E0,$A0,$07,$02,$88,$B1,$3E,$4A,$2E,$0A,$BC,$04,$1C,$99,$00
!byte $BB,$E8,$E0,$56,$90,$ED,$C7,$2E,$98,$D0,$9E,$A6,$55,$BD,$24,$18
!byte $29,$3F,$9D,$0A,$CA,$10,$00,$F5,$60,$38,$86,$27,$8E,$78,$06,$1C
!byte $BD,$8D,$C0,$FB,$F3,$18,$30,$7C,$AD,$2A,$85,$26,$0F,$A9,$FF,$9D
!byte $8F,$E7,$1D,$8C,$F0,$48,$68,$EA,$A0,$60,$04,$0A,$20,$B9,$B8,$88
!byte $0F,$D0,$F8,$A9,$D5,$1D,$FC,$75,$42,$AA,$22,$AD,$03,$98,$A0,$56
!byte $D0,$03,$B9,$00,$5C,$59,$FF,$BB,$AA,$BD,$29,$BA,$1B,$A6,$27,$9D
!byte $85,$60,$66,$52,$EB,$A5,$26,$EA,$70,$59,$A9,$15,$AE,$A1,$B0,$16
!byte $30,$50,$BB,$C8,$D0,$46,$EA,$3D,$20,$E5,$82,$DE,$72,$4B,$EB,$2D
!byte $DE,$B4,$0B,$FC,$06,$29,$60,$18,$DE,$D0,$66,$7C,$7A,$70,$A0,$06
!byte $A2,$56,$CA,$30,$FB,$77,$65,$5E,$CC,$2A,$00,$04,$91,$3E,$C8,$C4
!byte $26,$D8,$C0,$34,$20,$88,$30,$F0,$61,$5B,$10,$FB,$49,$7F,$D5,$2A
!byte $F4,$EA,$0A,$3D,$C9,$AA,$28,$F2,$92,$84,$0B,$7B,$AD,$38,$E7,$A9
!byte $05,$88,$84,$26,$BC,$10,$0E,$8B,$1E,$BA,$A4,$A8,$FF,$F8,$D0,$56
!byte $EE,$11,$91,$91,$2A,$EE,$10,$41,$D9,$E9,$13,$49,$39,$C3,$CF,$05
!byte $EA,$61,$0A,$5C,$38,$9B,$D0,$F7,$66,$1D,$4C,$04,$E6,$4A,$F0,$F3
!byte $16,$87,$4A,$C9,$6A,$E5,$EF,$74,$6E,$23,$09,$96,$18,$D8,$A0,$03
!byte $DC,$85,$27,$A9,$0F,$2A,$21,$3C,$13,$08,$25,$38,$C2,$2C,$0F,$45
!byte $27,$88,$41,$E7,$A8,$D0,$B7,$4A,$5C,$9C,$00,$18,$60,$86,$2B,$85
!byte $2A,$06,$CD,$78,$04,$F0,$53,$79,$36,$26,$AD,$12,$82,$1F,$38,$E5
!byte $2A,$80,$33,$B0,$07,$49,$FF,$EE,$C0,$1C,$90,$05,$69,$FE,$CE,$C7
!byte $0E,$C5,$26,$94,$02,$80,$4E,$C9,$0C,$B0,$03,$01,$A8,$38,$20,$EE
!byte $B9,$89,$11,$BA,$DA,$81,$AD,$A5,$27,$18,$F1,$F1,$90,$18,$1D,$90
!byte $9B,$19,$D0,$C3,$0F,$18,$81,$83,$29,$03,$2A,$05,$2B,$20,$62,$80
!byte $3B,$C0,$A6,$3B,$60,$B8,$A0,$80,$A2,$11,$CA,$D0,$FD,$E6,$46,$E8
!byte $02,$E8,$47,$1E,$38,$E9,$01,$CE,$F0,$60,$80,$30,$28,$24,$20,$1E
!byte $28,$1D,$1C,$01,$05,$70,$2C,$26,$22,$1F,$30,$0C,$96,$97,$9A,$00
!byte $9B,$9D,$9E,$9F,$A6,$A7,$AB,$AC,$00,$AD,$AE,$AF,$B2,$B3,$B4,$B5
!byte $B6,$00,$B7,$B9,$BA,$BB,$BC,$BD,$BE,$BF,$00,$CB,$CD,$CE,$CF,$D3
!byte $D6,$D7,$D9,$00,$DA,$DB,$DC,$DD,$DE,$DF,$E5,$E6,$00,$E7,$E9,$EA
!byte $EB,$EC,$ED,$EE,$EF,$00,$F2,$F3,$F4,$F5,$F6,$F7,$F9,$FA,$07,$FB
!byte $FC,$FD,$FE,$FF,$0A,$01,$74,$43,$FF,$B7,$08,$F5,$54,$B3,$27,$97
!byte $5E,$32,$22,$DD,$10,$20,$C3,$6F,$BC,$07,$CA,$8D,$0E,$16,$EA,$0B
!byte $FE,$F0,$AE,$27,$5F,$E2,$C8,$0B,$96,$8F,$A5,$41,$E8,$C4,$10,$44
!byte $88,$3F,$4F,$EF,$45,$9C,$BC,$85,$48,$4A,$05,$3E,$D8,$19,$68,$64
!byte $09,$54,$D4,$0A,$DE,$34,$E4,$EB,$4B,$18,$BA,$0C,$19,$27,$DD,$13
!byte $EA,$6D,$02,$54,$08,$A1,$DE,$10,$00,$60,$88,$A5,$E8,$91,$A0,$76
!byte $94,$52,$96,$06,$7B,$F8,$C8,$F8,$D0,$85,$1F,$A3,$00,$A0,$A5,$85
!byte $A4,$84,$48,$E8,$49,$F0,$02,$17,$8C,$F8,$06,$1B,$C1,$0A,$9F,$A1
!byte $01,$B1,$48,$60,$15,$0F,$75,$D1,$1E,$F0,$1B,$8A,$73,$17,$68,$F3
!byte $91,$DE,$CB,$34,$A0,$08,$CE,$05,$4F,$D0,$F6,$D1,$E0,$68,$AA,$49
!byte $77,$16,$15,$D2,$DF,$04,$8A,$F8,$05,$1C,$10,$03,$33,$EE,$26,$89
!byte $31,$30,$06,$72,$99,$36,$C1,$C8,$E5,$0A,$A6,$5E,$F3,$3E,$0D,$3C
!byte $85,$47,$C0,$BD,$24,$33,$10,$AB,$06,$3E,$9C,$28,$F0,$2C,$08,$6A
!byte $B7,$01,$BD,$8A,$C0,$B0,$03,$D5,$8B,$D4,$66,$35,$7F,$28,$0B,$D0
!byte $0B,$A0,$07,$2C,$9D,$7E,$FA,$68,$AE,$94,$87,$37,$58,$D1,$5A,$BE
!byte $28,$F4,$11,$A4,$1F,$47,$10,$0D,$8B,$12,$88,$19,$9E,$F7,$07,$87
!byte $F3,$D6,$0C,$36,$17,$F0,$5A,$C9,$03,$0C,$58,$6A,$08,$60,$7A,$64
!byte $B8,$A0,$30,$8C,$37,$78,$05,$69,$B0,$44,$B9,$90,$24,$62,$CE,$16
!byte $10,$F3,$C8,$E0,$48,$A9,$0F,$60,$20,$95,$BE,$D4,$D1,$1E,$F0,$28
!byte $BE,$A8,$8D,$D3,$FF,$C3,$32,$9F,$68,$09,$4C,$C0,$AB,$A4,$2E,$5D
!byte $CC,$4B,$28,$1C,$26,$66,$98,$4B,$68,$4C,$FC,$D0,$1E,$E5,$F0,$CA
!byte $01,$A9,$40,$28,$4C,$48,$FF,$CB,$39,$AB,$AF,$AD,$C9,$A5,$EC,$A5
!byte $2F,$EE,$0E,$A0,$AB,$68,$F0,$3C,$08,$C5,$F4,$C3,$82,$20,$D0,$E1
!byte $FB,$05,$01,$F6,$A8,$B9,$B8,$BF,$C5,$2D,$F0,$97,$28,$0F,$90,$1C
!byte $20,$DC,$74,$82,$3C,$8E,$B8,$A2,$1E,$86,$26,$DE,$C2,$E2,$04,$18
!byte $24,$38,$A0,$0D,$91,$2B,$88,$C0,$84,$FA,$2A,$B8,$90,$80,$DD,$10
!byte $B0,$EE,$FD,$24,$4D,$3C,$3E,$6A,$68,$81,$08,$0A,$20,$6B,$BE,$4E
!byte $97,$E6,$60,$1E,$C9,$5E,$8E,$58,$B9,$12,$24,$35,$3B,$30,$03,$E6
!byte $F4,$8D,$14,$31,$A5,$2A,$19,$05,$99,$01,$10,$03,$D7,$03,$1C,$4C
!byte $A0,$B9,$8A,$4A,$24,$03,$A8,$D1,$29,$32,$12,$6A,$18,$1C,$61,$68
!byte $0A,$A7,$23,$12,$60,$54,$51,$B1,$26,$41,$03,$3A,$3D,$3E,$25,$56
!byte $00,$12,$44,$99,$FF,$BB,$92,$38,$ED,$C2,$82,$06,$A9,$50,$AE,$D4
!byte $A2,$28,$85,$45,$6A,$47,$0F,$EF,$87,$0D,$BF,$CA,$A5,$1D,$24,$18
!byte $30,$D0,$05,$38,$92,$1D,$24,$F0,$19,$27,$85,$B0,$F5,$A5,$0A,$C2
!byte $F1,$BF,$BC,$9F,$EC,$E6,$B0,$4E,$C9,$23,$90,$24,$D3,$18,$8D,$21
!byte $BB,$14,$38,$BC,$99,$A5,$3F,$F4,$80,$D0,$00,$02,$A4,$45,$20,$56
!byte $BC,$B0,$6B,$AB,$CB,$A8,$66,$E6,$3F,$98,$91,$09,$C9,$10,$90,$EC
!byte $87,$16,$84,$AA,$4D,$80,$99,$A8,$BF,$88,$10,$FA,$CF,$47,$87,$14
!byte $03,$92,$86,$FE,$FC,$50,$F1,$5E,$23,$80,$F0,$15,$A1,$FC,$C5,$47
!byte $82,$22,$E9,$01,$80,$88,$C9,$05,$B0,$11,$28,$38,$60,$19,$F3,$A8
!byte $E7,$37,$8A,$86,$11,$28,$0B,$01,$C9,$0F,$EE,$A4,$15,$8C,$23,$EB
!byte $0C,$4C,$A4,$2D,$B9,$B0,$30,$58,$DD,$30,$60,$BF,$C6,$3F,$10,$CA
!byte $A0,$9D,$D0,$0A,$D9,$8C,$F3,$E5,$FB,$B6,$04,$25,$18,$60,$15,$22
!byte $00,$0D,$0B,$09,$07,$05,$03,$00,$01,$0E,$0C,$0A,$08,$06,$04,$02
!byte $01,$0F,$20,$93,$FE,$AD,$81,$C0,$A0,$07,$C4,$70,$8D,$0B,$E0,$4C
!byte $44,$B7,$2F,$85,$27,$63,$AA,$C6,$70,$06,$76,$71,$A0,$84,$5B,$A7
!byte $31,$8C,$B7,$0F,$7E,$AE,$C4,$9B,$B3,$7E,$9A,$0C,$16,$A3,$BA,$8E
!byte $10,$A9,$1F,$09,$4C,$85,$70,$00

177
src/unpack.a Normal file
View File

@ -0,0 +1,177 @@
;aPLib data decompressor for Apple II
;Peter Ferrie (peter.ferrie@gmail.com)
;assemble using ACME
;dst<src
!zone {
Unpack ;unpacker entrypoint
lda #0
sta last
sta ecx+1
literal
jsr getput
ldy #2
nexttag
jsr getbit
bcc literal
jsr getbit
bcc codepair
jsr getbit
bcs onebyte
jsr getsrc
lsr
beq donedepacking
ldx #0
stx ecx
rol ecx
stx last+1
tax
bne domatch_with_2inc
getbit
asl last
bne .stillbitsleft
jsr getsrc
asl
sta last
inc last
.stillbitsleft
donedepacking
rts
onebyte
ldy #1
sty ecx
iny
lda #0
sta tmpu+1
lda #$10
.getmorebits
pha
jsr getbit
pla
rol
bcc .getmorebits
bne domatch
jsr putdst
linktag
bne nexttag
codepair
jsr getgamma
- jsr dececx
dey
bne -
tay
ora ecx+1
beq +
normalcodepair
dey
sty last+1
jsr getsrc
tax
!byte $a9
+ iny
jsr getgamma
cpy #$7d
bcs domatch_with_2inc
cpy #5
bcs domatch_with_inc
txa
bmi domatch_new_lastpos
tya
bne domatch_new_lastpos
domatch_with_2inc
inc ecx
bne domatch_with_inc
inc ecx+1
domatch_with_inc
inc ecx
bne domatch_new_lastpos
inc ecx+1
domatch_new_lastpos
domatch_lastpos
ldy #1
lda last+1
sta tmpu+1
txa
domatch
sta tmpu
lda src+1
pha
lda src
pha
lda dst
sec
sbc tmpu
sta src
lda dst+1
sbc tmpu+1
sta src+1
- jsr getput
jsr dececx
ora ecx+1
bne -
pla
sta src
pla
sta src+1
bne linktag
getgamma
lda #1
sta ecx
sta ecx+1
dec ecx+1
.getgammaloop
jsr getbit
rol ecx
rol ecx+1
jsr getbit
bcs .getgammaloop
rts
dececx
lda ecx
bne +
dec ecx+1
+ dec ecx
lda ecx
rts
getput
jsr getsrc
putdst
sty tmpu
ldy #0
sta (dst), y
ldy tmpu
inc dst
bne +
inc dst+1
+ rts
getsrc
sty tmpu
ldy #0
lda (src), y
ldy tmpu
inc src
bne +
inc src+1
+ rts
}