Subject: /bin/as - major changes (#153 - part 2 of 2) Index: bin/as/* 2.11BSD Description: This is part 2 (of 2) of changes and improvements to the assembler. This description and the directions for applying the update are repeated in both parts of the update kit. The changes include: 1) Consolidation of the assembler source into 2 source files rather than 18 (some of which were empty/null!) files. 2) Elimination of 2 of the 3 /tmp files. Previously 'as' created 3 files in /tmp: a) /tmp/atm1aXXXXXX - the intermediate object file b) /tmp/atm2aXXXXXX - the forward/backward (fb) branch table c) /tmp/atm3aXXXXXX - the symbol table Only the first file is used now because the 'fb' and symbol tables are maintained in memory only. 3) Elimination of /lib/as2! /bin/as now contains _both_ phases of the assembler. There is no 'exec' of a second program now. Not having a second program also means that the symbol table does not need to be written out by /bin/as and then read by /lib/as2. 4) The filename '-' can be used to read input from the "stdin". 5) Support for the "string table" (a la 4.3BSD) object file format (long symbol names). The new assembler can produce _either_ the old "fixed 8" symbol table information or the new variable length "string table" format. The default is the _old style_ (obviously) but the choice of symbol table output format is a simple true/false (patchable via 'adb') flag. Repeat-By: By observation and experience. The organization of 'as' (items 1,2 and 3) has always left much to be desired. Number 4 is a nicety added at the last moment. Long symbol names (a cap of 32 characters is used to avoid running out of space) have been missing for long enough! With the assembler done only 'ld', 'ranlib', 'nlist(3)' and a few miscellaneous utilities need to be rewritten/modified. The changes to 'ld' are being sketched out on paper now. Time permitting the new symbol table format will be done on or before Christmas. Fix: MAKE SURE you have both parts 1 and 2 of this update kit! Part 2 (this part) includes the patches for 'as2.s' (the last pass of the assembler. ++++++++Description of changes+++++++++ The detailed directions for installing the assembler updates follow this description of what changes were made. I may have overlooked a couple of the smaller/cosmetic changes but those are obvious by looking at the sources. 1) All of the as1?.s files have been catenated into as0.s and the as2?.s files have been catenated into as2.s. 2) as0.s and as2.s have some of the same symbols, therefore all symbols must be _explicitly_ made global with the .globl, the old practice of using the '-' or '-g' option can not and must not be used. 3) The replicated initialization code in as2 has been removed. Because the symbol table is already in memory there is no need to read it in. Similarily the intermediate object file is already open, it merely needs to be rewound rather than reopened. 4) There is only _1_ Permanent Symbol Table (PST) now, the "duplicate" copies (one for /bin/as and another for /lib/as2) have been merged into a single table. In order to use a similar symbol table format for the PST and UST (User Symbol Table) the layout of the PST was altered - the strings are no longer embedded in the PST. A macro capability would have made this easier, but... 5) Symbol tables are extended by using either _realloc (in the case of the 'fb' table since it is never very large) or by linked blocks of memory created by _calloc. The old practice of simply calling _sbrk is not used (it meant that only the _last_ table could be expanded. Ugghh.) 6) The 'string' part of a UST entry is allocated separately from the value+flags data of a symbol. 7) A temporary file for the 'fb' table is no longer used. Instead a realloc()'d table is used. It should be noted that C files processed by /lib/c2 very _rarely_ have a 'fb' table longer than 0 bytes (because 'c2' is very good at rearranging branches). 8) Fairly large blocks of (helpful it is hoped) comments were included in the new sections of code. The tab'ing was made more uniform in other areas of the code. 9) The data and buffer declarations were consolidated at the end of each source file rather than being scattered thru the modules. 10) The hashtable is dynamically allocated rather than being statically declared. 11) Code was added in as2 to output either the old or new style of symbol table entry to the a.out file. If the global variable 'Newsym' is 0 the old style is output (this is the default) otherwise the new format is emitted. ++++++++End of Description of changes+++++++++ ---------------------start of installation instructions------------ Save the indicated portion of this file to /tmp/152. Do a similar thing to part 2 (patch #153) - saving the patch portion to /tmp/153. BACK UP THE CURRENT ASSEMBLER! Unless you're very trusting or very forgiving you will want to back up both the current executables for the assembler: tar cf safe_place.tar /bin/as /lib/as2 THEN: cd /usr/src/bin mv as as.old mkdir as chmod 755 as cd as cp ../as.old/Makefile Makefile cat ../as.old/as1?.s > as0.s cat ../as.old/as2?.s > as2.s patch < /tmp/152 patch < /tmp/153 make make install make clean make make install The double 'make' at the end makes sure that the new assembler can rebuild itself. If for any reason the patches do not apply cleanly or the assembler can not rebuild itself: tar -xpvf safe_place to restore the old versions. Then send me a mail item and I will send a complete dropin replacement for 'as'. ==============================cut here=============================== *** /usr/src/bin/as/as2.s.old Tue Sep 14 19:28:29 1993 --- /usr/src/bin/as/as2.s Wed Sep 1 19:26:36 1993 *************** *** 1,112 **** ! / ! / ! / a21 -- pdp-11 assembler pass 2 ! ! .data ! .globl _environ / for the standard library ! _environ: 0 ! .text ! ! .globl _main ! _main: ! mov $1,-(sp) / signal(SIGINT, SIG_IGN) ! mov $2,-(sp) / sys signal; 2; 1 ! jsr pc,_signal ! cmp (sp)+,(sp)+ ! ! ror r0 ! bcs 1f ! ! mov $saexit,-(sp) / signal(SIGINT, saexit) ! mov $2,-(sp) / sys signal; 2; saexit ! jsr pc,_signal ! cmp (sp)+,(sp)+ 1: - jmp start ! / set up sizes and origins ! go: ! ! / read in symbol table ! ! mov usymtab,r1 1: ! jsr pc,getw ! bvs 1f ! add $14,symsiz / count symbols ! jsr pc,getw ! jsr pc,getw ! jsr pc,getw ! jsr pc,getw ! mov r4,r0 bic $!37,r0 cmp r0,$2 /text blo 2f cmp r0,$3 /data bhi 2f ! add $31,r4 /mark "estimated" ! mov r4,(r1)+ ! jsr pc,getw ! mov r4,(r1)+ br 3f 2: clr (r1)+ clr (r1)+ - jsr pc,getw 3: ! jsr pc,setbrk ! br 1b 1: ! / read in f-b definitions ! mov r1,fbbufp ! mov fbfil,fin ! clr ibufc 1: ! jsr pc,getw ! bvs 1f add $31,r4 / "estimated" mov r4,(r1)+ ! jsr pc,getw ! mov r4,(r1)+ ! jsr pc,setbrk br 1b ! 1: mov r1,endtable mov $100000,(r1)+ ! / set up input text file; initialize f-b table ! jsr pc,setup ! / do pass 1 - jsr pc,assem - / prepare for pass 2 cmp outmod,$777 beq 1f jmp aexit 1: - clr dot - mov $2,dotrel - mov $..,dotdot - clr brtabp - - mov r1,-(sp) / protect r1 from library - mov fin,-(sp) / close(fin) - jsr pc,_close / movb fin,r0 - tst (sp)+ / sys close - mov (sp)+,r1 - - mov a.tmp1,-(sp) - jsr pc,ofile - mov r0,fin - clr ibufc jsr pc,setup - inc passno inc bsssiz bic $1,bsssiz mov txtsiz,r1 --- 1,117 ---- ! .globl _signal, _close, _lseek, _unlink, _umask, _chmod, __exit ! .globl _write, _read, _brk, _end, _open, _creat, _realloc, _fchmod ! .globl pass1, hshsiz, outmod, dot, dotdot, error ! .globl checkeos, curfb, savdot, ch, line, savop, inbuf, errflg ! .globl fbptr, fbtbl, symnum, hshtab, symblk, symleft, dotrel ! .globl symtab, aexit, overlaid, defund, a.outp, passno, filerr ! .globl wrterr, argb, errore, errora, curfb, nxtfb, usymtab ! .globl fin, fout, a.tmp1, ibufc, ibufp, obufp, outbuf, symbol ! .globl PSTENTSZ, SYMENTSZ, SYMBLKSZ, Newsym ! pass1: ! mov fout,fin / tmp file is now input file ! mov $666,-(sp) / mode ! mov $3001 ,-(sp) / O_WRONLY|O_CREAT|O_TRUNC ! mov a.outp,-(sp) / filename ! jsr pc,_open ! add $6,sp ! mov r0,fout / file descriptor any good? ! bpl 1f / yes - br ! mov a.outp,-(sp) ! jsr pc,filerr 1: ! / 'symnum' has number of symbols. The hashtable from pass 0 is no ! / longer needed - we can reuse it directly for 'usymtab' if there are less ! / than 'hshsiz' symbols. If there are more than 'hshsiz' (currently ! / 1500) symbols we have to realloc. ! / ! / The 'fb' table (usually 0 long) is appended to the 'usymtab' (4 byte ! / entries per symbol). ! mov fbptr,r0 ! sub fbtbl,r0 / # bytes in 'fb' table ! asr r0 / convert to number of words ! add symnum,r0 / add in number of symbols twice ! add symnum,r0 / because we need 2 words per symbol ! inc r0 / one more for terminator word ! cmp r0,$hshsiz / is hashtable big enough already? ! blo 1f / yes -br ! asl r0 / convert to bytes ! mov r0,-(sp) ! mov hshtab,-(sp) ! jsr pc,_realloc / hshtab = realloc(hshtab, r0) ! mov r0,hshtab ! / check for failure? 1: ! mov hshtab,r1 ! mov usymtab,r2 ! 9: ! mov r2,symblk / save ptr to start of block ! tst (r2)+ / skip link word ! mov $SYMBLKSZ,symleft / init amount left in block ! 1: ! tst (r2) / end of symbol table block ! beq 4f / yes - br ! add $8.,symsiz / size of symbol table ! tst Newsym / are we doing new style? ! bne 8f / yes - br ! add $4,symsiz / no, symbol table entries are bigger ! 8: ! mov 2(r2),r0 / flags word bic $!37,r0 cmp r0,$2 /text blo 2f cmp r0,$3 /data bhi 2f ! add $31,r0 /mark "estimated" ! mov r0,(r1)+ / store flags word ! mov 4(r2),(r1)+ / copy value word br 3f 2: clr (r1)+ clr (r1)+ 3: ! add $SYMENTSZ,r2 / skip to next symbol entry ! sub $SYMENTSZ,symleft / one symbol less in block ! cmp symleft,$SYMENTSZ / room for another symbol? ! bge 1b / yes - br ! 4: ! mov *symblk,r2 / follow link to next block ! bne 9b / if not at end 1: ! / The 'fb' table needs to be appended to the 'usymtab' table now ! mov fbtbl,r0 ! mov r1,fbbufp / save start of 'fb' table 1: ! cmp r0,fbptr / at end of table? ! bhis 2f / yes - br ! mov (r0)+,r4 add $31,r4 / "estimated" mov r4,(r1)+ ! mov (r0)+,(r1)+ br 1b ! 2: mov r1,endtable mov $100000,(r1)+ ! mov $savdot,r0 / reset the 'psect' (text,data,bss) ! clr (r0)+ / counters for the next pass ! clr (r0)+ ! clr (r0)+ ! jsr pc,setup / init fb stuff ! jsr pc,pass1_2 / do pass 1 / prepare for pass 2 + inc passno cmp outmod,$777 beq 1f jmp aexit 1: jsr pc,setup inc bsssiz bic $1,bsssiz mov txtsiz,r1 *************** *** 118,127 **** bic $1,r2 mov r2,datsiz mov r1,r3 ! mov r3,datbase / txtsiz mov r3,savdot+2 add r2,r3 ! mov r3,bssbase / txtsiz+datsiz mov r3,savdot+4 clr r0 asl r3 --- 123,132 ---- bic $1,r2 mov r2,datsiz mov r1,r3 ! mov r3,datbase / txtsiz mov r3,savdot+2 add r2,r3 ! mov r3,bssbase / txtsiz+datsiz mov r3,savdot+4 clr r0 asl r3 *************** *** 128,148 **** adc r0 add $20,r3 adc r0 ! mov r3,symseek+2 / 2*txtsiz+2*datsiz+20 mov r0,symseek sub r2,r3 sbc r0 ! mov r3,drelseek+2 / 2*txtsiz+datsiz mov r0,drelseek sub r1,r3 sbc r0 ! mov r3,trelseek+2 / txtsiz+datsiz+20 mov r0,trelseek sub r2,r3 sbc r0 mov r0,datseek ! mov r3,datseek+2 / txtsiz+20 ! mov usymtab,r1 1: jsr pc,doreloc add $4,r1 --- 133,153 ---- adc r0 add $20,r3 adc r0 ! mov r3,symseek+2 / 2*txtsiz+2*datsiz+20 mov r0,symseek sub r2,r3 sbc r0 ! mov r3,drelseek+2 / 2*txtsiz+datsiz mov r0,drelseek sub r1,r3 sbc r0 ! mov r3,trelseek+2 / txtsiz+datsiz+20 mov r0,trelseek sub r2,r3 sbc r0 mov r0,datseek ! mov r3,datseek+2 / txtsiz+20 ! mov hshtab,r1 1: jsr pc,doreloc add $4,r1 *************** *** 162,171 **** mov (r1)+,r0 mov $txtp,-(sp) jsr pc,putw ! dec r2 ! bne 1b ! jsr pc,assem /polish off text and relocation mov $txtp,-(sp) --- 167,176 ---- mov (r1)+,r0 mov $txtp,-(sp) jsr pc,putw ! sob r2,1b + jsr pc,pass1_2 / do pass 2 + /polish off text and relocation mov $txtp,-(sp) *************** *** 174,257 **** jsr pc,flush / append full symbol table - - mov symf,r0 - mov r0,fin - - clr -(sp) / lseek(fin, 0L, L_SET) - clr -(sp) / sys lseek; 0; 0; 0 - clr -(sp) - mov r0,-(sp) - jsr pc,_lseek - add $8.,sp - - clr ibufc mov symseek,r0 mov symseek+2,r1 mov $txtp,-(sp) jsr pc,oset ! mov usymtab,r1 ! 1: ! jsr pc,getw ! bvs 1f ! mov r4,r0 mov $txtp,-(sp) - jsr pc,putw - jsr pc,getw - mov r4,r0 - mov $txtp,-(sp) - jsr pc,putw - jsr pc,getw - mov r4,r0 - mov $txtp,-(sp) - jsr pc,putw - jsr pc,getw - mov r4,r0 - mov $txtp,-(sp) - jsr pc,putw - mov (r1)+,r0 - mov $txtp,-(sp) - jsr pc,putw - mov (r1)+,r0 - mov $txtp,-(sp) - jsr pc,putw - jsr pc,getw - jsr pc,getw - br 1b - 1: - mov $txtp,-(sp) jsr pc,flush ! jmp aexit saexit: mov pc,errflg aexit: ! mov a.tmp1,-(sp) / unlink(a.tmp1) ! jsr pc,_unlink / mov a.tmp1,0f ! / sys unlink; 0:.. ! mov a.tmp2,(sp) / unlink(a.tmp2) ! jsr pc,_unlink / mov a.tmp2,0f ! / sys unlink; 0:.. ! mov a.tmp3,(sp) / unlink(a.tmp3) ! jsr pc,_unlink / mov a.tmp3,0f ! / sys unlink; 0:.. tst errflg ! jne 2f ! clr (sp) / umask(0) ! jsr pc,_umask / sys umask; 0 ! bic r0,outmod / chmod(a.outp2, outmod&umask(0)) ! mov outmod,(sp) / bic r0,outmod ! mov a.outp2,-(sp) / sys chmod; a.outp2:a.out; outmod: 777 ! jsr pc,_chmod tst (sp)+ - .data - a.outp2: a.out - outmod: 0777 - .text - clr (sp) br 1f 2: --- 179,220 ---- jsr pc,flush / append full symbol table mov symseek,r0 mov symseek+2,r1 mov $txtp,-(sp) jsr pc,oset ! ! mov usymtab,r2 / pointer to first symbol block ! mov hshtab,r1 / 'type' and 'value' array ! ! tst Newsym ! beq 8f ! jsr pc,nsymout ! br 9f ! 8: ! jsr pc,osymout ! 9: mov $txtp,-(sp) jsr pc,flush ! br aexit saexit: mov pc,errflg aexit: ! mov $a.tmp1,-(sp) / unlink(a.tmp1) ! jsr pc,_unlink tst errflg ! bne 2f ! clr (sp) ! jsr pc,_umask ! bic r0,outmod / fchmod(fout, outmod&umask(0)) ! mov outmod,(sp) ! mov fout,-(sp) ! jsr pc,_fchmod tst (sp)+ clr (sp) br 1f 2: *************** *** 258,264 **** mov $2,(sp) 1: jsr pc,__exit / _exit(errflg ? 2 : 0) ! / sys exit filerr: mov 2(sp),r0 / filename string. no need to clean tst -(sp) / stack, this routine goes to saexit. --- 221,227 ---- mov $2,(sp) 1: jsr pc,__exit / _exit(errflg ? 2 : 0) ! filerr: mov 2(sp),r0 / filename string. no need to clean tst -(sp) / stack, this routine goes to saexit. *************** *** 278,285 **** mov $1,-(sp) jsr pc,_write add $6,sp ! jmp saexit doreloc: movb (r1),r0 bne 1f --- 241,388 ---- mov $1,-(sp) jsr pc,_write add $6,sp ! tst passno ! bpl saexit ! rts pc + osymout: + 9: + mov r2,symblk / save ptr to current sym block + tst (r2)+ / skip link word + mov $SYMBLKSZ,symleft / space left in symbol block + 1: + mov (r2),r4 / pointer to symbol name + beq 4f / end of block - br + + mov $8.,r5 / max number to copy + mov $symbol,r0 / destination buffer + 2: + movb (r4),(r0)+ / copy a byte + beq 6f + inc r4 / non null - bump source ptr + 6: + sob r5,2b + + / Now put four words of symbol name to the object file + mov $4,r5 / number of words to do + mov $symbol,r4 + 6: + mov (r4)+,r0 / word (2 chars) of symbol name + mov $txtp,-(sp) + jsr pc,putw + sob r5,6b + + / values from 'hshtab' (parallel array to symbol table) are retrieved now, + / they take the place of the flags and value entries of the symbol table. + mov (r1)+,r0 + mov $txtp,-(sp) + jsr pc,putw + mov (r1)+,r0 + mov $txtp,-(sp) + jsr pc,putw + add $SYMENTSZ,r2 / skip to next symbol + sub $SYMENTSZ,symleft / one less symbol in block + cmp symleft,$SYMENTSZ / room for another? + bge 1b / yes - br + 4: + mov *symblk,r2 / no, follow link to next block + bne 9b / unless it's end of list + rts pc + + nsymout: + clr totalsz + mov $4,totalsz+2 / string table min size is 4 + 9: + mov r2,symblk / save ptr to current symbol block + tst (r2)+ / skip link word + mov $SYMBLKSZ,symleft / amount of space left in block + 1: + mov (r2),r4 / pointer to symbol's string + beq 4f / end of block - br + mov totalsz,r0 / now output the... + mov $txtp,-(sp) / high order of the string index... + jsr pc,putw / to the object file + mov totalsz+2,r0 + mov $txtp,-(sp) + jsr pc,putw / and the low order word + 2: + tstb (r4)+ / find the end of the string + bne 2b + sub (r2),r4 / compute length including the null + add r4,totalsz+2 / offset of next string + adc totalsz + mov (r1)+,r0 / 'type' word of symbol + mov $txtp,-(sp) + jsr pc,putw + mov (r1)+,r0 / 'value' word of symbol + mov $txtp,-(sp) + jsr pc,putw + add $SYMENTSZ,r2 / advance to next symbol + sub $SYMENTSZ,symleft / adjust amount left in symbol block + cmp symleft,$SYMENTSZ / is there enough for another symbol? + bge 1b / yes - br + 4: + mov *symblk,r2 / follow link to next symbol block + bne 9b / more - br + mov totalsz,r0 / now output the string table length + mov $txtp,-(sp) / high order word first + jsr pc,putw + mov totalsz+2,r0 / followed by the low order + mov $txtp,-(sp) + jsr pc,putw + + / Now write the strings out + + mov usymtab,r2 / start at beginning of symbols + 9: + mov r2,symblk / save pointer to current block + tst (r2)+ / skip link word + mov $SYMBLKSZ,symleft / amount left in block + 1: + mov (r2),r4 / pointer to symbol's string + beq 4f / at end of block - br + jsr pc,putstring / write out the string + add $SYMENTSZ,r2 / advance to next symbol + sub $SYMENTSZ,symleft / adjust amount left in block + cmp symleft,$SYMENTSZ / enough for another symbol? + bge 1b / yes - br + 4: + mov *symblk,r2 / move to next block of symbols + bne 9b / any left - br + + / probably not necessary but let us leave the file size on an even + / byte boundary. + + bit $1,totalsz+2 / odd number of bytes in string table? + beq 5f / no - br + mov symblk,r4 / we know 'symblk' points to a null + jsr pc,putstring / output a single null + 5: + rts pc + + / R4 has the address of a null terminated string to write to the output + / file. The terminating null is included in the output. This routine + / "inlines" the 'txtp seek structure' manipulation because the 'putw' + / routine was 1) not suitable to byte output and 2) symbol strings are + / only written using the 'txtp' (as opposed to 'relp' - relocation info) + / structure. + + putstring: + cmp txtp,txtp+2 / room for another byte? + bhis 1f / no - br + 3: + movb (r4),*txtp / put byte in buffer + inc txtp / advance output position + tstb (r4)+ / did we just do the null? + bne putstring / no - go again + rts pc / yes - we're done, return + 1: + mov r2,-(sp) / save r2 from being destroyed + mov $txtp,-(sp) / flush buffered output and... + jsr pc,flush / reset the pointers + mov (sp)+,r2 / restore symbol pointer + br 3b / go output a byte + doreloc: movb (r1),r0 bne 1f *************** *** 298,355 **** 1: rts pc - setbrk: - mov r1,-(sp) - add $20,r1 - cmp r1,0f - blo 1f - add $512.,0f - - mov 0f,-(sp) / brk(0f) - jsr pc,_brk / sys indir; 9f - tst (sp)+ / .data - .data /9: sys sbreak; 0: end - 0: _end / .text - .text - 1: - mov (sp)+,r1 - rts pc - setup: mov $curfb,r4 1: clr (r4)+ cmp r4,$curfb+40. blo 1b - mov txtfil,fin - clr ibufc clr r4 1: jsr pc,fbadv ! tstb (r4)+ cmp r4,$10. blt 1b ! rts pc ! ! ofile: ! mov r1,-(sp) / protect r1 from library ! clr -(sp) / open(r0, O_RDONLY, 0) clr -(sp) ! mov 10(sp),-(sp) ! jsr pc,_open ! add $6,sp ! mov (sp)+,r1 ! tst r0 ! bmi 1f ! mov (sp)+,(sp) rts pc - 1: - jmp filerr - / - / - / a2 -- pdp-11 assembler pass 2 - outw: cmp dot-2,$4 beq 9f --- 401,433 ---- 1: rts pc setup: + clr dot + mov $2,dotrel + mov $..,dotdot + clr brtabp + mov $curfb,r4 1: clr (r4)+ cmp r4,$curfb+40. blo 1b clr r4 1: jsr pc,fbadv ! inc r4 cmp r4,$10. blt 1b ! / just rewind /tmp/atm1xx rather than close and re-open clr -(sp) ! clr -(sp) ! clr -(sp) ! mov fin,-(sp) ! jsr pc,_lseek / lseek(fin, 0L, 0) ! add $8.,sp ! clr ibufc rts pc outw: cmp dot-2,$4 beq 9f *************** *** 356,381 **** bit $1,dot bne 1f add $2,dot ! tstb passno beq 8f clr -(sp) rol r3 adc (sp) ! asr r3 / get relative pc bit cmp r3,$40 bne 2f / external references mov $666,outmod / make nonexecutable mov xsymbol,r3 ! sub usymtab,r3 asl r3 ! bis $4,r3 / external relocation br 3f 2: ! bic $40,r3 / clear any ext bits cmp r3,$5 blo 4f ! cmp r3,$33 / est. text, data beq 6f cmp r3,$34 bne 7f --- 434,459 ---- bit $1,dot bne 1f add $2,dot ! tst passno beq 8f clr -(sp) rol r3 adc (sp) ! asr r3 / get relative pc bit cmp r3,$40 bne 2f / external references mov $666,outmod / make nonexecutable mov xsymbol,r3 ! sub hshtab,r3 asl r3 ! bis $4,r3 / external relocation br 3f 2: ! bic $40,r3 / clear any ext bits cmp r3,$5 blo 4f ! cmp r3,$33 / est. text, data beq 6f cmp r3,$34 bne 7f *************** *** 383,389 **** mov $'r,-(sp) jsr pc,error 7: ! mov $1,r3 / make absolute 4: cmp r3,$2 blo 5f --- 461,467 ---- mov $'r,-(sp) jsr pc,error 7: ! mov $1,r3 / make absolute 4: cmp r3,$2 blo 5f *************** *** 424,430 **** clr r3 jsr pc,outb rts pc - 9: mov $'x,-(sp) jsr pc,error --- 502,507 ---- *************** *** 438,444 **** mov $'r,-(sp) jsr pc,error 1: ! tstb passno beq 2f mov r2,r0 bit $1,dot --- 515,521 ---- mov $'r,-(sp) jsr pc,error 1: ! tst passno beq 2f mov r2,r0 bit $1,dot *************** *** 462,525 **** inc dot rts pc ! error: ! mov pc,errflg ! mov $666,outmod / make nonexecutable ! mov r3,-(sp) ! mov r2,-(sp) ! mov r1,-(sp) ! mov r0,-(sp) ! tst -(sp) / write(1, argb, strlen(argb)) ! mov $argb,-(sp) ! mov $1,-(sp) ! mov $argb,r1 ! clr r0 ! 1: ! tstb (r1)+ ! beq 2f ! inc r0 ! br 1b ! 2: ! mov r0,4(sp) ! jsr pc,_write ! add $6,sp ! ! movb 12(sp),0f ! mov line,r3 ! mov $0f+6,r0 ! mov $4,r1 ! 2: ! clr r2 ! div $10.,r2 ! add $'0,r3 ! movb r3,-(r0) ! mov r2,r3 ! sob r1,2b ! ! mov $7,-(sp) / write(1, 0f, 7) ! mov $0f,-(sp) / mov $1,r0 ! mov $1,-(sp) / sys write; 0f; 7 ! jsr pc,_write ! add $6,sp ! ! mov (sp)+,r0 ! mov (sp)+,r1 ! mov (sp)+,r2 ! mov (sp)+,r3 ! mov (sp)+,(sp) ! rts pc ! ! .data ! 0: ! .even ! .text ! / ! / ! ! / a3 -- pdp-11 assembler pass 2 ! ! assem: jsr pc,readop cmp r4,$5 beq 2f --- 539,547 ---- inc dot rts pc ! / pass 1 and 2 common code ! pass1_2: jsr pc,readop cmp r4,$5 beq 2f *************** *** 544,550 **** 2: jsr pc,opline dotmax: ! tstb passno bne eal1 movb dotrel,r0 asl r0 --- 566,572 ---- 2: jsr pc,opline dotmax: ! tst passno bne eal1 movb dotrel,r0 asl r0 *************** *** 563,571 **** beq 3f mov $'x,-(sp) jsr pc,error ! br assem 1: ! tstb passno bne 2f movb (r4),r0 bic $!37,r0 --- 585,593 ---- beq 3f mov $'x,-(sp) jsr pc,error ! br pass1_2 1: ! tst passno bne 2f movb (r4),r0 bic $!37,r0 *************** *** 583,595 **** mov 2(r4),brdelt sub dot,brdelt mov dot,2(r4) ! br assem 2: cmp dot,2(r4) ! beq assem mov $'p,-(sp) jsr pc,error ! br assem 3: mov numval,r4 jsr pc,fbadv --- 605,617 ---- mov 2(r4),brdelt sub dot,brdelt mov dot,2(r4) ! br pass1_2 2: cmp dot,2(r4) ! beq pass1_2 mov $'p,-(sp) jsr pc,error ! br pass1_2 3: mov numval,r4 jsr pc,fbadv *************** *** 599,615 **** mov 2(r0),brdelt sub dot,brdelt mov dot,2(r0) ! br assem 4: jsr pc,readop jsr pc,expres mov (sp)+,r1 ! cmp r1,$symtab /test for dot bne 1f bic $40,r3 ! cmp r3,dotrel / can't change relocation bne 2f ! cmp r3,$4 / bss bne 3f mov r2,dot br dotmax --- 621,637 ---- mov 2(r0),brdelt sub dot,brdelt mov dot,2(r0) ! br pass1_2 4: jsr pc,readop jsr pc,expres mov (sp)+,r1 ! cmp r1,$dotrel /test for dot bne 1f bic $40,r3 ! cmp r3,dotrel / can't change relocation bne 2f ! cmp r3,$4 / bss bne 3f mov r2,dot br dotmax *************** *** 654,660 **** 1: inc line 9: ! jmp assem checkeos: cmp r4,$'\n --- 676,682 ---- 1: inc line 9: ! jmp pass1_2 checkeos: cmp r4,$'\n *************** *** 685,695 **** mov r1,nxtfb(r4) asr r4 rts pc - / - / - / a4 -- pdp-11 assembler pass 2 - oset: mov r2,-(sp) mov r3,-(sp) --- 707,713 ---- *************** *** 698,709 **** bic $!1777,r1 add r3,r1 add $8,r1 ! mov r1,(r3)+ / next slot mov r3,r1 add $2006,r1 ! mov r1,(r3)+ / buf max mov r0,(r3)+ ! mov r2,(r3)+ / seek addr mov (sp)+,r3 mov (sp)+,r2 mov (sp)+,(sp) --- 716,727 ---- bic $!1777,r1 add r3,r1 add $8,r1 ! mov r1,(r3)+ / next slot mov r3,r1 add $2006,r1 ! mov r1,(r3)+ / buf max mov r0,(r3)+ ! mov r2,(r3)+ / seek addr mov (sp)+,r3 mov (sp)+,r2 mov (sp)+,(sp) *************** *** 713,720 **** mov r1,-(sp) mov r2,-(sp) mov 6(sp),r2 ! mov (r2)+,r1 / slot ! cmp r1,(r2) / buf max bhis 1f mov r0,(r1)+ mov r1,-(r2) --- 731,738 ---- mov r1,-(sp) mov r2,-(sp) mov 6(sp),r2 ! mov (r2)+,r1 / slot ! cmp r1,(r2) / buf max bhis 1f mov r0,(r1)+ mov r1,-(r2) *************** *** 730,735 **** --- 748,754 ---- mov (sp)+,r2 mov (sp)+,r1 mov (sp)+,(sp) + ret: rts pc flush: *************** *** 739,765 **** flush1: clr -(sp) / lseek(fout, (r2)L+, L_SET) ! mov 2(r2),-(sp) / mov (r2)+,0f ! mov (r2)+,-(sp) / mov (r2)+,r1 ! tst (r2)+ / mov r1,0f+2 ! mov fout,-(sp) / mov fout,r0 ! jsr pc,_lseek / sys indir; 9f ! add $8.,sp / .data ! /9: sys lseek; 0:..; ..; 0 ! / .text cmp -(sp),-(sp) / write(fout, , ) bic $!1777,r1 ! add r2,r1 / write address mov r1,-(sp) / { } mov r2,r0 bis $1777,-(r2) ! add $1,(r2) / new seek addr adc -(r2) cmp -(r2),-(r2) sub (r2),r1 neg r1 ! mov r1,2(sp) / count ! mov r0,(r2) / new next slot mov fout,-(sp) mov r1,6(sp) / protect r1 from library --- 758,783 ---- flush1: clr -(sp) / lseek(fout, (r2)L+, L_SET) ! mov 2(r2),-(sp) ! mov (r2)+,-(sp) ! tst (r2)+ ! mov fout,-(sp) ! jsr pc,_lseek ! add $8.,sp ! cmp -(sp),-(sp) / write(fout, , ) bic $!1777,r1 ! add r2,r1 / write address mov r1,-(sp) / { } mov r2,r0 bis $1777,-(r2) ! add $1,(r2) / new seek addr adc -(r2) cmp -(r2),-(r2) sub (r2),r1 neg r1 ! mov r1,2(sp) / count ! mov r0,(r2) / new next slot mov fout,-(sp) mov r1,6(sp) / protect r1 from library *************** *** 767,787 **** add $6,sp mov (sp)+,r1 tst r0 ! jmi wrterr ! rts pc wrterr: ! mov $8f-9f,-(sp) / write(1, ERRMSG, strlen(ERRMSG)) ! mov $9f,-(sp) / mov $1,r0 ! mov $1,-(sp) / sys write; 9f; 8f-9f jsr pc,_write add $6,sp - jmp saexit - .data - 9: ; 8: .even - .text readop: mov savop,r4 beq 1f --- 785,808 ---- add $6,sp mov (sp)+,r1 tst r0 ! bpl ret ! / fall thru to wrterr wrterr: ! mov $8f-9f,-(sp) / write(1, 9f, 8f-9f) ! mov $9f,-(sp) ! mov $1,-(sp) jsr pc,_write add $6,sp jmp saexit + .data + 9: + + 8: + .even + .text + readop: mov savop,r4 beq 1f *************** *** 793,803 **** blo 1f cmp r4,$4000 blo 2f - add usymtab,r4 sub $4000,r4 rts pc 2: ! add $symtab-1000,r4 1: rts pc --- 814,835 ---- blo 1f cmp r4,$4000 blo 2f sub $4000,r4 + asl r4 + asl r4 + add hshtab,r4 rts pc 2: ! / remove PST flag (1000) then multiply by PSTENTSZ. In pass 0 the PST ! / symbol number was divided by PSTENTSZ(to make it fit) - we now reverse ! / that process. ! mov r5,-(sp) ! mov r4,r5 ! sub $1000,r5 ! mul $PSTENTSZ,r5 ! mov r5,r4 ! mov (sp)+,r5 ! add $dotrel,r4 / point at dot's flag field 1: rts pc *************** *** 812,829 **** mov r1,-(sp) / protect r1 from library mov $1024.,-(sp) / read(fin, inbuf, 1024) ! mov $inbuf,-(sp) / movb fin,r0 ! mov fin,-(sp) / sys read; inbuf; 1024. ! jsr pc,_read / bes 3f add $6,sp mov (sp)+,r1 - tst r0 - jmi 3f - asr r0 mov r0,ibufc ! bne 2f ! 3: mov $4,r4 sev rts pc --- 844,857 ---- mov r1,-(sp) / protect r1 from library mov $1024.,-(sp) / read(fin, inbuf, 1024) ! mov $inbuf,-(sp) ! mov fin,-(sp) ! jsr pc,_read add $6,sp mov (sp)+,r1 asr r0 mov r0,ibufc ! bgt 2f mov $4,r4 sev rts pc *************** *** 833,847 **** mov *ibufp,r4 add $2,ibufp rts pc - / - / - / as25 is empty - / - / - - / a6 -- pdp-11 assembler pass 2 - opline: mov r4,r0 bmi 2f --- 861,867 ---- *************** *** 860,870 **** rts pc 2: movb (r4),r0 ! cmp r0,$24 /reg beq xpr ! cmp r0,$33 /est text beq xpr ! cmp r0,$34 / est data beq xpr cmp r0,$5 blt xpr --- 880,890 ---- rts pc 2: movb (r4),r0 ! cmp r0,$24 /reg beq xpr ! cmp r0,$33 /est text beq xpr ! cmp r0,$34 / est data beq xpr cmp r0,$5 blt xpr *************** *** 928,946 **** tst (sp)+ rts pc ! opl30: / mpy, dvd etc inc swapf mov $1000,rlimit br opl13 ! opl14: / flop freg,fsrc inc swapf ! opl5: / flop src,freg mov $400,rlimit ! /double ! opl13: jsr pc,addres op2a: mov r2,-(sp) --- 948,965 ---- tst (sp)+ rts pc ! opl30: / mul, div etc inc swapf mov $1000,rlimit br opl13 ! opl14: / flop freg,fsrc inc swapf ! opl5: / flop src,freg mov $400,rlimit ! opl13: /double jsr pc,addres op2a: mov r2,-(sp) *************** *** 977,990 **** 1: rts pc ! opl15: / single operand clr -(sp) br op2b ! opl12: / movf mov $400,rlimit jsr pc,addres ! cmp r2,$4 / see if source is fregister blo 1f inc swapf br op2a --- 996,1009 ---- 1: rts pc ! opl15: / single operand clr -(sp) br op2b ! opl12: / movf mov $400,rlimit jsr pc,addres ! cmp r2,$4 / see if source is fregister blo 1f inc swapf br op2a *************** *** 992,1003 **** mov $174000,(sp) br op2a ! / jbr ! opl35: ! / jeq, jne, etc ! opl36: jsr pc,expres ! tstb passno bne 1f mov r2,r0 jsr pc,setbr --- 1011,1020 ---- mov $174000,(sp) br op2a ! opl35: / jbr ! opl36: / jeq, jne, etc jsr pc,expres ! tst passno bne 1f mov r2,r0 jsr pc,setbr *************** *** 1007,1013 **** beq 2f add $2,r2 2: ! add r2,dot / if doesn't fit add $2,dot tst (sp)+ rts pc --- 1024,1030 ---- beq 2f add $2,r2 2: ! add r2,dot / if doesn't fit add $2,dot tst (sp)+ rts pc *************** *** 1020,1026 **** cmp r0,$br beq 2f mov $402,r2 ! xor r0,r2 / flip cond, add ".+6" mov $1,r3 jsr pc,outw 2: --- 1037,1043 ---- cmp r0,$br beq 2f mov $402,r2 ! xor r0,r2 / flip cond, add ".+6" mov $1,r3 jsr pc,outw 2: *************** *** 1032,1039 **** jsr pc,outw rts pc ! /sob ! opl31: / sob jsr pc,expres jsr pc,checkreg swab r2 --- 1049,1055 ---- jsr pc,outw rts pc ! opl31: / sob jsr pc,expres jsr pc,checkreg swab r2 *************** *** 1042,1048 **** bis r2,(sp) jsr pc,readop jsr pc,expres ! tstb passno beq 3f sub dot,r2 neg r2 --- 1058,1064 ---- bis r2,(sp) jsr pc,readop jsr pc,expres ! tst passno beq 3f sub dot,r2 neg r2 *************** *** 1054,1063 **** add $4,r2 br 1f ! /branch ! opl6: jsr pc,expres ! tstb passno beq 3f dobranch: sub dot,r2 --- 1070,1078 ---- add $4,r2 br 1f ! opl6: /branch jsr pc,expres ! tst passno beq 3f dobranch: sub dot,r2 *************** *** 1069,1075 **** 1: bit $1,r2 bne 2f ! cmp r3,dot-2 / same relocation as . bne 2f asr r2 dec r2 --- 1084,1090 ---- 1: bit $1,r2 bne 2f ! cmp r3,dot-2 / same relocation as . bne 2f asr r2 dec r2 *************** *** 1085,1104 **** clr r2 br 3b ! /jsr ! opl7: jsr pc,expres jsr pc,checkreg jmp op2a ! / rts ! opl10: jsr pc,expres jsr pc,checkreg br 1f ! / sys, emt etc ! opl11: jsr pc,expres cmp r2,$256. bhis 0f --- 1100,1116 ---- clr r2 br 3b ! opl7: /jsr jsr pc,expres jsr pc,checkreg jmp op2a ! opl10: / rts jsr pc,expres jsr pc,checkreg br 1f ! opl11: / sys jsr pc,expres cmp r2,$256. bhis 0f *************** *** 1111,1118 **** jsr pc,outw rts pc ! / .byte ! opl16: jsr pc,expres jsr pc,outb cmp r4,$', --- 1123,1129 ---- jsr pc,outw rts pc ! opl16: / .byte jsr pc,expres jsr pc,outb cmp r4,$', *************** *** 1123,1130 **** tst (sp)+ rts pc ! / < (.ascii) ! opl17: jsr pc,getw mov $1,r3 mov r4,r2 --- 1134,1140 ---- tst (sp)+ rts pc ! opl17: / < (.ascii) jsr pc,getw mov $1,r3 mov r4,r2 *************** *** 1136,1147 **** jsr pc,getw rts pc ! /.even ! opl20: bit $1,dot beq 1f cmp dot-2,$4 ! beq 2f / bss mode clr r2 clr r3 jsr pc,outb --- 1146,1156 ---- jsr pc,getw rts pc ! opl20: /.even bit $1,dot beq 1f cmp dot-2,$4 ! beq 2f / bss mode clr r2 clr r3 jsr pc,outb *************** *** 1151,1157 **** 1: tst (sp)+ rts pc ! opl21: /if jsr pc,expres opl22: oplret: --- 1160,1167 ---- 1: tst (sp)+ rts pc ! ! opl21: /if jsr pc,expres opl22: oplret: *************** *** 1158,1165 **** tst (sp)+ rts pc ! /.globl ! opl23: cmp r4,$200 blo 1f bisb $40,(r4) --- 1168,1174 ---- tst (sp)+ rts pc ! opl23: /.globl cmp r4,$200 blo 1f bisb $40,(r4) *************** *** 1172,1179 **** tst (sp)+ rts pc ! / .text, .data, .bss ! opl25: opl26: opl27: inc dot --- 1181,1187 ---- tst (sp)+ rts pc ! opl25: / .text, .data, .bss opl26: opl27: inc dot *************** *** 1182,1188 **** mov dot-2,r1 asl r1 mov dot,savdot-4(r1) ! tstb passno beq 1f mov $txtp,-(sp) jsr pc,flush --- 1190,1196 ---- mov dot-2,r1 asl r1 mov dot,savdot-4(r1) ! tst passno beq 1f mov $txtp,-(sp) jsr pc,flush *************** *** 1207,1213 **** mov savdot-[2*25](r0),dot asr r0 sub $25-2,r0 ! mov r0,dot-2 / new . relocation tst (sp)+ rts pc --- 1215,1221 ---- mov savdot-[2*25](r0),dot asr r0 sub $25-2,r0 ! mov r0,dot-2 / new . relocation tst (sp)+ rts pc *************** *** 1337,1347 **** jsr pc,readop jmp 4b - errora: - mov $'a,-(sp) - jsr pc,error - rts pc - checkreg: cmp r2,$7 bhi 1f --- 1345,1350 ---- *************** *** 1357,1367 **** clr r3 rts pc - errore: - mov $'e,-(sp) - jsr pc,error - rts pc - checkrp: cmp r4,$') beq 1f --- 1360,1365 ---- *************** *** 1415,1427 **** ash $-3,r1 movb brtab(r1),r1 ash (sp)+,r1 ! ror r1 / 0-bit into c-bit rts pc - / - / - / a7 -- pdp-11 assembler - expres: clr xsymbol expres1: --- 1413,1421 ---- ash $-3,r1 movb brtab(r1),r1 ash (sp)+,r1 ! ror r1 / 0-bit into c-bit rts pc expres: clr xsymbol expres1: *************** *** 1439,1447 **** ble 7f 6: movb (r4),r0 - tst r0 bne 1f ! tstb passno beq 1f mov $'u,-(sp) jsr pc,error --- 1433,1440 ---- ble 7f 6: movb (r4),r0 bne 1f ! tst passno beq 1f mov $'u,-(sp) jsr pc,error *************** *** 1456,1464 **** / actually in another overlay. Elsewise, the assembler fix's up / the reference before the link editor changes the globl refrence / to the thunk. -wfj 5/80 ! cmp r0,$42 / is it globl text ? ! bne 0f / nope ! mov $40,r0 / yes, treat it as undefined external 0: cmp r0,$40 bne 1f --- 1449,1457 ---- / actually in another overlay. Elsewise, the assembler fix's up / the reference before the link editor changes the globl refrence / to the thunk. -wfj 5/80 ! cmp r0,$42 / is it globl text ? ! bne 0f / nope ! mov $40,r0 / yes, treat it as undefined external 0: cmp r0,$40 bne 1f *************** *** 1646,1652 **** jmp advanc combin: ! tstb passno bne combin1 mov r0,-(sp) bis r3,(sp) --- 1639,1645 ---- jmp advanc combin: ! tst passno bne combin1 mov r0,-(sp) bis r3,(sp) *************** *** 1736,1758 **** .byte 0, X, X, X, X, X .byte 0, X, X, X, X, X .byte 0, X, X, X, X, X - .text - / - / - / as8 -- PDP-11 assembler pass 2 - .data qnl: a.out: ! .even a.outp: a.out ! a.tmp1: 0 ! a.tmp2: 0 ! a.tmp3: 0 - overlaid: 0 - tseekp: txtseek rseekp: trelseek --- 1729,1744 ---- .byte 0, X, X, X, X, X .byte 0, X, X, X, X, X .byte 0, X, X, X, X, X qnl: a.out: ! .even a.outp: a.out ! obufp: outbuf ! passno: -1 ! outmod: 0777 tseekp: txtseek rseekp: trelseek *************** *** 1762,1770 **** datsiz: .=.+2 bsssiz: .=.+2 symsiz: .=.+2 ! stksiz: .=.+2 ! exorig: .=.+2 ! .=.+2 txtseek:0; 20 datseek:.=.+4 --- 1748,1754 ---- datsiz: .=.+2 bsssiz: .=.+2 symsiz: .=.+2 ! .=.+6 txtseek:0; 20 datseek:.=.+4 *************** *** 1774,2088 **** .=.+4 symseek:.=.+4 ! .bss ! brlen = 1024. brtab: .=.+[brlen\/8.] brtabp: .=.+2 brdelt: .=.+2 ! fbbufp: .=.+2 defund: .=.+2 - savdot: .=.+6 datbase:.=.+2 bssbase:.=.+2 - fbfil: .=.+2 - fin: .=.+2 ibufc: .=.+2 ! txtfil: .=.+2 ! symf: .=.+2 adrbuf: .=.+12. xsymbol:.=.+2 - fout: .=.+2 - ch: .=.+2 errflg: .=.+2 - wordf: .=.+2 argb: .=.+22. - line: .=.+2 - savop: .=.+2 - curfb: .=.+20. - nxtfb: .=.+20. numval: .=.+2 maxtyp: .=.+2 - relfil: .=.+2 ibufp: .=.+2 ! txtp: .=.+8+1024. ! relp: .=.+8+1024. swapf: .=.+2 rlimit: .=.+2 - passno: .=.+2 endtable:.=.+2 ! inbuf: .=.+1024. ! .data ! usymtab: _end ! .text ! / ! / ! ! / as9 -- PDP-11 assembler pass 2 ! ! .data ! symtab: ! ! / special variables ! ! dotrel: 02; dot:000000 /. ! 01; dotdot:000000 /.. ! ! / register ! ! 24;000000 /r0 ! 24;000001 /r1 ! 24;000002 /r2 ! 24;000003 /r3 ! 24;000004 /r4 ! 24;000005 /r5 ! 24;000006 /sp ! 24;000007 /pc ! ! / double operand ! ! 13;0010000 /mov ! 13;0110000 /movb ! 13;0020000 /cmp ! 13;0120000 /cmpb ! 13;0030000 /bit ! 13;0130000 /bitb ! 13;0040000 /bic ! 13;0140000 /bicb ! 13;0050000 /bis ! 13;0150000 /bisb ! 13;0060000 /add ! 13;0160000 /sub ! ! / branch ! ! 06;0000400 /br ! 06;0001000 /bne ! 06;0001400 /beq ! 06;0002000 /bge ! 06;0002400 /blt ! 06;0003000 /bgt ! 06;0003400 /ble ! 06;0100000 /bpl ! 06;0100400 /bmi ! 06;0101000 /bhi ! 06;0101400 /blos ! 06;0102000 /bvc ! 06;0102400 /bvs ! 06;0103000 /bhis ! 06;0103000 /bec ! 06;0103000 /bcc ! 06;0103400 /blo ! 06;0103400 /bcs ! 06;0103400 /bes ! ! / jump/ branch type ! ! 35;0000400 /jbr ! 36;0001000 /jne ! 36;0001400 /jeq ! 36;0002000 /jge ! 36;0002400 /jlt ! 36;0003000 /jgt ! 36;0003400 /jle ! 36;0100000 /jpl ! 36;0100400 /jmi ! 36;0101000 /jhi ! 36;0101400 /jlos ! 36;0102000 /jvc ! 36;0102400 /jvs ! 36;0103000 /jhis ! 36;0103000 /jec ! 36;0103000 /jcc ! 36;0103400 /jlo ! 36;0103400 /jcs ! 36;0103400 /jes ! ! / single operand ! ! 15;0005000 /clr ! 15;0105000 /clrb ! 15;0005100 /com ! 15;0105100 /comb ! 15;0005200 /inc ! 15;0105200 /incb ! 15;0005300 /dec ! 15;0105300 /decb ! 15;0005400 /neg ! 15;0105400 /negb ! 15;0005500 /adc ! 15;0105500 /adcb ! 15;0005600 /sbc ! 15;0105600 /sbcb ! 15;0005700 /tst ! 15;0105700 /tstb ! 15;0006000 /ror ! 15;0106000 /rorb ! 15;0006100 /rol ! 15;0106100 /rolb ! 15;0006200 /asr ! 15;0106200 /asrb ! 15;0006300 /asl ! 15;0106300 /aslb ! 15;0000100 /jmp ! 15;0000300 /swab ! 15;0006500 /mfpi ! 15;0006600 /mtpi ! 15;0106500 /mfpd ! 15;0106600 /mtpd ! 15;0170300 /stst ! 15;0106700 /mfps ! 15;0106400 /mtps ! 15;0007000 /csm ! 15;0007200 /tstset ! 15;0007300 /wrtlck ! ! / jsr ! ! 07;0004000 /jsr ! ! / rts ! ! 10;000200 /rts ! ! / simple operand ! ! 11;104400 /sys ! 11;000230 /spl ! ! / flag-setting ! ! 01;0000240 /nop ! 01;0000241 /clc ! 01;0000242 /clv ! 01;0000244 /clz ! 01;0000250 /cln ! 01;0000261 /sec ! 01;0000262 /sev ! 01;0000264 /sez ! 01;0000270 /sen ! 01;0000000 /halt ! 01;0000001 /wait ! 01;0000004 /iot ! 01;0000005 /reset ! 01;0000006 /rtt ! 01;0000007 /mfpt ! ! / floating point ops ! ! 01;170000 / cfcc ! 01;170001 / setf ! 01;170011 / setd ! 01;170002 / seti ! 01;170012 / setl ! 15;170400 / clrf ! 15;170700 / negf ! 15;170600 / absf ! 15;170500 / tstf ! 12;172400 / movf ! 14;177000 / movif ! 05;175400 / movfi ! 14;177400 / movof ! 05;176000 / movfo ! 14;172000 / addf ! 14;173000 / subf ! 14;171000 / mulf ! 14;174400 / divf ! 14;173400 / cmpf ! 14;171400 / modf ! 14;176400 / movie ! 05;175000 / movei ! 15;170100 / ldfps ! 15;170200 / stfps ! 24;000000 / fr0 ! 24;000001 / fr1 ! 24;000002 / fr2 ! 24;000003 / fr3 ! 24;000004 / fr4 ! 24;000005 / fr5 ! ! / 11/45 operations ! ! 30;070000 /mul ! 30;071000 /div ! 30;072000 /ash ! 30;073000 /ashc ! 07;074000 /xor ! 15;006700 /sxt ! 11;006400 /mark ! 31;077000 /sob ! ! / specials ! ! 16;000000 /.byte ! 20;000000 /.even ! 21;000000 /.if ! 22;000000 /.endif ! 23;000000 /.globl ! 25;000000 /.text ! 26;000000 /.data ! 27;000000 /.bss ! 32;000000 /.comm ! ! .text ! start: ! mov (sp)+,r0 ! tst (sp)+ ! 1: ! mov (sp)+,r1 ! cmpb (r1),$'- ! bne 1f ! dec r0 ! cmpb 1(r1),$'g ! bne 2f ! mov $40,defund / globalize externals ! br 1b ! 2: ! cmpb 1(r1), $'V ! bne 2f ! inc overlaid ! br 1b ! 2: ! cmpb 1(r1),$'o ! bne 1b ! dec r0 ! mov (sp)+,r1 ! mov r1,a.outp ! mov r1,a.outp1 ! mov r1,a.outp2 ! br 1b ! 1: ! cmp r0,$4 ! bge 1f ! jmp aexit ! 1: ! mov r1,a.tmp1 ! mov (sp)+,a.tmp2 ! mov (sp)+,a.tmp3 ! mov a.tmp1,-(sp) ! jsr pc,ofile ! mov r0,txtfil ! mov a.tmp2,-(sp) ! jsr pc,ofile ! mov r0,fbfil ! mov a.tmp3,-(sp) ! jsr pc,ofile ! mov r0,symf ! mov r0,fin ! ! mov r1,-(sp) / protect r1 from library ! mov $0666,-(sp) / creat(a.outp1, 0666) ! mov a.outp1,-(sp) / sys creat; a.outp1:a.out; 666 ! jsr pc,_creat / bec 1f ! cmp (sp)+,(sp)+ ! mov (sp)+,r1 ! tst r0 ! jpl 1f ! mov a.outp,-(sp) ! jsr pc,filerr ! 1: ! mov r0,fout ! jmp go ! .data ! a.outp1: a.out .text --- 1758,1789 ---- .=.+4 symseek:.=.+4 ! .bss brlen = 1024. brtab: .=.+[brlen\/8.] brtabp: .=.+2 brdelt: .=.+2 ! fbbufp: .=.+2 defund: .=.+2 datbase:.=.+2 bssbase:.=.+2 ibufc: .=.+2 ! overlaid: .=.+2 adrbuf: .=.+12. xsymbol:.=.+2 errflg: .=.+2 argb: .=.+22. numval: .=.+2 maxtyp: .=.+2 ibufp: .=.+2 ! txtp: .=.+8. ! .=.+1024. ! relp: .=.+8. ! outbuf: ! .=.+1024. swapf: .=.+2 rlimit: .=.+2 endtable:.=.+2 ! totalsz: / string table length ! .=.+4 .text