📄 c200mnrt.asm
字号:
;
.page
;---------------------------------------------------------------------------
; Define the MON_OPTION3 mnemonic.
;---------------------------------------------------------------------------
.eval 0, OPTION3
.eval MON_PMAP_PAGE | OPTION3, OPTION3 ; uses 2 bits
;eval MON_PMAP_PAGE | OPTION3, OPTION3 ; uses 2 bits
.eval MON_XTND_PROG | OPTION3, OPTION3
.eval (0 << 03h) | OPTION3, OPTION3 ; unused
;
MON_OPTION3 .set OPTION3
;
;---------------------------------------------------------------------------
; Define the MON_OPTION4 mnemonic.
;---------------------------------------------------------------------------
.eval 0, OPTION4
.eval MON_DMAP_PAGE | OPTION4, OPTION4 ; uses 2 bits
;eval MON_DMAP_PAGE | OPTION4, OPTION4 ; uses 2 bits
.eval MON_XTND_DATA | OPTION4, OPTION4
.eval (0 << 03h) | OPTION4, OPTION4 ; unused
;
MON_OPTION4 .set OPTION4
;
.page
;***************************************************************************
; REALTIME SECTIONS
;***************************************************************************
;
;---------------------------------------------------------------------------
; Define the table of addresses for the
; external commands used by the HLL Debugger.
;
; This table contain one address parameter per external command.
; It is the start point of the routine that implements the command.
;
; Note that "_A" signifies an address table mnemonic.
; Note that "_C" signifies an state machine command mnemonic.
; Note that "_S" signifies an state machine state mnemonic.
;---------------------------------------------------------------------------
EXTERNAL_TABLE .sect "mon_main"
;
UNUSED_A .word MON_UNUSED ; Unused Command.
;
A2MNRT_A .word MON_ADRSWR ; Write Monitor Address
;
PM2HOST_A .word MON_PMRD ; Read Program Memory
;
PM2MNRT_A .word MON_PMWR ; Write Program Memory
;
DM2HOST_A .word MON_DMRD ; Read Data Memory
;
DM2MNRT_A .word MON_DMWR ; Write Data Memory
.if (MON_IO_MAP_USE != MON_IO_MAP_USE_NOT)
IO2HOST_A .word MON_IORD ; Read IO Memory
;
IO2MNRT_A .word MON_IOWR ; Write IO Memory
.endif ; (MON_IO_MAP_USE != MON_IO_MAP_USE_NOT)
;
;---------------------------------------------------------------------------
; Define the set of external commands used by the HLL Debugger.
;
; These command values intentionally increment by ones.
;---------------------------------------------------------------------------
UNUSED_C .set UNUSED_A - EXTERNAL_TABLE ;
;
A2MNRT_C .set A2MNRT_A - EXTERNAL_TABLE ;
;
PM2HOST_C .set PM2HOST_A - EXTERNAL_TABLE ;
;
PM2MNRT_C .set PM2MNRT_A - EXTERNAL_TABLE ;
;
DM2HOST_C .set DM2HOST_A - EXTERNAL_TABLE ;
;
DM2MNRT_C .set DM2MNRT_A - EXTERNAL_TABLE ;
.if (MON_IO_MAP_USE != MON_IO_MAP_USE_NOT)
IO2HOST_C .set IO2HOST_A - EXTERNAL_TABLE ;
;
IO2MNRT_C .set IO2MNRT_A - EXTERNAL_TABLE ;
.endif ; (MON_IO_MAP_USE != MON_IO_MAP_USE_NOT)
;
.page
;---------------------------------------------------------------------------
; Define the table of addresses for the routines that implement
; the internal commands used by the monitor itself.
;
; This table contain two address parameters per internal command.
; The start point for entry into the routine is the second parameter.
; The return point for exit from the routine is the first parameter.
; The reverse order is used to shave a few words from the monitor's size.
;
; Note that "_A" signifies an address table mnemonic.
; Note that "_C" signifies an state machine command mnemonic.
; Note that "_S" signifies an state machine state mnemonic.
;---------------------------------------------------------------------------
INTERNAL_TABLE .sect "mon_main"
;
SENDCMND_A .word MON_WAIT ; Monitor send command
.word SENDCMND_ENTR ; and send status values.
;
RECVCMND_A .word RECVCMND_EXIT ; Monitor receive command
.word RECVCMND_ENTR ; and use a read command.
;
DOAWRITE_A .word DOAWRITE_EXIT ; Use a write command.
.word NOACTION_ENTR ;
;
SWCHOPRT_A .word MON_WAIT ;
.word SWCHOPRT_ENTR ; Operate the message switch.
;
MAYBERUN_A .word MAYBERUN_EXIT ;
.word NOACTION_ENTR ; Possibly exit the monitor.
;
;---------------------------------------------------------------------------
; Define the set of internal commands used by the monitor itself.
;
; These command values intentionally increment by twos.
;---------------------------------------------------------------------------
SENDCMND_C .set SENDCMND_A - INTERNAL_TABLE ;
;
RECVCMND_C .set RECVCMND_A - INTERNAL_TABLE ;
;
DOAWRITE_C .set DOAWRITE_A - INTERNAL_TABLE ;
;
SWCHOPRT_C .set SWCHOPRT_A - INTERNAL_TABLE ;
;
MAYBERUN_C .set MAYBERUN_A - INTERNAL_TABLE ;
;
.page
;---------------------------------------------------------------------------
; Define the four monitor states and the possible actions taken during
; each monitor state, based on four permutations of the status of the
; MSG_DATA and MSG_CMND buffers. The status of the buffers is taken from
; the STAT_WFUL, STAT_CMD and STAT_RFUL bits in the MSG_STAT register.
;
; Each five line ".eval" defines a monitor state and its possible actions.
;
; Line 1 declares the mnemonic for the state.
; Line 2 is nibble 3, the buffer has something from the monitor to the host.
; Line 3 is nibble 2, the buffer has a command to the monitor.
; Line 4 is nibble 1, the buffer has a datum to the monitor.
; Line 5 is nibble 0, the buffer is empty.
;
; Note that "_A" signifies an table entry address mnemonic.
; Note that "_C" signifies an state machine command mnemonic.
; Note that "_S" signifies an state machine state mnemonic.
;---------------------------------------------------------------------------
;
;---------------------------------------------------------------------------
; Define the AFTERREAD_S state. This is the monitor state after
; accepting an external read command from the HLL Debugger.
;---------------------------------------------------------------------------
.eval 0, AFTERREAD_S
.eval (SWCHOPRT_C << 12) | AFTERREAD_S, AFTERREAD_S
.eval (RECVCMND_C << 8) | AFTERREAD_S, AFTERREAD_S
.eval (SWCHOPRT_C << 4) | AFTERREAD_S, AFTERREAD_S
.eval (MAYBERUN_C ) | AFTERREAD_S, AFTERREAD_S
;
;---------------------------------------------------------------------------
; Define the AFTERWRIT_S state. This is the monitor state after
; accepting an external write command from the HLL Debugger.
;---------------------------------------------------------------------------
.eval 0, AFTERWRIT_S
.eval (SWCHOPRT_C << 12) | AFTERWRIT_S, AFTERWRIT_S
.eval (RECVCMND_C << 8) | AFTERWRIT_S, AFTERWRIT_S
.eval (DOAWRITE_C << 4) | AFTERWRIT_S, AFTERWRIT_S
.eval (MAYBERUN_C ) | AFTERWRIT_S, AFTERWRIT_S
;
;---------------------------------------------------------------------------
; Define the AFTEREROR_S state. This is the monitor state after an error
; has occurred, when all external commands from the HLL Debugger are
; discarded, until a status message is passed to the HLL debugger.
;---------------------------------------------------------------------------
.eval 0, AFTEREROR_S
.eval (SWCHOPRT_C << 12) | AFTEREROR_S, AFTEREROR_S
.eval (SWCHOPRT_C << 8) | AFTEREROR_S, AFTEREROR_S
.eval (SWCHOPRT_C << 4) | AFTEREROR_S, AFTEREROR_S
.eval (SENDCMND_C ) | AFTEREROR_S, AFTEREROR_S
;
;---------------------------------------------------------------------------
; Define the AFTERSTAT_S state. This is the monitor state after an error
; has occurred and a status message has been passed to the HLL debugger.
; The monitor is ready to accept an external command from the HLL Debugger.
;---------------------------------------------------------------------------
.eval 0, AFTERSTAT_S
.eval (SWCHOPRT_C << 12) | AFTERSTAT_S, AFTERSTAT_S
.eval (RECVCMND_C << 8) | AFTERSTAT_S, AFTERSTAT_S
.eval (SWCHOPRT_C << 4) | AFTERSTAT_S, AFTERSTAT_S
.eval (SENDCMND_C ) | AFTERSTAT_S, AFTERSTAT_S
;
.page
;***************************************************************************
; This page is intentionally left blank.
;***************************************************************************
;
.page
;***************************************************************************
; REALTIME SECTIONS
;***************************************************************************
;
;---------------------------------------------------------------------------
; Define the "mon_pge0" section in data memory.
;
; Note that "mon_pge0" is defined in the link command file.
; It can be put anywhere in page zero data memory to suit the application.
;---------------------------------------------------------------------------
PRM_CMND .usect "mon_pge0", 1 ; Message command parameter.
PRM_ADRS .usect "mon_pge0", 1 ; Message base address parameter.
.if (MON_XTND_EITHER == MON_XTND_ON)
PRM_XTND .usect "mon_pge0", 1 ; Message extended address parameter.
.else ; (MON_XTND_EITHER == MON_XTND_OFF)
PRM_XTND .set 0 ; Unused.
.endif ; (MON_XTND_EITHER)
;
MON_MACHINE .usect "mon_pge0", 1 ; Monitor state machine value.
MON_STATUS .usect "mon_pge0", 1 ; Monitor status.
MON_TRAP_VEC .usect "mon_pge0", 1 ; Remappable vector 0x0026 address.
;
.if (MON_XTND_EITHER == MON_XTND_ON)
MON_TWO_SAVE .usect "mon_pge0", 1 ; Saved bits from IMR/ST0 register.
; .asg MON_TWO_SAVE, MON_IMR_SAVE ; This is in "c200mnrt.i".
; .asg MON_TWO_SAVE, MON_ST0_SAVE ; This is in "c200mnrt.i".
.else ; (MON_XTND_EITHER == MON_XTND_OFF)
MON_TWO_SAVE .set 0 ; Unused.
MON_IMR_SAVE .usect "mon_pge0", 1 ; Saved bits from IMR register.
MON_ST0_SAVE .usect "mon_pge0", 1 ; Saved bits from ST0 register.
.endif ; (MON_XTND_EITHER)
;
.if (MON_WAIT_USE == MON_WAIT_USE_YES)
MON_WAIT_B2 .usect "mon_pge0", 1 ; Stop-sign flag.
.else ; (MON_WAIT_USE == MON_WAIT_USE_NOT)
MON_WAIT_B2 .set 0 ; Unused.
.endif ; (MON_WAIT_USE)
;
MON_TEMP0 .usect "mon_pge0", 1 ; General purpose temporary storage.
MON_TEMP1 .usect "mon_pge0", 1 ; General purpose temporary storage.
MON_TEMP2 .usect "mon_pge0", 1 ; General purpose temporary storage.
MON_TEMP3 .usect "mon_pge0", 1 ; General purpose temporary storage.
MON_TEMP4 .usect "mon_pge0", 1 ; General purpose temporary storage.
.if (MON_XTND_EITHER == MON_XTND_ON)
MON_TEMP5 .usect "mon_pge0", 1 ; General purpose temporary storage.
.endif ; (MON_XTND_EITHER == MON_XTND_ON)
;
MON_TEMP_PC .set MON_TEMP0 ; Temporary for PC in ETRAP & EINTR macros.
MON_TEMP_ST0 .set MON_TEMP1 ; Temporary for ST0 in ETRAP & EINTR macros.
MON_TEMP_ST1 .set MON_TEMP2 ; Temporary for ST1 in ETRAP & EINTR macros.
;
MON_TEMP_ACCL .set MON_TEMP3 ; Temporary for ACCL/H after monitor entry,
MON_TEMP_ACCH .set MON_TEMP4 ; inside EINTR macro and after ETRAP macro.
;
ENTR_ADRS .set MON_TEMP3 ; Temporary for the entry and exit addresses
EXIT_ADRS .set MON_TEMP4 ; used by the internal action routines.
;
.if (MON_XTND_EITHER == MON_XTND_ON)
XTND_ADRS .set MON_TEMP5 ; Temporary for PMAP/DMAP register values.
.endif ; (MON_XTND_EITHER == MON_XTND_ON)
;
MON_PGE0_DP .set PRM_CMND ; DP value for "mon_pge0" section.
;
.page
;---------------------------------------------------------------------------
; Define the "mon_rgst" section in data memory.
;
; Note that "mon_rgst" is defined in the link command file.
; It can be put anywhere in data memory to suit the application.
;
; The ordering is defined by the HLL Debugger and must *not* be altered.
;---------------------------------------------------------------------------
MON_PC .usect "mon_rgst", 1 ; 0x00 program counter.
MON_ST0 .usect "mon_rgst", 1 ; 0x01 status register 0.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -