Intel 8049 (8048, 8748, 8749, 8035, 8039) / MCS-48 Hardware-Debugger & Monitor
Image: "DeMon48_128k" Graphical User Interface (GUI)
It was necessary to design a GUI because the growing functionality available made operation via the rudimentary low-level protocol of the debug microcontroller increasingly confusing.
After the DeMon48 system has been connected to the personal computer, the desired interface has been selected in the GUI's corresponding drop list and the software has been connected to the hardware by clicking the 'Connect' button, the system is ready for operation.
The 'S' indicator is green when the single-step hardware is active and the MCS-48 µC is in the "Halt" state. The 'M' indicator is green when the monitor software is active.
The 'Firmware' field displays the firmware version of the Debug-µC.
The last read values and contents for DA16, DBR, PBR as PB1 and PB2, PC, A, T, PSW, F1, P1 and P2 are displayed here and can be changed by clicking the corresponding field, followed by a keyboard entry in the hexadecimal system and completed with the Enter key for values with more than one bit.
PB1 shows the value of the PBR before the execution of a JMP/CALL/RET instruction, PB2 indicates the contents of the hardware register acting on A12 to A15.
MB0 and MB1 indicate that a 2kB bank change has been prepared by a "SEL MB0" or "SEL MB1" instruction, but has not yet taken effect, and their states can also be changed by clicking them. Exceptions: If memory bank 0 (MB0) is currently active, a change to memory bank 0 cannot be prepared, and if memory bank 1 (MB1) is currently active, a change to memory bank 1 cannot be prepared.
T0, T1 and INT are used to display the logic levels present at these inputs.
Values changed by the user but not yet written by the Debug-µC are shown in red. The data can be transferred to the MCS-48 µC by clicking on the 'Sync' or 'Step' button. If the value of a register or a bit differs from the contents of the same during the previous read operation, this value is shown in blue so that values changed during program execution are automatically highlighted.
In the "Online disassembler" field, the command addressed by the current value of the address counter of the MCS-48 µC is shown disassembled with the contents of the associated 1...2 memory locations (1- and 2-byte commands).
The contents of a 256-byte page of the external RAM are displayed here and can be edited by the user by clicking the corresponding memory location and making the desired change followed by the Enter key. Memory locations that have been changed by the user but not yet written by the Debug-µC are shown in red. The data can be transferred to the RAM by clicking on the 'Sync' or 'Step' button. If the contents of a memory location differs from the contents of the previous read operation, the memory location is shown in blue so that values that have changed during program execution are automatically highlighted.
The offset of the 256-byte page to be displayed can be entered manually in the 'Page' text field: a value of 0A0, for example, selects the page 0x0A000 to 0x0A0FF. The two 'arrow' buttons can be used to quickly switch between consecutive pages.
If the checkbox 'Trace'/'Program (PBR+PC)' is activated, the currently displayed 256-byte page follows the contents of the PBR (Program Bank Register) and PC (PC). If the checkbox 'Trace'/'Data (DBR)' is activated, the currently displayed 256-byte page follows the contents of the DBR (Data Bank Register) (see "3.6.7 Composition of the address in different situations").
The contents of up to 128 bytes in the internal RAM of the MCS-48 µC are displayed here and can be edited by the user by clicking the corresponding memory location and making the desired change completed by pressing the Enter key. Memory locations that have been changed by the user but not yet written by the Debug-µC are shown in red. The data can be transferred to the RAM by clicking the 'Sync' or 'Step' button. If the contents of a memory location differs from the contents of the previous read operation, the memory location is shown in blue so that values that have been changed during program execution are automatically highlighted.
After clicking the 'File' button, binary (*.bin) or Intel hex files (*.hex) can be opened and loaded into the MCS-48 program memory.
The DeMon48 system supports the AS macro assembler by A. Arnold.
After selecting a source text file (*.asm), it is automatically assembled when the 'AS' button is clicked and an Intel hex file is generated, which is then loaded into the MCS-48 program memory. The "MAP" file generated by the assembler is used to display the source text including correct address information and to highlight the command addressed by the current contents of the PC (Program Counter) in the source text.
To be able to use the AS macro assembler, the path to the assembler files must be selected once after clicking the 'AS Cfg' button.
If a "MAP" file created by the assembler for debugging purposes is found when loading a binary file (*.bin), this is read and the debugging information obtained is used to display the correct address information in the source text and, secondly, to visually highlight the source text line that corresponds to the current contents of the program counter (PC). This also works with assembler projects consisting of several source files (e.g. linked using the "INCLUDE" statement of the AS macro assembler).
Caution is advised when using the "automatic bank change"-function of the AS macro assembler, as it apparently does not take into account that after the command sequence
the program counter is correctly loaded with the return address stored on the stack, but the state of the MB flip-flop is not affected by the RET command - the next CALL or JMP command therefore leads to an address in memory bank 1! Workaround: use the "ASSUME" commands of the AS macroassembler to specify the currently selected memory bank.
Serves to load the test routines still stored in the firmware of the Debug-µC into the MCS-48 program memory.
After clicking the 'Fill' button, the external and internal RAM can be partially or completely filled with a selectable value.
After clicking the 'Proj.' button, projects from up to 16 individual source files can be configured for the 16 4kB blocks of the "DeMon48_128k" system and loaded into the MCS-48 program memory.
Clicking the 'Run' button exits any active single-step or reset mode, exits the monitor, and the MCS-48 µC starts program execution at full speed.
After clicking the 'Step' button, the monitor is started, if the monitor is not active, all current values are read from the Debug-µC and displayed in the GUI. If the monitor is already active when the 'Step' button is clicked, all values changed by the user in the GUI are written by the Debug-µC, the monitor is terminated, a command from the MCS-48 user program is executed, the monitor is started, all current values are read from the Debug-µC and displayed in the GUI.
By clicking the 'Sync' button, the display in the GUI and the state of the hardware are synchronized. This means that all values changed by the user in the GUI are written to the hardware and all current values are read by the Debug-µC and then displayed in the GUI. The monitor will be started, if the monitor is not active when the 'Sync' button is clicked.
After clicking the 'Reset' button, it changes its color and a timer is started, after which the button returns to its original color. If the 'Reset' button is pressed for a second time while the timer is still running, a hardware reset of the MCS-48 µC is triggered.
If the "STOP TCNT" checkbox is activated, a "STOP TCNT" instruction is executed by the MCS-48 µC when the monitor is started to stop the timer/counter (see "4.1.2 Monitor start").
If the "STRT CNT" checkbox is activated, a "STRT CNT" instruction is executed by the MCS-48 µC when the monitor is exited to start the timer in counter mode. If the "STRT T" checkbox is activated, a "STRT T" instruction is executed by the MCS-48 µC when the monitor is exited to start the timer in timer mode (see "4.3.6 Restore PC, timer/counter configuration and MB-FF").
After clicking the 'Auto' button, 'Step' commands are automatically executed by the GUI in the interval selected by the drop list arranged next to it (see "6.11.0 'Step' button").
By clicking the 'SoftBP' button the MCS-48 µC starts program execution and it is automatically interrupted when the address entered in one of the activated address fields is reached. Then the monitor is started and the display in the GUI is updated. Since this is a function of the Debug-µC software, the program is executed at around 30,000 instructions/second.
By clicking the 'HardBP' button the MCS-48 µC starts program execution and it is automatically interrupted when the address entered in the activated address field is reached, the monitor is started and the display in the GUI is updated. Since the address bus is monitored by hardware to see if the breakpoint address is reached, programs in hardware breakpoint mode are executed at full speed. This is also why program execution is stopped at the instruction following the specified breakpoint address: it is not possible to abort the execution of the current instruction, so the 8049 is stopped before executing the instruction following the active breakpoint address.
The integrated stopwatch evaluates the 32-bit counter for the falling edges of the ALE signal in the Debug-µC - which correspond to the executed instruction cycles - and can reset it. The calculated execution time is automatically output in units µs, ms or s (up to 1000µs in µs, from 1000µs in ms, from 1000ms in s) and depends on the MCS-48 oscillator frequency specified in the GUI by the user.