Giter Club home page Giter Club logo

pdp12-asm's People

Contributors

brandonrc avatar jnowaczek avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

brandonrc

pdp12-asm's Issues

Test case coverage

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.

Support redefinition of instruction symbols

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:

  • Treat instructions no differently than any other symbol, but preload the symbol table with them at start time
  • Keep instructions separate and add a parsing rule to replace the assignment with 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.

Command line interface

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.

BIN binary format support

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

Compile list of reference materials

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 ๐Ÿ˜„

Implement pseudo-operators

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.