home *** CD-ROM | disk | FTP | other *** search
- / modified to add asleep function which allowes one to turn off
- / the clock interrupt fifo service sept 84
- / Stand alone C runtime startoff
- / Trap handler for system calls
- / Clock interrupt handler
-
- .globl _end / data space addresses generated by the loader
- .globl _edata
-
- .globl __trap / system call simulator in Unix kernel code
- .globl _zexit / system exit
-
- .globl _main / user entry point
-
- .globl _tick / interrupt enable and disable
- .globl _onclk / addresse of clock interrupt routine
- .globl _asleep / serial port control of clock interrupt enable/disable
-
-
- .globl start / startoff entry point
- .globl _wait / wait for bus interrupt
- .globl _halt / halt processor
-
- .globl savr5 / C run time save area
-
- / interrupt vectors
- timeout=4
- illegal=10
- break=14
- iott=20
- pwr=24
- emtt=30
- trap=34
- clock=100
- vax=200
-
- halt=0 / halt instruction
- wait=1 / wait for bus interrupt
- rti=2 / return from interrupt
- bpt=3 / break point
-
- .=timeout^. / bus timeout
- panic1
- 340
-
- .=illegal^. / illegal instructions
- panic2
- 340
-
- .=break^. / break point
- panic3
- 340
-
- .=iott^. / iot trap
- panic4
- 340
-
- .=pwr^. / power fail
- panic5
- 340
-
- .=emtt^. / emt instruction
- panic6
- 340
-
- .=trap^. /trap handler
- traph
- 0
-
- .=clock^. /clock
- clock+2
- rti
-
- .=vax^.
- panic7
- 340
- panic8
- 340
-
- .=2000^. /start address
- start:
- 0106427 /mtps
- 0340 /max priority
- mov $2000,sp /set up stack
-
- clr _tick
- mov $60,_asleep
- clr inserf
- mov $340,*$clock+2 /set up clock interrupt vector
- mov $service,*$clock
-
- mov $_edata,r0 /clear bss area
- 2: cmp r0,$_end
- beq 3f
- clrb (r0)+
- br 2b
- 3:
- mov $-1,-(sp)
- mov $sname,-(sp) /simulate exec with dummy name
- mov $1,-(sp)
-
- mov sp,r0
- mov (r0),-(sp)
- tst (r0)+
- mov r0,2(sp)
-
- 0106427 /mtps
- 0 /low priority
- jsr pc,_main
- clr (sp) / code 0
- jsr pc,_zexit
- cmp (sp)+,(sp)+
- mov r0,(sp)
- _halt:
- halt
-
- traph: /trap handler
- mov r0,-(sp)
- mov r1,-(sp)
- jsr pc,__trap
- mov (sp)+,r1
- mov (sp)+,r0
- rti
-
- service:
- bit $2000,*$-1300 / (DLV1->rcsr & READY)
- jne L4 / == 0 then L4
- mov *$-1276,_asleep / else _asleep = DLV1->rbuf
- L4: cmp $60,_asleep / asleep??
- bne 1f / NO then interrupt
- rti / YES then return
- 1:
- tst _tick / if tick is set equal to
- bne 1f / zero,ignor interrupt
- rti
- 1:
- inc tcount / check for the proper no. of
- cmp _tick,tcount / ticks before servicing the
- beq 1f / interrupt
- rti
- 1:
- tst inserf / if routine still in service
- beq 1f
- mov $9,code
- mov $_zexit,_onclk
- 1:
- 0106427 /mtps
- 0 /low priority
- inc inserf
- clr tcount
- mov r0,-(sp) / save
- mov r1,-(sp) / regs
- mov r2,-(sp)
- mov r3,-(sp)
- mov r4,-(sp)
- mov r5,-(sp)
- mov code,-(sp)
- jsr pc,*_onclk / call routine
- tst (sp)+
- mov (sp)+,r5 / restore
- mov (sp)+,r4 / regs
- mov (sp)+,r3
- mov (sp)+,r2
- mov (sp)+,r1
- mov (sp)+,r0
- clr inserf
- clr code
- clkrti: rti
-
-
-
- _wait: / wait for bus interrupt and return
- wait
- rts pc
-
- panic1: mov $1,code
- br 1f
- panic2: mov $2,code
- br 1f
- panic3: mov $3,code
- br 1f
- panic4: mov $4,code
- br 1f
- panic5: mov $5,code
- br 1f
- panic6: mov $6,code
- br 1f
- panic7: mov $7,code
- br 1f
- panic8: mov $8,code
-
- 1: 0106427 /mtps
- 0 /low priority
- mov r0,-(sp) / save
- mov r1,-(sp) / regs
- mov r2,-(sp)
- mov r3,-(sp)
- mov r4,-(sp)
- mov r5,-(sp)
- mov code,-(sp)
- jsr pc,_zexit
- tst (sp)+
- mov (sp)+,r5 / restore
- mov (sp)+,r4 / regs
- mov (sp)+,r3
- mov (sp)+,r2
- mov (sp)+,r1
- mov (sp)+,r0
- clr code
- rti
-
- retu: rts pc
-
- .bss
- savr5: .=.+2
- .data
- .=.+2 / loc 0 for I/D; null ptr points here.
- sname: <dummy\0>
- inserf: 0 / int routine in service
- tcount: 0 / tick count
- code : 0
- _tick : 0 / global tick number
- _onclk: retu / address of clock interupt routine
- _asleep: 1
-