From bb72a137a55c6b9ccc4a0eb74379c9ad6fad8892 Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Mon, 29 Feb 2016 13:38:51 -0500 Subject: [PATCH] update, extend asm_syntax.txt --- misc/asm_syntax.txt | 277 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 254 insertions(+), 23 deletions(-) diff --git a/misc/asm_syntax.txt b/misc/asm_syntax.txt index 6e9b072..596f8bc 100644 --- a/misc/asm_syntax.txt +++ b/misc/asm_syntax.txt @@ -1,42 +1,273 @@ -Basics of the Unix assembler syntax +Basics of the "Unix v0" 'as' assembler syntax and PDP-7 coding: -Lines starting with " are comment lines +ASSEMBLER SYNTAX: +================= + +Anything from " to end of line is a comment. . is the location counter, where the next code or constant will be placed -.. is the relocation counter +.. is the relocation counter (not currently handled) -t = 0 Sets a built-in variable to this value without generating any machine code. - Variables so far are . .. and t. Not sure what t's purpose is yet. +Symbol names start with a letter, and can contain letters and "." +The dump of label values in "scans/sysmap" appears to show truncation +after 8 characters (not currently enforced by the "as7" Perl script). -orig: is a label. It looks like labels can have dots in them. - Dots seem to separate structures and fields, e.g. u.base - but there are some symbols that start with dots, e.g. .seek +symbol = expression -jms copy; 10; u.rg+2; 6 Semicolons separate instructions and - word expressions that follow the instruction + Sets a built-in variable to this value without generating any + machine code. - Some expressions are 0:0, not sure about this. - Is it two 9-bit fields? No idea + as7 enters machine instructions and the indirect bit (i) + into the variable table. -jmp 1f Jump back to the closest 1: label -jmp 1b Jump forward to the closest 1: label +label: is a label. -Some lines are indented differently to others e.g. + single digit decimal numbers can be used as "local" labels, + which are referenced with Nf and Nb: - jms betwen; o10000; o17762 - jms error - dac .+1 + jmp 1f Jump back to the closest 1: label + jmp 1b Jump forward to the closest 1: label -I think this is to indicate the skip logic, but it plays no part in the assembly syntax. - --1 occurs instead of instructions, so it looks like the assembler allows -literal constants at any time. +multiple words can be entered on one line, separated by semi-colon. String literals seem to be two characters decorated with < > characters, e.g. "ab" is b. I'm guessing these are placed as pairs in one word. The syntax is confusing, because I've also seen ; 040 ; ; ;