You are on page 1of 56

MPF-I

MONITOR
PROGRAM
SOURCE LISTING

____________________________________________________________________________________

COPYRIGHT
Copyright 1981 by MULTITECH INDUSTRIAL CORP. All rights
reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrival system, or translated into
any language or computer language, in any form or by any means,
electronic, mechanical, magnetic, optical, chemical, manual or otherwise, whitout the prior written permission of MULTITECH INDUSTRIAL CORP.

DISCLAIMER
MULTITECH INDUSTRIAL CORP. makes no representations or
warranties, either express or implied, with respect to the contents
hereof and specifically disclaims any warranties or merchantability
or fitness for any particular purpose. MULTITECH INDUSTRIAL
CORP. software described in this manual is sold or licensed as is.
Should the programs prove defective following their purchase, the
buyer ( and not MULTITECH INDUSTRIAL CORP., its distrinuitor,
or its dealer ) assumes the entire cost of all necessary servicing, repair, and any incidental or consequential damages resulting from any
Defect in the software. Further, MULTITECH INDUSTRIAL CORP.
reserves the right to revise this publication and to make changes from
time to time in the content hereof without obligation of MULTITECH INDUSTRIAL CORP. to notify any person of such revision
or changes.

Multitech
INDUSTRIAL CORP.
OFFICE/
SFL. 266 SUNG CHIANG ROAD, TAIPEI 104
TAIWAN, R.O.C.
TEL: (02)6511101
TELEX: 19162 MULTIIC FAX: (02)5422805
FACTORY/
INDUSTRYE, ROAD, III.
HSINCHU SCIENCE BASED INDUSTRIAL PARK
HSINCHU, TAIWAN 300 R.O.C.

_________________________________________________________________________________

ii

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058

0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000 FF FF ...
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800

MPF-1
SOURCE STATEMENT

;***********************************************************
;*
*
COPYRIGHT , MULTITECH INDUSTRIAL CORP. 1981
*
;*
;*
All right reserved.
*
;*
No part of this software may be copied without
*
;*
the express written consent of MULTITECH
*
;*
INDUSTRIAL CORP.
*
;*
*
;***********************************************************
;
;
.FILL 0800H,0FFH
;Write 0FFH into 2KBytes EPROM.
;
P8255
DIGIT
SEG7
KIN
PWCODE
ZSUM

.EQU
.EQU
.EQU
.EQU
.EQU
.EQU

03H
02H
01H
00H
0A5H
71H

;8255 I control port


;8255 I port C
;8255 I port B
;8255 I port A
;Power-up code
;This will make the sum of all
;monitor codes to be zero

; The following EQUATEs are used for timing. Their values


; depend on the CPU clock frequency. (In this version, the
; crystal frequency is 1.79 MHz.)
COLDEL

.EQU

201

F1KHZ

.EQU

65

F2KHZ

.EQU

31

MPERIOD

.EQU

42

;
;
;
;
;
;
;
;
;
;

;Column delay time for routine


;SCAN and SCAN1
;Delay count for 1 kHz square wave,
;used by routine TONE1K.
;Delay count for 2 kHz square wave,
;used by routine TONE2k.
;1 kHz and 2 kHz threshold, used by
;tape input routine PERIOD.

The following EQUATEs are for tape modulation.


If the quality of tape recorder is good, the user may
change '4 4 2 8' to '2 2 1 4'. This will double
the tape data rate.
If the quality of tape recorder is poor, the user may
change '4 4 2 8' to '6 6 3 12'. This will improve
error performance but slow down the data rate.
Although the data format is changed the tape is still
compatible in each case, because only the ratio is
detected in the Tape-read.

ONE_1K
ONE_2K
ZERO_1K
ZERO_2K

.EQU
.EQU
.EQU
.EQU

4
4
2
8

;***********************************************************
; I/O port assignment: (8255 I)
; port A (address 00H):
;
bit 7 -- tape input
;
bit 6 -- 'USER KEY' on keyboard, active low
;
bit 5-0 row of keyboard matrix input, active low

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116

0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0800
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0002
0004
0004
0004
0004
0004
0006
0008
0008
0008
0008
0008
0008
0008
000A
000C

OBJ CODE M

MPF-1
SOURCE STATEMENT

; port B (address 01H): 7 segments of LED, active high


;
bit 7 -- segment d
;
bit 6 -- decimal point
;
bit 5 -- segment c
;
bit 4 -- segment b
;
bit 3 -- segment a
;
bit 2 -- segment f
;
bit 1 -- segment g
;
bit 0 -- segment e
; port C (address 02H):
;
bit 7 -- tape & tone output
;
bit 6 -- BREAK enable. NMI (CPU pin 17) will go to
;
low 5 M1's (machine cycle one) after this
;
bit goes to low. (This bit is connected to
;
the reset input of external counter.)
;
bit 5-0 -- colums of keyboard and the display matrix,
;
active high. Bit 5 is the leftmost column.
;***********************************************************
RST00
.ORG 00H
;original comment: -- reset -; There are two cases that will generate a RESET signal:
;
(i) power-up
;
(ii) 'RS' key pressed
; In both cases, the following actions will be taken:
;
a) disable interrupt, set interrupt mode to 0
;
set I register to 00 and start execution
;
at address 0000 (by Z80 CPU itself).
;
b) initial user's PC to the lowest RAM address;
;
c) set user's SP to 1F9FH;
;
d) set user's I register to 00 and disable user's
;
interrupt flip-flop;
; In addition subroutine INI will be called on power-up
; reset, which has the following effects:
;
e) disable BREAK POINT;
;
f) set the contents of location 1FEEH and 1FEFH to 66
;
and 00 respectively. This will make instruction RST
;
38H (opcode FF) have the same effect as BREAK.
; Memory location POWERUP is used to distinguish power-up
; from RS-key. (POWERUP) contains random data when
; power-up and contains PWCODE (0A5H) thereafter.
06 00
10 FE

LD
DJNZ

B,0
$

;Power-up delay

; Initialize 8255 to mode 0 with port A input, port B and C


; output. The control word is 90H.
3E 90
D3 03

LD
OUT
;
;
;
;

3E C0
D3 02
31 AF 1F

A,10010000B
(P8255),A

When the control word is sent to 8255, all output


ports are cleared to 0. It is necessary to disable
BREAK and deactivate all I/O by sending 0C0H to
port C.
LD
OUT
LD

A,0C0H
(DIGIT),A
SP,SYSSTK

;initial system stack

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174

000F
000F
000F
000F
000F
0012
0014
0017
0017
0017
0017
0017
0017
001A
001D
001F
0021
0024
0026
0026
0026
0026
0026
0026
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0028
0029
002A
002B
002E
0030
0030
0030
0030
0030
0030
0030
0030
0030
0030
0030

OBJ CODE M

MPF-1
SOURCE STATEMENT

; If the content of location POWERUP is not equal to


; PWCODE, call subroutine INI. Continue otherwise.
3A E5 1F
FE A5
C4 C1 03

LD
CP
CALL

A,(POWERUP)
PWCODE
NZ,INI

; Determine the lowest RAM address by checking whether


; address 1000H is RAM. If yes, set user's PC to this
; value. Otherwise, set it to 1800H.
21
CD
28
26
22
26

00 10
F6 05
02
18
DC 1F
00

PREPC

LD
CALL
JR
LD
LD
LD

HL,1000H
RAMCHK
Z,PREPC
H,18H
(USERPC),HL
H,0

; Address 28H and 30H are reserved for BREAK (RST 28H)
; and software BREAK (RST 30H). Skip these area, monitor
; program resumes at RESET1.
18 0A

E3
2B
E3
22 E8 1F
18 0E

JR
RESET1
;
;***********************************************************
RST28
.ORG 28H
; Address 28H is the entry point of BREAK trap.
; If a location is set as a BREAK point, the monitor
; will change the content of this location to C7 (RST 28H)
; before transfering control to user's program.
; In execution of user's program, a trap will occur if
; user's PC passes this location. The monitor then takes
; over control and the content of BREAK address
; will be restored. Monitor takes care of everything
; and makes the whole mechanism transparant to the user.
; The return address pushed onto stack is the PC after
; executing RST 28H. The original break address should
; be one less than that. The following 3 instructions
; decrease the content of (SP) by one without changing
; HL.
EX
DEC
EX
LD
JR

(SP),HL
HL
(SP),HL
(HLTEMP),HL
CONT28

;
;***********************************************************
RST30
.ORG 30H
; Instruction RST 30H (opcode F7) is usually used as:
;
i) Software break;
; ii) Terminator of user's program.
; The effect of this instruction is to save all user's
; registers and return to monitor.
18 34

JR

NMI

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232

0032
0032
0032
0032
0032
0032
0032
0035
0035
0037
0037
0037
0037
0037
0037
0037
0037
0038
0038
0038
0038
0038
0038
0038
0038
0038
0038
0038
0038
0038
0038
0038
0039
003C
003D
003D
003D
003D
003D
003D
003E
003E
003E
003E
003E
003E
003E
0041
0041
0041
0041
0041
0041
0041
0041
0044
0047
0048

OBJ CODE M

22 D2 1F
18 1D

MPF-1
SOURCE STATEMENT

;***********************************************************
; This is a part of reset routine. Address 0028 and
; 0030 are reserved for break point. Reset routine
; skips this area and resumes here.
;
RESET1
LD
(USERIF),HL
;set user's I register and
;interrupt flip flop to 0
JR
RESET2
;monitor resumes at RESET2
;***********************************************************
; The following byte makes the sum of the monitor
; code in ROM zero. ROMTEST is a self-checking routine.
; This routine requires the sum of ROM to be zero.

71

.BYTE ZSUM
;
;***********************************************************
RST38
.ORG 38H
;
;
;
;
;
;
;
;
;

E5
2A EE 1F
E3

Entry point of RST 38H (opcode FF) or mode 1 interrupt.


Fetch the address stored in location 1FEE and 1FEF,
then jump to this address. Initially, 1FEE and 1FEF
are set to 0066. So RST 38 will have the same effect
as software break. By changing the content of 1FEE
and 1FEF, the user can define his or her own service
routine.
The next three instructions push the contents of 1FEE
and 1FEF to stack without changing any registers.
PUSH
LD
EX

HL
HL,(IM1AD)
(SP),HL

; The top of the stack is now the address of user


; defined service routine. Pop out this address then
; branch to it.
C9

RET
;
;***********************************************************
CONT28:
; This is a part of break service routine. It continues
; the program at RST28.

32 E7 1F

LD
;
;
;
;
;

2A E0 1F
3A E2 1F
77

(ATEMP),A

The monitor has changed the content of user's


program at break address. The next 3 instructions
restore the destroyed content. BRAD contains the
break address, BRDA contains the original data at
break address.
LD
LD
LD

HL,(BRAD)
A,(BRDA)
(HL),A

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290

0048
0048
0048
0048
004A
004C
004F
0052
0053
0054
0054
0054
0054
0054
0054
0054
0054
0057
005A
005B
005E
005E
005E
005E
005E
005E
0062
0062
0062
0062
0062
0065
0065
0066
0066
0066
0066
0066
0066
0066
0066
0066
0069
006B
006D
006D
006F
0071
0074
0077
0078
007B
007B
007E
007E
0081
0085
0088

OBJ CODE M

MPF-1
SOURCE STATEMENT

; Send break enable signal to hardware counter.


; A nonmaskable interrupt will be issued at the 5th M1's
3E
D3
3A
2A
00
C9

80
02
E7 1F
E8 1F

21 9F 1F
22 D0 1F
AF
32 E6 1F

LD
OUT
LD
LD
NOP
RET

A,10000000B
(DIGIT),A
A,(ATEMP)
HL,(HLTEMP)

;
;
;
;

1st
2nd
3rd
4th

M1
M1
M1
M1

; Return to user's program. Execute the instruction


; at break address. After finishing one instruction,
; a nonmaskable interrupt happens and control is
; transferred to the monitor again.
;
RESET2:
LD
HL,USERSTK
LD
(USERSP),HL
;set user's SP
XOR
A
LD
(TEST),A
; TEST is a flag for monitor's own use. Illegal key-in
; blanking (bit 7 of TEST) and automatic leading zero
; (bit 0) use this flag. Clear it here.

DD 21 9F 07

LD

IX,MPF_I

; Address 0066 is the address for nonmaskable interrupt


; Skip this area, monitor resumes at SETST0
C3 D0 00
FF

JP
SETST0
; Address 0065 is an EPROM erased location.
;***********************************************************
NMI
.ORG 66H
;
;
;
;
;

Entry point of nonmaskable interrupt. NMI will occur


when MONI key is pressed or when user's program is
breaked. The service routine which starts here saves all
user's registers and status. It also checks the validity
of user's SP.

32 E7 1F
3E 90
D3 03

LD
LD
OUT

(ATEMP),A
A,10010000B
(P8255),A

3E
D3
3A
22
E1
22

LD
OUT
LD
LD
POP
LD

A,0C0H
(DIGIT),A
A, (ATEMP)
(HLTEMP),HL
HL
(ADSAVE),HL

C0
02
E7 1F
E8 1F
DE 1F

RGSAVE

22 DC 1F

LD

2A
ED
31
FD

LD
LD
LD
PUSH

E8 1F
73 D0 1F
D0 1F
E5

;save A register
;set 8255 to mode 0.
;Port A input; B,C output.

;disable break and LED's


;restore A register
;save register HL
;get return address from stack
;Save return address into
;ADSAVE.
(USERPC),HL
;Set user's PC to return
;address.
HL,(HLTEMP)
;restore HL register
(USERSP),SP
;set user's SP to current SP
SP,USERIY+2
;save other registers by
IY
;continously pushing them

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348

008A
008C
008D
008E
008F
0090
0091
0092
0093
0094
0095
0096
0097
0098
0098
0098
0098
0098
0098
0098
0098
009A
009D
009D
009D
009D
009D
009F
00A2
00A4
00A7
00A7
00AA
00AA
00AA
00AA
00AA
00AA
00AD
00B1
00B2
00B5
00B7
00B8
00BB
00BD
00BD
00BD
00BD
00BD
00BD
00C1
00C2
00C3
00C3
00C6
00C7
00C9

DD E5
D9
E5
D5
C5
D9
08
F5
08
E5
D5
C5
F5

MPF-1
SOURCE STATEMENT

PUSH
EXX
PUSH
PUSH
PUSH
EXX
EX
PUSH
EX
PUSH
PUSH
PUSH
PUSH
;
;
;
;
;

IX

;onto stack

HL
DE
BC
AF,AF'
AF
AF,AF'
HL
DE
BC
AF

The next two instructions save I register.


The interrupt flip-flop (IFF2) is copied into
parity flag (P/V) by instruction LD A, I.
The interrupt status (enabled or disabled)
can be determined by testing parity flag.

ED 57
32 D3 1F

LD
LD

A,I
(USERIF+1),A

; The next four instructions save IFF2 into


; user's IFF.
3E
E2
3E
32

00
A4 00
01
D2 1F

31 AF 1F

SETIF
;

LD
JP
LD
LD

A,0
PO,SETIF
A, 1
(USERIF),A

LD

SP,SYSSTK

;PO -- P/V = 0

;set SP to system stack

;The next 8 instructions check user's SP.


; If the user's SP points to a location not
; in RAM, display ERR-SP.
2A
DD
2B
CD
20
2B
CD
20

D0 1F
21 B5 07
F6 05
19
F6 05
13

LD
LD
DEC
CALL
JR
DEC
CALL
JR

HL,(USERSP)
IX,ERR_SP
HL
RAMCHK
NZ,SETST0
HL
RAMCHK
NZ,SETST0

; If the user's stack and system stack are


; overlayed, display SYS-SP. This checking
; is done by the following instructions.
DD 21 AF 07
00
00

LD
NOP
NOP

IX,SYS_SP

11 62 E0
19
38 07
DD 21 B6 1F

LD
ADD
JR
LD

DE,-USERSTK+1
HL,DE
C,SETST0
IX,DISPBF

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406

00CD
00CE
00CE
00D0
00D0
00D0
00D0
00D0
00D0
00D0
00D0
00D0
00D1
00D4
00D7
00D7
00DA
00DB
00DB
00DB
00DB
00DB
00DB
00DE
00DE
00DE
00DE
00DE
00DE
00DE
00DE
00DE
00E1
00E4
00E4
00E4
00E7
00E7
00E7
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00E9
00EB
00ED
00ED
00ED

37
18 04

AF
32 E4 1F
3A E2 1F

MPF-1
SOURCE STATEMENT

SCF

;set carryflag to indicate


;the user's SP is legal.

JR
BRRST0
;
SETST0:
; STATE is a memory location containing the monitor status.
; It will be described in detail later. STATE 0 stands
; for fixed display pattern. The initial pattern 'uPF--1'
; or message 'SYS-SP'... belong to this category. The next
; two instructions set STATE to zero.

BRRST0

2A E0 1F
77

XOR
LD
LD
LD
LD

;
;
;
;
DC 0B 04

A
;set A to 0,also clear Carry flag
(STATE),A
A,(BRDA)
;restore the data at
;break address
HL,(BRAD)
(HL),A

If the user's SP is legal SP is legal (carry set),


display user's PC and the content at PC.
Otherwise, display fixed message (ERR-SP
or SYS-SP or uPF--1)
CALL C,MEMDP2

;
;
;***********************************************************
; Scan the display and keyboard. When a key is
; detected, take proper action according to the
; key pressed.
MAIN:
31 AF 1F
CD FE 05

LD
CALL

SP,SYSSTK
SCAN

CD CB 06

CALL

BEEP

18 F5

JR

MAIN

;Initialize system stack


