Back to the "Kruncher".

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
XavSnap
Posts: 1705
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Back to the "Kruncher".

Post by XavSnap »

Hi,
From https://www.zx81.nl/dload/utils/

PRN0032.jpg
kruncher.jpg
kruncher.jpg (22.45 KiB) Viewed 278 times
Kruncher is a compression program like PKLITE, but then for the ZX81.
It works on ZX81 basic only, just load Kruncher, on te intro screen you can
choose a destination where the machinecoded program can be placed, the
default is 32500, then the program will NEW itself and you can load the
basic program and type RAND USR (address)
A krunched basic program doesn't need to be unkrunched and will now work
without kruncher but it's smaller.

Code: Select all

;------- TASM ASM mnemonics. -------
; Compile this file using:
; Set TASMOPTS = -b
; tasm -80 ThisCode.tas MyBinary.BIN
;-----------------------------------
; Zx81 Program name: VB81 XuR [CRUNCHER.P] :KRUNCHER.P
; REM   line   name: 0 REM:   238 Bytes@4082-416F

#define ORG  .org       ; TASM cross-assembler definitions
#define equ  .equ
;-----------------------------------

;------- Rom and Ram Symbols -------
SET_FAST equ $02E7
RAM_D_FILE equ $400C
RECLAIM_2 equ $0A60


ORG 32500
Lb4082:
	CALL SET_FAST ; [SET-FAST]
	JR Lb40B4 ; [$40B4:16564]
Lb4087:
	LD DE,(RAM_D_FILE) ; GET D-FILE
	DEC DE 
	LD HL,$407D 
Lb408F:
	PUSH HL 
	PUSH DE 
	EX DE,HL 
	AND A 
	SBC HL,DE 
	POP DE 
	POP HL 
	RET C 
	RET Z 
	INC HL 
	INC HL 
	PUSH HL 
	INC HL 
	INC HL 
	LD BC,$0000 
Lb40A1:
	LD A,$76 
	CP (HL) 
	JR Z, Lb40AA ; [$40AA:16554]
	INC BC 
	INC HL 
	JR Lb40A1 ; [$40A1:16545]
Lb40AA:
	INC BC 
	POP HL 
	LD (HL),C 
	INC HL 
	LD (HL),B 
	ADD HL,BC 
	INC HL 
	JR Lb408F ; [$408F:16527]
Lb40B3: ; <91491>
	NOP 
Lb40B4:
	LD HL,$407D 
	EX DE,HL 
	LD HL,(RAM_D_FILE) ; GET D-FILE
	AND A 
	SBC HL,DE 
	RET Z 
	LD B,H 
	LD C,L 
	EX DE,HL 
Lb40C2:
	LD A,$7E 
	CP (HL) 
	PUSH HL 
	PUSH BC 
	JR Z, Lb40D3 ; [$40D3:16595]
Lb40C9:
	POP BC 
	POP HL 
	INC HL 
	DEC BC 
	LD A,B 
	OR C 
	JR NZ, Lb40C2 ; [$40C2:16578]
	JR Lb4087 ; [$4087:16519]
Lb40D3:
	LD DE,$405B 
	LD B,$00 
Lb40D8:
	DEC HL 
	LD A,(HL) 
	NOP 
	NOP 
	NOP 
	NOP 
	CP $1B ; [27-"."]
	JR Z, Lb40EC ; [$40EC:16620]
	CP $25 ; [37-"9"]
	JR Z, Lb40E8 ; [$40E8:16616]
	JR NC, Lb40F1 ; [$40F1:16625]
Lb40E8:
	CP $1C ; [28-"0"]
	JR C, Lb40F1 ; [$40F1:16625]
Lb40EC:
	LD (DE),A 
	INC B 
	DEC DE 
	JR Lb40D8 ; [$40D8:16600]
Lb40F1:
	INC DE 
	INC HL 
	LD A,B 
	CP $00 ; [0]
	JR Z, Lb40C9 ; [$40C9:16585]
	CP $01 ; [1]
	JR NZ, Lb4109 ; [$4109:16649]
	LD A,(DE) 
	CP $1F ; [31-"3"]
	JR Z, Lb411B ; [$411B:16667]
	CP $1D ; [29-"1"]
	JR Z, Lb4124 ; [$4124:16676]
	CP $1C ; [28-"0"]
	JR Z, Lb412D ; [$412D:16685]
Lb4109:
	LD (HL),$C5 
	INC HL 
	LD (HL),$0B 
Lb410E:
	INC HL 
	LD A,(DE) 
	LD (HL),A 
	INC DE 
	DJNZ Lb410E ; [$410E:16654]
	INC HL 
	LD (HL),$0B 
	LD A,$03 
	JR Lb4134 ; [$4134:16692]
Lb411B:
	LD (HL),$CF 
	INC HL 
	LD (HL),$42 
	LD A,$05 
	JR Lb4134 ; [$4134:16692]
Lb4124:
	LD (HL),$D1 
	INC HL 
	LD (HL),$42 
	LD A,$05 
	JR Lb4134 ; [$4134:16692]
Lb412D:
	LD (HL),$D7 
	INC HL 
	LD (HL),$42 
	LD A,$05 
Lb4134:
	INC HL 
	LD B,$00 
	LD C,A 
	CALL RECLAIM_2 ; [RECLAIM-2]
	JR Lb40C9 ; [$40C9:16585]
Lb413D: ; <91905>
	NOP 
	NOP 
	LD HL, Lb4082 
	LD DE,$7EF4 
	LD BC,$00C8 
	LDIR 
	RET ; ==========================

Lb414B: 
	RET ; ==========================

Lb414C:
	RET ; ==========================

Lb414D: 
	RET ; ==========================

Lb414E:
	RET ; ==========================

Lb414F:
	RET ; ==========================

Lb4150: 
	RET ; ==========================

Lb4151:
	RET ; ==========================

Lb4152:
	RET ; ==========================

Lb4153: 
	RET ; ==========================

Lb4154:
	RET ; ==========================

Lb4155:
	RET ; ==========================

Lb4156: 
	RET ; ==========================

Lb4157:
	RET ; ==========================

Lb4158:
	RET ; ==========================

Lb4159:
	RET ; ==========================

Lb415A:
	RET ; ==========================

Lb415B: 
	RET ; ==========================

Lb415C:
	RET ; ==========================

Lb415D: 
	RET ; ==========================

Lb415E: 
	RET ; ==========================

Lb415F:
	RET ; ==========================

Lb4160: 
	RET ; ==========================

Lb4161:
	RET ; ==========================

Lb4162:
	RET ; ==========================

Lb4163:
	RET ; ==========================

Lb4164: 
	RET ; ==========================

Lb4165: 
	RET ; ==========================

Lb4166: 
	RET ; ==========================

Lb4167:
	RET ; ==========================

Lb4168:
	RET ; ==========================

Lb4169:
	RET ; ==========================

Lb416A:
	RET ; ==========================

Lb416B:
	RET ; ==========================

Lb416C:
	RET ; ==========================

Lb416D: 
	RET ; ==========================

Lb416E: 
	RET ; ==========================

Lb416F: 
	RET ; ==========================

.end

CRUNCHER.P
(2.65 KiB) Downloaded 13 times
Have fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply