7.0.0 Anhang
7.1.0 Befehlssatz der 8035, 8039, 8048, 8049, 8748, 8749, 8040, 8050 µC
| Mnemonic | Zyklen | Byte | Flags |
| ADD A,Rr | 1 | 1 | AC,CY |
| ADD A,@Ri | 1 | 1 | AC,CY |
| ADD A,#data | 2 | 2 | AC,CY |
| ADDC A,Rr | 1 | 1 | AC,CY |
| ADDC A,@Ri | 1 | 1 | AC,CY |
| ADDC A,#data | 2 | 2 | AC,CY |
| 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 | CY |
| CLR F0 | 1 | 1 | F0 |
| CLR F1 | 1 | 1 | F1 |
| CPL A | 1 | 1 | - |
| CPL C | 1 | 1 | CY |
| CPL F0 | 1 | 1 | F0 |
| CPL F1 | 1 | 1 | F1 |
| DA A | 1 | 1 | AC,CY |
| 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 | Zyklen | Byte | 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 | CY |
| RR A | 1 | 1 | - |
| RRC A | 1 | 1 | CY |
| 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 | - |
(*) Darf nicht mit einem externen Programmspeicher genutzt werden (siehe Kapitel 2.6.0).
| Symbol | Bedeutung |
| AC | Auxiliary Carry Flag im PSW |
| BS | Register-Bank-Select Flag im PSW |
| CY | Carry Flag im PSW |
| F0 | User Flag 0 im PSW |
| F1 | User Flag 1 |
| Pp | Port (p = 1, 2 oder p = 4...7) |
| PSW | Program Status Word |
| Ri | Indexregister (i = 0, 1) |
| Rr | Arbeitsregister (r = 0...7) |
| SP | Stack-Pointer im PSW |
7.2.0 DeMon48_128k Protokoll der seriellen Schnittstelle
| Command | Description |
| 0x00 | Transmit DevID, VerMajor, VerMinor and VerRevision |
| 0x01 | Restart Debug µC |
| 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 Restart Debug µC
| PC | Dir. | DeMon48 | Notes |
| 0x01 | > | | |
| < | 0x01 | |
"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 |
| < | LoadEnable0 (*) | |
| < | LoadEnable1 (*) | |
| < | Src0 and 1 (**) | EEPROM source block for RAM block 0 and 1 |
| < | Src2 and 3 (**) | EEPROM source block for RAM block 2 and 3 |
| < | Src4 and 5 (**) | EEPROM source block for RAM block 4 and 5 |
| < | Src6 and 7 (**) | EEPROM source block for RAM block 6 and 7 |
| < | Src8 and 9 (**) | EEPROM source block for RAM block 8 and 9 |
| < | SrcA and B (**) | EEPROM source block for RAM block A and B |
| < | SrcC and D (**) | EEPROM source block for RAM block C and D |
| < | SrcE and F (**) | EEPROM source block for RAM block E and F |
"PC" = Personal Computer
(*) Byte0,Bit7 = Enable Load for 4k-RAM block 0; Byte1,Bit0 = Enable Load for 4k-RAM block F
(**) Bit7...Bit4 = Source for lower 4k-RAM block, Bit3...Bit0 = Source for upper 4k-RAM block
0x1D Receive AutoLoad dataset
| PC | Dir. | DeMon48 | Notes |
| 0x1D | > | | |
| < | 0x1D | |
| Dataset number | > | | 0...9 |
| LoadEnable0 (*) | > | | |
| LoadEnable1 (*) | > | | |
| Src0 and 1 (**) | > | | EEPROM source block for RAM block 0 and 1 |
| Src2 and 3 (**) | > | | EEPROM source block for RAM block 2 and 3 |
| Src4 and 5 (**) | > | | EEPROM source block for RAM block 4 and 5 |
| Src6 and 7 (**) | > | | EEPROM source block for RAM block 6 and 7 |
| Src8 and 9 (**) | > | | EEPROM source block for RAM block 8 and 9 |
| SrcA and B (**) | > | | EEPROM source block for RAM block A and B |
| SrcC and D (**) | > | | EEPROM source block for RAM block C and D |
| SrcE and F (**) | > | | EEPROM source block for RAM block E and F |
"PC" = Personal Computer
(*) Byte0,Bit7 = Enable Load for 4k-RAM block 0; Byte1,Bit0 = Enable Load for 4k-RAM block F
(**) Bit7...Bit4 = Source for lower 4k-RAM block, Bit3...Bit0 = Source for upper 4k-RAM block
7.3.0 MCS-48 Code-Beispiel "DeMon48_128k RAM Test"
"DeMon48_128k RAM Test" für MCS-48 µC beschreibt mit Hilfe der MMU das komplette DeMon48_128k RAM, liest den gespeicherten Wert zurück und vergleicht diesen mit dem zuvor geschriebenen Wert :
- Test des Speicherbereichs 0x1FFFF...0x10000
- Test des Speicherbereichs 0x0FFFF...0x00100
- Kopieren des Programms von Page 0 ab 0x00000 in Page 1 ab 0x00100
- Test des Speicherbereichs 0x000FF...0x00000
- Kopieren des Programms von Page 1 ab 0x00100 in Page 0 ab 0x00000
Bei einem Unterschied zwischen geschriebenen und gelesenen Wert wird der Fehlerzähler inkrementiert. Wenn T0 auf High-Potential gelegt ist, stoppt dann die Test-Schleife, bis sie durch einen High-zu-Low Wechsel an *INT
wieder aufgenommen wird.
Ist T1 auf Low-Potential gelegt, wird vor dem Start eines Test-Durchlaufs ein über die Jumper-Konfiguration (siehe "5.0.0 Speicherkonfigurationen") eingeblendeter I/O-Bereich über das Expansion-Register (EXP)
der MMU ausgeblendet.
Wenn an den Eingang P2.4 Low-Potential gelegt wird, wird an P1 der Stand des Fehlerzählers, bei High-Potential der Stand des Test-Zählers ausgegeben.
High-Potential am Ausgang P2.5 zeigt an, dass ein oder mehrere Fehler erkannt wurden, High-Potential am Ausgang P2.6 zeigt an, dass der aktuelle Test nach einem Fehler angehalten wurde und High-Potential am Ausgang P2.7
zeigt an, dass alle 256 Test-Durchläufe abgeschlossen sind.
;DeMon48_128k RAM Test V1.1.1
;
;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
;V1.1.1 Makes use of the "DIS_P2_L" bit in the "EXP" register
;
;(c)2024, 2025 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
;R0 : Loop counter, index register
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
MOV A,#00000100B ;Disable D-FF on P2.0...P2.3 (DIS_P2_L=1)
JT1 RAMTEST_EXP_WRITE ;Enable I/O, if T1 = 1
MOV A,#00001100B ;Disable I/O, if T1 = 0 (DIS_IO=1)
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,R3,R5,P2
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
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
MCS-48 Code-Beispiel "DeMon48_128k RAM Test" im Intel-Hex-Format:
:1000000027ACAB43103A14AA2304560E230C3FBE70
:1000100010FE073DBF10FF073C145F14AAEF16EE59
:1000200011BE10FE078DBF10FF078C145F14AA23AA
:1000300002DF96392301DEC63DEF28EE23BF01BE65
:1000400000149C2445278D8C345F34AABF00BE0168
:10005000349C95EC5D0A43903A14AA04590406B8FE
:1000600000F8B665376CAD9080DDC6981B0A43304A
:100070003A14AA268B0A43503A14AA8679BD000086
:100080000000ED7F9714AA868BE685BD0000000076
:10009000ED8D0A53BF43103AE8619583278DA8FE82
:1000A0008C80ADFF8CFD90E89F830A5310C6B4FC92
:0700B00037173983FB398388
:00000001FF

DeMon48_128k_Dokumentation - Onlineversion - ©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 !