; ; SUBROUTINES & MAINLINE TASKS AND A RAM ; ; KEYIN: EQU 004 ; INPUT CHAR from KEYBOARD - MSB set if valid character KEYOUT: EQU 012 ; ACK keyboard interface OSCP0: EQU 8 ; SCOPE OUTPUT 0 OSCP1: EQU 9 ; SCOPE OUTPUT 1 ; TERMINAL DEPENDENT CONSTANTS WIDTH: EQU 110 ; PRINTER WIDTH IN OCTAL CR: EQU 15 ; CAR RET CHAR C ASC 1 I Cf\= 1 S LF: EQU 12 ; LINE FEED CHAR (ASC I I LF=1 2> ESC: EQU 175 ; ENTER COMMAND HOOE C ASCI I ESC= 17S ) ETX: EQU 3 ; CONTROL C EXIT TO STRT . C: EQU 103 ; REQUIRED TO ECHO ETXr - c UPARR0: EQU 136 ; REQUIRED TO ECHO ETX, -c BLANK: EQU 040 BUFFSZ: EQU 310 NUMROW: EQU 5 NUMCOL: EQU 20 ORG 001#000 BUFFER: DATA *200 ADPTR: DATA *1 COLUM: DATA *1 ROM: DATA *1 ORG 002#000 ; ASCII TABLE OF DATA ASCTAB: DATA 000,000 ; @ - starburst DATA 340,037 ; A DATA 214,037 ; B DATA 230,177 ; C DATA 206,037 ; D DATA 230,036 ; E DATA 370,137 ; F DATA 210,077 ; G DATA 144,037 ; H DATA 233,173 ; I DATA 273,173 ; J DATA 374,125 ; K DATA 234,177 ; L DATA 344,155 ; M DATA 344,147 ; N DATA 200,177 ; O DATA 360,037 ; P DATA 200,167 ; Q DATA 360,027 ; R DATA 211,037 ; S DATA 373,173 ; T DATA 244,177 ; U DATA 174,175 ; V DATA 144,167 ; W DATA 177,145 ; X DATA 377,153 ; Y DATA 033,175 ; Z DATA 000,000 ; [ DATA 000,000 ; \ DATA 000,000 ; ] DATA 000,000 ; ^ DATA 000,000 ; _ DATA 377,177 ; space DATA 377,173 ; ! DATA 357,175 ; " DATA 343,033 ; # DATA 201,173 ; $ DATA 000,000 ; % DATA 000,000 ; & DATA 377,157 ; ’ DATA 000,000 ; ( DATA 000,000 ; ( DATA 177,001 ; * DATA 377,035 ; + DATA 277,172 ; , DATA 377,037 ; - DATA 377,176 ; . DATA 177,175 ; / DATA 000,175 ; 0 - BLOCK 11;61;1 /0 through 9/ DATA 377,173 ; 1 DATA 222,037 ; 2 DATA 203,037 ; 3 DATA 345,037 ; 4 DATA 211,137 ; 5 DATA 210,037 ; 6 DATA 173,175 ; 7 DATA 200,037 ; 8 DATA 341,037 ; 9 DATA 277,137 ; : DATA 373,037 ; ; DATA 377,165 ; < DATA 177,157 ; = DATA 000,000 ; > DATA 000,000 ; ? BEGN: JMP STRT OUTPUT: CPI 037 ; control character? JTC OUTCTL ; yes, go to special handler LHI \HB\ASCTAB ; POINT AT BEGINNING OF ASCTAB NDI 077 ; STRIP 2 MSBS RLC ; multiply by two LLA ; becomes index into table LCM ; fetch first byte INL ; point to second byte LDM ; fetch second byte ; save into output buffer LHI \HB\ADPTR ; POINT to add location LLI \LB\ADPTR LAM ; get current pointer to A LLA ; move to L LMC ; SAVE high byte INL LMD ; save low byte INL CPI 310 ; end of page? JFZ OUT2 ; no - just save LLI 000 ; reset to top of page OUT2: LAL LLI \LB\ADPTR ; point to add ptr LMA ; save it RET ; return OUTCTL: LHI \HB\ADPTR ; POINT to add location LLI \LB\ADPTR CPI 12 ; line feed? JFZ OUTCR ADI 052 CPI 320 RTC ; just return if at bottom OUTCT1: LMA ; save it RET ; return OUTCR: CPI 15 RFZ ; drop char if not CR ; RET DISPLAY: LHI \HB\BUFFER ; buffer ptr into HL LLI \LB\BUFFER LCI 5 ; row counter DISP0: LDI 20 ; column counter - 20 chars per row DISP1: LAM ; OUT OSCP0 ; output first byte to port 0 INL ; LAM OUT OSCP1 ; output second byte to port 1 INL DCD ; end of line? JFZ DISP1 ; branch if not DCC ; done with page? JTZ DISP2 ; yes branch to send new page LAI 125 ; end of line char OUT OSCP0 ; output it JMP DISP0 ; continue with next row DISP2: LAI 200 ; end of page char OUT OSCP1 ; output it RET ; all done INIT: LLI BUFFSZ ; first zero entire buffer page LHI \HB\BUFFER ; LCI 377 ; P0 output char0 LDI 177 ; P1 output char1 INIT1: DCL LMD ; P1 output char to mem DCL LMC ; P0 output char to memory JFZ INIT1 ; finish initalizing buffer LCI 0 ; store zeros, the rest of the way LDC INIT2: DCL LMD ; P1 output char to mem DCL LMC ; P0 output char to memory LAL ; CPI BUFFSZ ; end of buffer? JFZ INIT2 ; no, continue RET ; ; HERE IS THE ROUTINE TO READ FROM KEYBOARD INTERFACE ; destroys C & D ; returns character in A INPUT: INP KEYIN ; read keyboard NDA ; set sign if a new character present RET ; return character in A with MSB set ; ; MINI EXEC (for test) ; STRT: CAL INIT ; initialize output buffer and pointer LAI 100 ; for test purposes, start with a starburst CAL OUTPUT ; output it LAI 040 ; now a space CAL OUTPUT ; output it LAI 101 ; output 'A' CAL OUTPUT LAI 132 ; output 'Z' CAL OUTPUT LAI 060 ; output '0' CAL OUTPUT LAI 071 ; output '9' CAL OUTPUT ; STRT1: CAL DISPLAY ; display buffer on scope CAL INPUT ; check keyboard JFS STRT1 ; no new character OUT KEYOUT ; ack character read NDI 177 ; clear MSB CAL OUTPUT ; add to output buffer JMP STRT1 ; continue display/polling