pdp11 BBC BASIC development
 MDFS::Software.PDP11.BBCBasic.blog Search  

Floating point addition and multiplication rounding corrected. 06-Aug-2016:
Fractional decimal parsing implemented. E format and power only implments positive integer exponents. Decimal printout not yet implemented, so printing fractions prints as integers.
Written a BBC text VDU driver for Unix.

Wow! Running on real hardware!
Running on David Banks' Matchbox CoPro for the BBC/Master. A real, live, hardware (emulated) PDP-11 second processor for the BBC. What we could have done with this back in the day!
The screenshots show a 20MHz core running at the equivalent of a 25MHz 6502 and SIMH running at the effective speed of a 60MHz 6502.

Generalised command table, added *Help command.
PROC/FN parameter passing, and restoring on return works. Demo'd with a PROCedure that sets ANSI colours.

PROC/FN calls work, AddrOf PROC/FN also works. Now need to get parameter passing working. This is looking fiddly juggling between variables and the stack.
READ works.
FOR/NEXT and INSTR() works.

Floating point division works, including rounding from rounding. 1/3+1/3+1/3 gives 1.
Integer division now also works with negative numbers and floating point numbers, resulting in MOD also working.
Speeded up dispatch by only doing SkipSpace when actually needed.

Floating point arithmetic! While all the internals could pass around and store floating point values, all the arithmetic was integer only. I knew the concepts of floating point arthimetic from 'O' level maths, so sat down to implement it. The main code for addition was fairly simple, the fiddly bits is when the signs are different and the result is on the other size of zero. Multiplication also done, which was easier. Division to do next, then power, which may be fiddly.
Note: the printout routine only prints integers, which is why PI+PI=6 and PI*PI=9.

Dynamic variables implemented, all heap items now word aligned.
Got Unix brk() call working, documentation was faulty. Now claims as much memory as possible. END terminates if QUIT is true. TRACE output works. *cd implemented. Program can be edited from immediate mode.

OSFILE &00 (save) implemented for Unix, OPENOUT uses creat() call. SIGSEG and SIGBUS trapped and generate local error. OSARGS 0-6 reading and writing PTR, EXT, Alloc and EOF done. OSCLI implemented.

OSFILE &FF (load) implemented for Unix, load count is SP-(load address). Can load and run programs on Unix. If running on Unix, PAGE=(SP AND &FC00), putting program and heap at bottom of Unix's stack memory. Having difficulty working out how to get brk() call to claim low memory to work correctly, or how to find out how far stack memory can be pushed down before generating a Memory Fault. Comparisons implemented, so proper Beers program can be used.

Static variables implemented, variable reading and assignment mostly working, indirection working. Added ^ (AddrOf) function, calls to MOS functions working with returned registers returned to evaluator the correct way around. More work on getting interface to real Unix working. Bit of a slog getting SIGINT and SIGQUIT background handler working properly while allowing them to operate while waiting for raw-ish input.

Full 7-level recursive expression evaluator written, full set of integer arithmetic routines, decimal number printing, completed all I/O commands.

Forgot to demo I/O commands when could see results. All work, but with test code removed from PRINT, can't see results of functions.
PRINT works, including all print formatting. Number output currently returns a dummy string.

Input doesn't echo, DEL in line input backspaces, ESC returns escape state and returns to generate error quitting restores tty state.
Execution dispatch works. PRINT currently justs prints the evaluation result: type, value: string, string length, string start or integer, b16-b31, b0-b15 or real exponent, mantissa b16-b31, b0-b15. tty settings not set, so input echoes, and BS causes a quit.

Reads input line, but dumps core Reading words from non-word aligned addresses
Successfully starts up

Authored by J.G.Harston - Last update: 21-Aug-2016