;Scan display and input keys.
;Routine SCAN will not return
;until any key is pressed.
;After a key is detected, there
;will be accompanied with a
; beep sound.
;Back to MAIN, get more keys
;and execute them.

;
;
;***********************************************************
KEYEXEC:
;
;
;
;
;
;
FE 10
38 24

Input key dispatch routine.


This routine uses the key code returned by subroutine
SCAN, which is one byte stored in A register. The
range of key codes is from 00 to 1FH.
(i) key code = 00 - 0FH :
These are hexadecimal keys.
CP
JR

Branch to routine KHEX.

10H
C,KHEX

; If the key entered is not hexadecimal, it must be a


; function or subfunction key. This means the previous

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464

00ED
00ED
00ED
00ED
00ED
00ED
00ED
00F0
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F2
00F4
00F6
00F9
00FC
00FC
00FC
00FC
00FC
00FC
00FC
00FC
00FC
00FC
0100
0102
0105
0106
0106
0106
0106
0106
0106
0106
0109
010B
010E
010E
0111
0111
0111
0111
0111
0111
0111
0111
0111

OBJ CODE M

MPF-1
SOURCE STATEMENT

;
;
;
;
;

numeric
must be
This is
of TEST
cleared

21 E6 1F
CB C6

entry has terminated. Bit 0 of TEST flag


set at the beginning of a new numeric entry.
done by the next two instructions. (If bit 0
is set, the data buffer will be automatically
when a hexadecimal key is entered.)
LD
SET

HL,TEST
0,(HL)

; (ii) key code = 10H - 17H :


;
(+, -, GO, STEP, DATA, SBR, INS, DEL)
;
There is no state corresponding to these keys.
;
The response of them depends on the current
;
state and minor-state. (E.g., the response of '+'
;
key depends on the current function. It is illegal
;
when the display is 'uPF--1', but is legal when the
;
display is of 'address-data' form.) In this
;
documentation, they are named 'sub-function key'.
;
They are all branched by table KSUBFUN and routine
;
BRANCH.
D6
FE
21
DA

10
08
37 07
B0 03

SUB
CP
LD
JP
;(iii)
;
;
;
;
;
;

10H
8
HL,KSUBFUN
C,BRANCH

key code = 18H - 1FH


(PC, Addr, CBr, Reg, Move, Rela, WRtape, RDtape)
These keys are named 'function key'. They are
acceptable at any time. When they are hit, the
monitor will unconditionally enter a new state.
STMINOR contains the minor-state, which is required
to dispatch some sub-function keys (e.g. +, -).

DD 21 B6 1F
D6 08
21 E4 1F
77

LD
SUB
LD
LD

IX,DISPBF
8
HL,STATE
(HL),A

21 E3 1F
36 00
21 41 07

LD
LD
LD

HL,STMINOR
(HL),0
HL,KFUN

C3 B0 03

JP

BRANCH

;set STATE to key-code minus 18H


;The STATE is updated here. It
;will be modified later by local
;service routines if the
;function-key is PC,Addr or CBr.
;For function-other keys, STATE
;will not be modified later.
;set STMINOR to 0
;KFUN is the base of the branch
;table the offset is stored in A

;
;***********************************************************
;STATE:
;
0=FIX
;Display fixed pattern, e.g. 'uPF--1'.
;
1=AD
;The hex key entered is interpreted as
;memory addres.
;
2=DA
;The hex key entered is interpreted as
;memory data.

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522

0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0112
0112
0115
0118
011B
011B
011B
011B
011B
011B
011B

OBJ CODE M

MPF-1
SOURCE STATEMENT

3=RGFIX

;
;
;
;
;

4=MV
5=RL
6=WT
7=RT
8=RGAD

9=RGDA

;Display fixed pattern: 'Reg- ' and


;expect register name to be entered.
;Expect parameters for 'Move' function.
;Expect parameters for 'Rela' function.
;Expect parameters for 'WRtape' func.
;Expect parameters for 'RDtape' func.
;Hex-key entered will be interpreted as
;address name for registers.
;Hex-key entered will be interpreted as
; data for registers.

;
; Subroutine naming conventions:
;
(i) K???? -- K stands for key, ???? is the key name,
;
e.g. KINS corresponds to key 'INS'. Each
;
time a key ???? is entered, the routine
;
with name K???? will be executed. All of
;
them are branched by table KFUN or KSUBFUN.
;
(ii) H???? -- H stands for hexadecimal, ???? is the
;
current STATE. For example, routine
;
HDA will be executed if the entered
;
key is hexadecimal and STATE is DA now.
;
These routines are branched by table
;
HTAB.
; (iii) I???? -- I stands for increment (+ key), ???? is
;
the current STATE. E.g. IMV will be
;
executed when STATE is MV and '+' key
;
is entered. These routines are branched
;
by table ITAB
;
(iv) D???? -- D stands for decrement (- key), ???? is
;
the current STATE. These routines are
;
branched using table DTAB.
;
(v) G???? -- G stands for 'GO' key, ???? is the current
;
STATE. These routines are branched using
;
table GTAB.
;***********************************************************
; Hexadecimal, '+', '-' and 'GO' keys may be entered after
; different function keys. The monitor uses branch tables
; and STATE to determine the current function and branch
; to the proper entry point.
;
KHEX:
;Executed when hexadecimal keys are pressed.
;Use HTAB and STATE for further branch.
4F
21 4B 07
3A E4 1F
C3 B0 03

BR1

LD

C,A

LD
LD
JP

HL,HTAB
A,(STATE)
BRANCH

;save A register in C
;which is the hex key-code.

;
KINC:
;Branched by KSUBFUN table.
;Executed when '+' key is pressed.
;Use ITAB and STATE for further branch.
;STATE will be stored in A register at BR1.

_________________________________________________________________________________

____________________________________________________________________________________

STMT

LOC

0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580

011B
011B
011E
0120
0120
0120
0120
0120
0120
0120
0120
0120
0123
0125
0125
0125
0125
0125
0125
0125
0125
0125
0128
012A
012A
012A
012A
012A
012A
012A
012D
012D
013D
013D
013D
0130
0132
0132
0132
0132
0135
0135
0135
0135
0135
0135
0135
0138
0138
013A
013A
013A
013D
013D
013D
013E
0140
0140

OBJ CODE M

MPF-1
SOURCE STATEMENT

21 57 07
18 F5

LD
JR

HL,ITAB
BR1

;
KDEC:
;Branched by KSUBFUN table.
;Executed when '-' key is pressed.
;Use DTAB and STATE for further branch.
;STATE will be stored in A register at BR1.
21 63 07
18 F0

LD
JR

HL,DTAB
BR1

;
KGO:
;Branched by KSUBFUN table.
;Executed when 'GO' key is pressed.
;Use DTAB and STATE for further branch.
;STATE will be stored in A register at BR1.
21 6F 07
18 EB

LD
JR

HL,GTAB
BR1

;
KSTEP:
;Branched by table KSUBFUN.
;Executed when 'STEP' key is pressed.
CD E5 03

CALL

TESTM

C2 BB 03
3E 80

JP
LD

NZ,IGNORE
A,10000000B

C3 A3 02

JP

PREOUT

;Check if the left 4 digits of


;the display are memory address.
;If not, disable all LED's as
;a warning to the user. This
;is done by routine IGNORE.
;This data will be output
;to port B to enable
;BREAK. It is done by
;routine PREOUT.

;
KDATA:
;Branched by table KSUBFUN.
;Executed when 'DATA' key is pressed.
CD E5 03

CALL

TESTM

20 04

JR

NZ,TESTRG

CD 0B 04

CALL

MEMDP2

RET
CP

JP

C,IGNORE

C9
FE 08
DA BB 03

TESTRG

;Check if the left 4 digits of


;the display are memory address.
;If not, branch to TESTRG
;to check whether the display
;is register or not.
;If yes, display the data of
;that address and set STATE
;to 2.
;check if the status is 8 or 9
;(RGAD or RGDA).
;If not, ignore this key and

_________________________________________________________________________________

10

____________________________________________________________________________________

STMT

LOC

0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638

0143
0143
0146
0146
0147
0147
0147
0147
0147
0147
0147
0147
014A
014A
014D
014D
0150
0150
0153
0153
0156
0156
0159
0159
015C
015C
015C
015D
015D
015D
015D
015D
015D
015D
0160
0160
0163
0163
0166
0166
0166
0167
0167
016A
016A
016A
016B
016E
0171
0171
0174
0174
0174
0174
0174
0174
0174
0174

OBJ CODE M

MPF-1
SOURCE STATEMENT

CD 77 04

CALL

C9

RET

REGDP9

;send out a warning message.


;If yes, display register and
;set status to 9 (RGDA).

;
KSBR:
;Branched by table KSUBFUN.
;Executed when 'SBr' key (set break point)
; is pressed.
CD E5 03

CALL

TESTM

C2 BB 03

JP

NZ,IGNORE

2A DE 1F

LD

HL,(ADSAVE)

CD F6 05

CALL

RAMCHK

C2 BB 03

JP

NZ,IGNORE

22 E0 1F

LD

(BRAD),HL

CD 0B 04

CALL

MEMDP2

C9

RET

;Check if the display is of


;'address-data' form.
;If not, ignore this key and
;send out a warning message.
;If yes, get the address
;being displayed now.
;Check if this address is
;in RAM.
;If not, ignore the 'SBR' key
;and send out a warning message.
;If yes, set this address as
;a break point.
;Display the data of break
;address and set STATE to
;2 (DA).

;
KINS:
;Branched by table KSUBFUN.
;Executed when 'Ins' key (insert) is pressed.
CD E5 03

CALL

TESTM

;Check if the display is of


;'addres-data' form.
;If not, ignore the 'INS' key
;and send out a warning message.
;If yes, get the address being
;displayed now.

C2 BB 03

JP

NZ,IGNORE

2A DE 1F

LD

HL,(ADSAVE)

00

NOP

22 AF 1F

LD

(STEPBF),HL

23
22 B3 1F
CD F6 05

INC
LD
CALL

C2 BB 03

JP

11 FE 1D

LD

HL
(STEPBF+4),HL
RAMCHK
;Check if the address to be
;inserted is in RAM.
NZ,IGNORE
;If not, ignore the 'INS' key
;and send out a warning message.
;If the address to be inserted
;is in 1800-1DFF, store 1DFE into
;STEPBF+2
;Otherwise, ignore the 'INS' key.
;This is done by the following
;instructions.
DE,1DFEH

;Store this address in


;STEPBF and the next address
;in STEPBF+4 for later use.

_________________________________________________________________________________

11

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696

0177
0178
017A
017C
017E
0181
0183
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
0187
018A
018B
018B
018B
018B
018B
018B
018C
018F
0192
0195
0195
0196
0196
0196
0196
0196
0196
0199
0199
019C
019C
019C
019C

7C
FE
38
FE
DA
16
ED

MPF-1
SOURCE STATEMENT

1E
07
20
BB 03
27
53 B1 1F SKIPH1

LD
CP
JR
CP
JP
LD
LD

A,H
1EH
C,SKIPH1
20H
C,IGNORE
D,27H
(STEPBF+2),DE

;When one byte is inserted at some


;address, all data below this address
;will be shifted down one position.
;The last location will be shifted out
;and therefore lost.
;The RAM is divided into 3 blocks as
;insert is concerned. They are:
;1800-1DFF, 1E00-1FFF and 2000-27FF
;The 2nd block cannot be inserted and
;is usually used as data bank. System
;data that of course cannot be shifted
;is also stored in this bank. Each
;block is independent of the other when
;shift is performed, i.e. the data
;shifted out of the first block will not
;be propagated to next block.
;The shift is accomplished by block
;transfer, i.e. MOVE. This is the
;job of subroutine GMV.
;Routine GMV needs 3 parameters which
;are stored in step-buffer (STEPBF):
;STEPBF: starting address (2 bytes);
;STEPBF+2: ending address (2 bytes);
;STEPBF+4: destination address (2 bytes).
CD E4 02
AF

12
2A B3 1F
22 DE 1F
CD 0B 04
C9

DOMV

CALL
XOR

GMV
A

LD
LD
LD
CALL

(DE),A
HL,(STEPBF+4) ;Store the data in (STEPBF+4)
(ADSAVE),HL
;into (ADSAVE).
MEMDP2
;Display the address and data
;also set STATE to 2.

;After the RAM has been shifted


;down,the data of the address to be
;inserted is cleared to zero. This
;is done by these two instructions.
;Register DE contains inserted
;address after GMV is performed.

RET
;
KDEL:
;Branched by table KSUBFUN.
;Executed when 'Del' (delete) key is pressed.

CD E5 03

CALL

TESTM

C2 BB 03

JP

NZ,IGNORE

;Check if the display is of


;'address-data' form.
;If not, ignore the 'Del' key
;and send out a warning message.
;'Delete' is quite similar to
;'Insert',except that the memory
;is shifted up up instead of

_________________________________________________________________________________

12

____________________________________________________________________________________

STMT

LOC

0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754

019C
019C
019C
019F
019F
019F
019F
019F
01A0
01A0
01A3
01A6
01A9
01A9
01A9
01A9
01A9
01A9
01AC
01AD
01AF
01B1
01B3
01B6
01B8
01BC
01BD
01C0
01C2
01C2
01C2
01C2
01C2
01C2
01C2
01C5
01C8
01CB
01CB
01CB
01CC
01CC
01CC
01CC
01CC
01CC
01CF
01CF
01CF
01D2
01D5
01D5
01D6
01D6
01D6
01D6
01D6
01DA

OBJ CODE M

MPF-1
SOURCE STATEMENT

2A DE 1F

LD

00

NOP

22 B3 1F
CD F6 05
C2 BB 03

LD
CALL
JP

11
7C
FE
38
FE
DA
16
ED
23
22
18

LD
LD
CP
JR
CP
JP
LD
LD
INC
LD
JR

00 1E
1E
07
20
BB 03
28
53 B1 1F SKIPH2
AF 1F
C5

HL,(ADSAVE)

;shifted down. See the comments


;on routine KINS for details.
;Get the address being displayed
;now. This is the address to
;be deleted.

(STEPBF+4),HL
RAMCHK
;Check if the address is in RAM.
NZ,IGNORE
;If not, ignore this key and
;send out a warning message.
;Following instructions prepare
;the parameters for routine GMV
;in step-buffer. Refer to routine
;KINS for detail.
DE,1E00H
A, H
1EH
C,SKIPH2
20H
C,IGNORE
D, 28H
(STEPBF+2),DE
HL
(STEPBF),HL
DOMV

;
;***********************************************************
KPC:
;Branched by table KFUN.
;Executed when 'PC' key is pressed.
2A DC 1F
22 DE 1F
CD 0B 04

C9

LD
LD
CALL

HL,(USERPC)
(ADSAVE),HL
MEMDP2

;Store the user's program


;counter into (ADSAVE).
;Routine MEMDP2 displays the
;address in (ADSAVE) and its
;data.It also sets the STATE to 2

RET
;
KCBR:
;Branched by table KFUN.
;Executed when 'CBr' (clear break point) key is pressed.

CD DE 03

CALL

CLRBR

22 DE 1F
CD 0B 04

LD
CALL

(ADSAVE),HL
MEMDP2

;Call subroutine CLRBR to clear


;break point. When returned, the
;HL register will contain FFFF.
;Store FFFF into (ADSAVE)
;Display address and its data.
;Also set STATE to 2.

C9

RET
;
KREG:
;Branched by table KFUN.
;Executed when 'Reg' key is pressed.
DD 21 CA 07
LD
IX,REG_ ;Routine SCAN uses IX as a pointer
;for display buffer.Setting IX to

_________________________________________________________________________________

13

____________________________________________________________________________________

STMT

LOC

0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812

01DA
01DA
01DD
01DD
01DD
01DD
01DD
01DD
01DE
01DE
01DE
01DE
01DE
01DE
01E1
01E1
01E1
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E2
01E5
01E8
01E8
01E8
01E8
01E8
01E8
01E8
01E8
01E8
01E8
01E8
01EB
01EB
01EB
01EC
01EC
01EC
01EC

OBJ CODE M

MPF-1
SOURCE STATEMENT

CD C4 04

C9

CALL

;REG will make SCAN displays 'Reg-'


;Decode user's flag F and F' to
;binary display format. This
;format will be used later, when
;user requires the monitor to
;display decoded flag by pressing
;keys 'SZXH', 'XPNC',...

RET
;
KADDR:
;Branched by table KFUN.
; Executed when 'Addr' key is pressed.

CD 02 04

CALL

C9

MEMDP1

;Display the address stored in


;(ADSAVE) and its data. Set STATE
;to 1 (AD)

RET
;
;
;
;
;
;
;
;
;
;
;
;
;
;

Function Move, Relative, Read-tape and


Write-tape require from one to three
parameters. They are stored in STEPBF
(step buffer). STMINOR (minor status)
contains the number of parameters that has
been entered. For Move and Relative, the
default value of the first parameter is
the address stored in (ADSAVE). There
is no default value for the first parameter
(filename) of Read- and Write-tape. When the
function keys are pressed, STMINOR is automatically
reset to 0.

KMV:
;Branched
;Executed
KRL:
;Branched
;Executed
2A DE 1F
22 AF 1F

FCONV

by table KFUN.
when 'Move' key is pressed.
by table KFUN.
when 'Rela' (relative) key is pressed.
LD
HL,(ADSAVE)
;Store the contents of ADSAVE
LD
(STEPBF),HL
;into STEPBF as default value
;of first parameter.

KWT:
;Branched by table KFUN.
;Executed when 'WRtape' key is pressed.
KRT:
;Branched by table KFUN.
;Executed when 'RDtape' key is pressed.
CD 3A 04

C9

CALL

