plato:source:plaopl:exec10
Table of Contents
EXEC10
Table Of Contents
- [00006] EXEC10 OVERLAYS FOR COMMAND EXECUTION
- [00239] RBR - RESTORE B REGISTERS
- [00261] PLC - CYBIL ASCII CODES TO PLATO OUTPUT
- [00278] PLV - GENERATE VALUE FOR PLATO CODES
- [00351] -NAPLPS- COMMAND EXECUTION
Source Code
- EXEC10.txt
- EXEC10
- IDENT PLAT36$
- LCC OVERLAY(PLATO,1,0)
- END
- IDENT EXEC10
- TITLE EXEC10 OVERLAYS FOR COMMAND EXECUTION
- CST
- SPACE 5,11
- EXEC10$ OVFILE
- * /--- BLOCK CHARCNV 00 000 83/07/29 09.13
- CHARCNV TITLE CHARCNV - CONVERT CHARACTER SETS.
- * CONVERT CHARACTERS FROM PLATO TO ASCII
- *
- * CHARCNV PLATO,BUF1,LEN1,BUF2,LEN2,LEN3
- *
- * CONVERT CHARACTERS FROM ASCII TO PLATO
- *
- * CHARCNV ASCII,BUF1,LEN1,BUF2,LEN2,LEN3
- *
- * LEN1 = SOURCE BUFFER LENGTH IN SOURCE CHARACTERS
- * LEN2 = MAXIMUM DESTINATION BUFFER LENGTH IN WORDS
- * LEN3 = DESTINATION BUFFER LENGTH IN CHARACTERS
- * /--- BLOCK CHARCNV 00 000 83/07/29 09.13
- SPACE 5,11
- CHARCNX OVRLAY
- SX6 6 (X6) = MAXIMUM OF 6 ARGUMENTS
- CALL GETARGS
- * DETERMINE TYPE OF CONVERSION
- SA1 VARBUF
- AX1 60-XCODEL
- SX6 X1 (X6) = 0 IF PLATO TO ASCII
- SA6 CVT SAVE CONVERSION TYPE
- * CHECK SOURCE MESSAGE BUFFER
- SA1 VARBUF+1
- BX5 X1
- NGETVAR
- SX6 A1
- SA6 SBA
- * CHECK SOURCE MESSAGE BUFFER LENGTH
- SA1 VARBUF+2
- BX5 X1
- NGETVAR
- BX6 X1
- SA6 SBL
- SA2 CVT
- SA2 CCH+X2 (X2) = CHARACTERS PER WORD
- PX1 X1 CONVERT CHARACTERS TO WORDS
- NX1 X1
- FX1 X1+X2
- FX1 X1/X2
- UX1,B1 X1
- LX1 B1
- SA2 SBA
- SA0 X2
- RJ =XBOUNDS VERIFY SOURCE BUFFER IN BOUNDS
- * CHECK DESTINATION MESSAGE BUFFER
- SA1 VARBUF+3
- BX5 X1
- NGETVAR
- SX6 A1
- SA6 DBA
- * CHECK DESTINATION BUFFER LENGTH
- SA1 VARBUF+4
- BX5 X1
- NGETVAR
- BX6 X1
- SA6 DBL
- SA2 DBA CHECK BUFFER IN BOUNDS
- SA0 X2
- RJ =XBOUNDS
- SB1 1 (B1) = 1
- * SAVE B REGISTERS
- SX6 B4
- SA6 SBR
- SX6 B5
- SA6 A6+B1
- SX6 B6
- SA6 A6+B1
- SX6 B7
- SA6 A6+B1
- * SET UP REGISTERS
- SA1 SBA
- SA2 SBL (X2) = INPUT CHARACTER COUNT
- MX0 -6 (X0) = MASK 6
- MX7 -8 (X7) = MASK 8
- SB4 B0 (B4) = OUTPUT CHARACTER COUNT
- SA1 X1 (X1) = INPUT WORD
- BX6 X6-X6 (X6) = OUTPUT WORD
- SA3 DBA
- SB5 X3 (B5) = OUTPUT WORD ADDRESS
- SA3 DBL
- SB6 B5+X3 (B6) = LWA+1 OUTPUT BUFFER
- SA3 CVT
- NZ X3,CAS CONVERT TO ASCII
- * /--- BLOCK CPL 00 000 83/07/29 09.14
- * CONVERT ASCII TO PLATO
- SB2 5 (B2) = CHARACTERS IN WORD
- SB3 60-6 (B3) = OUTPUT SHIFT COUNT
- CPL1 SX2 X2-1
- NG X2,CPL6 IF CONVERSION COMPLETE
- LX1 12
- BX5 -X7*X1
- SB2 B2-B1
- NZ B2,CPL2 IF MORE CHARACTERS
- SA1 A1+B1
- SB2 5
- CPL2 LX5 -1
- SA3 XAP+X5 GET PLATO CODES
- NG X5,CPL3 IF ODD CHARACTER
- AX3 8
- CPL3 BX5 -X0*X3 (X5) = PLATO CHARACTER
- LX3 59-7
- ZR X5,CPL1 IF NO TRANSLATION
- PL X3,CPL4 IF NO SHIFT PREFIX
- SX4 70B
- LX4 B3
- BX6 X6+X4
- SB3 B3-6
- SB4 B4+B1
- GE B3,CPL4 IF WORD NOT FULL
- GE B5,B6,CAS8 IF BUFFER TOO SHORT
- SA6 B5
- SB5 B5+B1
- BX6 X6-X6
- SB3 60-6
- CPL4 LX3 1
- PL X3,CPL5 IF NO ACCESS PREFIX
- SX4 76B
- LX4 B3
- BX6 X6+X4
- SB3 B3-6
- SB4 B4+B1
- GE B3,CPL5 IF WORD NOT FULL
- GE B5,B6,CAS8 IF BUFFER TOO SHORT
- SA6 B5
- SB5 B5+B1
- BX6 X6-X6
- SB3 60-6
- CPL5 LX5 B3
- BX6 X6+X5
- SB3 B3-6
- SB4 B4+B1
- GE B3,CPL1 IF WORD NOT FULL
- GE B5,B6,CAS8 IF BUFFER TOO SHORT
- SA6 B5
- SB5 B5+B1
- BX6 X6-X6
- SB3 60-6
- EQ CPL1
- * CONVERSION COMPLETE
- CPL6 SB7 60-6
- EQ CAS6
- * /--- BLOCK CAS 00 000 83/07/29 09.18
- * CONVERT PLATO TO ASCII
- CAS SB2 10 (B2) = CHARACTERS IN WORD
- SB3 60-12 (B3) = OUTPUT SHIFT COUNT
- BX4 X4-X4 (X4) = SHIFT/ACCESS FLAGS
- CAS1 SX2 X2-1
- NG X2,CAS5 IF CONVERSION COMPLETE
- LX1 6
- BX3 -X0*X1
- SB2 B2-B1
- NZ B2,CAS2 IF MORE CHARACTERS
- SA1 A1+B1
- SB2 10
- CAS2 SX5 X3-70B
- NZ X5,CAS3 IF NOT A SHIFT CODE
- SX3 8
- BX4 X4-X3
- EQ CAS1
- CAS3 SX5 X3-76B
- NZ X5,CAS4 IF NOT AN ACCESS CODE
- SX3 16
- BX4 X4-X3
- EQ CAS1
- CAS4 SA3 XAP+X3 GET ASCII CHARACTER
- SB7 X4+12+8
- LX3 B7
- BX3 -X7*X3 EXTRACT CHARACTER
- BX4 X4-X4 CLEAR SHIFT/ACCESS FLAG
- ZR X3,CAS1 IF NO TRANSLATION
- LX3 B3
- BX6 X6+X3
- SB3 B3-12
- SB4 B4+B1
- GE B3,CAS1 IF ROOM FOR MORE CHARACTERS
- GE B5,B6,CAS8 IF BUFFER TOO SHORT
- SA6 B5
- SB5 B5+B1
- SB3 60-12
- BX6 X6-X6
- EQ CAS1 PROCESS NEXT CHARACTER
- * CONVERSION COMPLETE
- CAS5 SB7 60-12
- CAS6 EQ B7,B3,CAS7 IF NO PARTIAL WORD LEFT
- GE B5,B6,CAS8 IF BUFFER TOO SHORT
- SA6 B5
- * RETURN CONVERTED CHARACTER COUNT
- CAS7 SA1 VARBUF+5
- BX5 X1
- SX6 B4 (X6) = OUTPUT CHARACTER COUNT
- RJ RBR RESTORE B REGISTERS
- NPUTVAR
- EQ =XCKPROC EXIT
- * PROCESS DESTINATION BUFFER TOO SHORT
- CAS8 RJ RBR RESTORE B REGISTERS
- EXECERR 46
- * /--- BLOCK SUBS/DATA 00 000 83/07/29 09.20
- RBR SPACE 5,11
- ** RBR - RESTORE B REGISTERS
- *
- * B REGISTERS B4 - B7 ARE RESTORED TO INITIAL VALUES
- RBR PS
- SA1 SBR
- SB4 X1
- SA1 A1+B1
- SB5 X1
- SA1 A1+B1
- SB6 X1
- SA1 A1+B1
- SB7 X1
- EQ RBR
- * DATA STORAGE
- CCH DATA 5.0 ASCII CHARACTERS PER WORD
- DATA 10.0 PLATO CHARACTERS PER WORD
- * /--- BLOCK TABLES 00 000 83/07/29 09.20
- PLC SPACE 5,11
- ** PLC - CYBIL ASCII CODES TO PLATO OUTPUT
- *
- * PLC (EVEN CODES,PLOT),(ODD CODES,PLOT)
- *
- * CODES = PLATO CHARACTER CODES TO PLOT CHARACTER
- * PLOT = CHARACTER PLOTTING ACTION
- PLC MACRO C0,C1
- PLV .3,C0
- PLV .4,C1
- .2 OCTMIC .1,3
- VFD 12/0,8/K".2",8/KS".2",8/KA".2",8/KSA".2",8/.3,8/.4
- .1 SET .1+1
- ENDM
- ** PLV - GENERATE VALUE FOR PLATO CODES
- *
- * PLV VALUE SYMBOL,PLATO CODES,PLOTTING ACTION
- PLV MACRO V,P,PA
- .5 SET 1
- .7 SET 0
- V SET 0
- .S MICRO 1,, K
- DUP 99
- .6 MICRO .5,2, P
- . IFC EQ,*".6"**
- V SET V+.7
- STOPDUP
- . ELSE
- .. IFC EQ,*".6"*70*
- V SET V+200B
- .S MICRO 1,, ".S"S
- .. ELSE
- ... IFC EQ,*".6"*76*
- V SET V+100B
- .S MICRO 1,, ".S"A
- ... ELSE
- .7 SET ".6"_B
- ... ENDIF
- .. ENDIF
- .5 SET .5+2
- . ENDIF
- ENDD
- .6 OCTMIC .7,3
- . IF -DEF,".S"_".6"
- ".S"_".6" EQU .N
- . ENDIF
- .N SET .N+1
- ENDM
- NOREF .N,.1,.2,.3,.4,.5,.6,.7
- .1 SET 0
- .N SET 0
- LIST X
- *CALL PLATASC
- LIST *
- SPACE 5,11
- * BUILD SYMBOLS FOR ALL UNDEFINED CHARACTERS
- .1 SET 0
- DUP 128
- .2 OCTMIC .1,3
- NOREF K".2",KS".2",KA".2",KSA".2"
- IF -DEF,K".2",1
- K".2" EQU 0
- IF -DEF,KS".2",1
- KS".2" EQU 0
- IF -DEF,KA".2",1
- KA".2" EQU 0
- IF -DEF,KSA".2",1
- KSA".2" EQU 0
- .1 SET .1+1
- ENDD
- SPACE 5,11
- * TEMPORARY VARIABLES
- SBA EQU TBINTSV+0 SOURCE BUFFER ADDRESS
- SBL EQU TBINTSV+1 SOURCE BUFFER LENGTH
- DBA EQU TBINTSV+2 DESTINATION BUFFER ADDRESS
- DBL EQU TBINTSV+3 DESTINATION BUFFER LENGTH
- CVT EQU TBINTSV+4 CONVERSION TYPE
- SBR EQU TBINTSV+5 B-REGISTER SAVE (4 WORDS)
- ENDOV
- TITLE -NAPLPS- COMMAND EXECUTION
- **
- * -NAPLPS- (CODE = 300)
- *
- * NAPLPS SET,BUFFER,COUNT
- * NAPLPS '7ASCII'7,VIDBUF,12
- *
- * (NAPLPS = NORTH AMERICAN PRESENTATION LEVEL PROTOCOL SYNTAX)
- *
- * -NAPLPS- SENDS RAW NAPLPS (VIDEOTEX) DATA TO
- * A NAPLPS-SPEAKING TERMINAL VIA A SPECIAL
- * FORMATTER CODE.
- *
- * ',SET', IS A LEFT-JUSTIFIED STRING SPECIFYING THE
- * REPERTOIRE SET TO BE INVOKED.
- *
- * ',BUFFER', IS THE FIRST VARIABLE OF A BUFFER
- * CONTAINING NAPLPS CODES. CODES ARE PACKED
- * RIGHT-JUSTIFIED IN 12-BIT BYTES, 5 BYTES PER
- * 60-BIT WORD.
- *
- * ',COUNT', SPECIFIES THE NUMBER OF CODES TO BE
- * SENT TO THE TERMINAL.
- *
- * ON EXIT, *ZRETURN* = -1 IF EVERYTHING IS OK
- * 0 IF THE REPERTOIRE SET NAME
- * IS INVALID
- * 1 IF ',COUNT', IS INVALID
- **
- EXT RETRNZ
- EXT PROCESS
- NAPLPSX OVRLAY
- SX6 -1
- SA6 TRETURN INITIALLY OK
- SA5 A5 ENSURE COMMAND WORD UNCHANGED
- SX6 3 THREE VARS TO UNPACK
- RJ =XGETCODX IN EXEC1
- * CHECK COUNT AGAINST FREE SPACE IN *MOUT*
- SA1 VARBUF+2 COUNT IN THIRD VAR
- BX5 X1 X5 = GETVAR CODE FOR -NGETVAR-
- NGETVAR RETURNS COUNT IN X1
- MX0 -6
- BX0 X0*X1 LIMIT MAX BYTES TO 0..127
- NZ X0,BADCNT -> BAD COUNT ERRROR
- BX6 X1 SAVE COUNT
- SA6 COUNT
- ZR X1,MOUTCHK -> NO BYTES; CHECK BUFFER SPACE
- SA2 FIVEP0 X2 = 5.0 (BYTES / WORD)
- BX0 X2 X0 = 5.0
- PX1 X1 FLOAT BYTES COUNT
- NX1 X1
- FX3 X1/X0 X3 = COUNT / 5.0
- UX2 X3,B2 X2 = WHOLE PART OF QUOTIENT
- LX2 B2
- PX2 X2 RE-FLOAT FOR SUBTRACT
- NX2 X2
- FX3 X2*X0 X3 = WHOLE PART * 5.0
- FX3 X1-X3 X3 = REMAINDER
- UX3 X3,B2
- LX3 B2
- ZR X3,WDS -> BYTE COUNT EVENLY DIV. BY 5
- SA1 ONEP0 X1 = 1.0
- FX2 X1+X2 BUMP WORDS COUNT BY 1
- WDS BSS 0
- UX6 X2,B2 FIX WORDS COUNT
- LX6 B2
- SA6 WORDS
- MOUTCHK BSS 0
- SA1 MOUTLOC
- SX6 X6+1 ADD ONE FOR HEADER WORD
- IX1 X1+X6 COUNT + CURRENT *MOUT* CONTENTS
- SX1 X1-MOUTLTH SEE IF BUFFER CAN HOLD BYTES
- PL X1,RETRNZ -> BACK UP AND END TIMESLICE
- * DECODE FIRST VAR (SET NAME)
- SA1 VARBUF
- BX5 X1 NGETVAR WANTS IT IN X5
- NGETVAR RETRIEVE ALPHA STRING
- SA2 SETLIST SET NAME TABLE FIRST ENTRY
- SETCHEK BSS 0 MAKE SURE IT'7S A VALID SET NAME
- BX0 X1-X2 CHECK NAME AGAINST TABLE ENTRY
- ZR X0,OKSET -> FOUND IT
- SA2 A2+B1 GET NEXT TABLE ENTRY
- NZ X2,SETCHEK -> CHECK NEXT TABLE ENTRY
- SX6 0 BAD SET NAME
- SA6 TRETURN
- EQ PROCESS -> END COMMAND NOW
- OKSET BSS 0 SET IS VALID
- SX6 A2-SETLIST+1 X6 = SET ORDINAL
- SA2 COUNT RETRIEVE BYTES COUNT
- LX6 18 POSITION ORDINAL FOR *MOUT* CODE
- BX1 X6+X2 ADD ORDINAL + COUNT
- *
- * ADD WORDS COUNT TO HEADER WORD SO FRAMAT KNOWS
- * HOW MANY WORDS TO SKIP IF USER IS ON A NON-NAPLPS
- * TERMINAL.
- *
- SA3 WORDS X3 = WORDS COUNT
- SX3 X3+1 ADD ONE FOR HEADER
- LX3 12 MAKE ROOM FOR *MOUT* CODE
- SX2 VTXCODE
- BX3 X3+X2 FORM *MOUT* CODE
- *
- * FINAL HEADER WORD FORMAT';
- * 10/0,8/SET ORDINAL,18/BYTE COUNT,12/WORD COUNT,12/VTXCODE
- *
- OUTP X3 SEND TO FRAMAT
- * GET CODES FROM BUFFER. STORE IN *MOUT*.
- * (A6 MUST POINT TO CURRENT *MOUT* SLOT)
- * THIS ASSUMES THAT A1 CONTAINS THE ADDRESS OF THE
- * FIRST BUFFER VAR ON RETURN FROM -NGETVAR-.
- SA2 COUNT RE-READ BYTES COUNT
- ZR X2,PROCESS -> DONE IF NO BYTES
- SA2 WORDS X2 = WORDS COUNT
- SB2 X2 B2 = BUFFER WORD COUNT
- SA1 VARBUF+1 X1 = BUFFER GETVAR CODE
- BX5 X1 TO X5 FOR -NGETVAR-
- NGETVAR
- SB1 1
- SA3 MOUTLOC CURRENT *MOUT* ENTRIES COUNTER
- BX7 X3
- CODES BSS 0
- BX6 X1 MOVE CODES FOR STORAGE
- SA6 A6+B1 STORE IN *MOUT*
- SX7 X7+B1 INCREMENT *MOUT* ENTRIES COUNT
- SA7 A3 UPDATE *MOUTLOC*
- SB2 B2-B1 DECREMENT WORDS COUNT
- ZR B2,PROCESS -> FINISHED BUFFER
- SA1 A1+B1 GET NEXT BUFFER WORD
- EQ CODES -> SEND TO *MOUT*
- BADCNT BSS 0
- SX6 1 BAD BYTES COUNT
- SA6 TRETURN
- EQ PROCESS
- *
- * INVOKING SEQUENCE NAMES.
- * NOTE -- FRAMAT DEPENDS UPON THE ORDER OF THESE
- * STRINGS.
- *
- SETLIST BSS 0
- DATA 0LASCII
- DATA 0LPDICODE
- DATA 0LSUPPLEMENT
- DATA 0LPDIMACRO
- DATA 0LDRCS
- DATA 0LMOSAIC
- DATA 0LG3
- DATA 0LSUPCON
- DATA 0LASCIICON
- DATA 0LNONE
- DATA 0LSETUP
- DATA 0LSWITCH
- DATA 0 END OF TABLE
- COUNT BSS 1 COUNT OF BYTES TO SEND
- WORDS BSS 1 COUNT OF WORDS USED
- SETORD BSS 1 SET ORDINAL
- FIVEP0 DATA 5.0
- ONEP0 DATA 1.0
- ENDOV
- SPACE 5,11
- OVTABLE
- END EXEC10$
plato/source/plaopl/exec10.txt ยท Last modified: 2023/08/05 18:54 by Site Administrator