mkweb

PDP-8 Emulator written in Javascipt with HTML5 Canvas based frontend.

/ Test program to print a solid 80x24 box of ascii characters

*20
MAXCOL, 7657     / 80 Columns - 0120 oct - 2's complement 7660 - 1 = 7657
MAXROW, 7750      / 24 Rows - 0030 oct - 2's complement 7750

CURCOL, 0
CURROW, 0

*200
BEG,    TAD MAXROW
        DCA CURROW
COL,    TAD MAXCOL
        DCA CURCOL
LOOP,   TAD CURCOL  / Load current column into AC
        IAC         / Increment AC
        DCA CURCOL  / Save new column
        TAD CURCOL  / Load value back into AC
        SMA         / Skip if we haven't reached max columns
        JMP ROW     / Jump to next row routine
        JMS PUTCH   / Print a 0
        CLA         / Clear AC in preparation for loop
        JMP LOOP    / Loop until max columns has been reached

ROW,    CLA         / Clear AC
        TAD CURROW  / Load current row into AC
        IAC         / Increment AC
        DCA CURROW  / Save new row
        TAD CURROW  / Load value back into AC
        SMA         / Skip if we havent reached max rows
        JMP END     / Jump to end routine
        JMS PUTLN   / Print newline character
        CLA         / Clear AC
        JMP COL     / Jump to start of row 

PUTCH,  0
        CLA         / Clear AC
        TAD CHAR    / Load character
        TSF         / Skip if teleprinter flag set
        JMP .-1     / Else jump back and loop
        TLS         / Transfer char in AC, print, clear flag
        JMP I PUTCH / Return from subroutine
CHAR,   '!'

PUTLN,  0
        CLA         / Clear AC
        TAD LF      / Load character
        TSF         / Skip if teleprinter flag set
        JMP .-1     / Else jump back and loop
        TLS         / Transfer char in AC, print, clear flag
        JMP I PUTLN / Return from subroutine
LF,     '\n'

END,    CLA CLL
        TAD CHAR
        HLT
        CLA
        ISZ CHAR
        JMP BEG
$