STEPDP

;Display the parameter that


;is being entered now by calling
;subroutine STEPDP.

RET
;
;***********************************************************
; The following subroutines with name H???
; are the service routines for hexadecimal

_________________________________________________________________________________

14

____________________________________________________________________________________

STMT

LOC

0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870

01EC
01EC
01EC
01EC
01EF
01EF
01EF
01EF
01EF
01EF
01F2
01F2
01F5
01F8
01F8
01FB
01FB
01FB
01FB
01FC
01FC
01FE
01FE
0201
0201
0202
0202
0205
0208
0208
0208
0209
0209
0209
0209
0209
020B
020C
020E
0211
0211
0212
0212
0212
0212
0213
0217
021A
021B
021B
021C
021C
021F
021F
0220
0220
0220
0220

OBJ CODE M

MPF-1
SOURCE STATEMENT

; keys corresponding to each STATE. They


; are all branched by table HTAB and STATE.
C3 BB 03

HFIX

JP

IGNORE

2A DE 1F

;
HDA

LD

HL,(ADSAVE)

CD F6 05
C2 BB 03

CALL
JP

CD EE 03

CALL

79

LD

ED 6F

RLD

CD 0B 04

CALL

C9
21 DE 1F
CD FA 03

;When the display is fixed pattern


;hexadecimal keys are illegal.
;Disable all LED's as a warning
;message to the user. This is what
;routine IGNORE does.

;Get the address being displayed


;now from (ADSAVE)
RAMCHK
;Check if it is in RAM.
NZ,IGNORE
;If not, ignore this key and
;send out a warning message.
PRECL1
;If this is the first hexadecimal
;key entered after function or sub;function key,reset the data of that
;address to 0. (by routine PERCL1)
A,C
;The key-code is saved in C by
;routine KHEX. Restore it to A.
;Rotate the key-code (4 bits) into
;the address obtained above. (in HL)
MEMDP2
;Display the address and data,
;then set STATE to 2 (DA).

RET
;
HAD:

LD
CALL

79

LD

ED 6F
23
ED 6F
CD 02 04

RLD
INC
RLD
CALL

C9

HL,ADSAVE
PRECL2
;If this is the first hexadecimal
;key after function key is entered,
;set the contents of ADSAVE to 0.
A,C
;The key-code is saved in C
;by routine KHEX.
;The next three instructions shift
;the addres being displayed by
;one digit.
HL
MEMDP1

;Display the address and its


;data. Also, set STATE to 1.

RET
;
HRGAD:
HRGFIX:

79
DD 21 B6 1F
21 E3 1F
87

LD
LD
LD
ADD

A,C
IX,DISPBF
HL,STMINOR
A,A

77

LD

(HL),A

CD 73 04

CALL

REGDP8

C9

;The key-code is the register


;name. Double it and store it
;into STMINOR.
;Display register and set
;STATE to 8. (RGAD)

RET
;
HRT:
HWT:
HRL:

_________________________________________________________________________________

15

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

MPF-1
SOURCE STATEMENT

0871
0872
0873
0874
0875
0876
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914
0915
0916
0917
0918
0919
0920
0921
0922
0923
0924
0925
0926
0927
0928

0220
0223
0223
0223
0223
0226
0226
0226
0226
0227
0229
0229
0229
022A
022C
022F
0230
0230
0233
0233
0236
0236
0236
0237
0239
0239
0239
023C
023C
023D
023D
023D
023D
023D
023D
023D
023D
023D
023D
023D
0240
0240
0240
0240
0243
0243
0243
0244
0247
024A
024A
024B
024B
024B
024B
024B
024E
024E

CD 55 04

HMV:

CALL

LOCSTBF

CD FA 03

CALL

PRECL2

79
ED 6F

LD
RLD

A,C

23
ED 6F
CD 3A 04
C9

INC
RLD
CALL
RET

HL
STEPDP

;Display the parameter.

CALL

LOCRGBF

CD EE 03

CALL

PRECL1

79
ED 6F

LD
RLD

A,C

;Calculate the address of


;the register being modified.
;If this is the first hex
;key entered. Clear the register
;(1 byte) by PRECL1.
;C contains the key-code
;Rotate user's register (1 byte)
;1 digit left with the key-code.

CD 77 04

CALL

REGDP9

CD BB 04

C9

;
HRGDA

;Use STMINOR and STEPBF


;to calculate the address
;of current parameter in
;step buffer.
;If this is the first hex
;key entered, clear the
;parameter (2 bytes) by
;PRECL2.
;C contains the key-code
;Rotate the parameter (2 bytes)
;1 digit left with the key-code.

;Display the register and set


;STATE to 9 (RGDA).

RET
;
;***********************************************************
;The following routines with name
;I???? are the service routines for
;'+' key corresponding to each STATE
;They are all branched by table ITAB
;and STATE
IFIX:
IRGFIX:

C3 BB 03

2A DE 1F

;
IAD:
IDA:

23
22 DE 1F
CD 0B 04
C9

21 E3 1F

JP

IGNORE

;'+' key is illegal for state


;FIX or RGFIX, ignore it.

LD

HL, ADSAVE)

;Increase the address being


;displayed now (in ADSAVE)
;by 1.

INC
LD
CALL

HL
(ADSAVE),HL
MEMDP2

;Display the address and data,


;then set the STATE to 2 (DA).

RET
;
IRT:
IWT:
IRL:
IMV:

LD

HL,STMINOR

;STMINOR contains the


;parameter count, increment
;it by one.

_________________________________________________________________________________

16

____________________________________________________________________________________
MPF-1
SOURCE STATEMENT

STMT

LOC

OBJ CODE M

0929
0930
0931
0932
0933
0934
0935
0936
0937
0938
0939
0940
0941
0942
0943
0944
0945
0946
0947
0948
0949
0950
0951
0952
0953
0954
0955
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965
0966
0967
0968
0969
0970
0971
0972
0973
0974
0975
0976
0977
0978
0979
0980
0981
0982
0983
0984
0985
0986

024E
024F
0252
0252
0254
0254
0255
0255
0258
025B
025B
025C
025C
025C
025F
025F
025F
025F
025F
0260
0262
0263
0265
0267
026A
026A
026B
026B
026B
026B
026B
026B
026B
026B
026B
026B
026B
026E
026E
026E
026E
0271
0271
0271
0272
0275
0278
0278
0279
0279
0279
0279
0279
027C
027C
027C
027C
027C

34
CD 5F 04

INC
CALL

(HL)
LOCSTNA

20 04

JR

NZ,ISTEP

35

DEC

(HL)

JP
CALL

IGNORE
STEPDP

C3 BB 03
CD 3A 04

ISTEP

C9

is
continue
the count
key.

;Display the parameter at


;step buffer.

RET

21 E3 1F

34
3E
BE
30
36
CD

;Check if the count


;overflowed.
;If not overflowed,
;at ISTEP
;Otherwise, restore
;and ignore the '+'

;
IRGAD:
IRGDA:

LD

HL,STMINOR

IRGNA

INC
LD
CP
JR
LD
CALL

(HL)
A,1FH
(HL)
NC,IRGNA
(HL),0
REGDP9

1F
02
00
77 04

C9

;In these states, the STMINOR


;contains the register name.
;Increase it by 1. If it
;reaches the last one, reset
;it to the first one (0).

;Display the register and


;set STATE to 9

RET
;
;***********************************************************
;The following routines with name
;D???? are the service routines for
;'-' key corresponding to each state.
;They are all branched by table DTAB
;and STATE.
DFIX:
DRGFIX:

C3 BB 03

2A DE 1F

;
DAD:
DDA:

2B
22 DE 1F
CD 0B 04
C9

21 E3 1F

JP

IGNORE

;'-' key is illegal for


;these states. Ignore it.

LD

HL,(ADSAVE)

;Decrease the address being


;displayed now (in ADSAVE)
;by one.

DEC
LD
CALL

HL
(ADSAVE),HL
MEMDP2

;Display the address and data,


;set STATE to 2 (DA).

RET
;
DRT:
DWT:
DRL:
DMV:

LD

HL,STMINOR

;In these states, STMINOR


;contains the parameter count.
;Decrease it by one. If overflow
;occurs, restore STMINOR and
;ignore the '-' key. Otherwise
;continue at DSTEP.

_________________________________________________________________________________

17

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

0987
0988
0989
0990
0991
0992
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044

027C
027D
0280
0282
0283
0286
0289
028A
028A
028A
028D
028D
028D
028D
028D
028E
0290
0291
0293
0295
0298
0298
0299
0299
0299
0299
0299
0299
0299
0299
0299
0299
0299
0299
029C
029C
029C
029C
029F
029F
02A1
02A1
02A1
02A1
02A1
02A1
02A1
02A3
02A3
02A3
02A6
02A9
02A9
02A9
02A9
02A9
02A9
02A9

35
CD
20
34
C3
CD
C9

DEC
CALL
JR
INC
JP
CALL
RET

(HL)
LOCSTNA
NZ,DSTEP
(HL)
IGNORE
STEPDP

;
DRGAD:
DRGDA:

LD

HL,STMINOR

DRGNA

DEC
LD
CP
JR
LD
CALL

(HL)
A,01FH
(HL)
NC,DRGNA
(HL),1FH
REGDP9

5F 04
04
BB 03
3A 04

21 E3 1F

35
3E
BE
30
36
CD

MPF-1
SOURCE STATEMENT

DSTEP

1F
02
1F
77 04

C9

;Display the parameter.

;In these states, STMINOR


;contains the register name.
;Decrease it by one. If it
;goes below zero, set it to
;the highest value (1F).

;Display the register and


;set STATE to 9.

RET
;
;***********************************************************
;The following routines with name
;G???? are the service routines for
;'GO' key corresponding to each
;state. They are all branced by
;table GTAB and STATE.

C3 BB 03

GFIX:
GRGFIX:
GRGAD:
GRGDA:

JP

IGNORE

;'GO' key is illegal for


;these states. Ignore it.

2A E0 1F

;
GAD:
GDA:

LD

HL,(BRAD)

36 EF

LD

(HL),0EFH

3E FF

LD

A, 0FFH

LD
LD

(TEMP),A
A, (USERIF)

;Get the address of break


;point.
;Instruction RST28H.
;The content of break address
;ischanged to RST 28H before
;the control is transfered to
;user's program. THis
;will cause a trap when user's
;PC passes this point.
;Save FF into TEMP.This data will
;be output to port C later. FF is
;used to disable break point.
;Store A into TEMP.
;Save two instructions into
;TEMP and TEMP+1. THese two
;instructions will be executed
;later. If the user's IFF
;(interrupt flip-flop) is 1,
;the instructions are 'EI RET'.
;Otherwise, they are 'DI RET'.

BIT

0,A

32 EA 1F
3A D2 1F

CB 47

PREOUT

_________________________________________________________________________________

18

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102

02AB
02AE
02B0
02B2
02B5
02B8
02B8
02B8
02B8
02B9
02BA
02BB
02BC
02BD
02BE
02BF
02C0
02C1
02C2
02C3
02C4
02C6
02C8
02CC
02CF
02D2
02D4
02D4
02D5
02D5
02D5
02D5
02D5
02D8
02D9
02DC
02DC
02DC
02DC
02DC
02DC
02DC
02DC
02DC
02DC
02DC
02DC
02DE
02E1
02E1
02E4
02E4
02E4
02E4
02E4
02E4
02E4
02E4

21
20
2E
22
31

LD
JR
LD
LD
LD

HL,0C9FBH
NZ,EIDI
L,0F3H
(TEMP+1),HL
SP,REGBF

POP
POP
POP
POP
EX
POP
EX
EXX
POP
POP
POP
EXX
POP
POP
LD
LD
LD
LD
PUSH

AF
BC
DE
HL
AF,AF'
AF
AF,AF'

IX
IY
SP,(USERSP)
(USERAF+1),A
A,(USERIF+1)
I,A
HL

2A DE 1F
E3
3A EA 1F

LD
EX
LD

HL,(ADSAVE)
(SP),HL
A,(TEMP)

D3 02
3A BD 1F

OUT
LD

(DIGIT),A
A,(USERAF+1)

C3 EB 1F

JP

TEMP+1

F1
C1
D1
E1
08
F1
08
D9
C1
D1
E1
D9
DD
FD
ED
32
3A
ED
E5

FB C9
02
F3
EB 1F
BC 1F

MPF-1
SOURCE STATEMENT

E1
E1
7B D0 1F
BD 1F
D3 1F
47

EIDI

;'EI', 'RET'
;'DI'
;Restore user's registers by
;setting SP to REGBF (register
;buffer) and continuously popping
;the stack.

BC
DE
HL

;Restore user's SP.


;Temporarily save A
;Restore user's I
;The next 3 instructions
;push the address being
;displayed now (in ADSAVE)
;onto stack without changing
;HL register. This address will
;be treated as user's new PC.

;Output the data stored in


;TEMP to port C of 8255
;This data is prepared by
;routine KSTEP or GAD or
;GDA. In first case, it is
;10111111 and will enable
;break point. In other
;cases, it is FF and will
;disable break point. If
;break is enabled, non-maskable
;interrupt will occur 5 M1's
;after the OUT instruction.
;1st M1,
;Restore A register.
;2nd M1,
;Execute the two instructions
;stored in RAM. They are:
;
EI (or DI)
;3rd M1
;
RET
;4th M1
;The starting address of user's
;program has been pushed onto
;the top of the stack. RET pops
;out this address and transfers

_________________________________________________________________________________

19

____________________________________________________________________________________

STMT

LOC

1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160

02E4
02E4
02E4
02E4
02E4
02E4
02E4
02E4
02E4
02E4
02E7
02EA
02EA
02EA
02EA
02EA
02EA
02EC
02EC
02EC
02F0
02F0
02F2
02F2
02F4
02F4
02F5
02F6
02F7
02F8
02FB
02FD
02FE
0300
0300
0301
0301
0303
0304
0306
0306
0306
030A
030A
030B
030B
030B
030B
030B
030B
030C
030F
030F
0310
0312
0313
0313
0313

OBJ CODE M

MPF-1
SOURCE STATEMENT

;control to it. The first M1


;of user's program will be the
;5th M1 after OUT. If break point
;is enabled, NMI will occur after
;this instruction is completed.
;This is the mechanism of single
;step.
;
;***********************************************************
21 AF 1F
GMV
LD
HL,STEPBF
CD 3D 05
CALL GETP
;Load parameters from
;step buffer into registers.
;Also check if the parameters
;are legal. After GETP,
;HL = start address of source
;BC = length to MOVE.
38 67
JR
C,ERROR
;Jump to ERROR if the parameters
;are illegal. (I.e., Ending
;address < starting address.)
ED 5B B3 1F
LD
DE,(STEPBF+4) ;Load destination
;address into DE.
ED 52
SBC
HL,DE
;Compare HL and DE to
;determine move up or down.
30 0C
JR
NC,MVUP
;Move down:
EB
EX
DE,HL
;HL = destination address
09
ADD
HL,BC
;HL = dest. address + length
2B
DEC
HL
;HL = end address of dest.
EB
EX
DE,HL
;DE = end address of dest.
2A B1 1F
LD
HL,(STEPBF+2) ;HL = end address of source
ED B8
LDDR
;block transfer instruction
13
INC
DE
;DE = last address moved
18 1C
JR
ENDFUN
;Continue at ENDFUN
MVUP:
;Move up:
19
ADD
HL,DE
;HL is destroyed by
;SBC HL, DE. Restore HL.
ED B0
LDIR
;block transfer
1B
DEC
DE
;DE = last address moved
18 16
JR
ENDFUN
;Continue at ENDFUN
;
;***********************************************************
ED 5B AF 1F GRL
LD
DE,(STEPBF)
;Load starting address
;into DE.
13
INC
DE
;Increase this address by 2.
;Relative address is used in
;instruction JR or DJNZ.
;The codes for them are 2 bytes.
;The PC is increased by 2 after
;opcode is fetched.
13
INC
DE
2A B1 1F
LD
HL,(STEPBF+2) ;Load destination
;address into HL.
B7
OR
A
ED 52
SBC
HL,DE
;Calculate difference.
7D
LD
A,L
;Check if the offset is between
;+127 (007FH) and -128 (FF80H).
;If the offset is positive, both H
;and bit 7 of L must be zero; if it

_________________________________________________________________________________

20

____________________________________________________________________________________

STMT

LOC

1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218

0313
0313
0313
0313
0314
0315
0317
0319
0319
031A
031B
031C
031C
031C
031C
031C
0320
0323
0323
0324
0324
0324
0324
0327
0327
0327
0327
0327
0327
0329
0329
0329
032C
032C
032F
032F
032F
0332
0335
0335
0335
0335
0338
033B
033E
033E
033E
033E
033E
0341
0344
0344
0344
0347
034A
034A
034A
034D

OBJ CODE M

MPF-1
SOURCE STATEMENT

17
7C
CE 00
20 3A

RLA
LD
ADC
JR

7D
1B
12

LD
DEC
LD

;is negative, H and bit 7 of L must


;be FF and 1. In both cases, adding
;H with bit 7 of L results in 0.
;Rotate bit 7 of L into carry flag.
A,H
A,0
;ADD H and bit 7 of L.
NZ,ERROR ;Branch to ERROR if
;the results is nonzero.
A,L
DE
(DE),A
;Save the offset into
;the next byte of opcode.
;(DJNZ or JR)

;
ENDFUN:
ED 53 DE 1F
CD 0B 04
C9

CD 2D 05

38 2A

32 B5 1F
21 A0 0F

CD DE 05
21 AF 1F

01 07 00
CD A7 05
21 A0 0F

CD E2 05
CD 3A 05

CD A7 05
21 A0 0F

