jnowaczek / pdp12-asm Goto Github PK
View Code? Open in Web Editor NEWDEC PDP-12 Cross-Assembler
License: GNU General Public License v3.0
DEC PDP-12 Cross-Assembler
License: GNU General Public License v3.0
At the moment, each test case consists of an assembly listing file and a "known good" machine code file. I think most of the machine code was either assembled by hand (suspect) or obtained online from paper tape archives (also suspect). It would be great to use the output of an existing PDP-8 cross-assembler as a comparison to validate our output.
As a preliminary goal, it would be great to ensure we have at least one test case for each permanent symbol.
The Read In Module format is relatively simple, and probably the easier to implement. Basically, a 12-bit address and 12-bit instruction are split up into four 6-bit words. Channel 8 punches indicate leader or rubout (erased instructions), and channel 7 punches indicate the start of an address-instruction pair.
See pages Intro-13 through Intro-14: http://bitsavers.trailing-edge.com/pdf/dec/pdp8/software/DEC-08-NGCC-D_PaperTapeSW.pdf
Some programs, like STPWCH, redefine instruction symbols. My best guess is this was to permit assembling these programs in older assemblers that did not have these instructions in their default symbol tables, but it causes problems for the current implementation:
Illegal symbol 'LexToken(EQUALS,'=',2,8)'
Error
Traceback (most recent call last):
File "/Users/julian/Documents/GitHub/pdp12-asm/test/test_asm_programs.py", line 53, in test_stpwch
result, expected = self.read_and_assemble('STPWCH')
File "/Users/julian/Documents/GitHub/pdp12-asm/test/test_asm_programs.py", line 20, in read_and_assemble
result = asm_parse.parse(listing.read())
File "/Users/julian/Documents/GitHub/pdp12-asm/src/asm_parse.py", line 221, in parse
mc = p.parse(file)
File "/Users/julian/Documents/GitHub/pdp12-asm/venv/lib/python3.9/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/Users/julian/Documents/GitHub/pdp12-asm/venv/lib/python3.9/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/Users/julian/Documents/GitHub/pdp12-asm/src/asm_parse.py", line 87, in p_machine_code
p[0] = s['opcode'] | 0o400
TypeError: 'int' object is not subscriptable
I can think of two approaches to solving this problem:
empty
As I understand things, the first option is closer to the way LAP6-DIAL and PAL-8 work. However, I am not sure how the LMODE
and PMODE
pseudo-ops would interact with this... it seems like I would still need to keep track of which symbols were defined by the user and which were predefined. The second option seems more attractive, it would just require looking up instructions in the user symbol table before the predefined table.
Eventually the assembler will be a binary that will be installed and run from the command line. A well designed CLI is important to maximize the ease of use - I think minimizing the number of flags or other parameters required for the common case is a decent preliminary design principle.
The BIN module format is more complicated than the RIM format (#5) but allows for non-contiguous program structure and requires less paper tape to store the same program. The BIN format is similar to the structure of an assembly listing in that a channel 7 punch denotes a change of origin and subsequent pairs of columns are interpreted as data in sequential order. Just like the RIM format, channel 8 punches indicate leader or rubout (erased instructions).
See pages Intro-13 through Intro-14: http://bitsavers.trailing-edge.com/pdf/dec/pdp8/software/DEC-08-NGCC-D_PaperTapeSW.pdf
It would be great to build a list of DEC documents that describe assembly syntax, instruction format, etc. - anything that is or could be useful.
Even better would be to make note of what information is contained in each document to aid in locating it when you need it ๐
A minimum set of pseudo-ops to support are those listed in the LAP6-DIAL Programmer's Reference Manual:
PMODE
LMODE
SEGMNT n
FIELD n
PAGE n
LISTAPE n
DECIMAL
OCTAL
NOLIST
LIST
TEXT
EJECT
ASMIFx n
ASMSKP n
SAVSYM n
LODSYM N
Some pseudo-ops are workarounds for memory limitations (like SAVSYM and LODSYM
) but I'll probably need to implement them in case these are encountered assembling old programs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.