Annotation of 40BSD/cmd/px/00case.h, revision 1.1.1.1

1.1       root        1: #
                      2: # Copyright (c) 1979 Regents of the University of California
                      3: #
                      4: # char sccsid[] = "@(#)00case.h 4.1 10/10/80";
                      5: #
                      6: # Berkeley Pascal Assembler Kernel
                      7: #
                      8:        .globl  _interpret      #normal interpreter entry point
                      9: #
                     10: # register definitions
                     11: #
                     12: # registers R0 - R6 are for scratch use
                     13: #
                     14:        .set    lino, r11
                     15:        .set    lc, r10
                     16:        .set    dp, r9
                     17:        .set    loop, r8
                     18:        .set    buf, r7
                     19: #
                     20: # Global constants
                     21: #
                     22:        .set    R2,0x004        #register fields in call mask
                     23:        .set    R3,0x008
                     24:        .set    R4,0x010
                     25:        .set    R5,0x020
                     26:        .set    R6,0x040
                     27:        .set    R7,0x080
                     28:        .set    R8,0x100
                     29:        .set    R9,0x200
                     30:        .set    R10,0x400
                     31:        .set    R11,0x800
                     32:        .set    SIGINT,2        #interrupt signal
                     33:        .set    SIGFPE,8        #arithmetic exception signal
                     34:        .set    SIGSEGV,11      #segmentation violation
                     35:        .set    MASK,6          #offset of save mask in call stack
                     36:        .set    FP,12           #offset of "fp" in call stack
                     37:        .set    PC,16           #offset of "pc" in call stack
                     38:        .set    REGS,20         #beginning of saved registers in call stack
                     39:        .set    O_DATE,0345     #DATE opcode number
                     40:        .set    O_TIME,0346     #TIME opcode number
                     41:        .set    tempsize,-1024  #maximum required temporary stack space
                     42: #
                     43: # program variables
                     44: #
                     45:        .globl  _display        #runtime display
                     46:        .globl  _file           #current file name
                     47:        .globl  _fchain         #head of active file chain
                     48:        .globl  _llimit         #max number of output lines
                     49:        .globl  _stcnt          #number of stmts executed
                     50:        .globl  _stlim          #max number of stmts to exec
                     51:        .globl  _nodump         #1 => no postmortum dump
                     52:        .globl  _perrno         #interpreter error number
                     53:        .globl  _profcnts       #PX profile execution counts
                     54:        .globl  _pxpbuf         #ptr to pxp buffer
                     55:        .globl  _pxpsize        #size of pxp buffer
                     56:        .globl  _argc           #number of passed args
                     57:        .globl  _argv           #values of passed args
                     58:        .globl  __iob           #base of I/O buffer block
                     59:        .globl  __sobuf         #standard output buffer
                     60: #
                     61: # system subroutines
                     62: #
                     63:        .globl  _signal
                     64:        .globl  _time
                     65:        .globl  _times
                     66: #
                     67: # system math routines
                     68: #
                     69:        .globl  _atan
                     70:        .globl  _cos
                     71:        .globl  _exp
                     72:        .globl  _log
                     73:        .globl  _sin
                     74:        .globl  _sqrt
                     75:        .globl  _srand
                     76:        .globl  _rand
                     77: #
                     78: # pascal specific subroutines
                     79: #
                     80:        .globl  _error          #error message routine
                     81:        .globl  _palloc         #heap allocator
                     82:        .globl  _pfree
                     83:        .globl  _cttot          #set constructor
                     84:        .globl  _inct           #set inclusion
                     85:        .globl  _pdattim        #getting date, time info
                     86:        .globl  _perror         #process pxp errors
                     87: #
                     88: # initializing the interpreter
                     89: #
                     90: _interpret:
                     91:        .word   0xffc           #register save mask
                     92:        moval   iloop,r8
                     93:        tstl    8(ap)           #check for profiling
                     94:        beql    l0050
                     95:        moval   ploop,r8        #set profiling request
                     96: l0050:
                     97:        callg   *4(ap),l0051    #set ap to base of program
                     98:        ret
                     99: l0051:
                    100:        .word   0
                    101:        bispsw  $0xe0           #enable overflow traps
                    102:        movl    ap,r10          #program start address
                    103:        moval   _display,r9
                    104:        moval   -4(sp),(r9)
                    105:        pushal  stderr          #set up global file variables
                    106:        movl    sp,stderr+FLEV
                    107:        movl    _llimit,stderr+LLIMIT
                    108:        calls   $0,_unit        #init active file
                    109:        pushal  stdout
                    110:        movl    sp,stdout+FLEV
                    111:        movl    _llimit,stdout+LLIMIT
                    112:        pushal  stdin
                    113:        movl    sp,stdin+FLEV
                    114:        moval   stdin,_fchain
                    115:        jmp     (r8)            #begin interpreter
                    116: #
                    117: # main interpreter loop
                    118: # the instruction 'jmp (loop)'
                    119: # transfers here
                    120: #
                    121: ploop:
                    122:        movzbl  (r10),r0
                    123:        incl    _profcnts[r0]
                    124: iloop:
                    125:        caseb   (r10)+,$0,$255
                    126: optab:

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.