[MEMOTECH] Serial I/F ROM Disassembly.

Discussions about Sinclair ZX80 and ZX81 Hardware
Post Reply
User avatar
XavSnap
Posts: 698
Joined: Sat May 10, 2008 4:23 pm

[MEMOTECH] Serial I/F ROM Disassembly.

Post by XavSnap » Thu Sep 05, 2019 10:36 pm

Hi,

The ROM is now available…
Thanks to Philippe.

Code: Select all

;------- TASM ASM mnemonics. -------
; Compile this file using:
; Set TASMOPTS = -b
; tasm -80 ThisCode.tas MyBinary.BIN
;-----------------------------------
; Zx81 Program name: VB81 XuR [MemotechCIF.bas] :
; REM   line   name: D=10752/11775 : H=2A00/2DFF

#define ORG  .org       ; TASM cross-assembler definitions
#define equ  .equ
;-----------------------------------
;- ZX81 CARACTERS CODES ------------
;-----------------------------------
_   .equ $00
_0  .equ $1C
_1  .equ $1D
_2  .equ $1E
_3  .equ $1F
_4  .equ $20
_5  .equ $21
_6  .equ $22
_7  .equ $23
_8  .equ $24
_9  .equ $25
A   .equ $26
B   .equ $27
C   .equ $28
D   .equ $29
E   .equ $2A
F   .equ $2B
G   .equ $2C
H   .equ $2D
I   .equ $2E
J   .equ $2F
K   .equ $30
L   .equ $31
M   .equ $32
N   .equ $33
O   .equ $34
P   .equ $35
Q   .equ $36
R   .equ $37
S   .equ $38
T   .equ $39
U   .equ $3A
V   .equ $3B
W   .equ $3C
X   .equ $3D
Y   .equ $3E
Z   .equ $3F
__  .equ $80
_A   .equ $A6
_B   .equ $A7
_C   .equ $A8
_D   .equ $A9
_E   .equ $AA
_F   .equ $AB
_G   .equ $AC
_H   .equ $AD
_I   .equ $AE
_J   .equ $AF
_K   .equ $B0
_L   .equ $B1
_M   .equ $B2
_N   .equ $B3
_O   .equ $B4
_P   .equ $B5
_Q   .equ $B6
_R   .equ $B7
_S   .equ $B8
_T   .equ $B9
_U   .equ $BA
_V   .equ $BB
_W   .equ $BC
_X   .equ $BD
_Y   .equ $BE
_Z   .equ $BF
;-----------------------------------

;------- Rom and Ram Symbols -------
FIND_INT equ $0EA7
DECODE equ $07BD
RAM_DF_CC equ $400E
DEBOUNCE equ $0F4B
RAM_D_FILE equ $400C
LPRINT_CH equ $0851
RAM_LAST_K equ $4025
RAM_VARS equ $4010
NEXT_ONE equ $09F2


ORG $2A00 ; [@10752/@h2A00]
.db __,__,__,__,__,__,__,__; ZX-TEXT
.db $72,__,$71,$70,$75,$76,__,__; ZX-TEXT
.db __,__,__,__,__,__,__,__; ZX-TEXT
.db __,$73,$D8,__,__,__,__,__; ZX-TEXT
.db _,$8C,",£,$,$8C,$8D,$8E; ZX-TEXT
.db (,),*,+,,,-,.,/; ZX-TEXT
.db 0,1,2,3,4,5,6,7; ZX-TEXT
.db 8,9,:,;,<,=,>,?; ZX-TEXT
.db $95,A,B,C,D,E,F,G; ZX-TEXT
.db H,I,J,K,L,M,N,O; ZX-TEXT
.db P,Q,R,S,T,U,V,W; ZX-TEXT
.db X,Y,Z,$94,$98,$96,$99,$93; ZX-TEXT
.db $9A,_A,_B,_C,_D,_E,_F,_G; ZX-TEXT
.db _H,_I,_J,_K,_L,_M,_N,_O; ZX-TEXT
.db _P,_Q,_R,_S,_T,_U,_V,_W; ZX-TEXT
.db _X,_Y,_Z,$90,$8B,$91,$92; ZX-TEXT

