file | remarks (based on SIMH 3.2.1) |
makefile |
- in the Common Libraries section add "realcons.c" to the SIM line :
SIM = scp.c realcons.c sim_console.c sim_fio.c sim_timer.c sim_sock.c \
- Remove all other processor related instruction lines.
|
realcons.c realcons.h |
- new added files to implement the interface and the required definitions
|
scp.c |
- add the following two lines after the four #include definitions
#include "realcons.h" #include <stdlib.h>
- add the following line in the Global data section
REALCONS realcons_data;
- add in the table static CTAB cmd_table[] after the lines
{ "RESET", &reset_cmd, 0,
"r{eset} {ALL|} reset simulator\n" },
the following two lines: { "REALCONS", &real_cons_cmd, 0,
"real console <COM#> {n} connect to REAL on COM#, n*10k opcodes interval\n" },
- add in main (int argc, char *argv[]) before the line *cbuf = 0;
the line
init_realcons_port();
- add in main() in the while (stat != SCPE_EXIT) loop
before the printf ("sim> "); /*print prompt*/
if ( realcons_data.source == KEYBOARD_SOURCE )
and change the function call read_line in the line
else cptr = read_line (cbuf, CBUFSIZE, stdin); to read_source
- in the function t_stat dep_reg change the function call
read_line
in the line cptr = read_line (gbuf, CBUFSIZE, stdin); to
read_source
- in the function t_stat dep_addr change the function call
read_line in the line cptr = read_line (gbuf, CBUFSIZE, stdin);
to read_source
- insert before the procedure t_stat run_cmd (int32 flag, char *cptr) the following
procedure:
t_stat real_cons_cmd (int32 flag, char *cptr) {
code to initialize the specified REALCONS COM-port }
- insert after the function void int_handler (int sig) the following function:
void realcons_stop_cpu(void) { stop_cpu = 1; }
- add in the function t_stat ex_addr in the local variables section the line
uint16 dataword; and, to send data to the real console IF that is connected :
if ( realcons_data.response == FALSE ) {
the original code block, but exclude the "return" statement
}
and add the following block plus the return statement :
else { // send output to real-console
if (!(flag & EX_E)) return SCPE_OK;
GET_RADIX (rdx, dptr->dradix);
dataword = (uint16)(sim_eval[0] & 0xFFFF);
rc_send_data(dataword);
realcons_data.response = FALSE;
reason = SCPE_OK;
}
return reason;
- before the line r = sim_instr(); insert the line
rc_send_fnc_sts(FSTS_RUN_LED, FSTS_LED_ON, TRUE);
- after the line r = sim_instr(); insert the two lines
rc_send_fnc_sts(FSTS_CONSOLE_LED, FSTS_LED_ON, TRUE);
rc_clear_toggles();
- In the function t_stat run_cmd (int32 flag, char *cptr)
change the line if (flag == RU_BOOT) { into the line
if ( (flag == RU_BOOT) && (realcons_data.halt_active == FALSE) ) {
and change the line
if ((flag == RU_RUN) || (flag == RU_BOOT)) { into the line
if ((flag == RU_RUN) ||
((flag == RU_BOOT) && (realcons_data.halt_active == FALSE)) ) {
|
pdp11_cpu.c |
- add the #include "..\realcons.h" statement after
#include "pdp11_defs.h"
- in the function t_stat sim_instr(void), in the section
/* Fetch and decode next instruction */
after the 2 lines
IR = ReadW (PC | isenable); PC = (PC + 2) & 0177777; add the following lines :
rc_show_addrs_data(PC, (uint16)IR, FALSE);
if ( halt_from_RealConsole() == TRUE ) reason = SCPE_STOP;
if (cm == MD_KER) { // kernel mode --> "virtual" LED on
rc_send_fnc_sts(FSTS_VIRTUAL_LED, FSTS_LED_ON, FALSE); }
else { // user or supervisor mode --> "user" LED on
rc_send_fnc_sts(FSTS_USER_LED, FSTS_LED_ON, FALSE); }
- at the end (far away) of the function t_stat sim_instr(void), in the section
/* Simulation halted */,
just before the return reason; statement, add the following lines:
if ( (reason == STOP_HALT) || (reason == STOP_WAIT) || (reason == SCPE_STOP)
|| (reason == STOP_VECABORT) || (reason == STOP_SPABORT) )
{ // during HALT, general register R0 contents are displayed.
rc_show_addrs_data(saved_PC, (uint16)R[0], TRUE); } else
{ // during Single Instruction operation, the Processor Status Word is displayed.
rc_show_addrs_data(saved_PC, (uint16)PSW, TRUE); }
if (cm == MD_KER) { // kernel mode --> "virtual" LED on
rc_send_fnc_sts(FSTS_VIRTUAL_LED, FSTS_LED_ON, TRUE); }
else { // user or supervisor mode --> "user" LED on
rc_send_fnc_sts(FSTS_USER_LED, FSTS_LED_ON, TRUE); }
- PROC and BUS LEDs to be added ...
|