mpf-i the monitor (assembled with tasm; final 0,5 inch)
TRANSCRIPT
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
1/56
MPF-I
MONITOR
PROGRAM
SOURCE LISTING
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
2/56
____________________________________________________________________________________
_________________________________________________________________________________
ii
COPYRIGHT
Copyright 1981 by MULTITECH INDUSTRIAL CORP. All rightsreserved. No part of this publication may be reproduced, trans-mitted, transcribed, stored in a retrival system, or translated intoany language or computer language, in any form or by any means,electronic, mechanical, magnetic, optical, chemical, manual or other-wise, whitout the prior written permission of MULTITECH INDUS-TRIAL CORP.
DISCLAIMER
MULTITECH INDUSTRIAL CORP. makes no representations orwarranties, either express or implied, with respect to the contentshereof and specifically disclaims any warranties or merchantabilityor fitness for any particular purpose. MULTITECH INDUSTRIALCORP. software described in this manual is sold or licensed as is.Should the programs prove defective following their purchase, thebuyer ( and not MULTITECH INDUSTRIAL CORP., its distrinuitor,
or its dealer ) assumes the entire cost of all necessary servicing, re-pair, and any incidental or consequential damages resulting from anyDefect in the software. Further, MULTITECH INDUSTRIAL CORP.reserves the right to revise this publication and to make changes fromtime to time in the content hereof without obligation of MULTI-TECH INDUSTRIAL CORP. to notify any person of such revisionor changes.
MultitechINDUSTRIAL CORP.OFFICE/SFL. 266 SUNG CHIANG ROAD, TAIPEI 104TAIWAN, R.O.C.TEL: (02)6511101TELEX: 19162 MULTIIC FAX: (02)5422805FACTORY/INDUSTRYE, ROAD, III.HSINCHU SCIENCE BASED INDUSTRIAL PARKHSINCHU, TAIWAN 300 R.O.C.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
3/56
____________________________________________________________________________________
_________________________________________________________________________________
1
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0001 0000 ;***********************************************************
0002 0000 ;* *
0003 0000 ;* COPYRIGHT , MULTITECH INDUSTRIAL CORP. 1981 *
0004 0000 ;* All right reserved. *
0005 0000 ;* No part of this software may be copied without *
0006 0000 ;* the express written consent of MULTITECH *
0007 0000 ;* INDUSTRIAL CORP. *
0008 0000 ;* *
0009 0000 ;***********************************************************
0010 0000 ;
0011 0000 ;
0012 0000 FF FF ... .FILL 0800H,0FFH ;Write 0FFH into 2KBytes EPROM.
0013 0800
0014 0800 ;
0015 0800 P8255 .EQU 03H ;8255 I control port
0016 0800 DIGIT .EQU 02H ;8255 I port C
0017 0800 SEG7 .EQU 01H ;8255 I port B
0018 0800 KIN .EQU 00H ;8255 I port A
0019 0800 PWCODE .EQU 0A5H ;Power-up code
0020 0800 ZSUM .EQU 71H ;This will make the sum of all
0021 0800 ;monitor codes to be zero
0022 0800
0023 0800 ; The following EQUATEs are used for timing. Their values
0024 0800 ; depend on the CPU clock frequency. (In this version, the
0025 0800 ; crystal frequency is 1.79 MHz.)
0026 0800
0027 0800 COLDEL .EQU 201 ;Column delay time for routine
0028 0800 ;SCAN and SCAN1
0029 0800 F1KHZ .EQU 65 ;Delay count for 1 kHz square wave,
0030 0800 ;used by routine TONE1K.0031 0800 F2KHZ .EQU 31 ;Delay count for 2 kHz square wave,
0032 0800 ;used by routine TONE2k.
0033 0800 MPERIOD .EQU 42 ;1 kHz and 2 kHz threshold, used by
0034 0800 ;tape input routine PERIOD.
0035 0800
0036 0800 ; The following EQUATEs are for tape modulation.
0037 0800 ; If the quality of tape recorder is good, the user may
0038 0800 ; change '4 4 2 8' to '2 2 1 4'. This will double
0039 0800 ; the tape data rate.
0040 0800 ; If the quality of tape recorder is poor, the user may
0041 0800 ; change '4 4 2 8' to '6 6 3 12'. This will improve
0042 0800 ; error performance but slow down the data rate.
0043 0800 ; Although the data format is changed the tape is still0044 0800 ; compatible in each case, because only the ratio is
0045 0800 ; detected in the Tape-read.
0046 0800
0047 0800 ONE_1K .EQU 4
0048 0800 ONE_2K .EQU 4
0049 0800 ZERO_1K .EQU 2
0050 0800 ZERO_2K .EQU 8
0051 0800
0052 0800 ;***********************************************************
0053 0800 ; I/O port assignment: (8255 I)
0054 0800
0055 0800 ; port A (address 00H):
0056 0800 ; bit 7 -- tape input0057 0800 ; bit 6 -- 'USER KEY' on keyboard, active low
0058 0800 ; bit 5-0 row of keyboard matrix input, active low
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
4/56
____________________________________________________________________________________
_________________________________________________________________________________
2
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0059 0800 ; port B (address 01H): 7 segments of LED, active high
0060 0800 ; bit 7 -- segment d
0061 0800 ; bit 6 -- decimal point
0062 0800 ; bit 5 -- segment c0063 0800 ; bit 4 -- segment b
0064 0800 ; bit 3 -- segment a
0065 0800 ; bit 2 -- segment f
0066 0800 ; bit 1 -- segment g
0067 0800 ; bit 0 -- segment e
0068 0800 ; port C (address 02H):
0069 0800 ; bit 7 -- tape & tone output
0070 0800 ; bit 6 -- BREAK enable. NMI (CPU pin 17) will go to
0071 0800 ; low 5 M1's (machine cycle one) after this
0072 0800 ; bit goes to low. (This bit is connected to
0073 0800 ; the reset input of external counter.)
0074 0800 ; bit 5-0 -- colums of keyboard and the display matrix,
0075 0800 ; active high. Bit 5 is the leftmost column.0076 0800
0077 0800 ;***********************************************************
0078 0000 RST00 .ORG 00H ;original comment: -- reset --
0079 0000 ; There are two cases that will generate a RESET signal:
0080 0000 ; (i) power-up
0081 0000 ; (ii) 'RS' key pressed
0082 0000 ; In both cases, the following actions will be taken:
0083 0000 ; a) disable interrupt, set interrupt mode to 0
0084 0000 ; set I register to 00 and start execution
0085 0000 ; at address 0000 (by Z80 CPU itself).
0086 0000 ; b) initial user's PC to the lowest RAM address;
0087 0000 ; c) set user's SP to 1F9FH;
0088 0000 ; d) set user's I register to 00 and disable user's0089 0000 ; interrupt flip-flop;
0090 0000 ; In addition subroutine INI will be called on power-up
0091 0000 ; reset, which has the following effects:
0092 0000 ; e) disable BREAK POINT;
0093 0000 ; f) set the contents of location 1FEEH and 1FEFH to 66
0094 0000 ; and 00 respectively. This will make instruction RST
0095 0000 ; 38H (opcode FF) have the same effect as BREAK.
0096 0000 ; Memory location POWERUP is used to distinguish power-up
0097 0000 ; from RS-key. (POWERUP) contains random data when
0098 0000 ; power-up and contains PWCODE (0A5H) thereafter.
0099 0000
0100 0000 06 00 LD B,0
0101 0002 10 FE DJNZ $ ;Power-up delay0102 0004
0103 0004 ; Initialize 8255 to mode 0 with port A input, port B and C
0104 0004 ; output. The control word is 90H.
0105 0004
0106 0004 3E 90 LD A,10010000B
0107 0006 D3 03 OUT (P8255),A
0108 0008
0109 0008 ; When the control word is sent to 8255, all output
0110 0008 ; ports are cleared to 0. It is necessary to disable
0111 0008 ; BREAK and deactivate all I/O by sending 0C0H to
0112 0008 ; port C.
0113 0008
0114 0008 3E C0 LD A,0C0H0115 000A D3 02 OUT (DIGIT),A
0116 000C 31 AF 1F LD SP,SYSSTK ;initial system stack
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
5/56
____________________________________________________________________________________
_________________________________________________________________________________
3
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0117 000F
0118 000F ; If the content of location POWERUP is not equal to
0119 000F ; PWCODE, call subroutine INI. Continue otherwise.
0120 000F0121 000F 3A E5 1F LD A,(POWERUP)
0122 0012 FE A5 CP PWCODE
0123 0014 C4 C1 03 CALL NZ,INI
0124 0017
0125 0017 ; Determine the lowest RAM address by checking whether
0126 0017 ; address 1000H is RAM. If yes, set user's PC to this
0127 0017 ; value. Otherwise, set it to 1800H.
0128 0017
0129 0017 21 00 10 LD HL,1000H
0130 001A CD F6 05 CALL RAMCHK
0131 001D 28 02 JR Z,PREPC
0132 001F 26 18 LD H,18H
0133 0021 22 DC 1F PREPC LD (USERPC),HL0134 0024 26 00 LD H,0
0135 0026
0136 0026 ; Address 28H and 30H are reserved for BREAK (RST 28H)
0137 0026 ; and software BREAK (RST 30H). Skip these area, monitor
0138 0026 ; program resumes at RESET1.
0139 0026
0140 0026 18 0A JR RESET1
0141 0028 ;
0142 0028 ;***********************************************************
0143 0028 RST28 .ORG 28H
0144 0028 ; Address 28H is the entry point of BREAK trap.
0145 0028 ; If a location is set as a BREAK point, the monitor
0146 0028 ; will change the content of this location to C7 (RST 28H)0147 0028 ; before transfering control to user's program.
0148 0028 ; In execution of user's program, a trap will occur if
0149 0028 ; user's PC passes this location. The monitor then takes
0150 0028 ; over control and the content of BREAK address
0151 0028 ; will be restored. Monitor takes care of everything
0152 0028 ; and makes the whole mechanism transparant to the user.
0153 0028 ; The return address pushed onto stack is the PC after
0154 0028 ; executing RST 28H. The original break address should
0155 0028 ; be one less than that. The following 3 instructions
0156 0028 ; decrease the content of (SP) by one without changing
0157 0028 ; HL.
0158 0028
0159 0028 E3 EX (SP),HL0160 0029 2B DEC HL
0161 002A E3 EX (SP),HL
0162 002B 22 E8 1F LD (HLTEMP),HL
0163 002E 18 0E JR CONT28
0164 0030 ;
0165 0030 ;***********************************************************
0166 0030 RST30 .ORG 30H
0167 0030
0168 0030 ; Instruction RST 30H (opcode F7) is usually used as:
0169 0030 ; i) Software break;
0170 0030 ; ii) Terminator of user's program.
0171 0030 ; The effect of this instruction is to save all user's
0172 0030 ; registers and return to monitor.0173 0030
0174 0030 18 34 JR NMI
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
6/56
____________________________________________________________________________________
_________________________________________________________________________________
4
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0175 0032
0176 0032 ;***********************************************************
0177 0032 ; This is a part of reset routine. Address 0028 and
0178 0032 ; 0030 are reserved for break point. Reset routine0179 0032 ; skips this area and resumes here.
0180 0032 ;
0181 0032 22 D2 1F RESET1 LD (USERIF),HL ;set user's I register and
0182 0035 ;interrupt flip flop to 0
0183 0035 18 1D JR RESET2 ;monitor resumes at RESET2
0184 0037
0185 0037 ;***********************************************************
0186 0037
0187 0037 ; The following byte makes the sum of the monitor
0188 0037 ; code in ROM zero. ROMTEST is a self-checking routine.
0189 0037 ; This routine requires the sum of ROM to be zero.
0190 0037
0191 0037 71 .BYTE ZSUM0192 0038 ;
0193 0038 ;***********************************************************
0194 0038 RST38 .ORG 38H
0195 0038
0196 0038 ; Entry point of RST 38H (opcode FF) or mode 1 interrupt.
0197 0038 ; Fetch the address stored in location 1FEE and 1FEF,
0198 0038 ; then jump to this address. Initially, 1FEE and 1FEF
0199 0038 ; are set to 0066. So RST 38 will have the same effect
0200 0038 ; as software break. By changing the content of 1FEE
0201 0038 ; and 1FEF, the user can define his or her own service
0202 0038 ; routine.
0203 0038 ; The next three instructions push the contents of 1FEE
0204 0038 ; and 1FEF to stack without changing any registers.0205 0038
0206 0038 E5 PUSH HL
0207 0039 2A EE 1F LD HL,(IM1AD)
0208 003C E3 EX (SP),HL
0209 003D
0210 003D ; The top of the stack is now the address of user
0211 003D ; defined service routine. Pop out this address then
0212 003D ; branch to it.
0213 003D
0214 003D C9 RET
0215 003E ;
0216 003E ;***********************************************************
0217 003E CONT28:0218 003E ; This is a part of break service routine. It continues
0219 003E ; the program at RST28.
0220 003E
0221 003E 32 E7 1F LD (ATEMP),A
0222 0041
0223 0041 ; The monitor has changed the content of user's
0224 0041 ; program at break address. The next 3 instructions
0225 0041 ; restore the destroyed content. BRAD contains the
0226 0041 ; break address, BRDA contains the original data at
0227 0041 ; break address.
0228 0041
0229 0041 2A E0 1F LD HL,(BRAD)
0230 0044 3A E2 1F LD A,(BRDA)0231 0047 77 LD (HL),A
0232 0048
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
7/56
____________________________________________________________________________________
_________________________________________________________________________________
5
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0233 0048 ; Send break enable signal to hardware counter.
0234 0048 ; A nonmaskable interrupt will be issued at the 5th M1's
0235 0048
0236 0048 3E 80 LD A,10000000B0237 004A D3 02 OUT (DIGIT),A
0238 004C 3A E7 1F LD A,(ATEMP) ; 1st M1
0239 004F 2A E8 1F LD HL,(HLTEMP) ; 2nd M1
0240 0052 00 NOP ; 3rd M1
0241 0053 C9 RET ; 4th M1
0242 0054
0243 0054 ; Return to user's program. Execute the instruction
0244 0054 ; at break address. After finishing one instruction,
0245 0054 ; a nonmaskable interrupt happens and control is
0246 0054 ; transferred to the monitor again.
0247 0054 ;
0248 0054 RESET2:
0249 0054 21 9F 1F LD HL,USERSTK0250 0057 22 D0 1F LD (USERSP),HL ;set user's SP
0251 005A AF XOR A
0252 005B 32 E6 1F LD (TEST),A
0253 005E
0254 005E ; TEST is a flag for monitor's own use. Illegal key-in
0255 005E ; blanking (bit 7 of TEST) and automatic leading zero
0256 005E ; (bit 0) use this flag. Clear it here.
0257 005E
0258 005E DD 21 9F 07 LD IX,MPF_I
0259 0062
0260 0062 ; Address 0066 is the address for nonmaskable interrupt
0261 0062 ; Skip this area, monitor resumes at SETST0
0262 00620263 0062 C3 D0 00 JP SETST0
0264 0065 FF ; Address 0065 is an EPROM erased location.
0265 0065 ;***********************************************************
0266 0066 NMI .ORG 66H
0267 0066
0268 0066 ; Entry point of nonmaskable interrupt. NMI will occur
0269 0066 ; when MONI key is pressed or when user's program is
0270 0066 ; breaked. The service routine which starts here saves all
0271 0066 ; user's registers and status. It also checks the validity
0272 0066 ; of user's SP.
0273 0066
0274 0066 32 E7 1F LD (ATEMP),A ;save A register
0275 0069 3E 90 LD A,10010000B0276 006B D3 03 OUT (P8255),A ;set 8255 to mode 0.
0277 006D ;Port A input; B,C output.
0278 006D 3E C0 LD A,0C0H
0279 006F D3 02 OUT (DIGIT),A ;disable break and LED's
0280 0071 3A E7 1F LD A, (ATEMP) ;restore A register
0281 0074 22 E8 1F RGSAVE LD (HLTEMP),HL ;save register HL
0282 0077 E1 POP HL ;get return address from stack
0283 0078 22 DE 1F LD (ADSAVE),HL ;Save return address into
0284 007B ;ADSAVE.
0285 007B 22 DC 1F LD (USERPC),HL ;Set user's PC to return
0286 007E ;address.
0287 007E 2A E8 1F LD HL,(HLTEMP) ;restore HL register
0288 0081 ED 73 D0 1F LD (USERSP),SP ;set user's SP to current SP0289 0085 31 D0 1F LD SP,USERIY+2 ;save other registers by
0290 0088 FD E5 PUSH IY ;continously pushing them
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
8/56
____________________________________________________________________________________
_________________________________________________________________________________
6
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0291 008A DD E5 PUSH IX ;onto stack
0292 008C D9 EXX
0293 008D E5 PUSH HL
0294 008E D5 PUSH DE0295 008F C5 PUSH BC
0296 0090 D9 EXX
0297 0091 08 EX AF,AF'
0298 0092 F5 PUSH AF
0299 0093 08 EX AF,AF'
0300 0094 E5 PUSH HL
0301 0095 D5 PUSH DE
0302 0096 C5 PUSH BC
0303 0097 F5 PUSH AF
0304 0098
0305 0098 ; The next two instructions save I register.
0306 0098 ; The interrupt flip-flop (IFF2) is copied into
0307 0098 ; parity flag (P/V) by instruction LD A, I.0308 0098 ; The interrupt status (enabled or disabled)
0309 0098 ; can be determined by testing parity flag.
0310 0098
0311 0098 ED 57 LD A,I
0312 009A 32 D3 1F LD (USERIF+1),A
0313 009D
0314 009D ; The next four instructions save IFF2 into
0315 009D ; user's IFF.
0316 009D
0317 009D 3E 00 LD A,0
0318 009F E2 A4 00 JP PO,SETIF ;PO -- P/V = 0
0319 00A2 3E 01 LD A, 1
0320 00A4 32 D2 1F SETIF LD (USERIF),A0321 00A7 ;
0322 00A7 31 AF 1F LD SP,SYSSTK ;set SP to system stack
0323 00AA
0324 00AA ;The next 8 instructions check user's SP.
0325 00AA ; If the user's SP points to a location not
0326 00AA ; in RAM, display ERR-SP.
0327 00AA
0328 00AA 2A D0 1F LD HL,(USERSP)
0329 00AD DD 21 B5 07 LD IX,ERR_SP
0330 00B1 2B DEC HL
0331 00B2 CD F6 05 CALL RAMCHK
0332 00B5 20 19 JR NZ,SETST0
0333 00B7 2B DEC HL0334 00B8 CD F6 05 CALL RAMCHK
0335 00BB 20 13 JR NZ,SETST0
0336 00BD
0337 00BD ; If the user's stack and system stack are
0338 00BD ; overlayed, display SYS-SP. This checking
0339 00BD ; is done by the following instructions.
0340 00BD
0341 00BD DD 21 AF 07 LD IX,SYS_SP
0342 00C1 00 NOP
0343 00C2 00 NOP
0344 00C3
0345 00C3 11 62 E0 LD DE,-USERSTK+1
0346 00C6 19 ADD HL,DE0347 00C7 38 07 JR C,SETST0
0348 00C9 DD 21 B6 1F LD IX,DISPBF
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
9/56
____________________________________________________________________________________
_________________________________________________________________________________
7
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0349 00CD 37 SCF ;set carryflag to indicate
0350 00CE ;the user's SP is legal.
0351 00CE 18 04 JR BRRST0
0352 00D0 ;0353 00D0 SETST0:
0354 00D0 ; STATE is a memory location containing the monitor status.
0355 00D0 ; It will be described in detail later. STATE 0 stands
0356 00D0 ; for fixed display pattern. The initial pattern 'uPF--1'
0357 00D0 ; or message 'SYS-SP'... belong to this category. The next
0358 00D0 ; two instructions set STATE to zero.
0359 00D0
0360 00D0 AF XOR A ;set A to 0,also clear Carry flag
0361 00D1 32 E4 1F LD (STATE),A
0362 00D4 3A E2 1F BRRST0 LD A,(BRDA) ;restore the data at
0363 00D7 ;break address
0364 00D7 2A E0 1F LD HL,(BRAD)
0365 00DA 77 LD (HL),A0366 00DB
0367 00DB ; If the user's SP is legal SP is legal (carry set),
0368 00DB ; display user's PC and the content at PC.
0369 00DB ; Otherwise, display fixed message (ERR-SP
0370 00DB ; or SYS-SP or uPF--1)
0371 00DB DC 0B 04 CALL C,MEMDP2
0372 00DE ;
0373 00DE ;
0374 00DE ;***********************************************************
0375 00DE ; Scan the display and keyboard. When a key is
0376 00DE ; detected, take proper action according to the
0377 00DE ; key pressed.
0378 00DE0379 00DE MAIN:
0380 00DE 31 AF 1F LD SP,SYSSTK ;Initialize system stack
0381 00E1 CD FE 05 CALL SCAN ;Scan display and input keys.
0382 00E4 ;Routine SCAN will not return
0383 00E4 ;until any key is pressed.
0384 00E4 CD CB 06 CALL BEEP ;After a key is detected, there
0385 00E7 ;will be accompanied with a
0386 00E7 ; beep sound.
0387 00E7 18 F5 JR MAIN ;Back to MAIN, get more keys
0388 00E9 ;and execute them.
0389 00E9 ;
0390 00E9 ;
0391 00E9 ;***********************************************************0392 00E9 KEYEXEC:
0393 00E9
0394 00E9 ; Input key dispatch routine.
0395 00E9 ; This routine uses the key code returned by subroutine
0396 00E9 ; SCAN, which is one byte stored in A register. The
0397 00E9 ; range of key codes is from 00 to 1FH.
0398 00E9
0399 00E9 ; (i) key code = 00 - 0FH :
0400 00E9 ; These are hexadecimal keys. Branch to routine KHEX.
0401 00E9
0402 00E9 FE 10 CP 10H
0403 00EB 38 24 JR C,KHEX
0404 00ED0405 00ED ; If the key entered is not hexadecimal, it must be a
0406 00ED ; function or subfunction key. This means the previous
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
10/56
____________________________________________________________________________________
_________________________________________________________________________________
8
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0407 00ED ; numeric entry has terminated. Bit 0 of TEST flag
0408 00ED ; must be set at the beginning of a new numeric entry.
0409 00ED ; This is done by the next two instructions. (If bit 0
0410 00ED ; of TEST is set, the data buffer will be automatically0411 00ED ; cleared when a hexadecimal key is entered.)
0412 00ED
0413 00ED 21 E6 1F LD HL,TEST
0414 00F0 CB C6 SET 0,(HL)
0415 00F2
0416 00F2 ; (ii) key code = 10H - 17H :
0417 00F2 ; (+, -, GO, STEP, DATA, SBR, INS, DEL)
0418 00F2 ; There is no state corresponding to these keys.
0419 00F2 ; The response of them depends on the current
0420 00F2 ; state and minor-state. (E.g., the response of '+'
0421 00F2 ; key depends on the current function. It is illegal
0422 00F2 ; when the display is 'uPF--1', but is legal when the
0423 00F2 ; display is of 'address-data' form.) In this0424 00F2 ; documentation, they are named 'sub-function key'.
0425 00F2 ; They are all branched by table KSUBFUN and routine
0426 00F2 ; BRANCH.
0427 00F2
0428 00F2 D6 10 SUB 10H
0429 00F4 FE 08 CP 8
0430 00F6 21 37 07 LD HL,KSUBFUN
0431 00F9 DA B0 03 JP C,BRANCH
0432 00FC
0433 00FC ;(iii) key code = 18H - 1FH
0434 00FC ; (PC, Addr, CBr, Reg, Move, Rela, WRtape, RDtape)
0435 00FC ; These keys are named 'function key'. They are
0436 00FC ; acceptable at any time. When they are hit, the0437 00FC ; monitor will unconditionally enter a new state.
0438 00FC ; STMINOR contains the minor-state, which is required
0439 00FC ; to dispatch some sub-function keys (e.g. +, -).
0440 00FC
0441 00FC DD 21 B6 1F LD IX,DISPBF
0442 0100 D6 08 SUB 8
0443 0102 21 E4 1F LD HL,STATE
0444 0105 77 LD (HL),A ;set STATE to key-code minus 18H
0445 0106 ;The STATE is updated here. It
0446 0106 ;will be modified later by local
0447 0106 ;service routines if the
0448 0106 ;function-key is PC,Addr or CBr.
0449 0106 ;For function-other keys, STATE0450 0106 ;will not be modified later.
0451 0106 21 E3 1F LD HL,STMINOR
0452 0109 36 00 LD (HL),0 ;set STMINOR to 0
0453 010B 21 41 07 LD HL,KFUN ;KFUN is the base of the branch
0454 010E ;table the offset is stored in A
0455 010E C3 B0 03 JP BRANCH
0456 0111
0457 0111 ;
0458 0111 ;***********************************************************
0459 0111 ;STATE:
0460 0111 ; 0=FIX ;Display fixed pattern, e.g. 'uPF--1'.
0461 0111 ; 1=AD ;The hex key entered is interpreted as
0462 0111 ;memory addres.0463 0111 ; 2=DA ;The hex key entered is interpreted as
0464 0111 ;memory data.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
11/56
____________________________________________________________________________________
_________________________________________________________________________________
9
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0465 0111 ; 3=RGFIX ;Display fixed pattern: 'Reg- ' and
0466 0111 ;expect register name to be entered.
0467 0111 ; 4=MV ;Expect parameters for 'Move' function.
0468 0111 ; 5=RL ;Expect parameters for 'Rela' function.0469 0111 ; 6=WT ;Expect parameters for 'WRtape' func.
0470 0111 ; 7=RT ;Expect parameters for 'RDtape' func.
0471 0111 ; 8=RGAD ;Hex-key entered will be interpreted as
0472 0111 ;address name for registers.
0473 0111 ; 9=RGDA ;Hex-key entered will be interpreted as
0474 0111 ; data for registers.
0475 0111 ;
0476 0111 ; Subroutine naming conventions:
0477 0111 ; (i) K???? -- K stands for key, ???? is the key name,
0478 0111 ; e.g. KINS corresponds to key 'INS'. Each
0479 0111 ; time a key ???? is entered, the routine
0480 0111 ; with name K???? will be executed. All of
0481 0111 ; them are branched by table KFUN or KSUBFUN.0482 0111 ; (ii) H???? -- H stands for hexadecimal, ???? is the
0483 0111 ; current STATE. For example, routine
0484 0111 ; HDA will be executed if the entered
0485 0111 ; key is hexadecimal and STATE is DA now.
0486 0111 ; These routines are branched by table
0487 0111 ; HTAB.
0488 0111 ; (iii) I???? -- I stands for increment (+ key), ???? is
0489 0111 ; the current STATE. E.g. IMV will be
0490 0111 ; executed when STATE is MV and '+' key
0491 0111 ; is entered. These routines are branched
0492 0111 ; by table ITAB
0493 0111 ; (iv) D???? -- D stands for decrement (- key), ???? is
0494 0111 ; the current STATE. These routines are0495 0111 ; branched using table DTAB.
0496 0111 ; (v) G???? -- G stands for 'GO' key, ???? is the current
0497 0111 ; STATE. These routines are branched using
0498 0111 ; table GTAB.
0499 0111
0500 0111 ;***********************************************************
0501 0111
0502 0111 ; Hexadecimal, '+', '-' and 'GO' keys may be entered after
0503 0111 ; different function keys. The monitor uses branch tables
0504 0111 ; and STATE to determine the current function and branch
0505 0111 ; to the proper entry point.
0506 0111 ;
0507 0111 KHEX:0508 0111 ;Executed when hexadecimal keys are pressed.
0509 0111 ;Use HTAB and STATE for further branch.
0510 0111
0511 0111 4F LD C,A ;save A register in C
0512 0112 ;which is the hex key-code.
0513 0112 21 4B 07 LD HL,HTAB
0514 0115 3A E4 1F BR1 LD A,(STATE)
0515 0118 C3 B0 03 JP BRANCH
0516 011B ;
0517 011B
0518 011B KINC:
0519 011B ;Branched by KSUBFUN table.
0520 011B ;Executed when '+' key is pressed.0521 011B ;Use ITAB and STATE for further branch.
0522 011B ;STATE will be stored in A register at BR1.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
12/56
____________________________________________________________________________________
_________________________________________________________________________________
10
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0523 011B
0524 011B 21 57 07 LD HL,ITAB
0525 011E 18 F5 JR BR1
0526 01200527 0120 ;
0528 0120 KDEC:
0529 0120 ;Branched by KSUBFUN table.
0530 0120 ;Executed when '-' key is pressed.
0531 0120 ;Use DTAB and STATE for further branch.
0532 0120 ;STATE will be stored in A register at BR1.
0533 0120
0534 0120 21 63 07 LD HL,DTAB
0535 0123 18 F0 JR BR1
0536 0125
0537 0125 ;
0538 0125 KGO:
0539 0125 ;Branched by KSUBFUN table.0540 0125 ;Executed when 'GO' key is pressed.
0541 0125 ;Use DTAB and STATE for further branch.
0542 0125 ;STATE will be stored in A register at BR1.
0543 0125
0544 0125 21 6F 07 LD HL,GTAB
0545 0128 18 EB JR BR1
0546 012A
0547 012A ;
0548 012A KSTEP:
0549 012A ;Branched by table KSUBFUN.
0550 012A ;Executed when 'STEP' key is pressed.
0551 012A
0552 012A CD E5 03 CALL TESTM ;Check if the left 4 digits of0553 012D ;the display are memory address.
0554 012D ;If not, disable all LED's as
0555 013D ;a warning to the user. This
0556 013D ;is done by routine IGNORE.
0557 013D C2 BB 03 JP NZ,IGNORE
0558 0130 3E 80 LD A,10000000B ;This data will be output
0559 0132 ;to port B to enable
0560 0132 ;BREAK. It is done by
0561 0132 ;routine PREOUT.
0562 0132 C3 A3 02 JP PREOUT
0563 0135
0564 0135 ;
0565 0135 KDATA:0566 0135 ;Branched by table KSUBFUN.
0567 0135 ;Executed when 'DATA' key is pressed.
0568 0135
0569 0135 CD E5 03 CALL TESTM ;Check if the left 4 digits of
0570 0138 ;the display are memory address.
0571 0138 20 04 JR NZ,TESTRG ;If not, branch to TESTRG
0572 013A ;to check whether the display
0573 013A ;is register or not.
0574 013A CD 0B 04 CALL MEMDP2 ;If yes, display the data of
0575 013D ;that address and set STATE
0576 013D ;to 2.
0577 013D C9 RET
0578 013E FE 08 TESTRG CP 8 ;check if the status is 8 or 90579 0140 ;(RGAD or RGDA).
0580 0140 DA BB 03 JP C,IGNORE ;If not, ignore this key and
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
13/56
____________________________________________________________________________________
_________________________________________________________________________________
11
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0581 0143 ;send out a warning message.
0582 0143 CD 77 04 CALL REGDP9 ;If yes, display register and
0583 0146 ;set status to 9 (RGDA).
0584 0146 C9 RET0585 0147
0586 0147 ;
0587 0147 KSBR:
0588 0147 ;Branched by table KSUBFUN.
0589 0147 ;Executed when 'SBr' key (set break point)
0590 0147 ; is pressed.
0591 0147
0592 0147 CD E5 03 CALL TESTM ;Check if the display is of
0593 014A ;'address-data' form.
0594 014A C2 BB 03 JP NZ,IGNORE ;If not, ignore this key and
0595 014D ;send out a warning message.
0596 014D 2A DE 1F LD HL,(ADSAVE) ;If yes, get the address
0597 0150 ;being displayed now.0598 0150 CD F6 05 CALL RAMCHK ;Check if this address is
0599 0153 ;in RAM.
0600 0153 C2 BB 03 JP NZ,IGNORE ;If not, ignore the 'SBR' key
0601 0156 ;and send out a warning message.
0602 0156 22 E0 1F LD (BRAD),HL ;If yes, set this address as
0603 0159 ;a break point.
0604 0159 CD 0B 04 CALL MEMDP2 ;Display the data of break
0605 015C ;address and set STATE to
0606 015C ;2 (DA).
0607 015C C9 RET
0608 015D
0609 015D ;
0610 015D KINS:0611 015D ;Branched by table KSUBFUN.
0612 015D ;Executed when 'Ins' key (insert) is pressed.
0613 015D
0614 015D CD E5 03 CALL TESTM ;Check if the display is of
0615 0160 ;'addres-data' form.
0616 0160 C2 BB 03 JP NZ,IGNORE ;If not, ignore the 'INS' key
0617 0163 ;and send out a warning message.
0618 0163 2A DE 1F LD HL,(ADSAVE) ;If yes, get the address being
0619 0166 ;displayed now.
0620 0166
0621 0166 00 NOP
0622 0167
0623 0167 22 AF 1F LD (STEPBF),HL ;Store this address in0624 016A ;STEPBF and the next address
0625 016A ;in STEPBF+4 for later use.
0626 016A 23 INC HL
0627 016B 22 B3 1F LD (STEPBF+4),HL
0628 016E CD F6 05 CALL RAMCHK ;Check if the address to be
0629 0171 ;inserted is in RAM.
0630 0171 C2 BB 03 JP NZ,IGNORE ;If not, ignore the 'INS' key
0631 0174 ;and send out a warning message.
0632 0174 ;If the address to be inserted
0633 0174 ;is in 1800-1DFF, store 1DFE into
0634 0174 ;STEPBF+2
0635 0174 ;Otherwise, ignore the 'INS' key.
0636 0174 ;This is done by the following0637 0174 ;instructions.
0638 0174 11 FE 1D LD DE,1DFEH
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
14/56
____________________________________________________________________________________
_________________________________________________________________________________
12
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0639 0177 7C LD A,H
0640 0178 FE 1E CP 1EH
0641 017A 38 07 JR C,SKIPH1
0642 017C FE 20 CP 20H0643 017E DA BB 03 JP C,IGNORE
0644 0181 16 27 LD D,27H
0645 0183 ED 53 B1 1F SKIPH1 LD (STEPBF+2),DE
0646 0187
0647 0187 ;When one byte is inserted at some
0648 0187 ;address, all data below this address
0649 0187 ;will be shifted down one position.
0650 0187 ;The last location will be shifted out
0651 0187 ;and therefore lost.
0652 0187 ;The RAM is divided into 3 blocks as
0653 0187 ;insert is concerned. They are:
0654 0187 ;1800-1DFF, 1E00-1FFF and 2000-27FF
0655 0187 ;The 2nd block cannot be inserted and0656 0187 ;is usually used as data bank. System
0657 0187 ;data that of course cannot be shifted
0658 0187 ;is also stored in this bank. Each
0659 0187 ;block is independent of the other when
0660 0187 ;shift is performed, i.e. the data
0661 0187 ;shifted out of the first block will not
0662 0187 ;be propagated to next block.
0663 0187 ;The shift is accomplished by block
0664 0187 ;transfer, i.e. MOVE. This is the
0665 0187 ;job of subroutine GMV.
0666 0187 ;Routine GMV needs 3 parameters which
0667 0187 ;are stored in step-buffer (STEPBF):
0668 0187 ;STEPBF: starting address (2 bytes);0669 0187 ;STEPBF+2: ending address (2 bytes);
0670 0187 ;STEPBF+4: destination address (2 bytes).
0671 0187
0672 0187 CD E4 02 DOMV CALL GMV
0673 018A AF XOR A ;After the RAM has been shifted
0674 018B ;down,the data of the address to be
0675 018B ;inserted is cleared to zero. This
0676 018B ;is done by these two instructions.
0677 018B ;Register DE contains inserted
0678 018B ;address after GMV is performed.
0679 018B 12 LD (DE),A
0680 018C 2A B3 1F LD HL,(STEPBF+4) ;Store the data in (STEPBF+4)
0681 018F 22 DE 1F LD (ADSAVE),HL ;into (ADSAVE).0682 0192 CD 0B 04 CALL MEMDP2 ;Display the address and data
0683 0195 ;also set STATE to 2.
0684 0195 C9 RET
0685 0196 ;
0686 0196 KDEL:
0687 0196 ;Branched by table KSUBFUN.
0688 0196 ;Executed when 'Del' (delete) key is pressed.
0689 0196
0690 0196 CD E5 03 CALL TESTM ;Check if the display is of
0691 0199 ;'address-data' form.
0692 0199 C2 BB 03 JP NZ,IGNORE ;If not, ignore the 'Del' key
0693 019C ;and send out a warning message.
0694 019C ;'Delete' is quite similar to0695 019C ;'Insert',except that the memory
0696 019C ;is shifted up up instead of
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
15/56
____________________________________________________________________________________
_________________________________________________________________________________
13
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0697 019C ;shifted down. See the comments
0698 019C ;on routine KINS for details.
0699 019C 2A DE 1F LD HL,(ADSAVE) ;Get the address being displayed
0700 019F ;now. This is the address to0701 019F ;be deleted.
0702 019F
0703 019F
0704 019F 00 NOP
0705 01A0
0706 01A0 22 B3 1F LD (STEPBF+4),HL
0707 01A3 CD F6 05 CALL RAMCHK ;Check if the address is in RAM.
0708 01A6 C2 BB 03 JP NZ,IGNORE ;If not, ignore this key and
0709 01A9 ;send out a warning message.
0710 01A9 ;Following instructions prepare
0711 01A9 ;the parameters for routine GMV
0712 01A9 ;in step-buffer. Refer to routine
0713 01A9 ;KINS for detail.0714 01A9 11 00 1E LD DE,1E00H
0715 01AC 7C LD A, H
0716 01AD FE 1E CP 1EH
0717 01AF 38 07 JR C,SKIPH2
0718 01B1 FE 20 CP 20H
0719 01B3 DA BB 03 JP C,IGNORE
0720 01B6 16 28 LD D, 28H
0721 01B8 ED 53 B1 1F SKIPH2 LD (STEPBF+2),DE
0722 01BC 23 INC HL
0723 01BD 22 AF 1F LD (STEPBF),HL
0724 01C0 18 C5 JR DOMV
0725 01C2 ;
0726 01C2 ;***********************************************************0727 01C2 KPC:
0728 01C2 ;Branched by table KFUN.
0729 01C2 ;Executed when 'PC' key is pressed.
0730 01C2
0731 01C2 2A DC 1F LD HL,(USERPC) ;Store the user's program
0732 01C5 22 DE 1F LD (ADSAVE),HL ;counter into (ADSAVE).
0733 01C8 CD 0B 04 CALL MEMDP2 ;Routine MEMDP2 displays the
0734 01CB ;address in (ADSAVE) and its
0735 01CB ;data.It also sets the STATE to 2
0736 01CB C9 RET
0737 01CC ;
0738 01CC KCBR:
0739 01CC ;Branched by table KFUN.0740 01CC ;Executed when 'CBr' (clear break point) key is pressed.
0741 01CC
0742 01CC CD DE 03 CALL CLRBR ;Call subroutine CLRBR to clear
0743 01CF ;break point. When returned, the
0744 01CF ;HL register will contain FFFF.
0745 01CF 22 DE 1F LD (ADSAVE),HL ;Store FFFF into (ADSAVE)
0746 01D2 CD 0B 04 CALL MEMDP2 ;Display address and its data.
0747 01D5 ;Also set STATE to 2.
0748 01D5 C9 RET
0749 01D6 ;
0750 01D6 KREG:
0751 01D6 ;Branched by table KFUN.
0752 01D6 ;Executed when 'Reg' key is pressed.0753 01D6 DD 21 CA 07 LD IX,REG_ ;Routine SCAN uses IX as a pointer
0754 01DA ;for display buffer.Setting IX to
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
16/56
____________________________________________________________________________________
_________________________________________________________________________________
14
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0755 01DA ;REG will make SCAN displays 'Reg-'
0756 01DA CD C4 04 CALL FCONV ;Decode user's flag F and F' to
0757 01DD ;binary display format. This
0758 01DD ;format will be used later, when0759 01DD ;user requires the monitor to
0760 01DD ;display decoded flag by pressing
0761 01DD ;keys 'SZXH', 'XPNC',...
0762 01DD C9 RET
0763 01DE ;
0764 01DE KADDR:
0765 01DE ;Branched by table KFUN.
0766 01DE ; Executed when 'Addr' key is pressed.
0767 01DE
0768 01DE CD 02 04 CALL MEMDP1 ;Display the address stored in
0769 01E1 ;(ADSAVE) and its data. Set STATE
0770 01E1 ;to 1 (AD)
0771 01E1 C9 RET0772 01E2 ;
0773 01E2 ; Function Move, Relative, Read-tape and
0774 01E2 ; Write-tape require from one to three
0775 01E2 ; parameters. They are stored in STEPBF
0776 01E2 ; (step buffer). STMINOR (minor status)
0777 01E2 ; contains the number of parameters that has
0778 01E2 ; been entered. For Move and Relative, the
0779 01E2 ; default value of the first parameter is
0780 01E2 ; the address stored in (ADSAVE). There
0781 01E2 ; is no default value for the first parameter
0782 01E2 ; (filename) of Read- and Write-tape. When the
0783 01E2 ; function keys are pressed, STMINOR is automatically
0784 01E2 ; reset to 0.0785 01E2 ;
0786 01E2
0787 01E2 KMV:
0788 01E2 ;Branched by table KFUN.
0789 01E2 ;Executed when 'Move' key is pressed.
0790 01E2 KRL:
0791 01E2 ;Branched by table KFUN.
0792 01E2 ;Executed when 'Rela' (relative) key is pressed.
0793 01E2 2A DE 1F LD HL,(ADSAVE) ;Store the contents of ADSAVE
0794 01E5 22 AF 1F LD (STEPBF),HL ;into STEPBF as default value
0795 01E8 ;of first parameter.
0796 01E8
0797 01E8 KWT:0798 01E8 ;Branched by table KFUN.
0799 01E8 ;Executed when 'WRtape' key is pressed.
0800 01E8
0801 01E8 KRT:
0802 01E8 ;Branched by table KFUN.
0803 01E8 ;Executed when 'RDtape' key is pressed.
0804 01E8
0805 01E8 CD 3A 04 CALL STEPDP ;Display the parameter that
0806 01EB ;is being entered now by calling
0807 01EB ;subroutine STEPDP.
0808 01EB C9 RET
0809 01EC ;
0810 01EC ;***********************************************************0811 01EC ; The following subroutines with name H???
0812 01EC ; are the service routines for hexadecimal
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
17/56
____________________________________________________________________________________
_________________________________________________________________________________
15
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0813 01EC ; keys corresponding to each STATE. They
0814 01EC ; are all branched by table HTAB and STATE.
0815 01EC
0816 01EC C3 BB 03 HFIX JP IGNORE ;When the display is fixed pattern0817 01EF ;hexadecimal keys are illegal.
0818 01EF ;Disable all LED's as a warning
0819 01EF ;message to the user. This is what
0820 01EF ;routine IGNORE does.
0821 01EF ;
0822 01EF 2A DE 1F HDA LD HL,(ADSAVE) ;Get the address being displayed
0823 01F2 ;now from (ADSAVE)
0824 01F2 CD F6 05 CALL RAMCHK ;Check if it is in RAM.
0825 01F5 C2 BB 03 JP NZ,IGNORE ;If not, ignore this key and
0826 01F8 ;send out a warning message.
0827 01F8 CD EE 03 CALL PRECL1 ;If this is the first hexadecimal
0828 01FB ;key entered after function or sub-
0829 01FB ;function key,reset the data of that0830 01FB ;address to 0. (by routine PERCL1)
0831 01FB 79 LD A,C ;The key-code is saved in C by
0832 01FC ;routine KHEX. Restore it to A.
0833 01FC ED 6F RLD ;Rotate the key-code (4 bits) into
0834 01FE ;the address obtained above. (in HL)
0835 01FE CD 0B 04 CALL MEMDP2 ;Display the address and data,
0836 0201 ;then set STATE to 2 (DA).
0837 0201 C9 RET
0838 0202 ;
0839 0202 21 DE 1F HAD: LD HL,ADSAVE
0840 0205 CD FA 03 CALL PRECL2 ;If this is the first hexadecimal
0841 0208 ;key after function key is entered,
0842 0208 ;set the contents of ADSAVE to 0.0843 0208 79 LD A,C ;The key-code is saved in C
0844 0209 ;by routine KHEX.
0845 0209 ;The next three instructions shift
0846 0209 ;the addres being displayed by
0847 0209 ;one digit.
0848 0209 ED 6F RLD
0849 020B 23 INC HL
0850 020C ED 6F RLD
0851 020E CD 02 04 CALL MEMDP1 ;Display the address and its
0852 0211 ;data. Also, set STATE to 1.
0853 0211 C9 RET
0854 0212 ;
0855 0212 HRGAD:0856 0212 HRGFIX:
0857 0212 79 LD A,C
0858 0213 DD 21 B6 1F LD IX,DISPBF
0859 0217 21 E3 1F LD HL,STMINOR
0860 021A 87 ADD A,A ;The key-code is the register
0861 021B ;name. Double it and store it
0862 021B 77 LD (HL),A ;into STMINOR.
0863 021C
0864 021C CD 73 04 CALL REGDP8 ;Display register and set
0865 021F ;STATE to 8. (RGAD)
0866 021F C9 RET
0867 0220 ;
0868 0220 HRT:0869 0220 HWT:
0870 0220 HRL:
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
18/56
____________________________________________________________________________________
_________________________________________________________________________________
16
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0871 0220 CD 55 04 HMV: CALL LOCSTBF ;Use STMINOR and STEPBF
0872 0223 ;to calculate the address
0873 0223 ;of current parameter in
0874 0223 ;step buffer.0875 0223 CD FA 03 CALL PRECL2 ;If this is the first hex
0876 0226 ;key entered, clear the
0877 0226 ;parameter (2 bytes) by
0878 0226 ;PRECL2.
0879 0226 79 LD A,C ;C contains the key-code
0880 0227 ED 6F RLD ;Rotate the parameter (2 bytes)
0881 0229 ;1 digit left with the key-code.
0882 0229
0883 0229 23 INC HL
0884 022A ED 6F RLD
0885 022C CD 3A 04 CALL STEPDP ;Display the parameter.
0886 022F C9 RET
0887 0230 ;0888 0230 CD BB 04 HRGDA CALL LOCRGBF ;Calculate the address of
0889 0233 ;the register being modified.
0890 0233 CD EE 03 CALL PRECL1 ;If this is the first hex
0891 0236 ;key entered. Clear the register
0892 0236 ;(1 byte) by PRECL1.
0893 0236 79 LD A,C ;C contains the key-code
0894 0237 ED 6F RLD ;Rotate user's register (1 byte)
0895 0239 ;1 digit left with the key-code.
0896 0239
0897 0239 CD 77 04 CALL REGDP9 ;Display the register and set
0898 023C ;STATE to 9 (RGDA).
0899 023C C9 RET
0900 023D ;0901 023D ;***********************************************************
0902 023D ;The following routines with name
0903 023D ;I???? are the service routines for
0904 023D ;'+' key corresponding to each STATE
0905 023D ;They are all branched by table ITAB
0906 023D ;and STATE
0907 023D
0908 023D IFIX:
0909 023D IRGFIX:
0910 023D C3 BB 03 JP IGNORE ;'+' key is illegal for state
0911 0240 ;FIX or RGFIX, ignore it.
0912 0240 ;
0913 0240 IAD:0914 0240 2A DE 1F IDA: LD HL, ADSAVE) ;Increase the address being
0915 0243 ;displayed now (in ADSAVE)
0916 0243 ;by 1.
0917 0243 23 INC HL
0918 0244 22 DE 1F LD (ADSAVE),HL
0919 0247 CD 0B 04 CALL MEMDP2 ;Display the address and data,
0920 024A ;then set the STATE to 2 (DA).
0921 024A C9 RET
0922 024B ;
0923 024B IRT:
0924 024B IWT:
0925 024B IRL:
0926 024B 21 E3 1F IMV: LD HL,STMINOR ;STMINOR contains the0927 024E ;parameter count, increment
0928 024E ;it by one.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
19/56
____________________________________________________________________________________
_________________________________________________________________________________
17
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0929 024E 34 INC (HL)
0930 024F CD 5F 04 CALL LOCSTNA ;Check if the count is
0931 0252 ;overflowed.
0932 0252 20 04 JR NZ,ISTEP ;If not overflowed, continue0933 0254 ;at ISTEP
0934 0254 35 DEC (HL) ;Otherwise, restore the count
0935 0255 ;and ignore the '+' key.
0936 0255 C3 BB 03 JP IGNORE
0937 0258 CD 3A 04 ISTEP CALL STEPDP ;Display the parameter at
0938 025B ;step buffer.
0939 025B C9 RET
0940 025C ;
0941 025C IRGAD:
0942 025C 21 E3 1F IRGDA: LD HL,STMINOR ;In these states, the STMINOR
0943 025F ;contains the register name.
0944 025F ;Increase it by 1. If it
0945 025F ;reaches the last one, reset0946 025F ;it to the first one (0).
0947 025F 34 INC (HL)
0948 0260 3E 1F LD A,1FH
0949 0262 BE CP (HL)
0950 0263 30 02 JR NC,IRGNA
0951 0265 36 00 LD (HL),0
0952 0267 CD 77 04 IRGNA CALL REGDP9 ;Display the register and
0953 026A ;set STATE to 9
0954 026A C9 RET
0955 026B ;
0956 026B ;***********************************************************
0957 026B ;The following routines with name
0958 026B ;D???? are the service routines for0959 026B ;'-' key corresponding to each state.
0960 026B ;They are all branched by table DTAB
0961 026B ;and STATE.
0962 026B
0963 026B DFIX:
0964 026B DRGFIX:
0965 026B C3 BB 03 JP IGNORE ;'-' key is illegal for
0966 026E ;these states. Ignore it.
0967 026E ;
0968 026E DAD:
0969 026E 2A DE 1F DDA: LD HL,(ADSAVE) ;Decrease the address being
0970 0271 ;displayed now (in ADSAVE)
0971 0271 ;by one.0972 0271 2B DEC HL
0973 0272 22 DE 1F LD (ADSAVE),HL
0974 0275 CD 0B 04 CALL MEMDP2 ;Display the address and data,
0975 0278 ;set STATE to 2 (DA).
0976 0278 C9 RET
0977 0279 ;
0978 0279 DRT:
0979 0279 DWT:
0980 0279 DRL:
0981 0279 21 E3 1F DMV: LD HL,STMINOR ;In these states, STMINOR
0982 027C ;contains the parameter count.
0983 027C ;Decrease it by one. If overflow
0984 027C ;occurs, restore STMINOR and0985 027C ;ignore the '-' key. Otherwise
0986 027C ;continue at DSTEP.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
20/56
____________________________________________________________________________________
_________________________________________________________________________________
18
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
0987 027C 35 DEC (HL)
0988 027D CD 5F 04 CALL LOCSTNA
0989 0280 20 04 JR NZ,DSTEP
0990 0282 34 INC (HL)0991 0283 C3 BB 03 JP IGNORE
0992 0286 CD 3A 04 DSTEP CALL STEPDP ;Display the parameter.
0993 0289 C9 RET
0994 028A ;
0995 028A DRGAD:
0996 028A 21 E3 1F DRGDA: LD HL,STMINOR ;In these states, STMINOR
0997 028D ;contains the register name.
0998 028D ;Decrease it by one. If it
0999 028D ;goes below zero, set it to
1000 028D ;the highest value (1F).
1001 028D 35 DEC (HL)
1002 028E 3E 1F LD A,01FH
1003 0290 BE CP (HL)1004 0291 30 02 JR NC,DRGNA
1005 0293 36 1F LD (HL),1FH
1006 0295 CD 77 04 DRGNA CALL REGDP9 ;Display the register and
1007 0298 ;set STATE to 9.
1008 0298 C9 RET
1009 0299 ;
1010 0299 ;***********************************************************
1011 0299 ;The following routines with name
1012 0299 ;G???? are the service routines for
1013 0299 ;'GO' key corresponding to each
1014 0299 ;state. They are all branced by
1015 0299 ;table GTAB and STATE.
1016 02991017 0299 GFIX:
1018 0299 GRGFIX:
1019 0299 GRGAD:
1020 0299 C3 BB 03 GRGDA: JP IGNORE ;'GO' key is illegal for
1021 029C ;these states. Ignore it.
1022 029C ;
1023 029C GAD:
1024 029C 2A E0 1F GDA: LD HL,(BRAD) ;Get the address of break
1025 029F ;point.
1026 029F 36 EF LD (HL),0EFH ;Instruction RST28H.
1027 02A1 ;The content of break address
1028 02A1 ;ischanged to RST 28H before
1029 02A1 ;the control is transfered to1030 02A1 ;user's program. THis
1031 02A1 ;will cause a trap when user's
1032 02A1 ;PC passes this point.
1033 02A1 3E FF LD A, 0FFH ;Save FF into TEMP.This data will
1034 02A3 ;be output to port C later. FF is
1035 02A3 ;used to disable break point.
1036 02A3 32 EA 1F PREOUT LD (TEMP),A ;Store A into TEMP.
1037 02A6 3A D2 1F LD A, (USERIF) ;Save two instructions into
1038 02A9 ;TEMP and TEMP+1. THese two
1039 02A9 ;instructions will be executed
1040 02A9 ;later. If the user's IFF
1041 02A9 ;(interrupt flip-flop) is 1,
1042 02A9 ;the instructions are 'EI RET'.1043 02A9 ;Otherwise, they are 'DI RET'.
1044 02A9 CB 47 BIT 0,A
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
21/56
____________________________________________________________________________________
_________________________________________________________________________________
19
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1045 02AB 21 FB C9 LD HL,0C9FBH ;'EI', 'RET'
1046 02AE 20 02 JR NZ,EIDI
1047 02B0 2E F3 LD L,0F3H ;'DI'
1048 02B2 22 EB 1F EIDI LD (TEMP+1),HL1049 02B5 31 BC 1F LD SP,REGBF ;Restore user's registers by
1050 02B8 ;setting SP to REGBF (register
1051 02B8 ;buffer) and continuously popping
1052 02B8 ;the stack.
1053 02B8 F1 POP AF
1054 02B9 C1 POP BC
1055 02BA D1 POP DE
1056 02BB E1 POP HL
1057 02BC 08 EX AF,AF'
1058 02BD F1 POP AF
1059 02BE 08 EX AF,AF'
1060 02BF D9 EXX
1061 02C0 C1 POP BC1062 02C1 D1 POP DE
1063 02C2 E1 POP HL
1064 02C3 D9 EXX
1065 02C4 DD E1 POP IX
1066 02C6 FD E1 POP IY
1067 02C8 ED 7B D0 1F LD SP,(USERSP) ;Restore user's SP.
1068 02CC 32 BD 1F LD (USERAF+1),A ;Temporarily save A
1069 02CF 3A D3 1F LD A,(USERIF+1) ;Restore user's I
1070 02D2 ED 47 LD I,A
1071 02D4 E5 PUSH HL ;The next 3 instructions
1072 02D4 ;push the address being
1073 02D5 ;displayed now (in ADSAVE)
1074 02D5 ;onto stack without changing1075 02D5 ;HL register. This address will
1076 02D5 ;be treated as user's new PC.
1077 02D5 2A DE 1F LD HL,(ADSAVE)
1078 02D8 E3 EX (SP),HL
1079 02D9 3A EA 1F LD A,(TEMP) ;Output the data stored in
1080 02DC ;TEMP to port C of 8255
1081 02DC ;This data is prepared by
1082 02DC ;routine KSTEP or GAD or
1083 02DC ;GDA. In first case, it is
1084 02DC ;10111111 and will enable
1085 02DC ;break point. In other
1086 02DC ;cases, it is FF and will
1087 02DC ;disable break point. If1088 02DC ;break is enabled, non-maskable
1089 02DC ;interrupt will occur 5 M1's
1090 02DC ;after the OUT instruction.
1091 02DC D3 02 OUT (DIGIT),A
1092 02DE 3A BD 1F LD A,(USERAF+1) ;1st M1,
1093 02E1 ;Restore A register.
1094 02E1 C3 EB 1F JP TEMP+1 ;2nd M1,
1095 02E4 ;Execute the two instructions
1096 02E4 ;stored in RAM. They are:
1097 02E4 ; EI (or DI) ;3rd M1
1098 02E4 ; RET ;4th M1
1099 02E4 ;The starting address of user's
1100 02E4 ;program has been pushed onto1101 02E4 ;the top of the stack. RET pops
1102 02E4 ;out this address and transfers
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
22/56
____________________________________________________________________________________
_________________________________________________________________________________
20
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1103 02E4 ;control to it. The first M1
1104 02E4 ;of user's program will be the
1105 02E4 ;5th M1 after OUT. If break point
1106 02E4 ;is enabled, NMI will occur after1107 02E4 ;this instruction is completed.
1108 02E4 ;This is the mechanism of single
1109 02E4 ;step.
1110 02E4 ;
1111 02E4 ;***********************************************************
1112 02E4 21 AF 1F GMV LD HL,STEPBF
1113 02E7 CD 3D 05 CALL GETP ;Load parameters from
1114 02EA ;step buffer into registers.
1115 02EA ;Also check if the parameters
1116 02EA ;are legal. After GETP,
1117 02EA ;HL = start address of source
1118 02EA ;BC = length to MOVE.
1119 02EA 38 67 JR C,ERROR ;Jump to ERROR if the parameters1120 02EC ;are illegal. (I.e., Ending
1121 02EC ;address < starting address.)
1122 02EC ED 5B B3 1F LD DE,(STEPBF+4) ;Load destination
1123 02F0 ;address into DE.
1124 02F0 ED 52 SBC HL,DE ;Compare HL and DE to
1125 02F2 ;determine move up or down.
1126 02F2 30 0C JR NC,MVUP
1127 02F4 ;Move down:
1128 02F4 EB EX DE,HL ;HL = destination address
1129 02F5 09 ADD HL,BC ;HL = dest. address + length
1130 02F6 2B DEC HL ;HL = end address of dest.
1131 02F7 EB EX DE,HL ;DE = end address of dest.
1132 02F8 2A B1 1F LD HL,(STEPBF+2) ;HL = end address of source1133 02FB ED B8 LDDR ;block transfer instruction
1134 02FD 13 INC DE ;DE = last address moved
1135 02FE 18 1C JR ENDFUN ;Continue at ENDFUN
1136 0300 MVUP: ;Move up:
1137 0300 19 ADD HL,DE ;HL is destroyed by
1138 0301 ;SBC HL, DE. Restore HL.
1139 0301 ED B0 LDIR ;block transfer
1140 0303 1B DEC DE ;DE = last address moved
1141 0304 18 16 JR ENDFUN ;Continue at ENDFUN
1142 0306 ;
1143 0306 ;***********************************************************
1144 0306 ED 5B AF 1F GRL LD DE,(STEPBF) ;Load starting address
1145 030A ;into DE.1146 030A 13 INC DE ;Increase this address by 2.
1147 030B ;Relative address is used in
1148 030B ;instruction JR or DJNZ.
1149 030B ;The codes for them are 2 bytes.
1150 030B ;The PC is increased by 2 after
1151 030B ;opcode is fetched.
1152 030B 13 INC DE
1153 030C 2A B1 1F LD HL,(STEPBF+2) ;Load destination
1154 030F ;address into HL.
1155 030F B7 OR A
1156 0310 ED 52 SBC HL,DE ;Calculate difference.
1157 0312 7D LD A,L ;Check if the offset is between
1158 0313 ;+127 (007FH) and -128 (FF80H).1159 0313 ;If the offset is positive, both H
1160 0313 ;and bit 7 of L must be zero; if it
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
23/56
____________________________________________________________________________________
_________________________________________________________________________________
21
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1161 0313 ;is negative, H and bit 7 of L must
1162 0313 ;be FF and 1. In both cases, adding
1163 0313 ;H with bit 7 of L results in 0.
1164 0313 17 RLA ;Rotate bit 7 of L into carry flag.1165 0314 7C LD A,H
1166 0315 CE 00 ADC A,0 ;ADD H and bit 7 of L.
1167 0317 20 3A JR NZ,ERROR ;Branch to ERROR if
1168 0319 ;the results is nonzero.
1169 0319 7D LD A,L
1170 031A 1B DEC DE
1171 031B 12 LD (DE),A ;Save the offset into
1172 031C ;the next byte of opcode.
1173 031C ;(DJNZ or JR)
1174 031C ;
1175 031C ENDFUN:
1176 031C ED 53 DE 1F LD (ADSAVE),DE ;Save DE into ADSAVE.
1177 0320 CD 0B 04 CALL MEMDP2 ;Display this address and1178 0323 ;its data. Set STATE to 2.
1179 0323 C9 RET
1180 0324 ;
1181 0324 ;***********************************************************
1182 0324 GWT:
1183 0324 CD 2D 05 CALL SUM1 ;Load parameters from
1184 0327 ;step buffer into registers.
1185 0327 ;Check if the parameters
1186 0327 ;are legal. If legal, calculate
1187 0327 ;the sum of all data to be output
1188 0327 ;to tape.
1189 0327 38 2A JR C,ERROR ;Branch to ERROR if the
1190 0329 ;parameters are illegal.(length1191 0329 ;is negative)
1192 0329 32 B5 1F LD (STEPBF+6),A ;Store the checksum into
1193 032C ;STPEGBF+6.
1194 032C 21 A0 0F LD HL,4000 ;Output 1 kHz square
1195 032F ;wave for 4000 cycles.
1196 032F ;Leading sync. signal.
1197 032F CD DE 05 CALL TONE1K
1198 0332 21 AF 1F LD HL,STEPBF ;Output 7 bytes starting
1199 0335 ;at STEPBF. (Include:
1200 0335 ;filename, starting, ending
1201 0335 ;address and checksum)
1202 0335 01 07 00 LD BC,7
1203 0338 CD A7 05 CALL TAPEOUT1204 033B 21 A0 0F LD HL,4000 ;Output 2 kHz square
1205 033E ;wave for 4000 cycles.
1206 033E ;Middle sync.The file name of
1207 033E ;the file being read will be
1208 033E ;displayed in this interval.
1209 033E CD E2 05 CALL TONE2K
1210 0341 CD 3A 05 CALL GETPTR ;Load parameters into
1211 0344 ;registers. (Starting, ending and
1212 0344 ;length).
1213 0344 CD A7 05 CALL TAPEOUT ;Output user's data.
1214 0347 21 A0 0F LD HL,4000 ;Output 4000 cycles of
1215 034A ;2 kHz square wave.
1216 034A ;(Tail sync.)1217 034A CD E2 05 CALL TONE2K
1218 034D ED 5B B3 1F ENDTAPE LD DE,(STEPBF+4) ;DE = last address
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
24/56
____________________________________________________________________________________
_________________________________________________________________________________
22
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1219 0351 18 C9 JR ENDFUN ;Continue at ENDFUN
1220 0353 ;
1221 0353 DD 21 A9 07 ERROR LD IX,ERR_ ;IX points to '-Err '
1222 0357 C3 D0 00 JP SETST0 ;Set STATE to 0 by1223 035A ;branching to SETST0.
1224 035A ;
1225 035A ;***********************************************************
1226 035A GRT:
1227 035A 2A AF 1F LD HL,(STEPBF) ;Temporarily save filename.
1228 035D 22 EA 1F LD (TEMP),HL
1229 0360 3E 40 LEAD LD A,01000000B ;decimal point
1230 0362 D3 01 OUT (SEG7),A ;When searching for filename,
1231 0364 ;the display is blank initially.
1232 0364 ;If the data read from MIC is
1233 0364 ;acceptable 0 or 1, the display
1234 0364 ;becomes '......'.
1235 0364 21 E8 03 LD HL,10001236 0367 CD 8C 05 LEAD1 CALL PERIOD ;The return of PERIOD
1237 036A ;is in flag:
1238 036A ; NC -- tape input is 1 kHz;
1239 036A ; C -- otherwise.
1240 036A 38 F4 JR C,LEAD ;Loop until leading sync.
1241 036C ;is detected.
1242 036C 2B DEC HL ;Decrease HL by one when
1243 036D ;one period is detected.
1244 036D 7C LD A,H
1245 036E B5 OR L ;Check if both H and L are 0.
1246 036F 20 F6 JR NZ,LEAD1 ;Wait for 1000 periods.
1247 0371 ;The leading sync. is accepted
1248 0371 ;if it is longer than 10001249 0371 ;cycles (1 second).
1250 0371 CD 8C 05 LEAD2 CALL PERIOD
1251 0374 30 FB JR NC,LEAD2 ;Wait all leading sync. to
1252 0376 ;pass over.
1253 0376 ;
1254 0376 21 AF 1F LD HL,STEPBF ;Load 7 bytes from
1255 0379 ;tape into STEPBF.
1256 0379 01 07 00 LD BC,7
1257 037C CD 4D 05 CALL TAPEIN
1258 037F 38 DF JR C,LEAD ;Jump to LEAD if input
1259 0381 ;is not succesful.
1260 0381 ED 5B AF 1F LD DE,(STEPBF) ;Get filename from
1261 0385 ;step buffer.1262 0385 CD 65 06 CALL ADDRDP ;Convert it to display
1263 0388 ;format.
1264 0388 06 96 LD B,150 ;Display it for 1.5 sec.
1265 038A CD 24 06 FILEDP CALL SCAN1
1266 038D 10 FB DJNZ FILEDP
1267 038F 2A EA 1F LD HL,(TEMP) ;Check if the input
1268 0392 ;filename equals to the
1269 0392 ;specified filename.
1270 0392 B7 OR A
1271 0393 ED 52 SBC HL,DE
1272 0395 20 C9 JR NZ,LEAD ;If not, find the leading
1273 0397 ;sync. of next file.
1274 03971275 0397 ;If filename is found
1276 0397 3E 02 LD A,00000010B ;segment '-'
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
25/56
____________________________________________________________________________________
_________________________________________________________________________________
23
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1277 0399 D3 01 OUT (SEG7),A ;Display '------'.
1278 039B CD 3A 05 CALL GETPTR ;The parameters (starting,
1279 039E ;ending address and check-
1280 039E ;sum) have been loaded into1281 039E ;STEPBF. Load them into
1282 039E ;registers, calculate the block
1283 039E ;length and check if they are
1284 039E ;legal.
1285 039E 38 B3 JR C,ERROR ;Jump to ERROR if the
1286 03A0 ;parameters are illegal.
1287 03A0 CD 4D 05 CALL TAPEIN ;Input user's data.
1288 03A3 38 AE JR C,ERROR ;Jump to ERROR if input
1289 03A5 ;is not succesful.
1290 03A5 CD 2D 05 CALL SUM1 ;Calculate the sum of all
1291 03A8 ;input data.
1292 03A8 21 B5 1F LD HL,STEPBF+6
1293 03AB BE CP (HL) ;Compare it with the checksum1294 03AC ;calculated and stored by
1295 03AC ;'WRtape'.
1296 03AC 20 A5 JR NZ,ERROR ;Jump to ERROR if not
1297 03AE ;matched.
1298 03AE 18 9D JR ENDTAPE ;Continue at ENDTAPE.
1299 03B0 ;
1300 03B0 ;***********************************************************
1301 03B0 BRANCH:
1302 03B0 ;Branch table format:
1303 03B0 ; byte 1,2 : address of the 1st routine in
1304 03B0 ; each group.
1305 03B0 ; byte 3 : difference between the address
1306 03B0 ; of 1st and 1st routine, which is1307 03B0 ; of course 0.
1308 03B0 ; byte 4 : difference between the address
1309 03B0 ; of 2nd and 1st routine
1310 03B0 ; byte 5 : difference between the address
1311 03B0 ; of 3rd and 1st routine
1312 03B0 ; ...
1313 03B0 ; ...
1314 03B0 ; ...
1315 03B0 ; HL : address of branch table
1316 03B0 ; A : the routine number in its group
1317 03B0 ; Such branch tables can save table length and avoid page
1318 03B0 ; (256 bytes) boundary problems.
1319 03B01320 03B0 5E LD E,(HL) ;Load the address of 1st
1321 03B1 ;routine in the group into
1322 03B1 ;DE register.
1323 03B1 23 INC HL
1324 03B2 56 LD D,(HL)
1325 03B3 23 INC HL ;Locate the pointer of difference
1326 03B4 ;table.
1327 03B4 85 ADD A, L
1328 03B5 6F LD L, A
1329 03B6 6E LD L,(HL) ;Load the address
1330 03B7 ;difference into L.
1331 03B7 26 00 LD H,0
1332 03B9 19 ADD HL,DE ;Get routine's real address1333 03BA E9 JP (HL) ;Jump to it.
1334 03BB ;
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
26/56
____________________________________________________________________________________
_________________________________________________________________________________
24
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1335 03BB ;***********************************************************
1336 03BB IGNORE:
1337 03BB 21 E6 1F LD HL,TEST
1338 03BE CB FE SET 7,(HL) ;Routine SCAN will check bit1339 03C0 ;7 of TEST. If it is set,
1340 03C0 ;all LEDs will be disabled.
1341 03C0 ;This is a warning message to
1342 03C0 ;the user when a illegal key
1343 03C0 ;is entered.
1344 03C0 C9 RET
1345 03C1 ;
1346 03C1 ;***********************************************************
1347 03C1 INI:
1348 03C1 ; Power-up initialization.
1349 03C1 DD 21 A5 07 LD IX,BLANK ;BLANK is the initial display
1350 03C5 ;pattern.
1351 03C5 ;Display the following1352 03C5 ;patterns sequence, each 0.16
1353 03C5 ;seconds:
1354 03C5 ; ' '
1355 03C5 ; ' u'
1356 03C5 ; ' uP'
1357 03C5 ; ' uPF'
1358 03C5 ; ' uPF-'
1359 03C5 ; ' uPF--'
1360 03C5 ; 'uPF--1'
1361 03C5
1362 03C5 0E 07 LD C,7 ;pattern count
1363 03C7 06 10 INI1 LD B,16 ;Display 0.16 second.
1364 03C9 CD 24 06 INI2 CALL SCAN11365 03CC 10 FB DJNZ INI2
1366 03CE DD 2B DEC IX ;next pattern
1367 03D0 0D DEC C
1368 03D1 20 F4 JR NZ,INI1
1369 03D3 ;
1370 03D3 3E A5 LD A,PWCODE
1371 03D5 C3 B3 06 JP INI3
1372 03D8 21 66 00 INI4 LD HL,NMI
1373 03DB 22 EE 1F LD (IM1AD),HL ;Set the service routine
1374 03DE ;of RST 38H to NMI, which is the
1375 03DE ;nonmaskable interrupt service
1376 03DE ;routine for break point and
1377 03DE ;single step.1378 03DE CLRBR:
1379 03DE ; Clear break point by setting
1380 03DE ; the break point address to
1381 03DE ; FFFF. This is a non-existant
1382 03DE ; address, so break can never
1383 03DE ; happen.
1384 03DE
1385 03DE 21 FF FF LD HL,0FFFFH
1386 03E1 22 E0 1F LD (BRAD),HL
1387 03E4 C9 RET
1388 03E5 ;
1389 03E5 TESTM:
1390 03E5 ; Check if the display is of 'addres-data'1391 03E5 ; form, i.e. STATE 1 or 2.
1392 03E5 ; The result is stored in zero flag.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
27/56
____________________________________________________________________________________
_________________________________________________________________________________
25
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1393 03E5 ; Z: yes
1394 03E5 ; NZ: no
1395 03E5
1396 03E5 3A E4 1F LD A,(STATE)1397 03E8 FE 01 CP 1
1398 03EA C8 RET Z
1399 03EB FE 02 CP 2
1400 03ED C9 RET
1401 03EE ;
1402 03EE PRECL1:
1403 03EE ; Pre-clear 1 byte.
1404 03EE ; If bit 0 of TEST is not 0, load 0 into (HL). Bit 0 of
1405 03EE ; TEST is cleared after check.
1406 03EE ; Only AF register is destroyed.
1407 03EE
1408 03EE 3A E6 1F LD A,(TEST)
1409 03F1 B7 OR A ;Is bit 0 of TEST zero?1410 03F2 C8 RET Z
1411 03F3 3E 00 LD A,0
1412 03F5 77 LD (HL),A ;Clear (HL)
1413 03F6 32 E6 1F LD (TEST),A ;Clear TEST too.
1414 03F9 C9 RET
1415 03FA ;
1416 03FA PRECL2:
1417 03FA ; Pre-clear 2 bytes.
1418 03FA ; If bit 0 of TEST is nonzero, clear (HL)
1419 03FA ; and (HL+1).
1420 03FA ; Only AF register is destroyed.
1421 03FA
1422 03FA CD EE 03 CALL PRECL11423 03FD C8 RET Z
1424 03FE 23 INC HL
1425 03FF 77 LD (HL),A
1426 0400 2B DEC HL
1427 0401 C9 RET
1428 0402 ;
1429 0402 ;***********************************************************
1430 0402 ; Memory display format: (address-data)
1431 0402
1432 0402 ; i) A.A.A.A. D D -- State is AD. Four decimal points
1433 0402 ; under the address field indicate
1434 0402 ; that the numeric key entered will
1435 0402 ; be interpreted as memory address.1436 0402 ; ii) A A A A D.D.-- State is DA. Two decimal points
1437 0402 ; under the data field indicate
1438 0402 ; the monitor is expecting user to
1439 0402 ; enter memory data.
1440 0402 ; iii) A.A.A.A. D.D.-- Six decimal points indicate the
1441 0402 ; address being displayed is set
1442 0402 ; as a break point.
1443 0402
1444 0402 MEMDP1:
1445 0402 3E 01 LD A, 1 ;Next STATE = 1
1446 0404 06 04 LD B, 4 ;4 decimal points active
1447 0406 21 B8 1F LD HL,DISPBF+2 ;The first active decimal
1448 0409 ;point is in DISPBF+2, the1449 0409 ;last in DISPBF+5.
1450 0409 18 07 JR SAV12 ;Continue at SAV12.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
28/56
____________________________________________________________________________________
_________________________________________________________________________________
26
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1451 040B MEMDP2:
1452 040B 3E 02 LD A,2 ;Next STATE = 2
1453 040D 06 02 LD B,2 ;2 active decimal points
1454 040F 21 B6 1F LD HL,DISPBF ;1st decimal point is in1455 0412 ;DISPBF, 2nd in DISPBF+1.
1456 0412 32 E4 1F SAV12 LD (STATE),A ;Update STATE
1457 0415 D9 EXX ;Save register HL, BC, DE
1458 0416 ED 5B DE 1F LD DE,(ADSAVE) ;The address to be
1459 041A ;displayed is stored in
1460 041A ;(ADSAVE). Load it into
1461 041A ;DE register.
1462 041A CD 65 06 CALL ADDRDP ;Convert this address to
1463 041D ;display format and store it
1464 041D ;into DISPBF+2 - DISPBF+5.
1465 041D 1A LD A,(DE) ` ;Load the data of this
1466 041E ;address into A register
1467 041E CD 71 06 CALL DATADP ;Convert this data to1468 0421 ;display format and store it
1469 0421 ;into DISPBF - DISPBF+1
1470 0421 BRTEST:
1471 0421 ; The next 3 instructions serve to refresh the
1472 0421 ; data at break address every time memory is
1473 0421 ; displayed.
1474 0421 2A E0 1F LD HL,(BRAD) ;Get break point address.
1475 0424 7E LD A,(HL) ;Get the data of this
1476 0425 ;address into A register.
1477 0425 32 E2 1F LD (BRDA),A ;Store it into BRDA (break data).
1478 0428 B7 OR A
1479 0429 ED 52 SBC HL,DE ;Check if the address to
1480 042B ;be displayed is break point.1481 042B 20 06 JR NZ,SETPT1 ;If not, jump to SETPT1.
1482 042D 06 06 LD B,6 ;6 active decimal points.
1483 042F 21 B6 1F LD HL,DISPBF ;1st decimal point is in
1484 0432 ;DISPBF; 6th in DISPBF+5.
1485 0432 D9 EXX
1486 0433 D9 SETPT1 EXX
1487 0434 CB F6 SETPT SET 6,(HL) ;Set decimal points.
1488 0436 ;Count in B, first address
1489 0436 ;in HL register.
1490 0436 23 INC HL
1491 0437 10 FB DJNZ SETPT
1492 0439 C9 RET
1493 043A ;1494 043A ;***********************************************************
1495 043A ; Step display format: (this format is used when user is
1496 043A ; entering parameters for Move, Rela, WRtape, RDtape.)
1497 043A
1498 043A ; P.P.P.P. - N
1499 043A
1500 043A ; 'P' is the digit of parameter. Four decimal points
1501 043A ; indicate P's are being modified now. N is the mnemonic of
1502 043A ; the parameter:
1503 043A ; i) Move S -- starting address
1504 043A ; E -- ending address
1505 043A ; D -- destination address
1506 043A ; ii) Rela S -- source address1507 043A ; D -- destination address
1508 043A ; iii) WRtape F -- file name
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
29/56
____________________________________________________________________________________
_________________________________________________________________________________
27
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1509 043A ; S -- starting address
1510 043A ; E -- ending address
1511 043A ; iv) Rdtape F -- filename
1512 043A1513 043A STEPDP:
1514 043A ;Display step buffer and its parameter name.
1515 043A ;Input: STATE
1516 043A ; STMINOR (parameter count)
1517 043A ;registers destroyed: AF, BC, DE, HL
1518 043A
1519 043A CD 55 04 CALL LOCSTBF ;Get parameter address
1520 043D 5E LD E,(HL) ;Load parameter into DE
1521 043E 23 INC HL
1522 043F 56 LD D,(HL)
1523 0440 CD 65 06 CALL ADDRDP ;Convert this paramter to
1524 0443 ;display format (4 digits)
1525 0443 ;and store it into DISPBF+21526 0443 ; - DISPBF+5
1527 0443 21 B8 1F LD HL,DISPBF+2 ;Set 4 decimal points
1528 0446 ;From DISPBF+2 to DISPBF+5
1529 0446 06 04 LD B,4
1530 0448 CD 34 04 CALL SETPT
1531 044B CD 5F 04 CALL LOCSTNA ;Get parameter name.
1532 044E 6F LD L,A
1533 044F 26 02 LD H,2 ;Pattern '-' for 2nd rightmost
1534 0451 ;digit.
1535 0451 22 B6 1F LD (DISPBF),HL
1536 0454 C9 RET
1537 0455 ;
1538 0455 LOCSTBF:1539 0455 ;Get the location of paramter.
1540 0455 ; address = STEPBF + STMINOR*2
1541 0455 ;registers destroyed: AF,HL
1542 0455
1543 0455 3A E3 1F LD A,(STMINOR) ;Get parameter count.
1544 0458 87 ADD A,A ;Each parameter has 2 bytes
1545 0459 21 AF 1F LD HL,STEPBF ;Get base address
1546 045C 85 ADD A,L
1547 045D 6F LD L,A
1548 045E C9 RET
1549 045F ;
1550 045F LOCSTNA
1551 045F ;Get parameter name.1552 045F ;Input: STATE, STMINOR
1553 045F ;Output: parameter name in A, and Z flag.
1554 045F
1555 045F ;registers destroyed: AF, DE
1556 045F 3A E4 1F LD A,(STATE) ;Get STATE.
1557 0462 ;Possible states are:
1558 0462 ;4,5,6,7. (Move, Rel,
1559 0462 ;WRtape, RDtape)
1560 0462 D6 04 SUB 4 ;Change 4,5,6,7 to
1561 0464 ;0,1,2,3
1562 0464 87 ADD A,A ;Each state has 4 bytes for names
1563 0465 87 ADD A,A
1564 0466 11 BC 07 LD DE,STEPTAB1565 0469 83 ADD A,E
1566 046A 5F LD E,A ;Now, DE contains the
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
30/56
____________________________________________________________________________________
_________________________________________________________________________________
28
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1567 046B ;address of 1st name
1568 046B ;for each state.
1569 046B 3A E3 1F LD A,(STMINOR) ;Get parameter count
1570 046E 83 ADD A,E ;DE
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
31/56
____________________________________________________________________________________
_________________________________________________________________________________
29
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1625 0485 ;Store them into DISPBF
1626 0485 ;and DISPBF+1.
1627 0485 78 LD A,B ;Restore A (register pair leader).
1628 0486 CD BE 04 CALL LOCRG ;Get the address of1629 0489 ;user's register.
1630 0489 5E LD E,(HL) ;Get register data. (2 bytes)
1631 048A 23 INC HL
1632 048B 56 LD D, (HL)
1633 048C ED 53 DE 1F LD (ADSAVE),DE ;Convert them to display
1634 0490 ;format and store into
1635 0490 ;display buffer.
1636 0490 CD 65 06 CALL ADDRDP
1637 0493 3A E4 1F LD A,(STATE)
1638 0496 FE 09 CP 9 ;If STATE equals to 9 (RGDA),
1639 0498 ;set 2 decimal points.
1640 0498 ;Otherwise return here.
1641 0498 C0 RET NZ1642 0499 21 B8 1F LD HL,DISPBF+2
1643 049C 3A E3 1F LD A,(STMINOR) ;Get register name.
1644 049F CB 47 BIT 0,A ;If this register is
1645 04A1 ;group leader, set decimal
1646 04A1 ;points of two central digits.
1647 04A1 ;Otherwise set two left digits.
1648 04A1 28 02 JR Z,LOCPT
1649 04A3 23 INC HL
1650 04A4 23 INC HL
1651 04A5 CB F6 LOCPT SET 6,(HL) ;Set decimapl points of
1652 04A7 ;(HL) and (HL+1)
1653 04A7 23 INC HL
1654 04A8 CB F6 SET 6,(HL)1655 04AA CD C4 04 CALL FCONV ;Convert user's flag (F, F')
1656 04AD ;to binary display format.
1657 04AD C9 RET
1658 04AE ;
1659 04AE RGNADP:
1660 04AE ; Get the patterns of register names and
1661 04AE ; store them into DISPBF and DISPBF+1.
1662 04AE ; Input: A contains register count of
1663 04AE ; pair leader.
1664 04AE ; registers destroyed: AF,DE,HL
1665 04AE
1666 04AE 21 D0 07 LD HL,RGTAB ;Get address of pattern
1667 04B1 ;table.1668 04B1 85 ADD A,L
1669 04B2 6F LD L,A
1670 04B3 5E LD E,(HL) ;Get first pattern
1671 04B4 23 INC HL
1672 04B5 56 LD D,(HL) ;Get 2nd pattern.
1673 04B6 ED 53 B6 1F LD (DISPBF),DE
1674 04BA C9 RET
1675 04BB ;
1676 04BB LOCRGBF:
1677 04BB ; Get the address of user's register.
1678 04BB ; Register name contained is STMINOR.
1679 04BB ; Destroys HL, AF.
1680 04BB1681 04BB 3A E3 1F LD A,(STMINOR)
1682 04BE 21 BC 1F LOCRG LD HL,REGBF
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
32/56
____________________________________________________________________________________
_________________________________________________________________________________
30
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1683 04C1 85 ADD A,L
1684 04C2 6F LD L,A
1685 04C3 C9 RET
1686 04C4 ;1687 04C4 FCONV:
1688 04C4 ; Encode or decode user's flag register.
1689 04C4 ; STMINOR contains the name of the flag
1690 04C4 ; being displayed now.
1691 04C4 ; registers destroyed: AF, BC, HL.
1692 04C4
1693 04C4 3A E3 1F LD A,(STMINOR) ;Get register name.
1694 04C7 B7 OR A ;Clear carry flag.
1695 04C8 1F RRA ;name of I register: 17H,
1696 04C9 ;name of IFF: 16H.
1697 04C9 ;Rotate right one bit, both
1698 04C9 ;become 0BH.
1699 04C9 FE 0B CP 0BH1700 04CB 28 09 JR Z,FLAGX ;Jump to FLAGX if
1701 04CD ;I or IFF is being
1702 04CD ;displayed now.
1703 04CD 4F LD C,A ;Otherwise, mask out bit
1704 04CE ;1 to bit 7 fof user's IFF.
1705 04CE ;IFF is only 1 bit, monitor
1706 04CE ;uses one byte to store it,
1707 04CE ;masking out bit 1-7 is to
1708 04CE ;ignore the useless bits.
1709 04CE ;This is done only when the
1710 04CE ;user is not modifying IFF.
1711 04CE ;If user is modifying IFF,
1712 04CE ;monitor will display whatever1713 04CE ;he enters, even if bit 1-7
1714 04CE ;are not all zero.
1715 04CE ;A register is not changed
1716 04CE ;after doing this.
1717 04CE 21 D2 1F LD HL,USERIF
1718 04D1 7E LD A,(HL)
1719 04D2 E6 01 AND 00000001B
1720 04D4 77 LD (HL),A
1721 04D5 79 LD A,C
1722 04D6 FE 0C FLAGX CP 0CH ;If STMINOR contains
1723 04D8 ;the name of SZXH, XPNC,
1724 04D8 ;SZXH' or XPNC', after
1725 04D8 ;rotating right one bit1726 04D8 ;it will be greater than
1727 04D8 ;or equal to 0CH.
1728 04D8 ;Decode user's flag if it
1729 04D8 ;is not being modified now,
1730 04D8 ;encode it otherwise.
1731 04D8 30 1F JR NC,FCONV2
1732 04DA 3A BC 1F FCONV1 LD A,(USERAF) ;Get user's F register
1733 04DD CD 18 05 CALL DECODE ;Decode upper 4 bits.
1734 04E0 22 D4 1F LD (FLAGH),HL
1735 04E3 CD 18 05 CALL DECODE ;Decode lower 4 bits.
1736 04E6 22 D6 1F LD (FLAGL),HL
1737 04E9 3A C4 1F LD A,(UAFP) ;Get user's F' register.
1738 04EC CD 18 05 CALL DECODE1739 04EF 22 D8 1F LD (FLAGHP),HL
1740 04F2 CD 18 05 CALL DECODE
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
33/56
____________________________________________________________________________________
_________________________________________________________________________________
31
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1741 04F5 22 DA 1F LD (FLAGLP),HL
1742 04F8 C9 RET
1743 04F9 2A D4 1F FCONV2 LD HL,(FLAGH) ;Get the binary form
1744 04FC ;of 4 upper bits of1745 04FC ;user's F register.
1746 04FC CD 23 05 CALL ENCODE ;Encode it.
1747 04FF 2A D6 1F LD HL,(FLAGL) ;Encode 4 lower bits.
1748 0502 CD 23 05 CALL ENCODE
1749 0505 32 BC 1F LD (USERAF),A ;Save the encoded
1750 0508 ;result into USERAF.
1751 0508 2A D8 1F LD HL,(FLAGHP) ;Encode F' register.
1752 050B CD 23 05 CALL ENCODE
1753 050E 2A DA 1F LD HL,(FLAGLP)
1754 0511 CD 23 05 CALL ENCODE
1755 0514 32 C4 1F LD (UAFP),A
1756 0517 C9 RET
1757 0518 ;1758 0518 DECODE:
1759 0518 ; Decode bit 7-4 of A register.
1760 0518 ; Each bit is extended to 4 bits.
1761 0518 ; 0 becomse 0000, 1 becomse 0001.
1762 0518 ; The output is stored in HL, which
1763 0518 ; is 16 bits in length. Also, after
1764 0518 ; execution, bits 7-4 of A register are
1765 0518 ; bits 3-0 of A before execution.
1766 0518 ; Registers destroyed: AF, B, HL
1767 0518
1768 0518 06 04 LD B,4 ;Loop 4 times
1769 051A 29 DRL4 ADD HL,HL ;Clear rightmost 3
1770 051B ;bits of HL.1771 051B 29 ADD HL,HL
1772 051C 29 ADD HL,HL
1773 051D 07 RLCA
1774 051E ED 6A ADC HL,HL ;The 4th bit of HL
1775 0520 ;is determined by carry
1776 0520 ;flag, which is the MSB
1777 0520 ;of A register.
1778 0520 10 F8 DJNZ DRL4
1779 0522 C9 RET
1780 0523 ;
1781 0523 ENCODE:
1782 0523 ; Encode HL register. Each 4 bits of HL
1783 0523 ; are encoded to 1 bit. 0000 become 0,1784 0523 ; 0001 become 1. The result is stored
1785 0523 ; in bit 3-0 of A register. Also, after
1786 0523 ; execution, bit 7-4 of A are bit 3-0
1787 0523 ; before execution.
1788 0523 ; Registers AF, B, HL are destroyed.
1789 0523
1790 0523 06 04 LD B,4 ;Loop 4 times.
1791 0525 29 ERL4 ADD HL,HL ;Shift HL left 4 bits.
1792 0526 ;Bit 12 of HL will be
1793 0526 ;shifted into carry flag.
1794 0526 29 ADD HL,HL
1795 0527 29 ADD HL HL
1796 0528 29 ADD HL,HL1797 0529 17 RLA ;Rotate carry flag into
1798 052A ;A register.
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
34/56
____________________________________________________________________________________
_________________________________________________________________________________
32
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1799 052A 10 F9 DJNZ ERL4
1800 052C C9 RET
1801 052D ;
1802 052D ;***********************************************************1803 052D SUM1:
1804 052D ; Calculate the sum of the data in a memory
1805 052D ; block. The starting and ending address
1806 052D ; of this block are stored in STEPBF+2 - STEPBF+4
1807 052D ; Registers AF, BC, DE, HL are destroyed.
1808 052D
1809 052D CD 3A 05 CALL GETPTR ;Get parameters from
1810 0530 ;step buffer.
1811 0530 D8 RET C ;Return if the parameters
1812 0531 ;are illegal.
1813 0531 SUM:
1814 0531 ; Calculate the sum of a memory block.
1815 0531 ; HL contains the starting address of1816 0531 ; this block, BC contains the length.
1817 0531 ; The result is stored in A. Registers
1818 0531 ; AF, BC, HL are destroyed.
1819 0531
1820 0531 AF XOR A ;Clear A
1821 0532 86 SUMCAL ADD A,(HL) ;Add
1822 0533 ED A1 CPI
1823 0535 EA 32 05 JP PE,SUMCAL
1824 0538 B7 OR A ;Clear flags.
1825 0539 C9 RET
1826 053A ;
1827 053A GETPTR:
1828 053A ; Get parameters from step buffer.1829 053A ; Input: (STEPBF+2) and (STEPBF+3) contain
1830 053A ; starting address.
1831 053A ; (STEPBF+4) and (STEPBF+5) contain
1832 053A ; ending address.
1833 053A ; Output: HL register contains the starting
1834 053A ; address.
1835 053A ; BC register contains the length.
1836 053A ; Carry flag 0 -- BC positive
1837 053A ; 1 -- BC negative
1838 053A ; Destroyed registers: AF, BC, DE, HL.
1839 053A
1840 053A 21 B1 1F LD HL,STEPBF+2
1841 053D 5E GETP LD E,(HL) ;Load starting address1842 053E ;into DE.
1843 053E 23 INC HL
1844 053F 56 LD D,(HL)
1845 0540 23 INC HL
1846 0541 4E LD C,(HL)
1847 0542 23 INC HL ;Load ending address
1848 0543 ;into HL.
1849 0543 66 LD H,(HL)
1850 0544 69 LD L,C
1851 0545 B7 OR A ;Clear carry flag.
1852 0546 ED 52 SBC HL,DE ;Find difference.
1853 0548 ;Carry flag is changed here.
1854 0548 4D LD C,L1855 0549 44 LD B,H
1856 054A 03 INC BC ;Now BC contains the
-
7/28/2019 MPF-I the Monitor (Assembled With TASM; FINAL 0,5 Inch)
35/56
____________________________________________________________________________________
_________________________________________________________________________________
33
MPF-1
STMT LOC OBJ CODE M SOURCE STATEMENT
1857 054B ;length.
1858 054B EB EX DE,HL ;Now HL contains the
1859 054C ;starting address.
1860 054C C9 RET1861 054D ;
1862 054D TAPEIN:
1863 054D ; Load a memory block from tape.
1864 054D ; Input: HL -- starting address of the block
1865 054D ; BC -- length of the block
1866 054D ; Output: Carry flag 1 -- reading error
1867 054D ; 0 -- no error
1868 054D ; Destroyed registers: AF, BC, DE, HL, AF', BC', DE', HL'
1869 054D
1870 054D AF XOR A ;Clear carry flag.
1871 054E ;At beginning, the reading is
1872 054E ;no error.
1873 054E 08 EX AF,AF'1874 054F CD 5A 05 TLOOP CALL GETBYTE ;Read 1 byte from tape.
1875 0552 73 LD (HL),E ;Store it into memory.
1876 0553 ED A1 CPI
1877 0555 EA 4F 05 JP PE,TLOOP ;Loop until length
1878 0558 ;is zero.
1879 0558 08 EX AF,AF'
1880 0559 C9 RET
1881 055A ;
1882 055A GETBYTE:
1883 055A ; Read one byte from tape.
1884 055A ; Output: E -- data read
1885