Lb2A7F:
.db $97; DATA

	LD C,$00 
	JP Lb2D12 ; [11538]

	LD C,$01 
	JP Lb2D12 ; [11538]

	LD C,$00 
	JP Lb2D40 ; [11584]

	LD C,$01 
	JP Lb2D40 ; [11584]

	LD B,$D5 
	CALL Lb2D62 ; [11618]
	JR NC, Lb2AA4 ; [$2AA4:10916]
	LD A,$16 
	LD ($2F0B),A 
	LD A,$08 
	JR Lb2AAE ; [$2AAE:10926]
Lb2AA4:
	CALL Lb2D93 ; [11667]
	LD ($2F0B),A 
	INC HL 
	CALL Lb2D93 ; [11667]
Lb2AAE:
	LD ($2F0A),A 
	INC A 
	LD ($2F0A),A 
	LD A,($2F0C) 
	RET ; ==========================

	LD (IY+34),$00 
	CALL Lb2BBA ; [11194]
	CALL Lb2CD3 ; [11475]
	LD (IY+57),$40 
Lb2AC7:
	CALL FIND_INT+5 ; []*BIOS ROM*
	JR Z, Lb2AD7 ; [$2AD7:10967]
	CALL Lb2CB5 ; [11445]
Lb2ACF:
	CALL Lb2C2C ; [11308]
	CALL Lb2B7B ; [11131]
	JR Lb2AC7 ; [$2AC7:10951]
Lb2AD7:
	CALL Lb2D9F ; [11679]
	JR Z, Lb2AC7 ; [$2AC7:10951]
	CALL Lb2C95 ; [11413]
	JR Z, Lb2AC7 ; [$2AC7:10951]
	CALL Lb2AF2 ; [10994]
	CALL Lb2BFF ; [11263]
	CALL Lb2C56 ; [11350]
	SRL C, (IY+110) 
	JR Z, Lb2AC7 ; [$2AC7:10951]
	JR Lb2ACF ; [$2ACF:10959]
Lb2AF2:
	PUSH HL 
	PUSH DE 
	CALL DECODE ; [DECODE]
	LD A,(HL) 
	POP DE 
	POP HL 
	LD B,$00 
	JR NC, Lb2B5B ; [$2B5B:11099]
	CALL Lb2CE4 ; [11492]
	CP $77 ; [119]
	JR NZ, Lb2B07 ; [$2B07:11015]
	LD A,$97 
Lb2B07:
	CP $E2 ; [226]
	JR NZ, Lb2B10 ; [$2B10:11024]
	CALL Lb2CF8 ; [11512]
	LD B,$01 
Lb2B10:
	CP $74 ; [116]
	JR NZ, Lb2B16 ; [$2B16:11030]
	LD B,$10 
Lb2B16:
	CP $79 ; [121]
	JR NZ, Lb2B1C ; [$2B1C:11036]
	LD B,$80 
Lb2B1C:
	CP $E3 ; [227]
	JR NZ, Lb2B42 ; [$2B42:11074]
Lb2B20:
	LD A,D 
	CP $16 ; [22-"-"]
	DEC A 
	JR C, Lb2B2B ; [$2B2B:11051]
	CALL Lb2C33 ; [11315]
	JR Lb2B20 ; [$2B20:11040]
Lb2B2B:
	LD (RAM_DF_CC),HL ; SET DF-CC
	LD A,$19 
	SUB D 
	LD (IY+58),A 
	LD A,$22 
	SUB E 
	LD (IY+57),A 
	POP BC 
	LD (IY+34),$02 
	JP DEBOUNCE ; [DEBOUNCE]
