From 60af94212952ba526471a4c9b7776338295f7741 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Fri, 22 May 2015 00:13:54 +0200 Subject: [PATCH] .RESTORE restores DOT too this is how it should be according to page 6-42 of the manual. Kermit does this ugly thing to backpatch some .word value: 435 000070 dial$time 35. 1 000070 modval 35.,dial.time 1 .save 2 000070 .psect modinf 3 000006 . = $$current + dial.time 4 000006 000043 .word 35. 5 000070 .restore 436 000070 wake$string <^E^M> where the current program section already is modinf. So the .save stores DOT, it's changed to a lower value (6) to backpatch, and .restore sets DOT back to 70. --- assemble.c | 2 ++ assemble_globals.c | 1 + assemble_globals.h | 1 + 3 files changed, 4 insertions(+) diff --git a/assemble.c b/assemble.c index e161247..5cda79d 100644 --- a/assemble.c +++ b/assemble.c @@ -357,6 +357,7 @@ static int assemble( } sect_sp++; sect_stack[sect_sp] = current_pc->section; + dot_stack[sect_sp] = DOT; return 1; case P_RESTORE: @@ -365,6 +366,7 @@ static int assemble( return 0; } else { go_section(tr, sect_stack[sect_sp]); + DOT = dot_stack[sect_sp]; list_location(stack->top, DOT); if (!enabl_lsb) { lsb = get_next_lsb(); diff --git a/assemble_globals.c b/assemble_globals.c index 509797a..b8c724e 100644 --- a/assemble_globals.c +++ b/assemble_globals.c @@ -47,6 +47,7 @@ COND conds[MAX_CONDS]; /* Stack of recent conditions */ int last_cond; /* 0 means no stacked cond. */ SECTION *sect_stack[SECT_STACK_SIZE]; /* 32 saved sections */ +int dot_stack[SECT_STACK_SIZE]; /* 32 saved sections */ int sect_sp; /* Stack pointer */ char *module_name = NULL; /* The module name (taken from the 'TITLE'); */ diff --git a/assemble_globals.h b/assemble_globals.h index 372fd53..bc54277 100644 --- a/assemble_globals.h +++ b/assemble_globals.h @@ -57,6 +57,7 @@ extern COND conds[MAX_CONDS]; /* Stack of recent conditions */ extern int last_cond; /* 0 means no stacked cond. */ extern SECTION *sect_stack[SECT_STACK_SIZE]; /* 32 saved sections */ +extern int dot_stack[SECT_STACK_SIZE]; /* 32 saved sections */ extern int sect_sp; /* Stack pointer */ extern char *module_name; /* The module name (taken from the 'TITLE'); */