1 / IPL GENERATING PROGRAM
3 / LAST EDIT: 08-OCT-1991 12:00:00 CJL
5 / MUST BE ASSEMBLED WITH '/F' SWITCH SET.
7 / THIS IS A UTILITY NAMED IPLGEN (AKA K12IPG) TO CREATE FIELD0.IPL (AKA
8 / K12FL0.IPL) AND FIELD1.IPL (AKA K12FL1.IPL). THESE FILES ARE IN TURN MEANT
9 / FOR USE WITH THE DIRECT LOADING PROGRAM IPLOAD (AKA K12IPL). FUTURE VERSIONS
10 / OF K12MIT.SV MAY "GROW" TO USE FIELD TWO, IN WHICH CASE THIS PROGRAM WILL HAVE
13 / THIS PROGRAM ALWAYS RESIDES IN THE NEXT FIELD BEYOND K12MIT.SV, AND CREATES
14 / FILES FOR ALL FIELDS LOWER THAN ITS LOADING FIELD. THIS CURRENTLY REQUIRES A
15 / 12K MACHINE TO ENCODE ALL LOCATIONS 00000-07577 AND 10000-17577.
19 / SINCE K12MIT.SV IS A COMPLETE IMAGE FILE, IT MUST BE LOADED FIRST IN IMAGE
20 / MODE, AND THEN OVERLAYED WITH THE BINARY OF THIS ASSEMBLY:
22 / .PAL IPLGEN<IPLGEN/E/F ASSEMBLE IPLGEN PROGRAM.
24 / .LOAD K12MIT.SV/I$*IPLGEN/G=20200 LOAD K12MIT.SV IN IMAGE MODE; THE $
25 / INDICATES USING <ESC> TO TERMINATE
26 / THE LINE; THEN LOAD IPLGEN AND START.
28 / THE FILES SYS:FIELD0.IP AND SYS:FIELD1.IP WILL BE CREATED AND THE PROGRAM
29 / EXITS TO THE KEYBOARD MONITOR. THE RESULTANT FILES MAY BE EDITED AS LONG AS
30 / THE RULES OF .IPL FORMAT ENCODING ARE OBEYED (ADDITIONAL LOWER-CASE LEADER
31 / COMMENTS SHOULD BE ADDED AT THE BEGINNING, AND UNRESTRICTED COMMENTS AT THE
36 / ERROR NUMBER PROBABLE CAUSE
38 / 5 ERROR WHILE ATTEMPTING TO ENTER OUTPUT FILE.
40 / 6 OUTPUT FILE LARGER THAN AVAILABLE FILE SPACE.
42 / 7 ERROR WHILE CLOSING THE OUTPUT FILE.
44 / 8 I/O ERROR WHILE ENCODING FILE DATA.
47 CLOSE= 4 /CLOSE OUTPUT FILE
48 DFIELD= 2 /PROGRAM LOADS INTO FIELD TWO (ALSO OUTPUT COUNT)
49 DFLD= DFIELD^10 /PROGRAM FIELD FOR CDF INSTRUCTIONS
50 ENTER= 3 /ENTER TENTATIVE FILE
51 NL0001= CLA IAC /LOAD AC WITH 0001
52 NL0002= CLA CLL CML RTL /LOAD AC WITH 0002
53 NL7777= CLA CMA /LOAD AC WITH 7777
54 SBOOT= 7600 /MONITOR EXIT
55 SYSENTR=7607 /CALL SYS: HANDLER HERE
56 USERROR=7 /USER SIGNALLED ERROR
57 USRENT= 7700 /USR ENTRY POINT WHEN NON-RESIDENT
59 WRITE= 4000 /I/O WRITE BIT
60 \f FIELD DFIELD /WHERE WE LOAD
62 *20 /GET PAST AUTO-INDEX AREA
64 BUFPTR, .-. /OUTPUT BUFFER POINTER
65 DANGCNT,.-. /DANGER COUNT FOR OUTPUT FILE
66 FCNT, -DFIELD /FIELD, FILE COUNTER
67 FNAME, FILENAM FIELD0.IP /OUTPUT FILE NAME FIELD
68 LATEST, .-. /LATEST OUTPUT CHARACTER
69 OUTRECO,.-. /OUTPUT RECORD
70 SCRCASE,.-. /CURRENT MESSAGE CASE
71 SCRCHAR,.-. /LATEST MESSAGE CHARACTER
72 SCRPTR, .-. /MESSAGE POINTER
73 TEMPTR, .-. /TEMPORARY OUTPUT POINTER
74 WRDADR, .-. /WORD ADDRESS
75 WRDCNT, .-. /WORD COUNTER
77 DSETUP, .-. /DATA FIELD SETUP
78 DATFLD, CDF 00+.-. /WILL BE LATEST DATA FIELD
79 JMP I DSETUP /RETURN TO CALLER
80 \f PAGE /START AT THE BEGINNING
82 BEGIN, NOP /IN CASE WE'RE CHAINED TO
83 LOOP, TAD (FNAME) /POINT TO
84 DCA ENTAR1 /STORED FILENAME
85 DCA ENTAR2 /CLEAR SECOND ARGUMENT
86 NL0001 /SYS: IS ALWAYS DEVICE ONE
87 CDF DFLD /INDICATE OUR CALLING FIELD
88 CIF USRFLD /GOTO USR FIELD
89 JMS I (USRENTRY) /CALL USR ROUTINE
90 ENTER /ENTER TENTATIVE FILENAME
91 ENTAR1, .-. /WILL POINT TO FILENAME
92 ENTAR2, .-. /WILL BE ZERO
93 JMP ENTERR /ENTER ERROR
94 TAD ENTAR1 /GET RETURNED FIRST RECORD
95 DCA OUTRECORD /STORE IT
96 TAD ENTAR2 /GET RETURNED EMPTY LENGTH
97 IAC /ADD 2-1 FOR OS/278 CRAZINESS
98 DCA DANGCNT /STORE AS DANGER COUNT
99 NL7777 /INDICATE INITIALIZATION
100 JMS I [PUTBYTE] /INITIALIZE OUTPUT FILE
101 JMS LEADER /OUTPUT LEADER
102 JMS I (DOFLD) /OUTPUT LATEST FIELD'S DATA
103 JMS TRAILER /OUTPUT TRAILER
104 TAD ("Z&37) /GET <^Z>
105 CLOSLUP,JMS I [PUTBYTE] /OUTPUT A BYTE (^Z OR NULL)
106 TAD BUFPTR /GET THE OUTPUT BUFFER POINTER
107 TAD (-OUTBUFFER) /COMPARE TO RESET VALUE
108 SZA CLA /SKIP IF IT MATCHES
109 JMP CLOSLUP /ELSE KEEP GOING
110 NL0001 /GET SYS:'S DEVICE NUMBER
111 CDF DFLD /INDICATE OUR CALLING FIELD
112 CIF USRFLD /GOTO USR FIELD
113 JMS I (USRENTRY) /CALL USR ROUTINE
114 CLOSE /CLOSE OUTPUT FILE
115 FNAME /POINTER TO FILENAME
116 OUTCNT, .-. /WILL BE ACTUAL COUNT
117 JMP CLSERR /CLOSE ERROR
118 ISZ FNAME+2 /BUMP THE FILENAME
119 TAD DATFLD /GET CURRENT DATA FIELD
120 TAD (10) /BUMP TO NEXT FIELD
121 DCA DATFLD /STORE BACK
122 ISZ FCNT /DONE ALL FIELDS YET?
123 JMP LOOP /NO, GO DO IT AGAIN
124 CIF CDF 00 /YES, GOTO MONITOR FIELD
125 JMP I [SBOOT] /EXIT TO MONITOR
126 \f/ ERROR WHILE OUTPUTTING THE FILE.
128 PROCERR,NL0002 /SET INCREMENT
131 / ERROR WHILE CLOSING THE OUTPUT FILE.
133 CLSERR, NL0001 /SET INCREMENT
136 / OUTPUT FILE TOO LARGE ERROR.
138 SIZERR, CLA /CLEAN UP
139 TAD (3) /SET INCREMENT
144 ENTERR, NL0002 /SET INCREMENT
145 TAD (3) /ADD ON OFFSET
146 DCA ERRNUMBER /STORE ERROR NUMBER
147 CDF DFLD /ENSURE OUR FIELD
148 CIF USRFLD /GOTO USR FIELD
149 JMS I (USRENTRY) /CALL USR ROUTINE
151 ERRNUMB,.-. /WILL BE PASSED ERROR NUMBER
154 LEADER, .-. /LEADER ROUTINE
155 JMS I (SCRIBE) /CALL SCRIBE ROUTINE
156 LEADMSG /FOR LEADER MESSAGE
157 TAD DATFLD /GET CURRENT FIELD
159 AND (7) /JUST FIELD NUMBER
160 TAD (NTABLE) /POINT TO TABLE ELEMENT
161 DCA MSGPTR /STASH THE POINTER
162 TAD I MSGPTR /GET THE MESSAGE ADDRESS
163 DCA MSGPTR /STORE IN-LINE
164 JMS I (SCRIBE) /CALL SCRIBE ROUTINE
165 MSGPTR, .-. /WILL POINT TO CORRECT MESSAGE
170 TRAILER,.-. /TRAILER ROUTINE
171 JMS I (SCRIBE) /CALL SCRIBE ROUTINE
172 SAVEMSG /END OF FILE MESSAGE
173 JMS OUTFLD /OUTPUT FIELD DIGIT
174 JMS I (SCRIBE) /CALL SCRIBE ROUTINE
175 SVMSG /.SV BRIDIGING MESSAGE
176 JMS OUTFLD /OUTPUT FIELD DIGIT
177 JMS I (SCRIBE) /CALL SCRIBE ROUTINE
178 SV0MSG /0000 BRIDGING MESSAGE
179 JMS OUTFLD /OUTPUT FIELD DIGIT
180 JMS I (SCRIBE) /CALL SCRIBE ROUTINE
181 SVEMSG /FINISHING MESSAGE
182 JMP I TRAILER /RETURN
184 OUTFLD, .-. /OUTPUT FIELD DIGIT ROUTINE
185 TAD DATFLD /GET OUTPUT FIELD
187 AND (7) /JUST FIELD DIGIT
188 TAD ("0&177) /MAKE IT ASCII
189 JMS I [PUTBYTE] /OUTPUT IT
193 \fDOFLD, .-. /DO LATEST FIELD ROUTINE
194 DCA WRDADR /CLEAR WORD ADDRESS
195 TAD (-7600) /SETUP THE
196 DCA WRDCNT /WORD COUNT
197 WRDLUP, JMS DSETUP /GOTO DATA FIELD
198 TAD I WRDADR /GET A WORD
200 CDF DFLD /BACK TO OUR FIELD
201 TAD DSETUP /GET THE WORD AGAIN
202 RTR;RTR;RTR /WANT HIGH-ORDER HALF FIRST
203 JMS DOBYTE /OUTPUT HIGH-ORDER BYTE
204 TAD DSETUP /GET THE WORD AGAIN
205 JMS DOBYTE /OUTPUT LOW-ORDER BYTE
206 ISZ WRDADR /BUMP TO NEXT ADDRESS
207 TAD WRDADR /GET LATEST ADDRESS
208 AND (37) /JUST LOW-ORDER BITS
209 SNA CLA /SKIP IF NOT AT GOOD BOUNDARY
210 JMS PUTCRLF /ELSE OUTPUT LINE BREAK
211 ISZ WRDCNT /DONE ALL WORD YET?
212 JMP WRDLUP /NO, KEEP GOING
213 JMP I DOFLD /YES, RETURN TO CALLER
215 DOBYTE, .-. /OUTPUT A SIX-BIT BYTE ROUTINE
216 AND (77) /JUST SIX BITS
217 TAD (41) /ADD ON OFFSET TO MAKE IT PRINTABLE
218 JMS I [PUTBYTE] /OUTPUT IT
220 \f/ <CR>/<LF> ROUTINE.
222 PUTCRLF,.-. /OUTPUT <CR>/<LF> ROUTINE
223 TAD ("M&37) /GET A <CR>
224 JMS I [PUTBYTE] /OUTPUT IT
225 TAD ("J&37) /GET A <LF>
226 JMS I [PUTBYTE] /OUTPUT IT
227 JMP I PUTCRLF /RETURN
229 / MESSAGE PRINT ROUTINE.
231 SCRIBE, .-. /MESSAGE PRINT ROUTINE
232 TAD I SCRIBE /GET IN-LINE POINTER ARGUMENT
233 DCA SCRPTR /STASH THE POINTER
234 ISZ SCRIBE /BUMP PAST ARGUMENT
235 TAD (140) /INITIALIZE TO
236 DCA SCRCASE /LOWER-CASE
237 SCRLUP, TAD I SCRPTR /GET LEFT HALF-WORD
238 RTR;RTR;RTR /MOVE OVER
239 JMS SCRPRNT /PRINT IT
240 TAD I SCRPTR /GET RIGHT HALF-WORD
241 JMS SCRPRNT /PRINT IT
242 ISZ SCRPTR /BUMP TO NEXT PAIR
243 JMP SCRLUP /KEEP GOING
245 SCRPRNT,.-. /CHARACTER PRINT ROUTINE
246 AND (77) /JUST SIX BITS
248 JMP I SCRIBE /YES, RETURN TO ORIGINAL CALLER
249 DCA SCRCHAR /NO, SAVE FOR NOW
250 TAD SCRCHAR /GET IT BACK
251 TAD (-"%!200) /IS IT "%"?
253 JMP SCRCRLF /JUMP IF IT MATCHES
254 TAD (-"^+100+"%) /IS IT "^"
256 JMP SCRFLIP /JUMP IF IT MATCHES
257 TAD SCRCHAR /GET THE CHARACTER
258 AND (40) /DOES CASE MATTER?
260 TAD SCRCASE /ELSE GET PREVAILING CASE
261 TAD SCRCHAR /GET THE CHARACTER
262 JMS I [PUTBYTE] /OUTPUT THE CHARACTER
263 JMP I SCRPRNT /RETURN
265 SCRCRLF,JMS PUTCRLF /OUTPUT <CR>/<LF>
266 JMP I SCRPRNT /RETURN
268 SCRFLIP,TAD SCRCASE /GET CURRENT CASE
270 TAD (140+100) /ADD SUM OF POSSIBLE VALUES
271 DCA SCRCASE /STORE NEW INVERTED CASE
272 JMP I SCRPRNT /RETURN
274 \fPUTBYTE,.-. /OUTPUT A BYTE ROUTINE
275 SPA /ARE WE INITIALIZING?
276 JMP PUTINITIALIZE /YES
277 AND (177) /JUST IN CASE
278 DCA LATEST /SAVE LATEST CHARACTER
279 TAD LATEST /GET LATEST CHARACTER
280 JMP I PUTNEXT /GO WHERE YOU SHOULD GO
282 PUTNEXT,.-. /EXIT ROUTINE
283 JMP I PUTBYTE /RETURN TO MAIN CALLER
285 PUTINIT,CLA /CLEAN UP
286 TAD OUTRECORD /GET STARTING RECORD OF TENTATIVE FILE
287 DCA PUTRECORD /STORE IN-LINE
288 DCA I (OUTCNT) /CLEAR ACTUAL FILE LENGTH
289 PUTNEWR,TAD (OUTBUFFER) /SETUP THE
290 DCA BUFPTR /BUFFER POINTER
291 PUTLOOP,JMS PUTNEXT /GET A CHARACTER
292 DCA I BUFPTR /STORE IT
293 TAD BUFPTR /GET POINTER VALUE
294 DCA TEMPTR /SAVE FOR LATER
295 ISZ BUFPTR /BUMP TO NEXT
296 JMS PUTNEXT /GET A CHARACTER
297 DCA I BUFPTR /STORE IT
298 JMS PUTNEXT /GET A CHARACTER
300 AND (7400) /ISOLATE HIGH NYBBLE
301 TAD I TEMPTR /ADD ON FIRST BYTE
302 DCA I TEMPTR /STORE COMPOSITE
303 TAD LATEST /GET LATEST CHARACTER
304 RTR;RTR;RAR /MOVE UP AND
305 AND (7400) /ISOLATE LOW NYBBLE
306 TAD I BUFPTR /ADD ON SECOND BYTE
307 DCA I BUFPTR /STORE COMPOSITE
308 ISZ BUFPTR /BUMP TO NEXT
309 TAD BUFPTR /GET LATEST POINTER VALUE
310 TAD (-2^200-OUTBUFFER) /COMPARE TO LIMIT
311 SZA CLA /SKIP IF AT END
312 JMP PUTLOOP /KEEP GOING
313 ISZ DANGCNT /TOO MANY RECORDS?
315 JMP I (SIZERR) /JUMP IF SO
316 CDF DFLD /SET OUR FIELD
317 CIF 00 /GOING TO SYSTEM FIELD
318 JMS I (SYSENTRY) /CALL I/O HANDLER
319 2^100+DFLD+WRITE /WRITE SOME PAGES FROM OUTPUT BUFFER
320 OUTBUFFER /BUFFER ADDRESS
321 PUTRECO,.-. /WILL BE LATEST RECORD NUMBER
322 JMP I (PROCERR) /OUTPUT ERROR!
323 ISZ I (OUTCNT) /BUMP ACTUAL LENGTH
324 ISZ PUTRECORD /BUMP TO NEXT RECORD
325 JMP PUTNEWRECORD /KEEP GOING
329 LEADMSG,TEXT "LEADER FOR DIRECT LOAD FILE WHICH MUST BE IN LOWER CASE%"
330 TEXT "%FILE CONTAINS KERMIT DATA IN IPL ENCODED FORMAT%%"
331 \f TEXT "THIS FILE CONTAINS DATA FOR FIELD"
332 ONEMSG, TEXT " ONE%%^"
333 SAVEMSG,TEXT "END OF DATA%%^A^FTER THE PROGRAM EXITS BACK TO THE MONITOR, "
334 \f TEXT "YOU SHOULD SAVE THE DATA WITH:%%.^SAVE SYS FIELD^"
337 SVEMSG, TEXT "7577=0%"
338 ZEROMSG,TEXT " ZERO%%"
339 \f/ DIGIT MESSAGE POINTER TABLE.
341 NTABLE, ZEROMSG /POINTER TO ZERO MESSAGE
342 ONEMSG /POINTER TO ONE MESSAGE
344 PAGE /GET TO A GOOD BOUNDARY
346 OUTBUFF=. /OUTPUT BUFFER HERE