Lb2B42:
	CP $E1 ; [225]
	JR NZ, Lb2B48 ; [$2B48:11080]
	LD B,$02 
Lb2B48:
	CP $DD ; [221]
	JR NZ, Lb2B4E ; [$2B4E:11086]
	LD B,$08 
Lb2B4E:
	CP $E5 ; [229]
	JR NZ, Lb2B54 ; [$2B54:11092]
	LD B,$20 
Lb2B54:
	CALL Lb2CE4 ; [11492]
	INC B 
	DEC B 
	JR Z, Lb2B66 ; [$2B66:11110]
Lb2B5B:
	LD A,(IY+57) 
	XOR B 
	LD (IY+57),A 
	POP BC 
	JP Lb2AC7 ; [10951]
Lb2B66:
	SRL C, (IY+102) 
	RET Z 
	CP $0B ; [11-"""]
	RET C 
	CP $1C ; [28-"0"]
	JR C, Lb2B78 ; [$2B78:11128]
	CP $26 ; [38-"A"]
	RET C 
	CP $40 ; [64]
	RET NC 
Lb2B78:
	SET 7,A 
	RET ; ==========================

Lb2B7B:
	CALL Lb2CE4 ; [11492]
	LD BC,$2BEE 
	PUSH BC 
	CP $70 ; [112]
	JR NZ, Lb2B96 ; [$2B96:11158]
Lb2B86:
	DEC D 
	JR NZ, Lb2B8F ; [$2B8F:11151]
	LD D,$18 
	LD BC,$0318 
	ADD HL,BC 
Lb2B8F:
	LD BC,$0021 
	AND A 
	SBC HL,BC 
	RET ; ==========================

Lb2B96:
	CP $71 ; [113]
	JR NZ, Lb2BA0 ; [$2BA0:11168]
	INC D 
	LD BC,$0021 
	ADD HL,BC 
	RET ; ==========================

Lb2BA0:
	CP $72 ; [114]
	JR NZ, Lb2BAF ; [$2BAF:11183]
	DEC HL 
	DEC E 
	RET NZ 
	LD BC,$0020 
	ADD HL,BC 
	LD E,$20 
	JR Lb2B86 ; [$2B86:11142]
Lb2BAF:
	CP $73 ; [115]
	JR NZ, Lb2BB6 ; [$2BB6:11190]
	INC E 
	INC HL 
	RET ; ==========================

Lb2BB6:
	CP $75 ; [117]
	JR NZ, Lb2BDE ; [$2BDE:11230]
Lb2BBA:
	LD C,A 
	LD B,(IY+57) 
	PUSH BC 
	LD HL,(RAM_D_FILE) ; GET D-FILE
	INC HL 
	LD (RAM_DF_CC),HL ; SET DF-CC
	LD (IY+58),$18 
	LD (IY+57),$21 
	LD B,$C0 
	SUB A 
Lb2BD1:
	RST 10H ; Display= A reg.
	RST 10H ; Display= A reg.
	RST 10H ; Display= A reg.
	RST 10H ; Display= A reg.
	DJNZ Lb2BD1 ; [$2BD1:11217]
	POP BC 
	LD (IY+57),B 
	LD A,C 
	JR Lb2BE2 ; [$2BE2:11234]
Lb2BDE:
	CP $D8 ; [216]
	JR NZ, Lb2BEA ; [$2BEA:11242]
Lb2BE2:
	LD HL,(RAM_D_FILE) ; GET D-FILE
	INC HL 
	LD E,$01 
	LD D,E 
	RET ; ==========================

Lb2BEA:
	CALL Lb2C6E ; [11374]
	RET ; ==========================

	SRL C, (IY+78) 
	JR Z, Lb2BFB ; [$2BFB:11259]
	PUSH HL 
	PUSH DE 
	CALL LPRINT_CH ; [LPRINT-CH]
	POP DE 
	POP HL 
Lb2BFB:
	CALL Lb2CD3 ; [11475]
	RET ; ==========================

Lb2BFF:
	SRL C, (IY+94) 
	JR Z, Lb2C1F ; [$2C1F:11295]
	SRL C, (IY-98) 
	SUB $25 
	JR NC, Lb2C1A ; [$2C1A:11290]
	ADD A,$03 
	JP P, Lb2C1D ; [11293]
	ADD A,$06 
	JP M, Lb2C1D ; [11293]
	ADD A,$1A 
	RET ; ==========================

Lb2C1A:
	CP $1B ; [27-"."]
	RET C 
Lb2C1D:
	LD A,$0F 
Lb2C1F:
	PUSH HL 
	LD HL, Lb2A7F 
	LD BC,$0080 
	CPDR 
	LD A,C 
	AND A 
	POP HL 
	RET ; ==========================

Lb2C2C:
	AND $7F 
	LD B,$2A 
	LD C,A 
	LD A,(BC) 
	RET ; ==========================

Lb2C33:
	PUSH HL 
	PUSH DE 
	LD HL,(RAM_D_FILE) ; GET D-FILE
	LD D,H 
	LD E,L 
	LD BC,$0021 
	ADD HL,BC 
	LD BC,$02F7 
	LDIR 
	LD B,$20 
Lb2C45:
	DEC HL 
	LD (HL),$00 
	DJNZ Lb2C45 ; [$2C45:11333]
	POP DE 
	POP HL 
	LD D,A 
	LD BC,$0021 
	SBC HL,BC 
	RET ; ==========================

Lb2C53:
	CALL Lb2C1F ; [11295]
Lb2C56:
	LD ($2F08),A 
	CP $0D ; [13-"$"]
	RET NZ 
	SRL C, (IY+126) 
	RET Z 
Lb2C61:
	CALL Lb2D9F ; [11679]
	JR Z, Lb2C61 ; [$2C61:11361]
	LD A,$0A 
	LD ($2F08),A 
	LD A,$0D 
	RET ; ==========================

Lb2C6E:
	CP $80 ; [128]
	RET Z 
	PUSH AF 
	CP $76 ; [118]
	JR NZ, Lb2C90 ; [$2C90:11408]
	SRL C, (IY+126) 
	LD B,$00 
	JR Z, Lb2C87 ; [$2C87:11399]
	LD A,$21 
	SUB E 
	LD C,A 
	ADD HL,BC 
	LD E,$21 
	JR Lb2C93 ; [$2C93:11411]
Lb2C87:
	LD C,E 
	DEC C 
	AND A 
	SBC HL,BC 
	LD E,$01 
	JR Lb2C93 ; [$2C93:11411]
Lb2C90:
	LD (HL),A 
	INC HL 
	INC E 
Lb2C93:
	POP AF 
	RET ; ==========================

Lb2C95:
	LD BC,(RAM_LAST_K) ; GET LAST-K
	INC C 
	JR NZ, Lb2CA1 ; [$2CA1:11425]
	SRL C, (IY-10) 
	RET ; ==========================

Lb2CA1:
	DEC C 
	SRL C, (IY+118) 
	RET Z 
	SRL C, (IY-74) 
	RET ; ==========================

Lb2CAC:
	LD A,($2F0D) 
	AND $08 
	LD B,$00 
	LD C,A 
	RET ; ==========================

Lb2CB5:
	LD A,($2F0C) 
	LD C,A 
	LD A,($2F0E) 
	AND $FE 
	LD ($2F0A),A 
	OR $01 
	LD ($2F0A),A 
	LD A,C 
	LD B,$00 
	RET ; ==========================

Lb2CCA:
	LD A,($2F0D) 
	AND $10 
	LD B,$00 
	LD C,A 
	RET ; ==========================

Lb2CD3:
	PUSH AF 
	LD A,(HL) 
	CP $76 ; [118]
	JR NZ, Lb2CDD ; [$2CDD:11485]
	INC HL 
	LD E,$01 
	INC D 
Lb2CDD:
	LD A,$18 
	CP D 
	CALL C, Lb2C33 ; [11315]
	POP AF 
Lb2CE4:
	PUSH AF 
	LD A,(HL) 
	RLA 
	CCF 
	RRA 
	LD (HL),A 
	POP AF 
	RET ; ==========================

	SRL C, (IY-2) 
	CALL Lb2CF8 ; [11512]
	SRL C, (IY-66) 
	RET ; ==========================

Lb2CF8:
	PUSH HL 
	PUSH DE 
	LD DE,$0317 
	LD HL,(RAM_D_FILE) ; GET D-FILE
Lb2D00:
	CALL Lb2D9F ; [11679]
	JR Z, Lb2D00 ; [$2D00:11520]
	LD A,(HL) 
	INC HL 
	CALL Lb2C53 ; [11347]
	DEC DE 
	LD A,D 
	OR E 
	JR NZ, Lb2D00 ; [$2D00:11520]
	POP DE 
	POP HL 
	RET ; ==========================

Lb2D12:
	LD B,$D7 
	CALL Lb2D62 ; [11618]
	PUSH DE 
Lb2D18:
	LD A,D 
	OR E 
	JR Z, Lb2D3A ; [$2D3A:11578]
	DEC DE 
	PUSH BC 
Lb2D1E:
	CALL Lb2CAC ; [11436]
	JR Z, Lb2D1E ; [$2D1E:11550]
	CALL Lb2CB5 ; [11445]
	POP BC 
	INC C 
	DEC C 
	JR Z, Lb2D30 ; [$2D30:11568]
	PUSH BC 
	CALL Lb2C2C ; [11308]
	POP BC 
Lb2D30:
	INC HL 
	LD (HL),A 
	CP $03 ; [3]
	JR Z, Lb2D3A ; [$2D3A:11578]
	CP $07 ; [7]
	JR NZ, Lb2D18 ; [$2D18:11544]
Lb2D3A:
	POP HL 
	SBC HL,DE 
	LD B,H 
	LD C,L 
	RET ; ==========================

Lb2D40:
	CALL Lb2D60 ; [11616]
	PUSH DE 
Lb2D44:
	LD A,D 
	OR E 
	JR Z, Lb2D5E ; [$2D5E:11614]
	DEC DE 
Lb2D49:
	CALL Lb2D9F ; [11679]
	JR Z, Lb2D49 ; [$2D49:11593]
	INC HL 
	LD A,(HL) 
	INC C 
	DEC C 
	JR Z, Lb2D59 ; [$2D59:11609]
	PUSH BC 
	CALL Lb2C1F ; [11295]
	POP BC 
Lb2D59:
	LD ($2F08),A 
	JR Lb2D44 ; [$2D44:11588]
Lb2D5E:
	POP BC 
	RET ; ==========================

Lb2D60:
	LD B,$D9 
Lb2D62:
	LD DE,(RAM_VARS) ; GET VARS
Lb2D66:
	EX DE,HL 
	LD A,(HL) 
	CP B 
	JR Z, Lb2D85 ; [$2D85:11653]
	ADD A,$80 
	JR NZ, Lb2D76 ; [$2D76:11638]
	LD A,$D5 
	CP B 
	SCF 
	RET Z 
	RST 08H 
.db	$1A ; RST8 Arg: Error Code:'R'
Lb2D76:
	CP B 
	JR Z, Lb2D80 ; [$2D80:11648]
	PUSH BC 
	CALL NEXT_ONE ; [NEXT-ONE]
	POP BC 
	JR Lb2D66 ; [$2D66:11622]
Lb2D80:
	INC HL 
	LD E,(HL) 
	INC HL 
	LD D,(HL) 
	RET ; ==========================

Lb2D85:
	INC HL 
	LD E,(HL) 
	INC HL 
	LD D,(HL) 
	INC HL 
	DEC DE 
	LD B,(HL) 
Lb2D8C:
	INC HL 
	INC HL 
	DEC DE 
	DEC DE 
	DJNZ Lb2D8C ; [$2D8C:11660]
	RET ; ==========================

Lb2D93:
	LD B,$08 
Lb2D95:
	INC HL 
	LD A,(HL) 
	ADD A,$E3 
	RL C 
	DJNZ Lb2D95 ; [$2D95:11669]
	LD A,C 
	RET ; ==========================

Lb2D9F:
	CALL Lb2CCA ; [11466]
	RET Z 
	LD A,($2F0D) 
	CPL 
	AND $40 
	LD C,A 
	LD B,$00 
	RET ; ==========================

	LD H,$2C 
	POP BC 
	INC HL 
	LD (HL),A 
	CP $03 ; [3]
	JR Z, Lb2DBA ; [$2DBA:11706]
	CP $07 ; [7]
	JR NZ, Lb2D98 ; [$2D98:11672]
Lb2DBA:
	POP HL 
	SBC HL,DE 
	LD B,H 
	LD C,L 
	RET ; ==========================

	CALL Lb2D60 ; [11616]
	PUSH DE 
Lb2DC4:
	LD A,D 
	OR E 
	JR Z, Lb2DDE ; [$2DDE:11742]
	DEC DE 
Lb2DC9:
	CALL Lb2D9F ; [11679]
	JR Z, Lb2DC9 ; [$2DC9:11721]
	INC HL 
	LD A,(HL) 
	INC C 
	DEC C 
	JR Z, Lb2DD9 ; [$2DD9:11737]
	PUSH BC 
	CALL Lb2C1F ; [11295]
	NOP 
Lb2DD9:
	LD ($2F08),A 
	JR Lb2DC4 ; [$2DC4:11716]
Lb2DDE:
	POP BC 
	RET ; ==========================

	LD B,$D9 
	LD DE,(RAM_VARS) ; GET VARS
Lb2DE6:
	EX DE,HL 
	LD A,(HL) 
	CP B 
	JR Z, Lb2E05 ; [$2E05:11781]
	ADD A,$80 
	JR NZ, Lb2DF6 ; [$2DF6:11766]
	LD A,$D5 
	CP B 
	SCF 
	RET Z 
	RST 08H 
.db	$1A ; RST8 Arg: Error Code:'R'
Lb2DF6:
	CP B 
	JR Z, Lb2E00 ; [$2E00:11776]
	PUSH BC 
	CALL NEXT_ONE ; [NEXT-ONE]
	POP BC 
	JR Lb2DE6 ; [$2DE6:11750]


;------------ Labels errors ------------
; LABEL ERROR @LB2D98:JR NZ,-34	[$2D98:11672]
.end
Memotech_SIF.zip
(557.88 KiB) Downloaded 2 times
If something's wrong, let me know !

User avatar
XavSnap
Posts: 698
Joined: Sat May 10, 2008 4:23 pm

Re: [MEMOTECH] Serial I/F ROM Disassembly.

Post by XavSnap » Mon Sep 09, 2019 8:56 pm

Hi All,

Another "instruction Manual" rebuilt from the OCRed text… (ZX81.NL)
If something's wrong, let me know. (/or edit the ODT file…)

Have fun…
MemotechSIF.pdf
(1.25 MiB) Downloaded 14 times
ODT.zip
(1.78 MiB) Downloaded 4 times

User avatar
XavSnap
Posts: 698
Joined: Sat May 10, 2008 4:23 pm

Re: [MEMOTECH] Serial I/F ROM Disassembly.

Post by XavSnap » Wed Sep 11, 2019 9:06 am

Hi,

JPG pictures @ http://dl.free.fr/vElm8Zfyj
vignettes.JPG
ikea.jpg
ikea.jpg (31.72 KiB) Viewed 86 times

Post Reply