CD E2 05
ED 5B B3

LD
CALL

(ADSAVE),DE
MEMDP2

;Save DE into ADSAVE.


;Display this address and
;its data. Set STATE to 2.

RET
;
;***********************************************************
GWT:
CALL SUM1
;Load parameters from
;step buffer into registers.
;Check if the parameters
;are legal. If legal, calculate
;the sum of all data to be output
;to tape.
JR
C,ERROR
;Branch to ERROR if the
;parameters are illegal.(length
;is negative)
LD
(STEPBF+6),A ;Store the checksum into
;STPEGBF+6.
LD
HL,4000
;Output 1 kHz square
;wave for 4000 cycles.
;Leading sync. signal.
CALL TONE1K
LD
HL,STEPBF
;Output 7 bytes starting
;at STEPBF. (Include:
;filename, starting, ending
;address and checksum)
LD
BC,7
CALL TAPEOUT
LD
HL,4000
;Output 2 kHz square
;wave for 4000 cycles.
;Middle sync.The file name of
;the file being read will be
;displayed in this interval.
CALL TONE2K
CALL GETPTR
;Load parameters into
;registers. (Starting, ending and
;length).
CALL TAPEOUT
;Output user's data.
LD
HL,4000
;Output 4000 cycles of
;2 kHz square wave.
;(Tail sync.)
CALL TONE2K
1F ENDTAPE LD
DE,(STEPBF+4) ;DE = last address

_________________________________________________________________________________

21

____________________________________________________________________________________
MPF-1
SOURCE STATEMENT

STMT

LOC

OBJ CODE M

1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276

0351
0353
0353
0357
035A
035A
035A
035A
035A
035D
0360
0362
0364
0364
0364
0364
0364
0367
036A
036A
036A
036A
036C
036C
036D
036D
036E
036F
0371
0371
0371
0371
0374
0376
0376
0376
0379
0379
037C
037F
0381
0381
0385
0385
0388
0388
038A
038D
038F
0392
0392
0392
0393
0395
0397
0397
0397
0397

18 C9

JR

ENDFUN

;Continue at ENDFUN

;
DD 21 A9 07 ERROR
C3 D0 00

LD
JP

IX,ERR_
SETST0

;IX points to '-Err '


;Set STATE to 0 by
;branching to SETST0.

;
;***********************************************************
GRT:
2A AF 1F
LD
HL,(STEPBF)
;Temporarily save filename.
22 EA 1F
LD
(TEMP),HL
3E 40
LEAD
LD
A,01000000B
;decimal point
D3 01
OUT
(SEG7),A
;When searching for filename,
;the display is blank initially.
;If the data read from MIC is
;acceptable 0 or 1, the display
;becomes '......'.
21 E8 03
LD
HL,1000
CD 8C 05
LEAD1
CALL PERIOD
;The return of PERIOD
;is in flag:
; NC -- tape input is 1 kHz;
;
C -- otherwise.
38 F4
JR
C,LEAD
;Loop until leading sync.
;is detected.
2B
DEC
HL
;Decrease HL by one when
;one period is detected.
7C
LD
A,H
B5
OR
L
;Check if both H and L are 0.
20 F6
JR
NZ,LEAD1
;Wait for 1000 periods.
;The leading sync. is accepted
;if it is longer than 1000
;cycles (1 second).
CD 8C 05
LEAD2
CALL PERIOD
30 FB
JR
NC,LEAD2
;Wait all leading sync. to
;pass over.
;
21 AF 1F
LD
HL,STEPBF
;Load 7 bytes from
;tape into STEPBF.
01 07 00
LD
BC,7
CD 4D 05
CALL TAPEIN
38 DF
JR
C,LEAD
;Jump to LEAD if input
;is not succesful.
ED 5B AF 1F
LD
DE,(STEPBF)
;Get filename from
;step buffer.
CD 65 06
CALL ADDRDP
;Convert it to display
;format.
06 96
LD
B,150
;Display it for 1.5 sec.
CD 24 06
FILEDP
CALL SCAN1
10 FB
DJNZ FILEDP
2A EA 1F
LD
HL,(TEMP)
;Check if the input
;filename equals to the
;specified filename.
B7
OR
A
ED 52
SBC
HL,DE
20 C9
JR
NZ,LEAD
;If not, find the leading
;sync. of next file.

3E 02

LD

A,00000010B

;If filename is found


;segment '-'

_________________________________________________________________________________

22

____________________________________________________________________________________
MPF-1
SOURCE STATEMENT

STMT

LOC

OBJ CODE M

1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334

0399
039B
039E
039E
039E
039E
039E
039E
039E
03A0
03A0
03A3
03A5
03A5
03A8
03A8
03AB
03AC
03AC
03AC
03AE
03AE
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B0
03B1
03B1
03B1
03B2
03B3
03B4
03B4
03B5
03B6
03B7
03B7
03B9
03BA
03BB

D3 01
CD 3A 05

OUT
CALL

(SEG7),A
GETPTR

38 B3

JR

C,ERROR

CD 4D 05
38 AE

CALL
JR

TAPEIN
C,ERROR

CD 2D 05

CALL

SUM1

21 B5 1F
BE

LD
CP

HL,STEPBF+6
(HL)

20 A5

JR

NZ,ERROR

18 9D

;Display '------'.
;The parameters (starting,
;ending address and check;sum) have been loaded into
;STEPBF. Load them into
;registers, calculate the block
;length and check if they are
;legal.
;Jump to ERROR if the
;parameters are illegal.
;Input user's data.
;Jump to ERROR if input
;is not succesful.
;Calculate the sum of all
;input data.
;Compare it with the checksum
;calculated and stored by
;'WRtape'.
;Jump to ERROR if not
;matched.
;Continue at ENDTAPE.

JR
ENDTAPE
;
;***********************************************************
BRANCH:
;Branch table format:
;
byte 1,2 : address of the 1st routine in
;
each group.
;
byte 3
: difference between the address
;
of 1st and 1st routine, which is
;
of course 0.
;
byte 4
: difference between the address
;
of 2nd and 1st routine
;
byte 5
: difference between the address
;
of 3rd and 1st routine
;
...
;
...
;
...
; HL : address of branch table
; A : the routine number in its group
; Such branch tables can save table length and avoid page
; (256 bytes) boundary problems.

5E

LD

E,(HL)

23
56
23

INC
LD
INC

HL
D,(HL)
HL

85
6F
6E

ADD
LD
LD

A, L
L, A
L,(HL)

26 00
19
E9

LD
ADD
JP

H,0
HL,DE
(HL)

;Load the address of 1st


;routine in the group into
;DE register.

;Locate the pointer of difference


;table.

;Load the address


;difference into L.
;Get routine's real address
;Jump to it.

_________________________________________________________________________________

23

____________________________________________________________________________________
MPF-1
SOURCE STATEMENT

STMT

LOC

OBJ CODE M

1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392

03BB
03BB
03BB
03BE
03C0
03C0
03C0
03C0
03C0
03C0
03C1
03C1
03C1
03C1
03C1
03C5
03C5
03C5
03C5
03C5
03C5
03C5
03C5
03C5
03C5
03C5
03C5
03C5
03C7
03C9
03CC
03CE
03D0
03D1
03D3
03D3
03D5
03D8
03DB
03DE
03DE
03DE
03DE
03DE
03DE
03DE
03DE
03DE
03DE
03DE
03DE
03E1
03E4
03E5
03E5
03E5
03E5
03E5

;***********************************************************
IGNORE:
21 E6 1F
LD
HL,TEST
CB FE
SET
7,(HL)
;Routine SCAN will check bit
;7 of TEST. If it is set,
;all LEDs will be disabled.
;This is a warning message to
;the user when a illegal key
;is entered.
C9
RET
;
;***********************************************************
INI:
; Power-up initialization.
DD 21 A5 07
LD
IX,BLANK
;BLANK is the initial display
;pattern.
;Display the following
;patterns sequence, each 0.16
;seconds:
;
'
'
;
'
u'
;
'
uP'
;
'
uPF'
;
' uPF-'
;
' uPF--'
;
'uPF--1'
0E
06
CD
10
DD
0D
20

07
10
24 06
FB
2B

3E
C3
21
22

A5
B3 06
66 00
EE 1F

INI1
INI2

F4

LD
LD
CALL
DJNZ
DEC
DEC
JR

C,7
B,16
SCAN1
INI2
IX
C
NZ,INI1

LD
JP
LD
LD

A,PWCODE
INI3
HL,NMI
(IM1AD),HL

;pattern count
;Display 0.16 second.

;next pattern

INI4

;Set the service routine


;of RST 38H to NMI, which is the
;nonmaskable interrupt service
;routine for break point and
;single step.

CLRBR:
; Clear break point by setting
; the break point address to
; FFFF. This is a non-existant
; address, so break can never
; happen.
21 FF FF
22 E0 1F
C9

LD
LD
RET

HL,0FFFFH
(BRAD),HL

;
TESTM:
; Check if the display is of 'addres-data'
; form, i.e. STATE 1 or 2.
; The result is stored in zero flag.

_________________________________________________________________________________

24

____________________________________________________________________________________

STMT

LOC

1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450

03E5
03E5
03E5
03E5
03E8
03EA
03EB
03ED
03EE
03EE
03EE
03EE
03EE
03EE
03EE
03EE
03F1
03F2
03F3
03F5
03F6
03F9
03FA
03FA
03FA
03FA
03FA
03FA
03FA
03FA
03FD
03FE
03FF
0400
0401
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0402
0404
0406
0409
0409
0409

OBJ CODE M

MPF-1
SOURCE STATEMENT

;
;

Z:
NZ:

3A E4 1F
FE 01
C8
FE 02
C9

yes
no
LD
CP
RET
CP
RET

A,(STATE)
1
Z
2

;
PRECL1:
; Pre-clear 1 byte.
; If bit 0 of TEST is not 0, load 0 into (HL).
; TEST is cleared after check.
; Only AF register is destroyed.
3A E6 1F
B7
C8
3E 00
77
32 E6 1F
C9

LD
OR
RET
LD
LD
LD
RET

A,(TEST)
A
Z
A,0
(HL),A
(TEST),A

Bit 0 of

;Is bit 0 of TEST zero?

;Clear (HL)
;Clear TEST too.

;
PRECL2:
; Pre-clear 2 bytes.
; If bit 0 of TEST is nonzero, clear (HL)
; and (HL+1).
; Only AF register is destroyed.
CD EE 03
C8
23
77
2B
C9

CALL
RET
INC
LD
DEC
RET

PRECL1
Z
HL
(HL),A
HL

;
;***********************************************************
; Memory display format: (address-data)
;
;
;
;
;
;
;
;
;
;
;

i) A.A.A.A. D D -- State is AD. Four decimal points


under the address field indicate
that the numeric key entered will
be interpreted as memory address.
ii) A A A A D.D.-- State is DA. Two decimal points
under the data field indicate
the monitor is expecting user to
enter memory data.
iii) A.A.A.A. D.D.-- Six decimal points indicate the
address being displayed is set
as a break point.

MEMDP1:
3E 01
06 04
21 B8 1F

LD
LD
LD

A, 1
B, 4
HL,DISPBF+2

18 07

JR

SAV12

;Next STATE = 1
;4 decimal points active
;The first active decimal
;point is in DISPBF+2, the
;last in DISPBF+5.
;Continue at SAV12.

_________________________________________________________________________________

25

____________________________________________________________________________________

STMT

LOC

1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508

040B
040B
040D
040F
0412
0412
0415
0416
041A
041A
041A
041A
041D
041D
041D
041E
041E
0421
0421
0421
0421
0421
0421
0421
0424
0425
0425
0428
0429
042B
042B
042D
042F
0432
0432
0433
0434
0436
0436
0436
0437
0439
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A

OBJ CODE M

MPF-1
SOURCE STATEMENT

MEMDP2:
3E 02
06 02
21 B6 1F

LD
LD
LD

A,2
B,2
HL,DISPBF

32 E4 1F
SAV12
D9
ED 5B DE 1F

LD
EXX
LD

(STATE),A
DE,(ADSAVE)

CD 65 06

CALL

ADDRDP

1A

LD

