7.0.0 Appendix
7.1.0 Instruction set of 8035,8039,8048,8049,8748,8749,8040,8050 µCs
Mnemonic | Cycles | Bytes | Flags |
ADD A,Rr | 1 | 1 | C |
ADD A,@Ri | 1 | 1 | C |
ADD A,#data | 2 | 2 | C |
ADDC A,Rr | 1 | 1 | C |
ADDC A,@Ri | 1 | 1 | C |
ADDC A,#data | 2 | 2 | C |
ANL A,Rr | 1 | 1 | - |
ANL A,@Ri | 1 | 1 | - |
ANL A,#data | 2 | 2 | - |
ANL BUS,#data(*) | 2 | 2 | - |
ANL Pp,#data | 2 | 2 | - |
ANLD Pp,A | 2 | 1 | - |
CALL address | 2 | 2 | SP |
CLR A | 1 | 1 | - |
CLR C | 1 | 1 | C |
CLR F0 | 1 | 1 | F0 |
CLR F1 | 1 | 1 | F1 |
CPL A | 1 | 1 | - |
CPL C | 1 | 1 | C |
CPL F0 | 1 | 1 | F0 |
CPL F1 | 1 | 1 | F1 |
DA A | 1 | 1 | AC, C |
DEC A | 1 | 1 | - |
DEC Rr | 1 | 1 | - |
DIS I | 1 | 1 | - |
DIS TCNTI | 1 | 1 | - |
DJNZ Rr,address | 2 | 2 | - |
EN I | 1 | 1 | - |
EN TCNTI | 1 | 1 | - |
ENT0 CLK | 1 | 1 | - |
IN A,Pp | 2 | 1 | - |
INC A | 1 | 1 | - |
INC Rr | 1 | 1 | - |
INC @Ri | 1 | 1 | - |
INS A,BUS (*) | 2 | 1 | - |
JBb address | 2 | 2 | - |
JC address | 2 | 2 | - |
JF0 address | 2 | 2 | - |
JF1 address | 2 | 2 | - |
JMP address | 2 | 2 | - |
JMPP @A | 2 | 1 | - |
JNC address | 2 | 2 | - |
JNI address | 2 | 2 | - |
JNT0 address | 2 | 2 | - |
JNT1 address | 2 | 2 | - |
JNZ address | 2 | 2 | - |
JTF address | 2 | 2 | - |
JT0 address | 2 | 2 | - |
Mnemonic | Cycles | Bytes | Flags |
JT1 address | 2 | 2 | - |
JZ address | 2 | 2 | - |
MOV A,#data | 2 | 2 | - |
MOV A,PSW | 1 | 1 | - |
MOV A,Rr | 1 | 1 | - |
MOV A,@Ri | 1 | 1 | - |
MOV A,T | 1 | 1 | - |
MOV PSW,A | 1 | 1 | - |
MOV Rr,A | 1 | 1 | - |
MOV Rr,#data | 2 | 2 | - |
MOV @Ri,A | 1 | 1 | - |
MOV @Ri,#data | 2 | 2 | - |
MOV T,A | 1 | 1 | - |
MOVD A,Pp | 2 | 1 | - |
MOVD Pp,A | 2 | 1 | - |
MOVP A,@A | 2 | 1 | - |
MOVP3 A,@A | 2 | 1 | - |
MOVX A,@Ri | 2 | 1 | - |
MOVX @Ri,A | 2 | 1 | - |
NOP | 1 | 1 | - |
ORL A,Rr | 1 | 1 | - |
ORL A,@Ri | 1 | 1 | - |
ORL A,#data | 2 | 2 | - |
ORL BUS,#data (*) | 2 | 2 | - |
ORL Pp,#data | 2 | 2 | - |
ORLD Pp,A | 2 | 1 | - |
OUTL BUS,A (*) | 2 | 1 | - |
OUTL Pp,A | 2 | 1 | - |
RET | 2 | 1 | SP |
RETR | 2 | 1 | SP, PSW |
RL A | 1 | 1 | - |
RLC A | 1 | 1 | C |
RR A | 1 | 1 | - |
RRC A | 1 | 1 | C |
SEL MB0 | 1 | 1 | - |
SEL MB1 | 1 | 1 | - |
SEL RB0 | 1 | 1 | BS |
SEL RB1 | 1 | 1 | BS |
STOP TCNT | 1 | 1 | - |
STRT CNT | 1 | 1 | - |
STRT T | 1 | 1 | - |
SWAP A | 1 | 1 | - |
XCH A,Rr | 1 | 1 | - |
XCH A,@Ri | 1 | 1 | - |
XCHD A,@Ri | 1 | 1 | - |
XRL A,Rr | 1 | 1 | - |
XRL A,@Ri | 1 | 1 | - |
XRL A,#data | 2 | 2 | - |
(*) Must not be used with an external program memory (see chapter 2.6.0).
Symbol | Definition |
AC | Auxiliary Carry Flag in PSW |
BS | Bank-Select Flag in PSW |
C | Carry Flag in PSW |
F0 | User Flag 0 in PSW |
F1 | User Flag 1 |
Pp | Port (p = 1, 2 or p = 4...7) |
PSW | Program Status Word |
Ri | Index Register (i = 0, 1) |
Rr | Work Register (r = 0...7) |
SP | Stack-Pointer in PSW |
7.2.0 DeMon48_128k Serial Interface Protocol
Command | Description |
0x00 | Transmit DevID, VerMajor, VerMinor and VerRevision |
0x01 | Load ROM Testroutine |
0x02 | Transmit a 256byte page from RAM |
0x03 | MCS48Run |
0x04 | Transmit and Receive Monitor Options |
0x05 | Reset MCS48 µC |
0x06 | Receive modified internal MCS-48 µC registers |
0x07 | Receive internal RAM locations 0x01 to 0x7F |
0x08 | Receive MCS-48 port contents and bits |
0x09 | Step And Read |
0x0A | Read Only |
0x0B | Receive a 256byte RAM page |
0x0C | Transmit Hardware Status |
0x0D | Execute with multiple Soft-BreakPoints |
0x0E | Receive n-bytes for external RAM |
0x0F | Execute with HardwareBreakPoint |
0x10 | Transmit ALE Cycle Counter contents |
0x11 | Reset ALE Cycle Counter |
0x12 | Fill area in external RAM with single value |
0x13 | Prepare Reception/Fill |
0x14 | Execute single command in direct mode |
0x15 | Write to the Debug-µC's internal EEPROM |
0x16 | Read from the Debug-µC's internal EEPROM |
0x17 | Set Single Step Delay Time (5µs increments) |
0x18 | XEEPROM_Write single Byte |
0x19 | XEEPROM_Read single Byte |
0x1A | XEEPROM_CopyFromRAM copy a 4kB page from RAM to XEEPROM |
0x1B | XEEPROM_CopyToRAM copy a 4kB page from XEEPROM to RAM |
0x1C | Transmit AutoLoad dataset |
0x1D | Receive AutoLoad dataset |
0x00 Transmit DevID, VerMajor, VerMinor and VerRevision
PC | Dir. | DeMon48 | Notes |
0x00 | > | | |
| < | 0x00 | |
| < | Device ID | |
| < | Version Major | |
| < | Version Minor | |
| < | Version Revision | |
"PC" = Personal Computer
0x01 Load ROM Testroutine
PC | Dir. | DeMon48 | Notes |
0x01 | > | | |
| < | 0x01 | |
Testroutine # | > | | |
"PC" = Personal Computer
0x02 Transmit a 256byte page from RAM
PC | Dir. | DeMon48 | Notes |
0x02 | > | | |
| < | 0x02 | |
StartAddrW | > | | A16 |
StartAddrH | > | | A15...A8 |
| < | Data | 256 bytes |
"PC" = Personal Computer
0x03 MCS48Run
PC | Dir. | DeMon48 | Notes |
0x03 | > | | |
| < | 0x03 | |
"PC" = Personal Computer
After execution of this command, the MCS48 µC controls A0...A16, D0...D7, RAM_OE, RAM_WE.
RESETOUT=H, nDBG_ACT=H.
0x04 Transmit and Receive Monitor Options
PC | Dir. | DeMon48 | Notes |
0x04 | > | | |
| < | 0x04 | |
| < | Options(*) | |
Options(*) | > | | |
"PC" = Personal Computer
(*) Bit2=StartCnt,Bit1=StartT,Bit0=StopTCnt
0x05 Reset MCS-48 µC
PC | Dir. | DeMon48 | Notes |
0x05 | > | | |
| < | 0x05 | |
"PC" = Personal Computer
0x06 Receive modified internal MCS-48 µC registers
PC | Dir. | DeMon48 | Notes |
0x06 | > | | |
| < | 0x06 | |
| < | Status | 0x00=Monitor is active |
DBG_PC_H | > | | |
DBG_PC_L | > | | |
DBG_A | > | | |
DBG_T | > | | |
DBG_PSW | > | | |
DBG_R0RB0 | > | | |
LoadT | > | | Bit0 is set to load new value in T-register |
"PC" = Personal Computer
0x07 Receive internal RAM locations 0x01 to 0x7F
PC | Dir. | DeMon48 | Notes |
0x07 | > | | |
| < | 0x07 | |
| < | Status | 0x00=Monitor is active |
Data | > | | 127 bytes |
"PC" = Personal Computer
0x08 Receive MCS-48 port contents and bits
PC | Dir. | DeMon48 | Notes |
0x08 | > | | |
| < | 0x08 | |
| < | Status | 0x00=Monitor is active |
DBG_P1 | > | | |
DBG_P2 | > | | |
DBG_BITS | > | | Bit2=F1, Bit4=SEL MB0 pending, Bit5=SEL MB1 pending |
DBG_PBR | > | | |
DBG_DBR | > | | |
"PC" = Personal Computer
0x09 Step And Read
PC | Dir. | DeMon48 | Notes |
0x09 | > | | |
| < | 0x09 | |
| < | DBG_PC_H | |
| < | DBG_PC_L | |
| < | DBG_A | |
| < | DBG_T | |
| < | DBG_PSW | |
| < | DBG_R0RB0 | |
| < | DBG_P1 | |
| < | DBG_P2 | |
| < | DBG_BITS | |
| < | DBG_PBR | |
| < | DBG_DBR | |
| < | DBG_NextInstr0 | |
| < | DBG_NextInstr1 | |
| < | Data | Internal MCS-48 µC RAM 0x01...0x7F |
"PC" = Personal Computer
0x0A Read Only
PC | Dir. | DeMon48 | Notes |
0x0A | > | | |
| < | 0x0A | |
| < | DBG_PC_H | |
| < | DBG_PC_L | |
| < | DBG_A | |
| < | DBG_T | |
| < | DBG_PSW | |
| < | DBG_R0RB0 | |
| < | DBG_P1 | |
| < | DBG_P2 | |
| < | DBG_BITS | |
| < | DBG_PBR | |
| < | DBG_DBR | |
| < | DBG_NextInstr0 | |
| < | DBG_NextInstr1 | |
| < | Data | Internal MCS-48 µC RAM 0x01...0x7F |
"PC" = Personal Computer
0x0B Receive a 256byte RAM page
PC | Dir. | DeMon48 | Notes |
0x0B | > | | |
| < | 0x0B | |
StartAddrW | > | | A16 |
StartAddrH | > | | A15...A8 |
Data | > | | 256 bytes |
"PC" = Personal Computer
0x0C Transmit Hardware Status
PC | Dir. | DeMon48 | Notes |
0x0C | > | | |
| < | 0x0C | |
| < | Status | Bit1=SingleStep active, Bit2=Monitor active |
"PC" = Personal Computer
0x0D Execute with multiple Soft-BreakPoints
PC | Dir. | DeMon48 | Notes |
0x0D | > | | |
| < | 0x0D | |
Soft_BP0_H | > | | A15...A8 |
Soft_BP0_L | > | | A7...A0 |
Soft_BP1_H | > | | A15...A8 |
Soft_BP1_L | > | | A7...A0 |
Soft_BP2_H | > | | A15...A8 |
Soft_BP2_L | > | | A7...A0 |
Soft_BP3_H | > | | A15...A8 |
Soft_BP3_L | > | | A7...A0 |
Soft_BP4_H | > | | A15...A8 |
Soft_BP4_L | > | | A7...A0 |
Soft_BP5_H | > | | A15...A8 |
Soft_BP5_L | > | | A7...A0 |
Soft_BP6_H | > | | A15...A8 |
Soft_BP6_L | > | | A7...A0 |
Soft_BP7_H | > | | A15...A8 |
Soft_BP7_L | > | | A7...A0 |
Soft_BP_Enable | > | | Bit0=Enable BP0 ... Bit7=Enable BP7 |
"PC" = Personal Computer
When a breakpoint-match is detected, 0xAA is sent to the PC.
When the "Break"-button in the GUI is clicked, 0x55 is sent to DeMon48 and program execution in breakpoint mode is aborted.
0x0E Receive n-bytes for external RAM
PC | Dir. | DeMon48 | Notes |
0x0E | > | | |
| < | 0x0E | |
| < | 0x55 | Synchronization byte |
StartAddrW | > | | A16 |
StartAddrH | > | | A15...A8 |
StartAddrL | > | | A7...A0 |
ByteCountH | > | | Number of bytes - H (Bit15...Bit8) |
ByteCountL | > | | Number of bytes - L (Bit7...Bit0) |
Data | > | | n-bytes |
"PC" = Personal Computer
0x0F Execute with HardwareBreakPoint
PC | Dir. | DeMon48 | Notes |
0x0F | > | | |
| < | 0x0F | |
Hard_BP_H | > | | A15...A8 |
Hard_BP_L | > | | A7...A0 |
"PC" = Personal Computer
When a breakpoint-match is detected, 0xAA is sent to the PC.
When the "Break"-button in the GUI is clicked, 0x55 is sent to DeMon48 and program execution in breakpoint mode is aborted.
0x10 Transmit ALE Cycle Counter contents
PC | Dir. | DeMon48 | Notes |
0x10 | > | | |
| < | 0x10 | |
| < | Count_X | D31...D24 |
| < | Count_W | D23...D16 |
| < | Count_H | D15...D8 |
| < | Count_L | D7...D0 |
"PC" = Personal Computer
0x11 Reset ALE Cycle Counter
PC | Dir. | DeMon48 | Notes |
0x11 | > | | |
| < | 0x11 | |
"PC" = Personal Computer
0x12 Fill area in external RAM with single value
PC | Dir. | DeMon48 | Notes |
0x12 | > | | |
| < | 0x12 | |
StartAddrW | > | | A16 |
StartAddrH | > | | A15...A8 |
StartAddrL | > | | A7...A0 |
ByteCountH | > | | Number of bytes - H (Bit15...Bit8) |
ByteCountL | > | | Number of bytes - L (Bit7...Bit0) |
FillValue | > | | |
"PC" = Personal Computer
0x13 Prepare Reception/Fill
PC | Dir. | DeMon48 | Notes |
0x13 | > | | |
| < | 0x13 | |
"PC" = Personal Computer
0x14 Execute single command in direct mode
PC | Dir. | DeMon48 | Notes |
0x14 | > | | |
| < | 0x14 | |
Command0 | > | | |
Command1 | > | | |
Flags | > | | Bit0=1/2byte, Bit1=PC is changed by command |
"PC" = Personal Computer
0x15 Write to the Debug-µC's internal EEPROM
PC | Dir. | DeMon48 | Notes |
0x15 | > | | |
| < | 0x15 | |
Data | > | | |
Address | > | | |
"PC" = Personal Computer
0x16 Read from the Debug-µC's internal EEPROM
PC | Dir. | DeMon48 | Notes |
0x16 | > | | |
| < | 0x16 | |
Address | > | | |
| < | Data | |
"PC" = Personal Computer
0x17 Set Single Step Delay Time (5µs increments)
PC | Dir. | DeMon48 | Notes |
0x17 | > | | |
| < | 0x17 | |
DelayW | > | | D23...D16 |
DelayH | > | | D15...D8 |
DelayL | > | | D7...D0 |
"PC" = Personal Computer
0x18 XEEPROM_Write single Byte
PC | Dir. | DeMon48 | Notes |
0x18 | > | | |
| < | 0x18 | |
AddrH | > | | A15...A8 |
AddrL | > | | A7...A0 |
Data | > | | |
"PC" = Personal Computer
0x19 XEEPROM_Read single Byte
PC | Dir. | DeMon48 | Notes |
0x19 | > | | |
| < | 0x19 | |
AddrH | > | | A15...A8 |
AddrL | > | | A7...A0 |
| < | Data | |
"PC" = Personal Computer
0x1A XEEPROM_CopyFromRAM
PC | Dir. | DeMon48 | Notes |
0x1A | > | | |
| < | 0x1A | |
RAM_Block | > | | 4kB block number in RAM |
EEPROM_Block | > | | 4kB block number in XEEPROM |
| < | Flags | |
"PC" = Personal Computer
0x1B XEEPROM_CopyToRAM
PC | Dir. | DeMon48 | Notes |
0x1B | > | | |
| < | 0x1B | |
RAM_Block | > | | 4kB block number in RAM |
EEPROM_Block | > | | 4kB block number in XEEPROM |
| < | Flags | |
"PC" = Personal Computer
0x1C Transmit AutoLoad dataset
PC | Dir. | DeMon48 | Notes |
0x1C | > | | |
| < | 0x1C | |
Dataset number | > | | 0...9 |
| < | BlockEnable0 (*) | |
| < | BlockEnable1 (*) | |
| < | Destination0 (**) | EEPROM block 0 and 1 |
| < | Destination1 (**) | EEPROM block 2 and 3 |
| < | Destination2 (**) | EEPROM block 4 and 5 |
| < | Destination3 (**) | EEPROM block 6 and 7 |
| < | Destination4 (**) | EEPROM block 8 and 9 |
| < | Destination5 (**) | EEPROM block A and B |
| < | Destination6 (**) | EEPROM block C and D |
| < | Destination7 (**) | EEPROM block E and F |
"PC" = Personal Computer
(*) Byte0,Bit7 = Enable Load for 4kB block #00; Byte1,Bit0 = Enable Load for 4kB block #0F
(**) Bit7...Bit4 = Lower 4k-EEPROM block, Bit3...Bit0 = Upper 4k-EEPROM block
0x1D Receive AutoLoad dataset
PC | Dir. | DeMon48 | Notes |
0x1D | > | | |
| < | 0x1D | |
Dataset number | > | | 0...9 |
BlockEnable0(*) | > | | |
BlockEnable1(*) | > | | |
Destination0 (**) | > | | EEPROM block 0 and 1 |
Destination1 (**) | > | | EEPROM block 2 and 3 |
Destination2 (**) | > | | EEPROM block 4 and 5 |
Destination3 (**) | > | | EEPROM block 6 and 7 |
Destination4 (**) | > | | EEPROM block 8 and 9 |
Destination5 (**) | > | | EEPROM block A and B |
Destination6 (**) | > | | EEPROM block C and D |
Destination7 (**) | > | | EEPROM block E and F |
"PC" = Personal Computer
(*) Byte0,Bit7 = Enable Load for 4kB block #00; Byte1,Bit0 = Enable Load for 4kB block #0F
(**) Bit7...Bit4 = Lower 4k-EEPROM block, Bit3...Bit0 = Upper 4k-EEPROM block
7.3.0 DeMon48_128k code example "RAM Test"
"RAM Test" for MCS-48 µCs uses the MMU to write to the entire DeMon48_128k RAM, reading back the stored value and comparing it with the previously written value:
- Test memory area 0x1FFFF...0x10000
- Test memory area 0x0FFFF...0x00100
- Copy program from page 0 (start address 0x00000) to page 1 (start address 0x00100)
- Test memory area 0x000FF...0x00000
- Copy program from page 1 (start address 0x00100) to page 0 (start address 0x00000)
If there is a difference between the written and read value, the error-counter output on P1 is incremented. If T0 is set to logic high, the test loop then stops until it is resumed by a high-to-low transition at *INT.
If T1 is set to logic low, an I/O area enabled by the jumper configuration (see "5.0.0 Memory configurations") is disabled via the MMU's expansion register (EXP) before a new test run is started.
;DeMon48_128k RAM Test V1.1.0
;
;Tests its entire 128kB RAM 256 times and displays the number of verify
;errors or test runs on P1 and various status signals on P2.7 ... P2.5
;
;V1.0.0 Inital release
;V1.0.1 Uses a more sophisticated test pattern by toggling
; inversion of the written value every 256 bytes and between
; successive runs
;V1.1.0 Improved test pattern, status displays on P2 and error / test
; counter display on P1
;
;(c)2024 M. Schmoll * www.controller-designs.de
;
;T0 : 1=Stop on verify error / 0=Don't stop on verify error
;T1 : 1=Enable I/O address range / 0=Disable I/O address range
;*INT : Continue after stop (H->L)
;P2.7 : Test is complete (Output)
;P2.6 : Stopped after error (Output)
;P2.5 : Error(s) detected (Output)
;P2.4 : 1=Display test counter, 0=Display error counter (Input)
;R7 : Loop counter (DBL)
;R6 : Loop counter (DBH)
;R5 : Temporary register
;R4 : Test counter
;R3 : Error counter
CPU 8039
ORG 000H
CLR A
MOV R4,A ;Initialize Test counter
MOV R3,A ;Initialize Error counter
ORL A,#00010000B ;P2.4 = Input
OUTL P2,A
RAMTEST128K:
CALL READ_SWITCHES_AND_DISPLAY
CLR A
JT1 RAMTEST_EXP_WRITE ;Enable I/O, if T1 = 1
MOV A,#00001000B ;Disable I/O, if T1 = 0
RAMTEST_EXP_WRITE:
MOVD P7,A ;EXP = A, DA16 = H
U64K_TEST:
;Test 0x1FFFF...0x10000
MOV R6,#10H
U64K_LOOP2:
MOV A,R6
DEC A
MOVD P5,A ;DBH = A, DA16 = H
MOV R7,#10H
U64K_LOOP1:
MOV A,R7
DEC A
MOVD P4,A ;DBL = A, DA16 = H
CALL TEST256BYT
CALL READ_SWITCHES_AND_DISPLAY
DJNZ R7,U64K_LOOP1
DJNZ R6,U64K_LOOP2
L64K_TEST:
;Test 0x0FFFF...0x00100
MOV R6,#10H
L64K_LOOP2:
MOV A,R6
DEC A
ORLD P5,A ;DBH = A, DA16 = L
MOV R7,#10H
L64K_LOOP1:
MOV A,R7
DEC A
ORLD P4,A ;DBL = A, DA16 = L
CALL TEST256BYT
CALL READ_SWITCHES_AND_DISPLAY
MOV A,#02H
XRL A,R7 ;DBL = 0x1 ?
JNZ L64K_CONT
MOV A,#01H
XRL A,R6 ;DBH = 0x0 ?
JZ L64K_EXIT ;Yes, exit before writing to page 0
L64K_CONT:
DJNZ R7,L64K_LOOP1
DJNZ R6,L64K_LOOP2
L64K_EXIT:
;Prepare 256Byte copy from page 0 to page 1
MOV R7,#01 ;Destination page
MOV R6,#00 ;Source page
CALL COPY256BYT
JMP TEST_P0 + 0100H ;Jump to page 1
TEST_P0:
;Test 0x000FF...0x00000
CLR A
ORLD P5,A ;DBH = A, DA16 = L
ORLD P4,A ;DBL = A, DA16 = L
CALL TEST256BYT + 0100H ;Call to page 1
CALL READ_SWITCHES_AND_DISPLAY + 0100H
;Prepare 256Byte copy from page 1 to page 0
MOV R7,#00 ;Destination page
MOV R6,#01 ;Source page
CALL COPY256BYT + 0100H ;Call to page 1
CPL F0 ;Toggle invert/non-invert bit for next run
DJNZ R4,RAMTEST128K_NEXT
RAMTEST128K_FINISH:
IN A,P2 ;Set "Test finished" output
ORL A,#10010000B
OUTL P2,A
RAMTEST128K_FINISH_L0:
CALL READ_SWITCHES_AND_DISPLAY
JMP RAMTEST128K_FINISH_L0
RAMTEST128K_NEXT:
JMP RAMTEST128K ;Jump to page 0
;------------------------------------------------------------------------
TEST256BYT:
;Test a 256Byte page selected by DBH and DBL
;Destroys : A,R0,R5,P1
MOV R0,#00
TEST256BYT_L0:
MOV A,R0
JF0 TEST256BYT_L1
CPL A ;Invert write value, if F0 = 0
TEST256BYT_L1:
ADD A,R4 ;Add Test counter value
MOV R5,A ;Save write value
MOVX @R0,A ;Write
MOVX A,@R0 ;Read
XRL A,R5 ;Verify
JZ TEST256BYT_L5 ;Verify ok
INC R3 ;Increment Error counter
IN A,P2 ;Set "Error(s) detected" output
ORL A,#00110000B
OUTL P2,A
CALL READ_SWITCHES_AND_DISPLAY
JNT0 TEST256BYT_L4 ;Don't stop on error, if T0 = 0
IN A,P2 ;Set "Test stopped" output
ORL A,#01010000B
OUTL P2,A
TEST256BYT_L2:
;Wait for *INT=H
CALL READ_SWITCHES_AND_DISPLAY
JNI TEST256BYT_L2
MOV R5,#00H ;Debounce
NOP
NOP
NOP
DJNZ R5,$-3
CLR C
TEST256BYT_L3:
;Wait for *INT=L
CALL READ_SWITCHES_AND_DISPLAY
JNI TEST256BYT_L4
JNC TEST256BYT_L3
TEST256BYT_L4:
MOV R5,#00H ;Delay after verify error
NOP
NOP
NOP
DJNZ R5,$-3
IN A,P2 ;Clear "Test stopped" output
ANL A,#10111111B
ORL A,#00010000B ;P2.4 = Input
OUTL P2,A
TEST256BYT_L5:
DJNZ R0,TEST256BYT_L0
CPL F0 ;Toggle invert/non-invert bit for next 256 bytes
RET
;------------------------------------------------------------------------
COPY256BYT:
;Copy a 256Byte page in 4kB-Bank 0
;R7 = Destination page
;R6 = Source page
;Destroys : A,R0,R5,DBL,DBH,DA16
CLR A
ORLD P5,A ;DBH = A, DA16 = L
MOV R0,A ;Init loop counter
COPY256BYT_L:
MOV A,R6 ;Source page
ORLD P4,A ;DBL = A, DA16 = L
MOV A,R0
MOVX A,@R0
MOV R5,A
MOV A,R7 ;Destination page
ORLD P4,A ;DBL = A, DA16 = L
MOV A,R5
MOVX @R0,A
DJNZ R0,COPY256BYT_L
RET
;------------------------------------------------------------------------
READ_SWITCHES_AND_DISPLAY:
;P2.4 : 1=Display test counter, 0=Display error counter (Input)
;R4 : Test counter
;R3 : Error counter
IN A,P2
ANL A,#00010000B
JZ READ_SWITCHES_AND_DISPLAY_L
MOV A,R4 ;Test counter
CPL A
INC A
OUTL P1,A
RET
READ_SWITCHES_AND_DISPLAY_L:
MOV A,R3 ;Error counter
OUTL P1,A
RET
DeMon48_128k_Documentation - Online version - ©2023...2025 Marco Schmoll *
www.controller-designs.de * All Rights Reserved !
DeMon48_128k * Intel 8049 / MCS-48 Hardware-Debugger & Monitor - ©2021...2025 Marco Schmoll *
www.controller-designs.de * All Rights Reserved !