--- /dev/null
+* (O$LA)
+*
+*
+* PROGRAM TITLE: O$LA (O$LA,O$LE,O$LH,O$LC,O$LF)
+* LINE PRINTER ROUTINES
+*
+* REVISIONS:
+* 1.0 (2005-02-04)
+* 1.1 (2006-04-03) - GET IT SMALLER
+*
+* AUTHOR
+*
+* PHILIPP HACHTMANN
+*
+*
+* PURPOSE
+*
+* THESE ARE THE LIBRARY ROUTINES FOR HACHTI'S LINE PRINTER INTERFACE
+*
+* ******* SPECIAL VERSION CONFIGURED FOR 80*64 LASER PRINTER!
+*
+* RESTRICTIONS
+*
+* DEPENDS ON HACHTI'S HARDWARE AND FORTRAN IV COMPILER TAPE
+*
+*
+* STORAGE
+*
+* 420 (OCTAL)
+* 271 (DECIMAL)
+*
+*
+* USE
+*
+* CALL O$LA
+* DAC (BUFFER ADDRESS)
+* NORMAL
+*
+* THIS PRINTS ONE LINE OF LISING TEXT
+* (60 2-CHAR WORDS MAX) TO THE LINE PRINTER.
+*
+*
+* CALL O$LH
+* DAC (HEADING ADDRESS)
+* NORMAL RETURN
+*
+* SETUP THE LISTING HEADER
+* RESETS THE PAGE COUNTER AND SPACES TO THE BEGINNING OF
+* THE NEXT PAGE.
+*
+*
+* CALL O$LP
+* DAC (BUFFER ADDRESS)
+* NORMAL RETURN
+*
+* PRINT TEXT FROM BUFFER. NO CR OR LF IS OUTPUT.
+*
+* CALL O$LC
+* NORMAL RETURN
+*
+* PRODUCE A CARRIAGE RETURN ON THE LINE PRINTER.
+*
+*
+* CALL O$LF
+* NORMAL RETURN
+*
+* SEND A LINE FEED COMMAND TO THE PRINTER.
+*
+*
+* CALL O$LE
+* NORMAL RETURN
+*
+* EJECT CURRENT PAGE
+* SPACES TO THE BEGINNING OF THE NEXT PAGE BY SENDING
+* A FF CHARACTER TO THE PRINTER.
+*
+********************************************************************************
+*
+ SUBR O$LA TYPE A COMPLETE LINE WITH CR/LF, HEADING ETC.
+ SUBR O$LH INITIALISE HEADING
+ SUBR O$LP,T1 TYPE A LINE, NO CR
+ SUBR O$LC,T20 RETURN THE CARRIAGE
+ SUBR O$LF,T30 ADVANCE TO NEXT LINE
+ SUBR O$LE,FF EJECT PAGE
+*
+ SUBR O$LSK1,SKP1 EMPTY LINES BETWEEN TOP OF PAGE AND HEADING
+ SUBR O$LSK2,SKP2 EMPTY LINES BETWEEN HEADING AND MAIN TEXT
+ SUBR O$LLPP,LPP PURE TEXT LINES PER PAGE
+ SUBR O$LRS,RS DISTANCE FROM PAGE NUMBERING TO RIGHT MARGIN
+*
+********************************************************************************
+*
+ REL RELOCATEABLE MODE
+ ORG 0
+*
+* CONFIGURATION
+LPP DEC 60 DATA LINES PER PAGE (WITHOUT HEADING ETC.)
+LNW DEC 40 LINE LENGTH IN 2-CHAR WORDS
+*
+*
+O$LA DAC **
+ LDA* O$LA BUFFER ADDRESS
+ STA LBUF STORE
+ LDA LINE LEFT LINE COUNTER
+ SZE LINES LEFT ON PAGE?
+ JMP PGOK YES, JUMP AWAY
+ JST FF CALL FORM FEED ROUTINE
+PGOK LDA LPP LINES PER PAGE
+ TCA
+ CAS LINES ARE WE ON THE FIRST LINE?
+ JMP *+2 NO, WE ARE NOT.
+ JST NP MAKE HEADER, SPACING ETC.
+ NOP
+ IRS LINE BUMP COUNTER
+ NOP WE DON'T CONTROL THAT HERE ANYMORE
+ JST T1 PRINT THE LINE
+LBUF DAC ** ADDRESS OF LINE BUFFER
+ JST T20 CARRIAGE RETURN
+ JST T30 LINE FEED
+ IRS O$LA MAKE RETURN ADDRESS
+ JMP* O$LA RETURN
+*
+*
+O$LH DAC ** INIT HEADING
+ LDA* O$LH
+ STA P1 POINTER TO SOURCE
+ LDA HBUP
+ STA P2 POINTER TO TARGET
+ LDA LNW LINE LENGTH
+ TCA
+ STA CNT
+HL1 LDA* P1
+ STA* P2
+ IRS P1
+ IRS P2
+ IRS CNT READY?
+ JMP HL1 NO
+ LDA LPP LINES PER PAGE
+ TCA RENEW
+ STA LINE THE LINE COUNTER
+ IRS O$LH ADJUST ADDRESS
+ CRA
+ STA LN1 CLEAR PAGE NUMBERING
+ STA LN2 CLEAR PAGE NUMBERING
+ STA LN3 CLEAR PAGE NUMBERING
+ JMP* O$LH RETURN
+*
+*
+*
+SKP1 DEC 0 EMPTY LINES BEFORE HEADING
+SKP2 DEC 1 EMPTY LINES BETWEEN HEADING AND TEXT
+NP DAC ** PREPARE NEW PAGE
+ LDA SKP1 SPACES BEFORE HEADING
+ SNZ SPACING REQUIRED?
+ JMP NHDS NO SPACE BEFORE HEADING
+ TCA
+ STA CNT
+S1 JST T30 LINE FEED
+ IRS CNT
+ JMP S1
+NHDS JST LNNR PREPARE LINE NUMBERING
+ JST T1 TYPE HBUF
+HBUP DAC HBUF ADDRESS OF HEADER BUFFER
+ JST T20 CARRIAGE RETURN
+ JST T30 LINE FEED
+ LDA SKP2 NUMBER OF SPACES BEFORE TEXT
+ SNZ SPACING REQUIRED?
+ JMP NSPC NO, IT'S NOT.
+ TCA NEGATE
+ STA CNT TO COUNTER
+SP1 JST T30 LINE FEED
+ IRS CNT DEC COUNTER, SKIP IF READY
+ JMP SP1 NOT READY
+NSPC JMP* NP RETURN
+*
+* FORM FEED
+FF DAC **
+ LDA LPP REFILL
+ TCA THE
+ STA LINE LINE COUNTER
+*
+ LDA =12 FORM FEED
+ OTA 0 SEND FORMFEED
+ JMP *-1 WAIT
+ JMP* FF RETURN
+*
+*
+* VARIABLES
+XR DEC 0 THE CALLER'S X REGISTER
+CNT DEC 0
+HBP DAC HBUF
+P1 DEC 0 POINTER 1
+P2 DEC 0 POINTER 2
+LINE DEC -40 NEG LINES LEFT ON PAGE
+PGS BCI 5, PAGE XXX
+PGSP DAC PGS POINTER TO PGS
+*
+*
+************************************************************
+*
+* OUTPUT LINE
+T1 DAC **
+ STX XR SAVE CALLER'S INDEX REGISTER
+ LDA* T1
+ ADD LNW LINE WIDTH
+ ADD ='40000 SET TAG
+ STA T6
+ IRS T1
+ LDA LNW LINE WIDTH
+ TCA NEGATE
+ STA 0
+T3 LDA* T6
+ CAS ='120240
+ JMP *+2
+*
+ JMP T8
+T4 JST T14
+ IRS 0
+ JMP T3
+ LDX XR RESTORE CALLER'S INDEX REGISTER
+ JMP* T1
+T6 *** **
+*
+*
+T8 LDA 0
+ STA T12
+T10 IRS 0
+ JMP *+2
+ JMP* T1
+ LDA* T6
+ CAS ='120240
+ JMP *+2
+ JMP T10
+ LDA T12
+ STA 0
+ LDA ='120240
+ JMP T4
+T12 *** **
+*
+*
+T14 DAC **
+ ICA
+ OTA 0
+ JMP *-1
+ ICA
+ OTA 0
+ JMP *-1
+ JMP* T14
+****
+*
+* CARRIAGE RETURN
+T20 DAC **
+ LDA =13 CR CHARACTER
+ OTA 0 OUTPUT
+ JMP *-1
+ JMP* T20 RETURN
+*
+* LINE FEED
+T30 DAC **
+ LDA =10 LF CHARACTER
+ OTA 0 OUTPUT
+ JMP *-1 RETURN
+ JMP* T30
+*
+* PRINT LINE NUMBER TO BUFFER
+LNNR DAC ** INCREMENT LINE NUMBER, PUT TO BUFFER
+ JST LNR INCREMENT DIGIT
+LN1 DEC 0 LEAST SIGNIFICANT DIGIT
+ JMP RDY NO CARRY, COUNTING READY
+ JST LNR INCREMENT DIGIT
+LN2 DEC 0 SECOND DIGIT
+ JMP RDY NO CARRY, COUNTING READY
+ JST LNR INCREMENT DIGIT
+LN3 DEC 0 THIRD DIGIT
+ NOP NO CARRY, FINE
+RDY NOP OVERFLOW, BUT WHAT SHOULD WE DO?
+*
+*
+ LDA LN3 LEFTMOST VALUE (100)
+ JST MDG CONVERT
+ LRR 8 SHIFT DOWN
+ LDA =32 SPACE
+ LLR 8 SHIFT BACK
+ STA PGS+3 STORE
+*
+ LDA LN1 RIGHTMOST DIGIT (1)
+ ADD =48 ZERO CHARACTER
+ LRR 8 SHIFT AWAY
+*
+* MIDDLE VALUE CAN BE SPACE OR 0
+ LDA LN3 ASK LEFTMOST NUMBER
+ SNZ
+ JMP ZZ3
+ ADD =48
+ JMP ZZZ
+ZZ3 LDA LN2 MIDDLE VALUE (10)
+ JST MDG CONVERT
+ZZZ LLR 8 SHIFT UP AGAIN
+ STA PGS+4 STORE INTO POSITION
+*
+*
+ LDA HBP HEADER BUFFER ADDRESS
+ ADD LNW PAGE WIDTH
+ SUB RS RIGHT SPACING
+ ADD ='40000 SET INDEX BIT
+ STA P1 TO WRITE POINTER
+ LDA PGSP PAGE NUMBER BUFFER ADDRESS
+ ADD =5 ADD PAGE NUMBERING LENGTH
+ ADD ='40000 SET INDEX BIT
+ STA P2 TO READ POINTER
+ LDA =-5
+ STA 0
+PP1 LDA* P2
+ STA* P1
+ IRS 0
+ JMP PP1
+ JMP* LNNR RETURN
+RS DEC 0 RIGHT DISTANCE FOR PAGE NUMBERING (2-CHAR WORDS)
+*
+*
+MDG DAC ** MAKE DIGIT FROM A
+ SZE
+ JMP NZ NO ZERO
+ LDA =32 IS ZERO->SPACE
+ JMP* MDG RETURN
+NZ ADD =48 THE ZERO CHARACTER
+ JMP* MDG
+*
+*
+LNR DAC ** DIGIT SERVICE
+ IRS* LNR INCREMENT DIGIT
+ LDA* LNR LOAD NEW VALUE OF DIGIT
+ SUB =10 TEST IF OVERFLOW
+ SZE OVERFLOW?
+ JMP NOFL NO, TAKE FIRST RETURN
+ STA* LNR YES, CLEAR DIGIT (A WAS ZERO)
+ IRS LNR TALLY RETURN ADDRESS
+NOFL IRS LNR TALLY RETURN ADDRESS
+ JMP* LNR
+*
+HBUF BCI 20,
+ BCI 20,
+ BCI 20,
+*
+ FIN WRITE OUT LITERALS
+*
+* PUH.....
+*
+ END