A,(DE) `

CD 71 06

CALL

DATADP

2A E0 1F
7E
32 E2 1F
B7
ED 52
20 06
06 06
21 B6 1F
D9
D9
CB F6

23
10 FB
C9

;Next STATE = 2
;2 active decimal points
;1st decimal point is in
;DISPBF, 2nd in DISPBF+1.
;Update STATE
;Save register HL, BC, DE
;The address to be
;displayed is stored in
;(ADSAVE). Load it into
;DE register.
;Convert this address to
;display format and store it
;into DISPBF+2 - DISPBF+5.
;Load the data of this
;address into A register
;Convert this data to
;display format and store it
;into DISPBF - DISPBF+1

BRTEST:
; The next 3 instructions serve to refresh the
; data at break address every time memory is
; displayed.
LD
HL,(BRAD)
;Get break point address.
LD
A,(HL)
;Get the data of this
;address into A register.
LD
(BRDA),A
;Store it into BRDA (break data).
OR
A
SBC
HL,DE
;Check if the address to
;be displayed is break point.
JR
NZ,SETPT1
;If not, jump to SETPT1.
LD
B,6
;6 active decimal points.
LD
HL,DISPBF
;1st decimal point is in
;DISPBF; 6th in DISPBF+5.
EXX
SETPT1
EXX
SETPT
SET
6,(HL)
;Set decimal points.
;Count in B, first address
;in HL register.
INC
HL
DJNZ SETPT
RET
;
;***********************************************************
; Step display format: (this format is used when user is
; entering parameters for Move, Rela, WRtape, RDtape.)
;

P.P.P.P. - N

; 'P' is the digit of parameter. Four decimal points


; indicate P's are being modified now. N is the mnemonic of
; the parameter:
;
i) Move
S -- starting address
;
E -- ending address
;
D -- destination address
;
ii) Rela
S -- source address
;
D -- destination address
;
iii) WRtape F -- file name

_________________________________________________________________________________

26

____________________________________________________________________________________

STMT

LOC

1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566

043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043A
043D
043E
043F
0440
0443
0443
0443
0443
0446
0446
0448
044B
044E
044F
0451
0451
0454
0455
0455
0455
0455
0455
0455
0455
0458
0459
045C
045D
045E
045F
045F
045F
045F
045F
045F
045F
045F
0462
0462
0462
0462
0464
0464
0465
0466
0469
046A

OBJ CODE M

MPF-1
SOURCE STATEMENT

;
;
;

S -- starting address
E -- ending address
iv) Rdtape F -- filename

STEPDP:
;Display step buffer and its parameter name.
;Input: STATE
;
STMINOR (parameter count)
;registers destroyed: AF, BC, DE, HL
CD 55 04
5E
23
56
CD 65 06

CALL
LD
INC
LD
CALL

LOCSTBF
E,(HL)
HL
D,(HL)
ADDRDP

21 B8 1F

LD

HL,DISPBF+2

06
CD
CD
6F
26

LD
CALL
CALL
LD
LD

B,4
SETPT
LOCSTNA
L,A
H,2

LD
RET

(DISPBF),HL

04
34 04
5F 04
02

22 B6 1F
C9

;Get parameter address


;Load parameter into DE

;Convert this paramter to


;display format (4 digits)
;and store it into DISPBF+2
; - DISPBF+5
;Set 4 decimal points
;From DISPBF+2 to DISPBF+5

;Get parameter name.


;Pattern '-' for 2nd rightmost
;digit.

;
LOCSTBF:
;Get the location of paramter.
; address = STEPBF + STMINOR*2
;registers destroyed: AF,HL
3A E3 1F
87
21 AF 1F
85
6F
C9

LD
ADD
LD
ADD
LD
RET

A,(STMINOR)
A,A
HL,STEPBF
A,L
L,A

;Get parameter count.


;Each parameter has 2 bytes
;Get base address

;
LOCSTNA
;Get parameter name.
;Input: STATE, STMINOR
;Output: parameter name in A, and Z flag.

3A E4 1F

D6 04
87
87
11 BC 07
83
5F

;registers destroyed: AF, DE


LD
A,(STATE)
;Get STATE.
;Possible states are:
;4,5,6,7. (Move, Rel,
;WRtape, RDtape)
SUB
4
;Change 4,5,6,7 to
;0,1,2,3
ADD
A,A
;Each state has 4 bytes for names
ADD
A,A
LD
DE,STEPTAB
ADD
A,E
LD
E,A
;Now, DE contains the

_________________________________________________________________________________

27

____________________________________________________________________________________

STMT

LOC

1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624

046B
046B
046B
046E
046F
0470
0471
0472
0472
0472
0472
0472
0472
0472
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0473
0475
0477
0477
0477
0477
0477
0479
0479
0479
0479
0479
0479
0479
0479
047C
047F
0481
0481
0481
0481
0482

OBJ CODE M

MPF-1
SOURCE STATEMENT

3A E3 1F
83
5F
1A
B7

C9

LD
ADD
LD
LD
OR

A,(STMINOR)
A,E
E,A
A,(DE)
A

;address of 1st name


;for each state.
;Get parameter count
;DE <--- DE + A
;Get parameter name.
;Change zero flag. If the
;returned pattern (in A) is
;zero, the '+' or '-' must
;have been pressed beyond legal
;parameter boundary. (Check if
;parameter name got from STEPTAB
;is zero)

RET
;
;***********************************************************
; Register display format:
;
;
;
;
;
;

i)

;
;
;
;
;
;
;

ii)
iii)

X X X X

Y Y -- State is REGAD. The numeric data


entered is interpreted as
register name.
YY is the register name, the
data of that register pair is,
XXXX.

X X X.X. Y Y or
X.X.X X Y Y -- State is REGDA. The unit of
register modification is byte.
The numeric data enterd will
change the byte with decimal
points under it. Decimal points
can be moved by '+' and '-' keys.

REGDP8:
; Display register and set STATE to 8.
3E 08
18 02

LD
JR

A,8
RGSTIN

;Next state = 8

REGDP9:
; Display register and set STATE to 9
3E 09

LD

A,9

;Next state = 9

RGSTIN:
; Update STATE by register A.
; Display user's register (count
; contained in STMINOR).
; registers destroyed: AF, BC, DE, HL
32 E4 1F
3A E3 1F
CB 87

LD
LD
RES

(STATE),A
A,(STMINOR)
0,A

47
CD AE 04

LD
CALL

B,A
RGNADP

;Update STATE
;Get register coutn.
;Registers are displayed by
;pairs. Find the count
;of pair leader. (count of
;the lower one)
;Temprorarily save A.
;Find register count.

_________________________________________________________________________________

28

____________________________________________________________________________________

STMT

LOC

1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682

0485
0485
0485
0486
0489
0489
048A
048B
048C
0490
0490
0490
0493
0496
0498
0498
0498
0499
049C
049F
04A1
04A1
04A1
04A1
04A3
04A4
04A5
04A7
04A7
04A8
04AA
04AD
04AD
04AE
04AE
04AE
04AE
04AE
04AE
04AE
04AE
04AE
04B1
04B1
04B2
04B3
04B4
04B5
04B6
04BA
04BB
04BB
04BB
04BB
04BB
04BB
04BB
04BE

OBJ CODE M

MPF-1
SOURCE STATEMENT

;Store them into DISPBF


;and DISPBF+1.
;Restore A (register pair leader).
;Get the address of
;user's register.
;Get register data. (2 bytes)

78
CD BE 04

LD
CALL

A,B
LOCRG

5E
23
56
ED 53 DE 1F

LD
INC
LD
LD

E,(HL)
HL
D, (HL)
(ADSAVE),DE

CD 65 06
3A E4 1F
FE 09

CALL
LD
CP

ADDRDP
A,(STATE)
9

C0
21 B8 1F
3A E3 1F
CB 47

RET
LD
LD
BIT

NZ
HL,DISPBF+2
A,(STMINOR)
0,A

28 02
23
23
CB F6

JR
INC
INC
SET

Z,LOCPT
HL
HL
6,(HL)

INC
SET
CALL

HL
6,(HL)
FCONV

LOCPT

23
CB F6
CD C4 04
C9

;Convert them to display


;format and store into
;display buffer.

;If STATE equals to 9 (RGDA),


;set 2 decimal points.
;Otherwise return here.

;Get register name.


;If this register is
;group leader, set decimal
;points of two central digits.
;Otherwise set two left digits.

;Set decimapl points of


;(HL) and (HL+1)

;Convert user's flag (F, F')


;to binary display format.

RET
;
RGNADP:
; Get the patterns of register names and
; store them into DISPBF and DISPBF+1.
; Input: A contains register count of
;
pair leader.
; registers destroyed: AF,DE,HL

21 D0 07

LD

HL,RGTAB

85
6F
5E
23
56
ED 53 B6 1F
C9

ADD
LD
LD
INC
LD
LD
RET

A,L
L,A
E,(HL)
HL
D,(HL)
(DISPBF),DE

;Get address of pattern


;table.

;Get first pattern


;Get 2nd pattern.

;
LOCRGBF:
; Get the address of user's register.
; Register name contained is STMINOR.
; Destroys HL, AF.
3A E3 1F
21 BC 1F

LOCRG

LD
LD

A,(STMINOR)
HL,REGBF

_________________________________________________________________________________

29

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740

04C1
04C2
04C3
04C4
04C4
04C4
04C4
04C4
04C4
04C4
04C4
04C7
04C8
04C9
04C9
04C9
04C9
04CB
04CD
04CD
04CD
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04CE
04D1
04D2
04D4
04D5
04D6
04D8
04D8
04D8
04D8
04D8
04D8
04D8
04D8
04D8
04DA
04DD
04E0
04E3
04E6
04E9
04EC
04EF
04F2

85
6F
C9

MPF-1
SOURCE STATEMENT

ADD
LD
RET

A,L
L,A

;
FCONV:
; Encode or decode user's flag register.
; STMINOR contains the name of the flag
; being displayed now.
; registers destroyed: AF, BC, HL.
3A E3 1F
B7
1F

LD
OR
RRA

A,(STMINOR)
A

FE 0B
28 09

CP
JR

0BH
Z,FLAGX

4F

LD

C,A

21 D2 1F
7E
E6 01
77
79
FE 0C

LD
LD
AND
LD
LD
CP

HL,USERIF
A,(HL)
00000001B
(HL),A
A,C
0CH

JR
LD
CALL
LD
CALL
LD
LD
CALL
LD
CALL

NC,FCONV2
A,(USERAF)
DECODE
(FLAGH),HL
DECODE
(FLAGL),HL
A,(UAFP)
DECODE
(FLAGHP),HL
DECODE

30
3A
CD
22
CD
22
3A
CD
22
CD

1F
BC
18
D4
18
D6
C4
18
D8
18

1F
05
1F
05
1F
1F
05
1F
05

FLAGX

FCONV1

;Get register name.


;Clear carry flag.
;name of I register: 17H,
;name of IFF: 16H.
;Rotate right one bit, both
;become 0BH.
;Jump to FLAGX if
;I or IFF is being
;displayed now.
;Otherwise, mask out bit
;1 to bit 7 fof user's IFF.
;IFF is only 1 bit, monitor
;uses one byte to store it,
;masking out bit 1-7 is to
;ignore the useless bits.
;This is done only when the
;user is not modifying IFF.
;If user is modifying IFF,
;monitor will display whatever
;he enters, even if bit 1-7
;are not all zero.
;A register is not changed
;after doing this.

;If STMINOR contains


;the name of SZXH, XPNC,
;SZXH' or XPNC', after
;rotating right one bit
;it will be greater than
;or equal to 0CH.
;Decode user's flag if it
;is not being modified now,
;encode it otherwise.
;Get user's F register
;Decode upper 4 bits.
;Decode lower 4 bits.
;Get user's F' register.

_________________________________________________________________________________

30

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798

04F5
04F8
04F9
04FC
04FC
04FC
04FF
0502
0505
0508
0508
050B
050E
0511
0514
0517
0518
0518
0518
0518
0518
0518
0518
0518
0518
0518
0518
0518
051A
051B
051B
051C
051D
051E
0520
0520
0520
0520
0522
0523
0523
0523
0523
0523
0523
0523
0523
0523
0523
0523
0525
0526
0526
0526
0527
0528
0529
052A

22 DA 1F
C9
2A D4 1F

MPF-1
SOURCE STATEMENT

FCONV2

LD
RET
LD

(FLAGLP),HL
HL,(FLAGH)

CD
2A
CD
32

23
D6
23
BC

05
1F
05
1F

CALL
LD
CALL
LD

ENCODE
HL,(FLAGL)
ENCODE
(USERAF),A

2A
CD
2A
CD
32
C9

D8
23
DA
23
C4

1F
05
1F
05
1F

LD
CALL
LD
CALL
LD
RET

HL,(FLAGHP)
ENCODE
HL,(FLAGLP)
ENCODE
(UAFP),A

;Get the binary form


;of 4 upper bits of
;user's F register.
;Encode it.
;Encode 4 lower bits.
;Save the encoded
;result into USERAF.
;Encode F' register.

;
DECODE:
; Decode bit 7-4 of A register.
; Each bit is extended to 4 bits.
; 0 becomse 0000, 1 becomse 0001.
; The output is stored in HL, which
; is 16 bits in length. Also, after
; execution, bits 7-4 of A register are
; bits 3-0 of A before execution.
; Registers destroyed: AF, B, HL
06 04
29

LD
ADD

B,4
HL,HL

29
29
07
ED 6A

ADD
ADD
RLCA
ADC

HL,HL
HL,HL

10 F8
C9

DJNZ
RET

DRL4

HL,HL

;Loop 4 times
;Clear rightmost 3
;bits of HL.

;The 4th bit of HL


;is determined by carry
;flag, which is the MSB
;of A register.

DRL4

;
ENCODE:
; Encode HL register. Each 4 bits of HL
; are encoded to 1 bit. 0000 become 0,
; 0001 become 1. The result is stored
; in bit 3-0 of A register. Also, after
; execution, bit 7-4 of A are bit 3-0
; before execution.
; Registers AF, B, HL are destroyed.
06 04
29

29
29
29
17

ERL4

LD
ADD

B,4
HL,HL

ADD
ADD
ADD
RLA

HL,HL
HL HL
HL,HL

;Loop 4 times.
;Shift HL left 4 bits.
;Bit 12 of HL will be
;shifted into carry flag.

;Rotate carry flag into


;A register.

_________________________________________________________________________________

31

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856

052A
052C
052D
052D
052D
052D
052D
052D
052D
052D
052D
0530
0530
0531
0531
0531
0531
0531
0531
0531
0531
0531
0532
0533
0535
0538
0539
053A
053A
053A
053A
053A
053A
053A
053A
053A
053A
053A
053A
053A
053A
053A
053D
053E
053E
053F
0540
0541
0542
0543
0543
0544
0545
0546
0548
0548
0549
054A

10 F9
C9

MPF-1
SOURCE STATEMENT

DJNZ
RET

ERL4

;
;***********************************************************
SUM1:
; Calculate the sum of the data in a memory
; block. The starting and ending address
; of this block are stored in STEPBF+2 - STEPBF+4
;
Registers AF, BC, DE, HL are destroyed.
CD 3A 05

CALL

GETPTR

D8

RET

;Get parameters from


;step buffer.
;Return if the parameters
;are illegal.

SUM:
; Calculate the sum of a memory block.
; HL contains the starting address of
; this block, BC contains the length.
; The result is stored in A. Registers
; AF, BC, HL are destroyed.
AF
86
ED A1
EA 32 05
B7
C9

SUMCAL

XOR
ADD
CPI
JP
OR
RET

A
A,(HL)

;Clear A
;Add

PE,SUMCAL
A

;Clear flags.

;
GETPTR:
; Get parameters from step buffer.
; Input: (STEPBF+2) and (STEPBF+3) contain
;
starting address.
;
(STEPBF+4) and (STEPBF+5) contain
;
ending address.
; Output: HL register contains the starting
;
address.
;
BC register contains the length.
;
Carry flag 0 -- BC positive
;
1 -- BC negative
; Destroyed registers: AF, BC, DE, HL.
21 B1 1F
5E

LD
LD

HL,STEPBF+2
E,(HL)

23
56
23
4E
23

INC
LD
INC
LD
INC

HL
D,(HL)
HL
C,(HL)
HL

66
69
B7
ED 52

LD
LD
OR
SBC

H,(HL)
L,C
A
HL,DE

4D
44
03

LD
LD
INC

C,L
B,H
BC

GETP

;Load starting address


;into DE.

;Load ending address


;into HL.

;Clear carry flag.


;Find difference.
;Carry flag is changed here.

;Now BC contains the

_________________________________________________________________________________

32

____________________________________________________________________________________

STMT

LOC

1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914

054B
054B
054C
054C
054D
054D
054D
054D
054D
054D
054D
054D
054D
054D
054E
054E
054E
054F
0552
0553
0555
0558
0558
0559
055A
055A
055A
055A
055A
055A
055A
055A
055A
055A
055A
055A
055A
055D
055F
0562
0562
0564
0565
0567
056A
056B
056B
056B
056B
056B
056B
056B
056B
056B
056B
056B
056B
056B

OBJ CODE M

MPF-1
SOURCE STATEMENT

EB
C9

EX

;length.
;Now HL contains the
;starting address.

RET
;
TAPEIN:
; Load a memory block from tape.
; Input: HL -- starting address of the block
;
BC -- length of the block
; Output: Carry flag 1 -- reading error
;
0 -- no error
; Destroyed registers: AF, BC, DE, HL, AF', BC', DE', HL'

AF

08
CD 5A 05
73
ED A1
EA 4F 05

DE,HL

TLOOP

08
C9

XOR

EX
CALL
LD
CPI
JP

AF,AF'
GETBYTE
(HL),E

EX
RET

PE,TLOOP

;Clear carry flag.


;At beginning, the reading is
;no error.
;Read 1 byte from tape.
;Store it into memory.
;Loop until length
;is zero.

AF,AF'

;
GETBYTE:
; Read one byte from tape.
; Output: E -- data read
;
Carry of F' 1 -- reading error
;
0 -- no error
; Destroy registers: AF, DE, AF', BC', DE', HL',
;Byte format:
; start bit bit bit bit bit bit bit bit stop
; bit
0
1
2
3
4
5
6
7
bit
CD 6B 05
16 08
CD 6B 05

BLOOP

CB 1B
15
20 F8
CD 6B 05
C9

CALL
LD
CALL

GETBIT
D,8
GETBIT

RR
DEC
JR
CALL
RET

E
D
NZ,BLOOP
GETBIT

;Get start bit.


;Loop 8 times
;Get one data bit.
;Result in carry flag.
;Rotate it into E.

;Get stop bit.

;
;
GETBIT:
; Read one bit from tape.
; Output: Carry of F: 0 -- this bit is 0
;
1 -- this bit is 1
;
Carry of F': 1 -- reading error
;
0 -- no error
; Destroyed registers: AF, AF', BC', DE', HL'
; Bit format:
;
;

0 -- 2 kHz 8 cycles + 1kHz 2 cycles.


1 -- 2 kHz 4 cycles + 1kHz 4 cycles.

_________________________________________________________________________________

33

____________________________________________________________________________________

STMT

LOC

1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972

056B
056B
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056C
056F
056F
0572
0573
0573
0573
0574
0576
0576
0576
0576
0578
0578
0579
0579
0579
0579
0579
057A
057C
057E
057F
057F
0581
0581
0581
0581

OBJ CODE M

MPF-1
SOURCE STATEMENT

D9

EXX

;Save HL, BC, DE registers

;
;
;
;
;
;
;
;
;
;
;
;
;

The tape-bit format of both 0 and 1 are


the same form: a high freq part followed by a
low freq part. The difference between 0 and 1
is the number of high freq cycles and low freq
cycles. Thus, a high freq period may have
two meanings:
i) It is used to count the number of high
freq cycles of the current tape-bit;
ii) If a high freq period is detected
immediately after a low freq period, then
this period is the first cycle of next
tape-bit and is used as a terminator of the
last tape-bit.

;
;
;
;
;
;
;
;
;
;
;
;

Bit 0 of H register is used to indicate the usage


of a high freq period. If this bit is zero, high
freq period causes counter increment for the current
tape-bit. If the high freq part has passed, bit 0
of H is set and the next high freq period will be used
as a terminator.
L register is used to up/down count the number of periods.
when a high freq period is read, L is increased by
1; when a low freq period is read, L is decreased
by 2. (The time duration for each count is 0.5 ms.)
At the end of a tape-bit, positive and negative L
stand for 0 and 1 respectively.

21 00 00

LD

HL,0

CALL
INC

PERIOD
D

15
20 11

DEC
JR

D
NZ,TERR

38 06

JR

C,SHORTP

2D

DEC

2D
CB C4
18 F1
2C

DEC
SET
JR
INC

L
0,H
COUNT
L

CB 44

BIT

0,H

28 EC

JR

Z,COUNT

CD 8C 05
14

COUNT

SHORTP

;Clear bit 0 of H,
;Set L to 0.
;Read one period.
;The next 2 instructions
;check if D is zero. Carry
;flag is not affected.
;If D is not zero, jump
;to error routine TERR.
;(Because the period is too
;much longer than that of 1 kHz.)
;If the period is short
;(2 kHz), jump to SHORTP.
;The period is 1 kHz, decrease L
; by 2. And set bit 0 of H
; to indicate this tape-bit has
; passed high freq part and
; reaches its low freq part.

;The period is 2 kHz,


;increase L by 1.
;If the tape-bit has passed its
;high freq part, high frequency
;means this bit is all over and
;next bit has started.

_________________________________________________________________________________

34

____________________________________________________________________________________

STMT

LOC

1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030

0583
0583
0585
0585
0585
0585
0585
0585
0585
0585
0585
0586
0587
0588
0589
058A
058B
058C
058C
058C
058C
058C
058C
058C
058C
058C
058C
058C
058F
0591
0592
0593
0595
0597
0597
0599
059B
059C
059D
059F
05A1
05A1
05A3
05A4
05A4
05A6
05A7
05A7
05A7
05A7
05A7
05A7
05A7
05A7
05A7
05A8
05AB
05AD

OBJ CODE M

CB 15

D9
C9
08
37
08
D9
C9

11
DB
13
17
38
3E

00 00
00

D3
DB
13
17
30
3E

02
00

MPF-1
SOURCE STATEMENT

; L=(# of 2k period)-2*(# of 1k period)


RL
L
; 0 --- NCarry (L positive)
; 1 --- Carry (L negative)
;The positive or negative sign of
;L corresponds to the tape-bit data.
;'RL L' will shift the sign bit of
;L into carry flag. After this
;instruction, the carry flag
;contains the tape-bit.
EXX
;Restore BC', DE', HL'
RET
TERR
EX
AF,AF'
SCF
;Set carry flag of F' to indicate error.
EX
AF,AF'
EXX
RET
;
PERIOD:
; Wait the tape to pass one period.
; The time duration is stored in DE. The
; unit is loop count. Typical value for
; 2kHz is 28, for 1 kHz is 56.
; Use (56+28)/2 as threshold. The returned
; result is in carry flag. (1 kHz -- NC, 2 kHz -- C)
; Registers destroyed: AF, DE
LD
IN
INC
RLA
JR
LD

DE,0
A,(KIN)
DE

(DIGIT),A
A,(KIN)
DE

FA
7F

OUT
IN
INC
RLA
JR
LD

D3 02
7B

OUT
LD

(DIGIT),A
A,E

FE 2A
C9

CP
RET

MPERIOD

LOOPH

FA
FF

LOOPL

C,LOOPH
A,11111111B

NC,LOOPL
A,01111111B

;Bit 7 of port A is Tapein.

;Loop until input goes low.


;Echo the tape input to
;speaker on MPF-I.

;Loop untili input goes high.


;Echo the tape input to
;speaker on MPF-I.
;Compare the result with
;the threshold.

;
;***********************************************************
TAPEOUT:
; Output a memory block to tape.
; Input: HL -- starting address of the block
;
BC -- length of the block
; Destroyed registers: AF, BC, DE, HL, BC', DE', HL'
5E
CD B1 05
ED A1
EA A7 05

LD
CALL
CPI
JP

E,(HL)
OUTBYTE

;Get the data.


;Output to tape.

PE,TAPEOUT

;Loop until finished.

_________________________________________________________________________________

35

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088

05B0
05B1
05B1
05B1
05B1
05B1
05B1
05B1
05B1
05B3
05B4
05B7
05B9
05BC
05BD
05BF
05C0
05C3
05C4
05C4
05C4
05C4
05C4
05C4
05C5
05C7
05C9
05C9
05CB
05CE
05D0
05D2
05D2
05D2
05D4
05D7
05D9
05DC
05DD
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05DE
05E0
05E2

C9

16
B7
CD
CB
CD
15
20
37
CD
C9

MPF-1
SOURCE STATEMENT

RET
;
OUTBYTE:
; Output one byte to tape. For tape-byte
; format, see coments on GETBYTE.
; Input: E -- data
; Destroyed registers: AF, DE, BC', DE', HL'
08
C4 05
1B
C4 05

OLOOP

F8
C4 05

D9
26 00
38 09
2E
CD
2E
18

08
E2 05
02
07

2E
CD
2E
CD
D9
C9

04
E2 05
04
DE 05

LD
OR
CALL
RR
CALL
DEC
JR
SCF
CALL
RET

D,8
A
OUTBIT
E
OUTBIT
D
NZ,OLOOP
OUTBIT

;Loop 8 times
;Clear carry flag.
;Output start bit.
;Rotate data into carry
;Output the carry

;Set carry flag.


;Output stop bit

;
OUTBIT:
; Output one bit to tape.
; Input: data in carry flag.
; Destroyed registers: AF, BC', DE', HL'
EXX
;Save BC, DE, HL.
LD
H,0
JR
C,OUT1
;If data=1, output 1.
OUT0:
;2 kHZ 8 cycles, 1kHz 2 cycles.
LD
L,ZERO_2K
CALL TONE2K
LD
L,ZERO_1K
JR
BITEND
;
OUT1:
;2 Khz 4 cycles, 1kHz 4 cycles.
LD
L,ONE_2K
CALL TONE2K
LD
L,ONE_1K
BITEND
CALL TONE1K
EXX
;Restore registers.
RET
;
;***********************************************************
;
;
UTILITY SUBROUTINES
;
;***********************************************************
;
; Function: Generate square wave to the MIC & speaker
;
on MPF--1
; Input:
C -- period = 2*(44+13*C) clock states.
;
HL -- number of periods.
; Output: none.
; Destroyed registers: AF, B, DE, HL.
; Call: none
TONE1K:

0E 41
18 02

LD
JR

C,F1KHZ
TONE

TONE2K:

_________________________________________________________________________________

36

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146

05E2
05E4
05E4
05E5
05E8
05EA
05EC
05ED
05EF
05F1
05F3
05F5
05F6
05F6
05F6
05F6
05F6
05F6
05F6
05F6
05F6
05F6
05F6
05F7
05F8
05F9
05FA
05FB
05FC
05FD
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
05FE
0600
0603
0605
0605
0605
0605
0605
0605
0607

0E 1F

MPF-1
SOURCE STATEMENT

LD

C,F2KHZ

ADD
LD
LD
OUT
LD
DJNZ
XOR
SBC
JR
RET

HL,HL
DE,1
A,0FFH
(DIGIT),A
B,C
$
80H
HL,DE
NZ,SQWAVE

TONE:
29
11
3E
D3
41
10
EE
ED
20
C9

01 00
FF
02

SQWAVE

FE
80
52
F5

;Half period: 44+13*C states


;Double for half-cycle count

;Bit-7 tapeout
;Half period delay
;Toggle output
;Decrement one count

;
;***********************************************************
; Function: check if a memory address is in RAM.
; Input: HL -- address to be checked.
; Output: Zero flag -- 0, ROM or nonexistant;
;
1, RAM.
; Destroyed registers: AF
; Call: none
RAMCHK:
7E
2F
77
7E
2F
77
BE
C9

LD
CPL
LD
LD
CPL
LD
CP
RET

A,(HL)
(HL),A
A,(HL)
(HL),A
(HL)

;
;***********************************************************
; Function: Scan the keyboard and display. Loop until
;
a key is detected. If the key is already
;
pressed when this routien starts execution,
;
return when next key is entered.
; Input: IX points to the buffer contains the display patterns.
;
6 LEDs require 6 byte data. (IX) contains the
;
pattern for rightmost LED, (IX+5) contains the
;
pattern for leftmost LED.
; Output:
A = internal code of the key pressed.
; Destroyed registers: AF, B, HL, AF', BC', DE'.
;
All other registers except IY are also
;
changed during execution, but they are
;
restored before return.
; Call: SCAN1
SCAN:
DD E5
21 E6 1F
CB 7E

PUSH
LD
BIT

IX
HL,TEST
7,(HL)

28 04
DD 21 A5 07

JR
LD

Z,SCPRE
IX,BLANK

;Save IX.
;This bit is set if the user
;has entered illegal key. The
;display will be disables as
;a warning to the user. This
;is done by replacing the display
;buffer pointer IX by BLANK.

_________________________________________________________________________________

37

____________________________________________________________________________________

STMT

LOC

2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204

060B
060B
060B
060B
060B
060B
060D
0610
0612
0612
0614
0616
0618
0618
0618
0618
061B
061D
061D
061D
061D
061D
061D
0620
0621
0622
0623
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0624
0625
0626

OBJ CODE M

MPF-1
SOURCE STATEMENT

; Wait until all keys are released for 40 ms.


; (The execution time of SCAN1 is 10 ms,
; 40 = 10 * 4.)
06 04
CD 24 06
30 F9

SCPRE
SCNX

10 F9
CB BE
DD E1

LD
CALL
JR

B,4
SCAN1
NC,SCPRE

DJNZ
RES
POP

SCNX
7,(HL)
IX

;If any key is pressed re-load


;the debounce counter B by 4.
;Clear error-flag.
;Restore original IX.

; Loop until any key is pressed.


CD 24 06
38 FB

SCLOOP

CALL
JR

SCAN1
C,SCLOOP

; Convert the key-position-code returned by SCAN1 to


; key-internal-code. This is done by table-lookup.
; The table used is KEYTAB.
21 7B 07
85
6F
7E
C9

KEYMAP

LD
ADD
LD
LD
RET

HL,KEYTAB
A,L
L,A
A,(HL)

;
;***********************************************************
; Function: Scan keyboard and display one cycle.
;
Total execution time is about 10 10 ms (exactly
;
9.95 ms, 17812 clock states @ 1.79 MHz).
; Input: Same as SCAN.
; Output: i) no key during one scan
;
Carry flag -- 1
;
ii) key pressed during one scan
;
Carry flag -- 0,
;
A -- position code of the key pressed.
;
If more than one key is pressed, A
;
contains the largest position-code.
;
(This key is the last key scanned.)
; Destroyed reg: AF, AF', BC', DE'. (see comments on SCAN)
; CALL: none.
SCAN1:
;In hardware, the display and keyboard are
;arranged as a 6 by 6 matrix. Each column
;corresponds to one LED and six key buttons.
;In normal operation, at most one column is
;active. The pattern of the active LED is the
;data output on port C of 8255 I. The data input
;from bit 0-5 of port A are the status of key
;buttons in the active column. All signals on
;I/O port are active low.
37
08
D9

SCF
EX
EXX

;Set carry flag.


AF,AF'

_________________________________________________________________________________

38

____________________________________________________________________________________

STMT

LOC

2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262

0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0627
0629
062B
062D
062D
062E
0630
0633
0635
0637
0639
063A
063C
063D
063E
0640
0642
0644
0646
0646
0646
0647
0649
0649
0649
064B
064B
064B
064B
064B
064B
064C
064D
064E
0650
0650
0652
0653
0655
0657

OBJ CODE M

MPF-1
SOURCE STATEMENT

;Carry flag of F' is used to return the status of


;the keyboard. If any key is pressed during one
;scan, the flag is reset; otherwise it is set.
;Initially, this flag is set. A' register is used
;to store the position-code of the key pressed.
;In this routine, 36 key positions are checked one
;by one. C register contains the code of the key
;being checked. The value of C is 0 at the beginning
;and is increased by 1 after each check. So the code
;ranges from 0 to 23H (total 36 positions). On each
;check, if the input bit is 0 (key pressed), C register
;is copied into A'. The carry flag of F' is set also.
;When some key is detected, the key positions after
;this key will still be checked. So if more than
;one key are pressed during one scan, the code of the
;last one will be returned.
0E 00
1E C1
26 06

LD
LD
LD

C,0
E,11000001B
H,6

LD
OUT
LD
OUT
LD
DJNZ
XOR
OUT
LD
CPL
OR
OUT
LD
IN

A,E
(DIGIT),A
A,(IX)
(SEG7),A
B,COLDEL
$
A
(SEG7),A
A,E

LD
RR

D,A
D

38 02

JR

C,NOKEY

79
08
0C
10 F7

LD
EX
INC
DJNZ

A,C
AF,AF'
C
KROW

INC
LD
AND
RLC
OR

IX
A,E
00111111B
A
11000000B

;Initial position code


;Scan from rightmost digit
;to the active column.

7B
D3
DD
D3
06
10
AF
D3
7B
2F
F6
D3
06
DB

KCOL
02
7E 00
01
C9
FE
01

C0
02
06
00

57
CB 1A

DD
7B
E6
CB
F6

23
3F
07
C0

KROW

NOKEY

11000000B
(DIGIT),A
B,6
A,(KIN)

;Activate one column.

;Delay 1.5 ms per digit.


;Deactivate all display segments

;Each column has 6 keys.


;Now, bit 0-5 of A contain
;the status of the 6 keys
;in the active column.
;Store A into D.
;Rotate D 1 bit right, bit 0
;of D will be rotated into
;carry flag.
;Skip next 2 instructions
;if the key is not pressed.
;The next 2 instructions
;store the current position-code
;into A' and reset carry flag
;of F' register.
;Key-in, get key position.
;Save A & Carry in AF'.
;Increase current key-code by 1.
;Loop until 6 keys in the
;active columns are checked.

_________________________________________________________________________________

39

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320

0659
065A
065B
065D
0660
0662
0663
0664
0665
0665
0665
0665
0665
0665
0665
0665
0665
0665
0665
0665
0668
0669
066C
066D
0670
0671
0671
0671
0671
0671
0671
0671
0671
0671
0671
0671
0671
0674
0677
0678
0678
0678
0678
0678
0678
0678
0678
0678
0678
0678
0678
0678
0678
0679
067C
067D
067E
067F

5F
25
20 D0
11 FA FF
DD 19
D9
08
C9

MPF-1
SOURCE STATEMENT

LD
DEC
JR
LD
ADD
EXX
EX
RET

E,A
H
NZ,KCOL
DE,-6
IX,DE

;Get original IX.

AF,AF'

;
;***********************************************************
; Function: Convert the 2 byte data stored in DE to
;
7-segment display format. The output is stored
;
in the address field of DISPBF (display buffer),
;
most significant digit in DISPBF+5.
;
This routine is usually used by monitor only.
; Destroyed registers: AF, HLK.
; Call: HEX7SG
ADDRDP:
21 B8 1F
7B
CD 78 06
7A
CD 78 06
C9

LD
LD
CALL
LD
CALL
RET

HL,DISPBF+2
A,E
HEX7SG
A,D
HEX7SG

;
;***********************************************************
; Function: Convert the data stored in A to 7-segment
;
display format. 1 byte is converted to 2
;
digits. The result is stored in the data
;
field of display buffer (DISPBF).
;
This routine is usually used by monitor only.
; Destroyed registers: AF, HL.
; Call: HEX7SG
DATADP:
21 B6 1F
CD 78 06
C9

LD
CALL
RET

HL,DISPBF
HEX7SG

;
;***********************************************************
; Function: Convert binary data to 7-segment display
;
format.
; Input: 1 byte in A register
;
HL points to the result buffer.
; Output: Pattern for 2 digits. Low order digit in (HL),
;
high order digit in (HL+1).
;
HL becomes HL+2.
; Destroyed registers: AF, HL.
; Call: HEX7
HEX7SG:
F5
CD 89 06
77
23
F1
0F

PUSH
CALL
LD
INC
POP
RRCA

AF
HEX7
(HL),A
HL
AF

_________________________________________________________________________________

40

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378

0680
0681
0682
0683
0686
0687
0688
0689
0689
0689
0689
0689
0689
0689
0689
0689
0689
0689
068A
068D
068F
0690
0691
0692
0693
0694
0694
0694
0694
0694
0694
0694
0694
0694
0694
0694
0697
069A
069D
069F
06A0
06A2
06A5
06A6
06A6
06A6
06A6
06A6
06A6
06A6
06A6
06A6
06A6
06A6
06A6
06A6
06A9
06AC

0F
0F
0F
CD 89 06
77
23
C9

MPF-1
SOURCE STATEMENT

RRCA
RRCA
RRCA
CALL
LD
INC
RET

HEX7
(HL),A
HL

;
;***********************************************************
; Function: Convert binary data to 7-segment display
;
format.
; Input: A -- LSB 4 bits contains the binary data
; Output: A -- display pattern for 1 digit.
; Destroyed registers: AF
; Call: none
HEX7:
E5
21 F0 07
E6 0F
85
6F
7E
E1
C9

PUSH
LD
AND
ADD
LD
LD
POP
RET

HL
HL,SEGTAB
0FH
A,L
L,A
A,(HL)
HL

;
;
;***********************************************************
; Function: RAM 1800-1FFF self-check.
; Input: note
; Output: none
; Destroyed registers: AF, BC, HL
; Call: RAMCHK
RAMTEST:
21
01
CD
28
76
ED
EA
C7

00 18
00 08
F6 05
01
A1
9A 06

RAMT

TNEXT

LD
LD
CALL
JR
HALT
CPI
JP
RST

HL,1800H
BC,0800H
RAMCHK
Z,TNEXT

LD
LD
CALL

HL,0
BC,0800H
SUM

;If error
PE,RAMT
00H

;Display 'uPF--1'.
;
;***********************************************************
;Monitor ROM self-check. Add the data of address
;0000 - 0800. If the sum equals to 0. Reset the monitor
;and display 'uPF--1'. If the sum is not0, which
;indicates error, HALT.
;Input: none.
;Output: none.
;Destroyed registers: AF, BC, HL.
;Call: SUM.
ROMTEST:

21 00 00
01 00 08
CD 31 05

_________________________________________________________________________________

41

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436

06AF
06B1
06B2
06B3
06B6
06B6
06B6
06B6
06B6
06B8
06BB
06BD
06C0
06C0
06C3
06C5
06C6
06C8
06C8
06CB
06CB
06CC
06CF
06D0
06D3
06D6
06D8
06DA
06DA
06DA
06DD
06DD
06DE
06E1
06E1
06E1
06E1
06E1
06E1
06E1
06E1
06E1
06E1
06E1
06E1
0737
0737
0739
073A
073B
073C
073D
073E
073F
0740
0741
0743
0744

28 01
76
C7
32 E5 1F

MPF-1
SOURCE STATEMENT

JR
HALT
RST
LD

00H
(POWERUP),A

LD
LD
LD
LD

A,55H
(BEEPSET) A
A,44H
(FBEEP),A

21 F2 1F
36 2F
23
36 00

LD
LD
INC
LD

HL,TBEEP
(HL),2FH
HL
(HL),0

C3 D8 03

JP

INI4

PUSH
LD
LD
LD
LD
CP
JR

AF
HL,FBEEP
C,(HL)
HL,(TBEEP)
A,(BEEPSET)
55H
NZ,NOTONE

CALL

TONE

POP
JP

AF
KEYEXEC

.ORG
.WORD
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.WORD
.BYTE
.BYTE

0737H
KINC
-KINC+KINC
-KINC+KDEC
-KINC+KGO
-KINC+KSTEP
-KINC+KDATA
-KINC+KSBR
-KINC+KINS
-KINC+KDEL
KPC
-KPC+KPC
-KPC+KADDR

3E
32
3E
32

SUMOK
INI3

55
F0 1F
44
F1 1F

Z,SUMOK
;If error.
;Display 'uPF--1'.
;Load power-code into
;(POWERUP). The monitor
;uses the location to decide
;wether a reset signal is
;on power-up.

;Beep frequency when key is


;pressed.
;Time duration of beep when

;key is pressed.

F5
21
4E
2A
3A
FE
20

BEEP
F1 1F
F2 1F
F0 1F
55
03

CD E4 05

;There is no beep sound when


;the key is pressed if data
;of (BEEPSET) is not 55H

NOTONE:
F1
C3 E9 00

;
;
;
;
;
;

;After a key is detected, determine


;what action should the monitor take.
;KEYEXEC uses the next 3 fators
;to get the entry point of proper
;service routine: key-code, STATE
;and STMINOR (Minor-State).
Below are the branch tables for each key and
state. The first entry of each table is
a base address, other entrys are the offset to
this address. Offset is only one byte long,
which is much shorter than the 2-byte address.
This can save the monitor code space.

KSUBFUN
1B 01
00
05
0A
0F
1A
2C
42
7B
C2 01
00
1C

KFUN

_________________________________________________________________________________

42

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494

0745
0746
0747
0748
0749
074A
074B
074D
074E
074F
0750
0751
0752
0753
0754
0755
0756
0757
0759
075A
075B
075C
075D
075E
075F
0760
0761
0762
0763
0765
0766
0767
0768
0769
076A
076B
076C
076D
076E
076F
0771
0772
0773
0774
0775
0776
0777
0778
0779
077A
077B
077B
077B
077B
077B
077C
077D
077E

0A
14
20
20
26
26
EC
00
16
03
26
34
34
34
34
26
44
3D
00
03
03
00
0E
0E
0E
0E
1F
1F
6B
00
03
03
00
0E
0E
0E
0E
1F
1F
99
00
03
03
00
4B
6D
8B
C1
00
00

MPF-1
SOURCE STATEMENT

01

HTAB

02

ITAB

02

DTAB

02

GTAB

.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.WORD
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.WORD
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.WORD
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.WORD
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE

-KPC+KCBR
-KPC+KREG
-KPC+KMV
-KPC+KRL
-KPC+KWT
-KPC+KRT
HFIX
-HFIX+HFIX
-HFIX+HAD
-HFIX+HDA
-HFIX+HRGFIX
-HFIX+HMV
-HFIX+HRL
-HFIX+HWT
-HFIX+HRT
-HFIX+HRGAD
-HFIX+HRGDA
IFIX
-IFIX+IFIX
-IFIX+IAD
-IFIX+IDA
-IFIX+IRGFIX
-IFIX+IMV
-IFIX+IRL
-IFIX+IWT
-IFIX+IRT
-IFIX+IRGAD
-IFIX+IRGDA
DFIX
-DFIX+DFIX
-DFIX+DAD
-DFIX+DDA
-DFIX+DRGFIX
-DFIX+DMV
-DFIX+DRL
-DFIX+DWT
-DFIX+DRT
-DFIX+DRGAD
-DFIX+DRGDA
GFIX
-GFIX+GFIX
-GFIX+GAD
-GFIX+GDA
-GFIX+GRGFIX
-GFIX+GMV
-GFIX+GRL
-GFIX+GWT
-GFIX+GRT
-GFIX+GRGAD
-GFIX+GRGDA

; Key-posistion-code to key-internal-code conversion table.

03
07
0B
0F

KEYTAB:
K0
K1
K2
K3

.BYTE
.BYTE
.BYTE
.BYTE

03H
07H
0BH
0FH

;HEX_3
;HEX_7
;HEX_B
;HEX_F

_________________________________________________________________________________

43

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552

077F
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789
078A
078B
078C
078D
078E
078F
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
079A
079B
079C
079D
079E
079F
079F
079F
079F
079F
07A0
07A1
07A2
07A3
07A4
07A5
07A6
07A7
07A8
07A9
07AA
07AB
07AC
07AD
07AE
07AF
07B0
07B1
07B2
07B3
07B4

20
21
02
06
0A
0E
22
23
01
05
09
0D
13
1F
00
04
08
0C
12
1E
1A
18
1B
19
17
1D
15
11
14
10
16
1C

30
02
02
0F
1F
A1
00
00
00
00
00
00
03
03
8F
02
1F
AE
02
AE
B6
AE

MPF-1
SOURCE STATEMENT

K4
K5
K6
K7
K8
K9
K0A
K0B
K0C
K0D
K0E
K0F
K10
K11
K12
K13
K14
K15
K16
K17
K18
K19
K1A
K1B
K1C
K1D
K1E
K1F
K20
K21
K22
K23
;
;
;
;
MPF_I

BLANK

ERR_

SYS_SP

.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE

20H
21H
02H
06H
0AH
0EH
22H
23H
01H
05H
09H
0DH
13H
1FH
00H
04H
08H
0CH
12H
1EH
1AH
18H
1BH
19H
17H
1DH
15H
11H
14H
10H
16H
1CH

;NOT USED
;NOT USED
;HEX_2
;HEX_6
;HEX_A
;HEX_E
;NOT USED
;NOT USED
;HEX_1
;HEX_5
;HEX_9
;HEX_D
;STEP
;TAPERD
;HEX_0
;HEX_4
;HEX_8
;HEX_C
;GO
;TAPEWR
;CBR
;PC
;REG
;ADDR
;DEL
;RELA
;SBR
;;DATA
;+
;INS
;MOVE

.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE

030H
002H
002H
00FH
01FH
0A1H
0
0
0
0
0
0
003H
003H
08FH
002H
01FH
0AEH
002H
0AEH
0B6H
0AEH

;'1'
;'-'
;'-'
;'F'
;'P'
;'u'

;'R'
;'R'
;'E'
;'-'
;'P'
;'S'
;'-'
;'S'
;'Y'
;'S'

_________________________________________________________________________________

44

____________________________________________________________________________________

STMT

LOC

OBJ CODE M

2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610

07B5
07B6
07B7
07B8
07B9
07BA
07BB
07BC
07BD
07BE
07BF
07C0
07C1
07C2
07C3
07C4
07C5
07C6
07C7
07C8
07C9
07CA
07CB
07CC
07CD
07CE
07CF
07D0
07D2
07D4
07D6
07D8
07DA
07DC
07DE
07E0
07E2
07E4
07E6
07E8
07EA
07EC
07EE
07F0
07F1
07F2
07F3
07F4
07F5
07F6
07F7
07F8
07F9
07FA
07FB
07FC
07FD
07FE

1F
AE
02
03
03
8F
00
AE
8F
B3
00
AE
B3
00
00
0F
AE
8F
00
0F
00
00
00
02
BE
8F
03
0F
8D
8F
85
4F
CD
CF
C5
07
B6
1F
0F
37
85
77
C5
BD
30
9B
BA
36
AE
AF
38
BF
BE
3F
A7
8D
B3
8F

MPF-1
SOURCE STATEMENT

ERR_SP

STEPTAB

REG_

3F
A7
B3
37
3F
A7
B3
37
30
30
AE
30
0F
0F
0F
0F

RGTAB

SEGTAB

.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.WORD
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE

01FH
0AEH
002H
003H
003H
08FH
0
0AEH
08FH
0B3H
0
0AEH
0B3H
0
0
00FH
0AEH
08FH
0
00FH
0
0
0
002H
0BEH
08FH
003H
03F0FH
0A78DH
0B38FH
03785H
03F4FH
0A7CDH
0B3CFH
037C5H
03007H
030B6H
0AE1FH
0300FH
00F37H
00F85H
00F77H
00FC5H
0BDH
030H
09BH
0BAH
036H
0AEH
0AFH
038H
0BFH
0BEH
03FH
0A7H
08DH
0B3H
08FH

;'P'
;'S'
;'-'
;'R'
;'R'
;'E'
;'S'
;'E'
;'D'
;'S'
;'D'

;'F'
;'S'
;'E'
;'F'

;'-'
;'G'
;'E'
;'R'
;'AF'
;'BC'
;'DE'
;'HL'
;'AF.'
;'BC.'
;'DE.'
;'HL.'
;'IX'
;'IY'
;'SP'
;'IF'
;'FH'
;'FL'
;'FH.'
;'FL.'
;'0'
;'1'
;'2'
;'3'
;'4'
;'5'
;'6'
;'7'
;'8'
;'9'
;'A'
;'B'
;'C'
;'D'
;'E'

_________________________________________________________________________________

45

____________________________________________________________________________________

STMT

LOC

2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659

07FF 0F
0800
0800
0800
1F9F
1F9F
1FAF
1FAF
1FB6
1FBC
1FBC
1FBE
1FC0
1FC2
1FC4
1FC6
1FC8
1FCA
1FCC
1FCE
1FD0
1FD2
1FD4
1FD6
1FD8
1FDA
1FDC
1FDE
1FDE
1FE0
1FE0
1FE2
1FE3
1FE4
1FE5
1FE6
1FE7
1FE7
1FE7
1FE7
1FE8
1FEA
1FEE
1FF0
1FF0
1FF0
1FF1
1FF2
1FF4

OBJ CODE M

MPF-1
SOURCE STATEMENT

.BYTE
00FH
;'F'
;
;***********************************************************
;SYSTEM RAM AREA:
USERSTK .ORG
1F9FH
.BLOCK 16
SYSSTK: .ORG
1FAFH
STEPBF .BLOCK 7
DISPBF .BLOCK 6
REGBF:
USERAF .BLOCK 2
USERBC .BLOCK 2
USERDE .BLOCK 2
USERHL .BLOCK 2
UAFP
.BLOCK 2
UBCP
.BLOCK 2
UDEP
.BLOCK 2
UHLP
.BLOCK 2
USERIX .BLOCK 2
USERIY .BLOCK 2
USERSP .BLOCK 2
USERIF .BLOCK 2
FLAGH
.BLOCK 2
FLAGL
.BLOCK 2
FLAGHP .BLOCK 2
FLAGLP .BLOCK 2
USERPC .BLOCK 2
;
ADSAVE .BLOCK 2
;Contains the address being
;displayed now.
BRAD
.BLOCK 2
;Break point address
BRDA
.BLOCK 1
;Data of break point address
STMINOR .BLOCK 1
;Minor state
STATE
.BLOCK 1
;State
POWERUP .BLOCK 1
;Power-up initialization
TEST
.BLOCK 1
;Flag, bit 0 -- set when function
;
or subfunction key is hit.
;
bit 7 -- set when illegal key
;
is entered.
ATEMP
.BLOCK 1
;Temporary storage.
HLTEMP .BLOCK 2
;Temporary storage.
TEMP
.BLOCK 4
;See comments on routine GDA.
IM1AD
.BLOCK 2
;Contains the address of Opcode 'FF'
;service routine. (RST 38H, mode
;1 interrupt, etc.)
BEEPSET .BLOCK 1
;Default value is 55H
FBEEP
.BLOCK 1
;Beep frequency
TBEEP
.BLOCK 2
;Time duration of beep
.END

_________________________________________________________________________________

46

____________________________________________________________________________________
CROSS REFERENCE
SYMBOL
VAL M

MPF-1
DEFN

REFS
1262
283
914
221
384
2388
2061
1349
1899
525
229
431
230
351

ADDRP
ADSAVE

0665
1FDE

2281
2639

ATEMP
BEEP
BEPSE
BITEND
BLANK
BLOOP
BR1
BRAD
BRANCH
BRDA
BRRSTO
BRTEST
CLRBR
COLDEL
CONT28
COUNT
DAD
DATADP
DDA
DECCDE
DFIX
2473
DIGIT
DISPBF

1FE7
06CB
1FF0
05D9
07A5
055F
0115
1FE0
03B0
1FE2
00D4
0421
03DE
00C9
003E
056F
026E
0671
026E
0518
026B

2650
2399
2656
2067
2537
1895
514
2641
1301
2642
362
1470
1378
27
217
1947
968
2298
969
1758
963

0002
1FB6

16
2619

DMV
DOMV
DRGAD
DRGDA
DRGFIX
DRGNA
DRL
DRL4
DRT
DSTEP
DTAB
DWT
EIDI
ENCODE
ENDFUN
ENDTAP
ERL4
ERROR
ERR
ERR_SP
F1KHz
F2KHz
FBEEP
FCONV
FCONV1
FCONV2
FILEDP
FLAGH
FLAGHP
FLAGL

0279
0187
028A
028A
026B
0295
0279
051A
0279
0286
0763
0279
02B2
0523
031C
034D
0525
0353
07A9
07B5
0041
001F
1FF1
04C4
04DA
04F9
038A
1FD4
1FD8
1FD8

981
672
995
996
964
1006
980
1769
978
992
2465
979
1048
1781
1175
1218
1791
1221
2541
2553
29
31
2657
1687
1732
1743
1265
2633
2635
2634

742
2231
163
1965
2467
1467
2468
1733
2465
2474
115
348
2282
2470
724
2474
2475
2469
1004
2471
1778
2473
989
534
2472
1046
1746
1135
1298
1799
1119
1221
329
2086
2089
2390
756
1731
1266
1734
1739
1736

1462
596
918
238

1523
618
969
274

1636
681
973
280

699
1077

732
1176

1024

1386

1474

745
1458

793
1633

822

839

2403
2146
535
364
455
362

345
602
515
1477

1972

1735
2466
2475
237
441
2299

1738
2466

1740
2467

2468

2469

2470

2471

2472

2473

279
858

1091
1447

2007
1454

2014
1483

2094
1527

2230
1535

2238
1642

1673

1748
1141

1752
1219

1754

1167

1189

1285

1288

1296

2400
1655

1743
1751
1747

_________________________________________________________________________________

47

____________________________________________________________________________________
CROSS REFERENCE
SYMBOL
VAL M
FLAGLP
1FDA
FLAGX
04D6
GAD
029C
GDA
029C
GATBIT
056B
GATBYT
055A
GATP
053D
GATPTR
053A
GFIX
0299

MPF-1
DEFN
2636
1722
1023
1024
1904
1882
1841
1827
1017

REFS
1741
1700
2478
2479
1893
1874
1113
1210
2476
2485
672
2485
2486
2480
2482
2484
544
2483
2445
2446
2316
2284
2443
2452
162
2448
2452
2553
2447
2449
2451
513
2450
2456
2457
2454
2463
557
816
207
2459
123
1368
1365
1371
2397
2463
2464
2458
952
925
923
937
524
2461

1753

1895

1900

1278
2477
2486
2481

1809
2477

2478

2479

2480

2481

2482

2483

2484

2300
2444

2445

2446

2447

2448

2449

2450

2451

281

287

2455

2456

2457

2458

2459

2460

2461

2462

594
910

600
936

616
965

630
991

643
1020

692

708

719

_________________________________________________________________________________

48

GMV
GRGAD
GRGDA
GRGFIX
GRL
GRT
GTAB
GWT
HAD
HDA
HEX7
HEX7SG
HFIX

02E4
0299
0299
0299
0306
035A
076F
0324
0202
01EF
0689
0678
01EC

1112
1019
1020
1018
1144
1226
2476
1182
839
822
2337
2314
816

HLTEMP
HMV
HRGAD
HRGDA
HRGFIX
HRL
HRT
HTAB
HWT
IAD
IDA
IFIX

1FE8
0220
0212
0230
0212
0220
0220
074B
0220
0240
0240
023D

2651
871
855
888
856
870
868
2443
869
913
914
908

IGNORE

03BB

1336

IM1AD
IMV
INI
INI1
INI2
INI3
INI4
IRGAD
IRGDA
IRGFIX
IRGNA
IRL
IRT
ISTEP
ITAB
IWT
KO
KOA
KOB
KOC

1FEE
024B
03C1
03C7
03C9
06B3
03D8
025C
025C
023D
0267
024B
024B
0258
0757
024B
077B
0785
0786
0787

2653
926
1347
1363
1364
2382
1372
941
942
909
952
925
923
937
2454
924
2491
2501
2502
2503

2324
2286
2444
2453
239

2455
2464
580
825
1373

____________________________________________________________________________________
CROSS REFERENCE
SYMBOL
VAL M
KOD
0788
KOE
0789
KOF
078A
K1
077C
K10
078B
K11
078C
K12
078D
K13
078E
K14
078F
K15
0790
K16
0791
K17
0792
K18
0793
K19
0794
K1A
0795
K1B
0796
K1C
0797
K1D
0798
K1E
0799
K1F
079A
K2
079D
K20
079B
K21
079C
K22
079D
K23
079E
K3
077A
K4
077D
K5
0780
K6
0781
K7
0782
K8
0783
K9
0784
KADDR
01DE
KCBR
01CC
KCOL
062D
KDATA
0135
KDEC
0120
KDEL
0196
KEYEXE
00E9
KEYMAP
061D
KEYTAB
077B
KFUN
0741
KGO
0125
KHEX
0111
KIN
0000
KINC
011B
KINS
015D
KMV
01E2
KPC
01C2
KREG
01D6
KRL
01E2
KROW
0647
KRT
01E8
KSBR
0147
KSTEP
012A
KSUBFU
0737
KWT
01E8
LEAD
0360
LEAD1
0367

MPF-1
DEFN
2504
2505
2506
2492
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2493
2523
2524
2525
2526
2494
2495
2496
2497
2498
2499
2500
764
738
2227
565
528
686
392
2196
2490
2434
538
507
18
518
610
787
727
750
790
2244
801
587
548
2424
797
1229
1236

REFS

2436
2437
2265
2430
2427
2433
2411
2169
453
2428
403
2001
2425
2432
2439
2434
2438
2440
2256
2442
2431
2429
430
2441
1240
1246

2008
2426

2240
2426

2427

2428

2429

2430

2431

2432

2433

2435

2435

2436

2437

2438

2439

2440

2441

2442

1258

1272

_________________________________________________________________________________

49

____________________________________________________________________________________
CROSS REFERENCE
SYMBOL
VAL M
LEAD2
0371
LOCPT
04A5
LOCRG
04BE
LOCRGB
04BB
LOCSTB
0455
LOCSTN
045F
LO0PH
048F
LOOPL
0599
MAIN
00DE
MEMDP1
0402
MEMDP2
040B
MPERIO
002A
MPF_I
079F
MVUP
0300
NMI
0066
NOKEY
064D
NOTONE
06DD
OLOOP
05B7
ONE_1K
0004
ONE_2K
0004
OUTO
05C9
OUT1
05D2
OUTBIT
05C4
OUTBYT
05B1
P8255
0003
PERIOD
058C
POWERU
1FE5
PRECL1
03EE
PRECL2
03FA
PREOUT
02A3
PREPC
0021
PWCODE
00A5
RAMCHK
05F6
RAMT
069A
RAMTES
0694
REGBF
1FBC
REGDP8
0473
REGDP9
0477
REG
07CA
RESET1
0032
RESET2
0054
RGNADP
04AE
RGSAVE
0074
RGSTIN
0479
RGTAB
07D0
ROMTES
06A6
RST28
0028
RST30
0030
RST38
0038
SAV12
0412
SCAN
05FE
SCAN1
0624
SCLOOP
0618
SCNX
060D
SCPRE
060B
SEG7
0001
SEGTAB
07F0
SETIF
00A4
SETPT
0434

MPF-1
DEFN
1250
1651
1682
1676
1538
1550
2001
2008
379
1444
1451
33
2531
1136
266
2255
2409
2042
47
48
2057
2063
2050
2033
15
1991
2645
1402
1416
1036
133
19
2110
2358
2355
2620
1600
1606
2574
181
248
1659
281
1611
2580
2375
143
166
194
1456
2136
2119
2162
2153
2152
17
2596
320
1487

REFS
1251
1648
1628
888
871
930
2004
2011
387
768
371
2017
258
1126
174
2247
2405
2045
2066
2064

1519
988

1531

851
574

604

974

1177

_________________________________________________________________________________

50

2056
2041
2028
107
1236
121
827
840
562
131
122
130
2362
1049
864
582
753
140
183
1624

682

733

746

835

919

334

598

628

707

824

2358

897

952

1006

1364

2153

2162

2154
1277

2228

2234

1372

2043
276
1250
2382
890
875

1370
331

2047

1947
1422

1682

1604
1666

1450
381
1265
2163
2156
2145
1230
2339
318
1491

1530

____________________________________________________________________________________
CROSS REFERENCE
SYMBOL
VAL M
SETPT1
0433
SETST0
00D0
SHORTP
057E
SKIPH1
0183
SKIPH2
02B8
SQWAVE
05EA
STATE
1FE4
STEPBF
1FAF

MPF-1
DEFN
1486
353
1966
645
721
2094
2644
2618

REFS
1481
263
1956
641
717
2099
361
623
1132
1545
805
1564
451
1681
2378
1183
1823
2379
116
341
1257
1203
2392
1036
0952
252
552
571
1877
2359
2078
1197
1209
1737

332

335

347

1222

443
627
1144
1840
885

514
645
1153

1396
680
1192

1456
706
1198

1556
721
1218

1617
723
1227

1637
796
1254

1112
1260

1112
1292

937

992

859
1693

926

942

981

996

1543

1569

1618

1643

1079

1091

1228

1267

1337
592

1408
614

1413
690

2138

2059

2065

1069

1717

_________________________________________________________________________________

51

STEPDP
STEPTA
STMINO

043A
07BC
1FE3

1513
2560
2643

SUM
SUM1
SUMCAL
SUMOK
SYSSTK
SYS_SP
TAPEIN
TAPEOU
TBEEP
TEMP
TERR
TEST
TESTM
TESTRG
TLOOP
TNEXT
TONE
TONE1K
TONE2K
UAFP
UBCP
UDEP
UHLP
USERAF
USERBC
USERDE
USERHL
USERIF
USERIX
USERIY
USERPC
USERSP
USERST
ZERO_1
ZERO_2
ZSUM

0531
052D
0532
06B2
1FAF
07AF
054D
05A7
1FF2
1FEA
0587
1FEG
03E5
013E
054F
06A0
05E4
05DE
05E2
1FC4
1FC6
1FC8
1FCA
1FBC
1FBE
1FC0
1FC2
1FD2
1FCC
1FCE
1FDC
1FD0
1F9F
0002
0008
0071

1813
1803
1821
2381
2617
2547
1862
2021
2658
2652
1985
2646
1389
578
1874
2361
2090
2085
2088
2625
2626
2627
2628
2621
2622
2623
2624
2632
2629
2630
2637
2631
2615
49
50
20

1290

322
1287
1213
2402
1048
413
569

2408
2067
1217
1755

380

2030

1068

1092

1732

1749

181

312

320

1037

285
288
345

731
328

1067

289
133
250
249
2060
2058
191

____________________________________________________________________________________
ADDR 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
----------------------------------------------------0000 06 00 10 FE 3E 90 D3 03 3E C0 D3 02 31 AF 1F 3A
0010 E5 1F FE A5 C4 C1 03 21 00 10 CD F6 05 28 02 26
0020 18 22 DC 1F 26 00 18 0A E3 2B E3 22 E8 1F 18 0E
0030 18 34 22 D2 1F 18 1D 71 E5 2A EE 1F E3 C9 32 E7
0040 1F 2A E0 1F 3A E2 1F 77 3E 80 D3 02 3A E7 1F 2A
0050 E8 1F 00 C9 21 9F 1F 22 D0 1F AF 32 E6 1F DD 21
0060 9F 07 C3 D0 00 FF 32 E7 1F 3E 90 D3 03 3E C0 D3
0070 02 3A E7 1F 22 E8 1F E1 22 DE 1F 22 DC 1F 2A E8
0080 1F ED 73 D0 1F 31 D0 1F FD E5 DD E5 D9 E5 D5 C5
0090 D9 08 F5 08 E5 D5 C5 F5 ED 57 32 D3 1F 3E 00 E2
00A0 A4 00 3E 01 32 D2 1F 31 AF 1F 2A D0 1F DD 21 B5
00B0 07 2B CD F6 05 20 19 2B CD F6 05 20 13 DD 21 AF
00C0 07 00 00 11 62 E0 19 38 07 DD 21 B6 1F 37 18 04
00D0 AF 32 E4 1F 3A E2 1F 2A E0 1F 77 DC 0B 04 31 AF
00E0 1F CD FE 05 CD CB 06 18 F5 FE 10 38 24 21 E6 1F
00F0 CB C6 D6 10 FE 08 21 37 07 DA B0 03 DD 21 B6 1F
0100 D6 08 21 E4 1F 77 21 E3 1F 36 00 21 41 07 C3 B0
0110 03 4F 21 4B 07 3A E4 1F C3 B0 03 21 57 07 18 F5
0120 21 63 07 18 F0 21 6F 07 18 EB CD E5 03 C2 BB 03
0130 3E 80 C3 A3 02 CD E5 03 20 04 CD 0B 04 C9 FE 08
0140 DA BB 03 CD 77 04 C9 CD E5 03 C2 BB 03 2A DE 1F
0150 CD F6 05 C2 BB 03 22 E0 1F CD 0B 04 C9 CD E5 03
0160 C2 BB 03 2A DE 1F 00 22 AF 1F 23 22 B3 1F CD F6
0170 05 C2 BB 03 11 FE 1D 7C FE 1E 38 07 FE 20 DA BB
0180 03 16 27 ED 53 B1 1F CD E4 02 AF 12 2A B3 1F 22
0190 DE 1F CD 0B 04 C9 CD E5 03 C2 BB 03 2A DE 1F 00
01A0 22 B3 1F CD F6 05 C2 BB 03 11 00 1E 7C FE 1E 38
01B0 07 FE 20 DA BB 03 16 28 ED 53 B1 1F 23 22 AF 1F
01C0 18 C5 2A DC 1F 22 DE 1F CD 0B 04 C9 CD DE 03 22
01D0 DE 1F CD 0B 04 C9 DD 21 CA 07 CD C4 04 C9 CD 02
01E0 04 C9 2A DE 1F 22 AF 1F CD 3A 04 C9 C3 BB 03 2A
01F0 DE 1F CD F6 05 C2 BB 03 CD EE 03 79 ED 6F CD 0B
0200 04 C9 21 DE 1F CD FA 03 79 ED 6F 23 ED 6F CD 02
0210 04 C9 79 DD 21 B6 1F 21 E3 1F 87 77 CD 73 04 C9
0220 CD 55 04 CD FA 03 79 ED 6F 23 ED 6F CD 3A 04 C9
0230 CD BB 04 CD EE 03 79 ED 6F CD 77 04 C9 C3 BB 03
0240 2A DE 1F 23 22 DE 1F CD 0B 04 C9 21 E3 1F 34 CD
0250 5F 04 20 04 35 C3 BB 03 CD 3A 04 C9 21 E3 1F 34
0260 3E 1F BE 30 02 36 00 CD 77 04 C9 C3 BB 03 2A DE
0270 1F 2B 22 DE 1F CD 0B 04 C9 21 E3 1F 35 CD 5F 04
0280 20 04 34 C3 BB 03 CD 3A 04 C9 21 E3 1F 35 3E 1F
0290 BE 30 02 36 1F CD 77 04 C9 C3 BB 03 2A E0 1F 36
02A0 EF 3E FF 32 EA 1F 3A D2 1F CB 47 21 FB C9 20 02
02B0 2E F3 22 EB 1F 31 BC 1F F1 C1 D1 E1 08 F1 08 D9
02C0 C1 D1 E1 D9 DD E1 FD E1 ED 7B D0 1F 32 BD 1F 3A
02D0 D3 1F ED 47 E5 2A DE 1F E3 3A EA 1F D3 02 3A BD
02E0 1F C3 EB 1F 21 AF 1F CD 3D 05 38 67 ED 5B B3 1F
02F0 ED 52 30 0C EB 09 2B EB 2A B1 1F ED B8 13 18 1C
0300 19 ED B0 1B 18 16 ED 5B AF 1F 13 13 2A B1 1F B7
0310 ED 52 7D 17 7C CE 00 20 3A 7D 1B 12 ED 53 DE 1F
0320 CD 0B 04 C9 CD 2D 05 38 2A 32 B5 1F 21 A0 0F CD
0330 DE 05 21 AF 1F 01 07 00 CD A7 05 21 A0 0F CD E2
0340 05 CD 3A 05 CD A7 05 21 A0 0F CD E2 05 ED 5B B3
0350 1F 18 C9 DD 21 A9 07 C3 D0 00 2A AF 1F 22 EA 1F
0360 3E 40 D3 01 21 E8 03 CD 8C 05 38 F4 2B 7C B5 20
0370 F6 CD 8C 05 30 FB 21 AF 1F 01 07 00 CD 4D 05 38
0380 DF ED 5B AF 1F CD 65 06 06 96 CD 24 06 10 FB 2A
0390 EA 1F B7 ED 52 20 C9 3E 02 D3 01 CD 3A 05 38 B3
03A0 CD 4D 05 38 AE CD 2D 05 21 B5 1F BE 20 A5 18 9D
03B0 5E 23 56 23 85 6F 6E 26 00 19 E9 21 E6 1F CB FE

_________________________________________________________________________________

52

____________________________________________________________________________________
ADDR 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
----------------------------------------------------03C0 C9 DD 21 A5 07 0E 07 06 10 CD 24 06 10 FB DD 2B
03D0 0D 20 F4 3E A5 C3 B3 06 21 66 00 22 EE 1F 21 FF
03E0 FF 22 E0 1F C9 3A E4 1F FE 01 C8 FE 02 C9 3A E6
03F0 1F B7 C8 3E 00 77 32 E6 1F C9 CD EE 03 C8 23 77
0400 2B C9 3E 01 06 04 21 B8 1F 18 07 3E 02 06 02 21
0410 B6 1F 32 E4 1F D9 ED 5B DE 1F CD 65 06 1A CD 71
0420 06 2A E0 1F 7E 32 E2 1F B7 ED 52 20 06 06 06 21
0430 B6 1F D9 D9 CB F6 23 10 FB C9 CD 55 04 5E 23 56
0440 CD 65 06 21 B8 1F 06 04 CD 34 04 CD 5F 04 6F 26
0450 02 22 B6 1F C9 3A E3 1F 87 21 AF 1F 85 6F C9 3A
0460 E4 1F D6 04 87 87 11 BC 07 83 5F 3A E3 1F 83 5F
0470 1A B7 C9 3E 08 18 02 3E 09 32 E4 1F 3A E3 1F CB
0480 87 47 CD AE 04 78 CD BE 04 5E 23 56 ED 53 DE 1F
0490 CD 65 06 3A E4 1F FE 09 C0 21 B8 1F 3A E3 1F CB
04A0 47 28 02 23 23 CB F6 23 CB F6 CD C4 04 C9 21 D0
04B0 07 85 6F 5E 23 56 ED 53 B6 1F C9 3A E3 1F 21 BC
04C0 1F 85 6F C9 3A E3 1F B7 1F FE 0B 28 09 4F 21 D2
04D0 1F 7E E6 01 77 79 FE 0C 30 1F 3A BC 1F CD 18 05
04E0 22 D4 1F CD 18 05 22 D6 1F 3A C4 1F CD 18 05 22
04F0 D8 1F CD 18 05 22 DA 1F C9 2A D4 1F CD 23 05 2A
0500 D6 1F CD 23 05 32 BC 1F 2A D8 1F CD 23 05 2A DA
0510 1F CD 23 05 32 C4 1F C9 06 04 29 29 29 07 ED 6A
0520 10 F8 C9 06 04 29 29 29 29 17 10 F9 C9 CD 3A 05
0530 D8 AF 86 ED A1 EA 32 05 B7 C9 21 B1 1F 5E 23 56
0540 23 4E 23 66 69 B7 ED 52 4D 44 03 EB C9 AF 08 CD
0550 5A 05 73 ED A1 EA 4F 05 08 C9 CD 6B 05 16 08 CD
0560 6B 05 CB 1B 15 20 F8 CD 6B 05 C9 D9 21 00 00 CD
0570 8C 05 14 15 20 11 38 06 2D 2D CB C4 18 F1 2C CB
0580 44 28 EC CB 15 D9 C9 08 37 08 D9 C9 11 00 00 DB
0590 00 13 17 38 FA 3E FF D3 02 DB 00 13 17 30 FA 3E
05A0 7F D3 02 7B FE 2A C9 5E CD B1 05 ED A1 EA A7 05
05B0 C9 16 08 B7 CD C4 05 CB 1B CD C4 05 15 20 F8 37
05C0 CD C4 05 C9 D9 26 00 38 09 2E 08 CD E2 05 2E 02
05D0 18 07 2E 04 CD E2 05 2E 04 CD DE 05 D9 C9 0E 41
05E0 18 02 0E 1F 29 11 01 00 3E FF D3 02 41 10 FE EE
05F0 80 ED 52 20 F5 C9 7E 2F 77 7E 2F 77 BE C9 DD E5
0600 21 E6 1F CB 7E 28 04 DD 21 A5 07 06 04 CD 24 06
0610 30 F9 10 F9 CB BE DD E1 CD 24 06 38 FB 21 7B 07
0620 85 6F 7E C9 37 08 D9 0E 00 1E C1 26 06 7B D3 02
0630 DD 7E 00 D3 01 06 C9 10 FE AF D3 01 7B 2F F6 C0
0640 D3 02 06 06 DB 00 57 CB 1A 38 02 79 08 0C 10 F7
0650 DD 23 7B E6 3F CB 07 F6 C0 5F 25 20 D0 11 FA FF
0660 DD 19 D9 08 C9 21 B8 1F 7B CD 78 06 7A CD 78 06
0670 C9 21 B6 1F CD 78 06 C9 F5 CD 89 06 77 23 F1 0F
0680 0F 0F 0F CD 89 06 77 23 C9 E5 21 F0 07 E6 0F 85
0690 6F 7E E1 C9 21 00 18 01 00 08 CD F6 05 28 01 76
06A0 ED A1 EA 9A 06 C7 21 00 00 01 00 08 CD 31 05 28
06B0 01 76 C7 32 E5 1F 3E 55 32 F0 1F 3E 44 32 F1 1F
06C0 21 F2 1F 36 2F 23 36 00 C3 D8 03 F5 21 F1 1F 4E
06D0 2A F2 1F 3A F0 1F FE 55 20 03 CD E4 05 F1 C3 E9
06E0 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
06F0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0700 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0710 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0720 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0730 FF FF FF FF FF FF FF 1B 01 00 05 0A 0F 1A 2C 42
0740 7B C2 01 00 1C 0A 14 20 20 26 26 EC 01 00 16 03
0750 26 34 34 34 34 26 44 3D 02 00 03 03 00 0E 0E 0E
0760 0E 1F 1F 6B 02 00 03 03 00 0E 0E 0E 0E 1F 1F 99
0770 02 00 03 03 00 4B 6D 8B C1 00 00 03 07 0B 0F 20

_________________________________________________________________________________

53

____________________________________________________________________________________
ADDR 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
----------------------------------------------------0780 21 02 06 0A 0E 22 23 01 05 09 0D 13 1F 00 04 08
0790 0C 12 1E 1A 18 1B 19 17 1D 15 11 14 10 16 1C 30
07A0 02 02 0F 1F A1 00 00 00 00 00 00 03 03 8F 02 1F
07B0 AE 02 AE B6 AE 1F AE 02 03 03 8F 00 AE 8F B3 00
07C0 AE B3 00 00 0F AE 8F 00 0F 00 00 00 02 BE 8F 03
07D0 0F 3F 8D A7 8F B3 85 37 4F 3F CD A7 CF B3 C5 37
07E0 07 30 B6 30 1F AE 0F 30 37 0F 85 0F 77 0F C5 0F
07F0 BD 30 9B BA 36 AE AF 38 BF BE 3F A7 8D B3 8F 0F
tasm: Number of errors = 0

_________________________________________________________________________________

54

You might also like