1
0
mirror of https://github.com/PDP-10/its.git synced 2026-04-18 09:06:23 +00:00
Files
PDP-10.its/c20/new/lib/c2ddrn.cmid
2018-05-15 07:06:17 +02:00

249 lines
4.0 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;
; c2ddrn - debugging runtime support for C programs
;
title c2ddrn
.insrt c:minsrt
.global $argc,$argv
.global chntab,prctab,lowlim,hilim,stackt
pdlsiz==20000 ; desired pdl size
;
; start-up routine
;
begin": move a,[440700,,[0]] ; null string
rscan ; set rscan buffer to null
start: skipa
setom cclflg ;set ccl flag if started at +1
reset
movei 1,.fhslf ;activate the interrupt system
move 2,[levtab,,chntab]
sir
movei 1,.fhslf
eir
movei 1,.fhslf
move 2,[400400,,000000] ;enable pdl overflow, debugger channels
aic
skipe lowlim ; if restarting, don't init free storage
jrst r1 ; system.
move p,pdlbot ; start runtime stack
movei ep,(p) ; first frame pointer
move a,seg3hi" ; top of symbol table
addi a,1000 ; get ready to ...
lsh a,-9. ; turn it into a page number
movem a,lowlim ; and mark as lower memory bound
move a,[.fhslf,,770] ; we are going to find out if DDT is here
rmap
came a,[-1] ;does this page exist? yes -> DDT loaded
skipa a,[760] ;top of core if DDT is loaded
movei a,1000 ;top of core if DDT isn't loaded
movem a,hilim ;is upper memory bound (you can't use DDT!)
ccall ainit ;initialise the storage allocator
r1: mcall setup
restart:
mcall debug,[$argc,[[$argv]]] ;run the users program
ccall exit,[[[0]]] ;and go home (this never returns)
;
; interrupt handlers
;
pdlsrv:
hrroi a,[asciz/?Fatal stack overflow - Can't continue
/]
psout
haltf
jrst pdlsrv
debrk
;
; exit routines
;
centry %exit,[cc] ;exit without cleaning up files
move a,cc ;can be continued
haltf
centry exit,[cc]
ccall closall ; close all c files
move a,cc
move c,a ; save return code
seto a,
closf ; close all files
jfcl
move a,c
haltf ; commit suicide
.exit1: hrroi a,[asciz/?Can't continue from exit() call
/]
psout
haltf
jrst .exit1
;
; number conversion
;
cfix": cfix ; convert float to int
movm 0,-1(p)
fadr 0,[.499999]
fix 0,0
skipge -1(p)
movns 0
movem 0,-1(p)
popj p,
cfloat":
fltr 0,-1(p)
movem 0,-1(p)
popj p,
; impure area
.idata
mdata cclflg
0 ; -1 if started from CCL
timing: block 1 ; timing flag
exiter: block 1 ; exit routine (for timing)
pdl": block pdlsiz ; the stack
chntab: 0,,intr0 ;debugger
0,,intr1
0,,intr2
0,,intr3
0,,intr4
0,,intr5
0,,intr6
0,,intr7
0,,intr8
1,,pdlsrv ; pdlov handler
0,,intr10
0,,intr11
0,,intr12
0,,intr13
0,,intr14
0,,intr15
0,,intr16
0,,intr17
0,,intr18
0,,intr19
0,,intr20
0,,intr21
0,,intr22
0,,intr23
0,,intr24
0,,intr25
0,,intr26
0,,intr27
0,,intr28
0,,intr29
0,,intr30
0,,intr31
0,,intr32
0,,intr33
0,,intr34
0,,intr35
.code
intr0: jsr intr
intr1: jsr intr
intr2: jsr intr
intr3: jsr intr
intr4: jsr intr
intr5: jsr intr
intr6: jsr intr
intr7: jsr intr
intr8: jsr intr
jsr intr
intr10: jsr intr
intr11: jsr intr
intr12: jsr intr
intr13: jsr intr
intr14: jsr intr
intr15: jsr intr
intr16: jsr intr
intr17: jsr intr
intr18: jsr intr
intr19: jsr intr
intr20: jsr intr
intr21: jsr intr
intr22: jsr intr
intr23: jsr intr
intr24: jsr intr
intr25: jsr intr
intr26: jsr intr
intr27: jsr intr
intr28: jsr intr
intr29: jsr intr
intr30: jsr intr
intr31: jsr intr
intr32: jsr intr
intr33: jsr intr
intr34: jsr intr
intr35: jsr intr
; note: only one level of interrupts permitted (level 3)!
begint":
intr: 0 ; clobbered by jsr
movem 0,intsav ; save all registers
movei 0,intsav+1
hrli 0,1
blt 0,intsav+p
hrrz 1,intr ; find out interrupt number
subi 1,intr0+1
movem 1,intnum
pushj p,@prctab(1) ; call routine
hrli 0,intsav+1
hrri 0,1
blt 0,p
move 0,intsav
setzm intnum
debrk
endint":
mentry dismiss
skipn intnum
jrst ds$1
movei b,ds$1
hrli b,010000 ; turn on user-mode bit
movem b,pclev3
setzm intnum
debrk
ds$1: return
.idata
levtab: pclev1
pclev2 ; not used currently
pclev3
pclev1":block 1
pclev2":block 1
pclev3":block 1
intsav: block p+1
pdlbot: <-pdlsiz,,pdl>
pdltop: pdl+pdlsiz-1
prctab: 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0
0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0 ? 0
intnum: 0
lowlim: 0
hilim: 0
patch: block 100
end start