--- /dev/null
+.define .outch1,.outch2,.inch1,.inch2
+
+ ! a0,d4 used
+ ! character in d1
+
+ .text
+.inch1:
+ move.l #acia1,a0
+ bra .inch
+.inch2:
+ move.l #acia2,a0
+.inch:
+ move.b (a0),d1
+ asr #1,d1
+ bcc .inch
+ move.b 2(a0),d1
+ and #0x7f,d1
+ rts
+
+.outch1:
+ move.l #acia1,a0
+ bra .outch
+.outch2:
+ move.l #acia2,a0
+.outch:
+ move.b (a0),d4
+ asr #2,d4
+ bcc .outch
+ move.b d1,2(a0)
+ rts
+
+
+.align 2
--- /dev/null
+.define .sar
+.define .lar
+.define .aar
+
+ !register usage:
+ ! a0 : descriptor address
+ ! d0 : index
+ ! a1 : base address
+ .text
+.aar:
+ movem.l d0/d1/a0/a1,.savreg
+ move.l (sp)+,.retara ! return address
+ move.l (sp)+,a0 ! descriptor address
+ move.l (sp)+,d0 ! index
+ move.l (sp)+,a1 ! base address
+ sub.l (a0),d0 ! index - lower bound : relative index
+ move.l 8(a0),-(sp) ! # bytes / element
+ move.l d0,-(sp)
+ jsr .mlu
+ add.l d1,a1 ! address of element
+ move.l a1,-(sp) ! returned on stack
+ move.l .retara,-(sp)
+ movem.l d0/d1/a0/a1,.savreg
+ rts
+
+
+.lar:
+ ! register usage: like .aar
+ ! d2 : # bytes / element
+
+ movem.l d0/d1/d2/a0/a1,.savreg
+ move.l (sp)+,.retara ! return address
+ move.l (sp)+,a0
+ move.l (sp)+,d0
+ move.l (sp)+,a1
+ sub.l (a0),d0
+ move.l 8(a0),d2 ! # bytes / element
+ move.l d0,-(sp)
+ move.l d2,-(sp)
+ jsr .mlu
+ add.l d1,a1 ! address of element
+ add.l d2,a1 ! a1++ because of predecrement
+ clr.l d1 !?nodig?
+ asr #1,d2
+ bne 3f
+ move.b -(a1),d1 ! 1 byte element
+ move.l d1,-(sp)
+ bra 5f
+3:
+ asr #1,d2
+ bne 4f
+ move.w -(a1),d1 ! 2 byte element
+ move.l d1,-(sp)
+ bra 5f
+4:
+ sub.l #1,d2
+1:
+ move.l -(a1),-(sp) ! 4n byte element (n = 1,2,...)
+ dbf d2,1b
+5:
+ move.l .retara,-(sp)
+ movem.l .savreg,d0/d1/d2/a0/a1
+ rts
+
+
+.sar:
+ !register usage: same as lar
+
+ movem.l d0/d1/a0/a1,.savreg
+ move.l (sp)+,.retara
+ move.l (sp)+,a0
+ move.l (sp)+,d0
+ move.l (sp)+,a1
+ sub.l (a0),d0
+ move.l 8(a0),d2 ! # bytes / element
+ move.l d0,-(sp)
+ move.l d2,-(sp)
+ jsr .mlu
+ add.l d1,a1
+ clr.l d1 !?nodig?
+ asr #1,d2
+ bne 3f
+ move.l (sp)+,d1
+ move.b d1,(a1) ! 1 byte element
+ bra 4f
+3:
+ asr #1,d2
+ bne 5f
+ move.l (sp)+,d1
+ move.w d1,(a1) ! 2 byte element
+ bra 4f
+5:
+ sub.l #1,d2
+1:
+ move.l (sp)+,(a1)+ ! 4n byte element (n = 1,2,...)
+ dbf d2,1b
+4:
+ move.l .retara,-(sp)
+ movem.l .savreg,d0/d1/a0/a1
+ rts
+.data
+.retara: .long 0
+.align 2
--- /dev/null
+.define .sari
+.define .lari
+.define .aari
+
+ .text
+.aari:
+ move.l (sp)+,.retari ! return address
+ cmp.l #4, (sp)+ ! size of descriptor elements
+ bne 9f
+ jsr .aar
+ move.l .retari,-(sp)
+ rts
+
+
+.lari:
+ move.l (sp)+,.retari ! return address
+ cmp.l #4, (sp)+ ! size of descriptor elements
+ bne 9f
+ jsr .lar
+ move.l .retari,-(sp)
+ rts
+9:
+ move.w #EILLINS,-(sp)
+ jmp .fat
+
+
+.sari:
+ move.l (sp)+,.retari ! return address
+ cmp.l #4, (sp)+ ! size of descriptor elements
+ bne 9b
+ jsr .sar
+ move.l .retari,-(sp)
+ rts
+.data
+.retari: .long 0
+.align 2
--- /dev/null
+.define .cii
+
+ .text
+.cii:
+ movem.l a0/d0/d1,.savreg
+ move.l (sp)+,a0 ! return address
+ move (sp)+,d0 ! destination size
+ sub (sp)+,d0 ! destination - source size
+ bgt 1f
+ sub d0,sp ! pop extra bytes
+ bra 3f
+1:
+ move (sp),d1
+ ext.l d1
+ swap d1
+ asr #1,d0
+2:
+ move.w d1,-(sp)
+ dbf d0,2b
+3:
+ move.l a0,-(sp)
+ movem.l .savreg,a0/d0/d1
+ rts
+.align 2
--- /dev/null
+.define .cmi, .cmi_
+
+ ! NUM == 4
+ ! result in d1
+ .text
+.cmi:
+.cmi_:
+ move.l (sp)+,.savret
+ move.l d0,.savd0
+ move.l #1,d1
+ move.l (sp)+,d0
+ cmp.l (sp)+,d0
+ bne 1f
+ clr.l d1
+ 1:
+ ble 2f
+ neg.l d1
+ 2:
+ move.l .savd0,d0
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .cmp
+
+ .text
+.cmp:
+ move.l (sp)+,.savret ! return address
+ move.l d0,.savd0
+ move.l #1,d1
+ move.l (sp)+,d0
+ cmp.l (sp)+,d0
+ bne 1f
+ clr.l d1
+ 1:
+ bcs 2f
+ neg.l d1
+ 2:
+ move.l .savd0,d0
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .cms
+
+ ! d0 contains set size
+
+ .text
+.cms:
+ move.l (sp)+,a2 ! return address
+ move.l sp,a0
+ move.l sp,a1
+ add d0,a1
+ move.w d0,d1
+ asr #1,d0
+1:
+ cmp (a0)+,(a1)+
+ bne 2f
+ dbf d0,1b
+2:
+ asl #1,d1
+ add d1,sp
+ move.l d0,-(sp)
+ jmp (a2)
+.align 2
--- /dev/null
+.define .cmu
+
+ ! d0 : # bytes of 1 block
+ .text
+.cmu:
+ movem.l d2/a0/a1/a2,.savreg
+ move.l (sp)+,a2 ! reta
+ move.l sp,a0 ! top block
+ move.l sp,a1
+ add.l d0,a1 ! lower block
+ move.l d0,d2
+ asr.l #2,d0
+ sub.l #1,d0
+ move.l #1,d1 ! greater
+1:
+ cmp.l (a0)+,(a1)+
+ bne 2f
+ dbf d0,1b
+ clr.l d1 ! equal
+2:
+ bcc 3f
+ neg.l d1 ! less
+3:
+ asl.l #1,d2
+ add.l d2,sp ! new sp
+ move.l a2,-(sp)
+ movem.l .savreg,d2/a0/a1/a2
+ rts
+.align 2
--- /dev/null
+.define .csa
+
+ .text
+.csa:
+ movem.l d0/a0/a1/a2,.savreg
+ move.l (sp)+,a0 ! case descriptor
+ move.l (sp)+,d0 ! index
+ move.l (a0)+,a1 ! default address
+ sub.l (a0)+,d0 ! index - lower bound
+ blt 1f
+ cmp.l (a0)+,d0 ! rel. index <-> upper - lower bound
+ bgt 1f
+ asl.l #2,d0
+ add.l d0,a0
+ move.l (a0),d0 ! test jump address
+ beq 1f
+ move.l d0,-(sp)
+ bra 3f
+1:
+ move.l a1,d0 ! test default jump address
+ beq 2f
+ move.l a1,-(sp) ! jump address
+3:
+ movem.l .savreg,d0/a0/a1/a2
+ rts ! not a real rts
+2:
+ move.w #ECASE,-(sp)
+ jmp .fat
+.align 2
--- /dev/null
+.define .csb
+
+ .text
+.csb:
+ movem.l d0/d1/a0/a1,.savreg
+ move.l (sp)+,a0 ! case descriptor
+ move.l (sp)+,d0 ! index
+ move.l (a0)+,a1 ! default jump address
+ move.l (a0)+,d1 ! # entries
+ beq 2f
+ sub.l #1,d1
+1:
+ cmp.l (a0)+,d0
+ beq 3f
+ tst.l (a0)+ ! skip jump address
+ dbf d1,1b
+2:
+ move.l a1,d1 ! default jump address
+ bne 4f
+ move.l #ECASE,-(sp)
+ jmp .fat
+3:
+ move.l (a0)+,a1 ! get jump address
+4:
+ move.l a1,-(sp)
+ movem.l .savreg,d0/d1/a0/a1
+ rts
+.align 2
--- /dev/null
+.define .ciu
+.define .cui
+.define .cuu
+
+ .text
+.ciu:
+.cui:
+.cuu:
+ move.l (sp)+,a0 ! return address
+ move (sp)+,d0 ! destination size
+ sub (sp)+,d0
+ bgt 1f
+ sub d0,sp
+ jmp (a0)
+1:
+ asr #1,d0
+2:
+ clr -(sp)
+ dbf d0,2b
+ jmp (a0)
+.align 2
--- /dev/null
+.define .cfi,.cif,.cfu,.cuf,.cff
+
+ .text
+
+ ! this is a dummy float conversion routine
+.cfi:
+.cif:
+.cfu:
+.cuf:
+.cff:
+ move.l (sp)+,a0 ! return address
+ move (sp)+,d0 ! destination size
+ sub (sp)+,d0 ! diff. in sizes
+ sub d0,sp
+ jmp (a0)
+.align 2
--- /dev/null
+.define .diagnos
+
+space = 040
+del = 0177
+
+ .text
+.diagnos:
+ move.l hol0,-(sp)
+ move.l hol0+FILN_AD,d2
+ beq 1f
+ move.l d2,a0
+ move.l #40,d0
+3:
+ move.b (a0)+,d1
+ beq 2f
+ cmp.b #del,d1
+ bge 1f
+ cmp.b #space,d1
+ blt 1f
+ sub #1,d0
+ bgt 3b
+ clr.b (a1)
+2:
+ move.l d2,-(sp)
+ pea fmt
+ jsr _printf
+ add #12,sp
+ jmp _printf
+
+1:
+ move.l #unknwn,d2
+ bra 2b
+
+ .data
+fmt: .asciz "%s, line %d: "
+unknwn: .asciz "unknown file"
+.align 2
--- /dev/null
+.define .dvi
+
+ ! signed long divide
+ .text
+.dvi:
+ movem.l d0/d4,.savdvi
+ move.l (sp)+,.retdvi
+ move.l (sp)+,d0
+ move.l (sp)+,d1
+ clr.l d4
+ tst.l d0 ! divisor
+ bpl 1f
+ neg.l d0
+ not d4
+1:
+ tst.l d1 ! dividend
+ bpl 2f
+ neg.l d1
+ not d4
+ swap d4
+ not d4
+ swap d4
+2:
+ move.l d1,-(sp)
+ move.l d0,-(sp)
+ jsr .dvu
+ tst d4
+ beq 5f
+ neg.l d1 ! quotient
+5:
+ tst.l d4
+ bpl 6f
+ neg.l d2 ! remainder
+6:
+ movem.l .savdvi,d0/d4
+ move.l .retdvi,-(sp)
+ rts
+.data
+.savdvi: .space 12
+.retdvi: .long 0
+.text
+.align 2
--- /dev/null
+.define .dvu
+
+ ! unsigned long divide
+ ! register usage:
+ ! : d0 divisor
+ ! d1 dividend
+ ! exit : d1 quotient
+ ! d2 remainder
+ .text
+.dvu:
+ movem.l d0/d3,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,d0
+ move.l (sp)+,d1
+ tst.l d0
+ bne 0f
+ move.w #EIDIVZ,-(sp)
+ jsr .trp
+0:
+ clr.l d2
+ move.l #31,d3
+3:
+ lsl.l #1,d1
+ roxl.l #1,d2
+ cmp.l d0,d2
+ blt 4f
+ sub.l d0,d2
+ add #1,d1
+4:
+ dbf d3,3b
+ movem.l .savreg,d0/d3
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .exg
+
+ ! d0 : exchange size in bytes
+ .text
+.exg:
+ move.l (sp)+,.savret
+ movem.l d1/a1/a2,.savreg
+ move.l sp,a1
+ sub.l d0,sp
+ move.l sp,a2
+ asr #1,d0
+ move.l d0,d1
+1:
+ move.l (a1)+,(a2)+
+ sub #1,d0
+ bgt 1b
+ move.l sp,a1
+ asr #1,d1
+1:
+ move.l (a1)+,(a2)+
+ sub #1,d1
+ bgt 1b
+ move.l a1,sp
+ movem.l .savreg,d1/a1/a2
+ move.l .savret,-(sp)
+ rts
--- /dev/null
+.define .fat
+
+ .text
+.fat:
+ jsr .trp
+ jmp EXIT
+.align 2
--- /dev/null
+.define .inn
+
+! d0 : set size in bytes
+! d1 : bitnumber
+
+ .text
+.inn:
+ movem.l d1/d2/a0/a1,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,d1
+ move.l sp,a1
+ add.l d0,a1
+ move.l sp,a0
+ move.l d1,d2
+ asr.l #4,d2
+ !bchg.l #0,d2
+ cmp.l d0,d2
+ bcc 1f
+ add.l d2,a0
+ move.l (a0),d2
+ btst d1,d2 !eigenlijk .l
+ beq 1f
+ move.l #1,d0
+ bra 2f
+1:
+ clr.l d0
+2:
+ move.l a1,sp
+ movem.l .savreg,d1/d2/a0/a1
+ move.l .savret,-(sp)
+ rts
--- /dev/null
+.define .lfr
+
+ .text
+.lfr:
+ move.l (sp)+,a0
+ cmp #2,d7
+ bne 1f
+ move d0,-(sp)
+ bra 3f
+1:
+ cmp #4,d7
+ bne 2f
+ move.l d0,-(sp)
+ bra 3f
+2:
+ cmp #8,d7
+ bne 4f
+ move.l d1,-(sp)
+ move.l d0,-(sp)
+3:
+ jmp(a0)
+4:
+ move.w #EILLINS,-(sp)
+ jmp .fat
+.align 2
--- /dev/null
+.define .los
+
+ ! d0 : # bytes
+ ! a0 : source address
+ .text
+.los:
+ movem.l d0/a0,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,d0
+ move.l (sp)+,a0
+ cmp.l #1,d0
+ bne 1f
+ clr.l d0 !1 byte
+ move.b (a0),d0
+ move.l d0,-(sp)
+ bra 3f
+1:
+ cmp.l #2,d0
+ bne 2f
+ clr.l d0 !2 bytes
+ add.l #2,a0
+ move.w (a0),d0
+ move.l d0,-(sp)
+ bra 3f
+2:
+ add.l d0,a0 !>=4 bytes
+ asr.l #2,d0
+
+4: move.l -(a0),-(sp)
+ sub.l #1,d0
+ bgt 4b
+3:
+ movem.l .savreg,d0/a0
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .mli
+
+
+ .text
+.mli:
+ move.l d5,.savmli
+ move.l (sp)+,.retmli
+ move.l (sp)+,d1
+ move.l (sp)+,d0
+ clr d5
+ tst.l d0
+ bpl 1f
+ neg.l d0
+ not d5
+1:
+ tst.l d1
+ bpl 2f
+ neg.l d1
+ not d5
+2:
+ move.l d0,-(sp)
+ move.l d1,-(sp)
+ jsr .mlu
+ tst d5
+ beq 3f
+ neg.l d1
+ negx.l d0
+3:
+ move.l .savmli,d5
+ move.l .retmli,-(sp)
+ rts
+.data
+.savmli: .long 0
+.retmli: .long 0
+.text
+.align 2
--- /dev/null
+.define .mlu
+
+ ! entry : d0 multiplicand
+ ! d1 multiplier
+ ! exit : d0 high order result
+ ! d1 low order result
+
+ .text
+.mlu:
+ move.l (sp)+,.savret
+ move.l (sp)+,d1
+ move.l (sp)+,d0
+ cmp.l #32768,d0
+ bgt 1f
+ cmp.l #32768,d1
+ bls 2f
+1: movem.l d2/d3/d4/d6,.savreg
+ move.l d1,d3
+ move.l d1,d2
+ swap d2
+ move.l d2,d4
+ mulu d0,d1
+ mulu d0,d2
+ swap d0
+ mulu d0,d3
+ mulu d4,d0
+ clr.l d6
+ swap d1
+ add d2,d1
+ addx.l d6,d0
+ add d3,d1
+ addx.l d6,d0
+ swap d1
+ clr d2
+ clr d3
+ swap d2
+ swap d3
+ add.l d2,d0
+ add.l d3,d0
+ movem.l .savreg,d2/d3/d4/d6
+ move.l .savret,-(sp)
+ rts
+2: mulu d0,d1
+ clr d0
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .mon
+ .text
+.mon:
+ move.l (sp)+,a0
+ pea fmt
+ jsr .diagnos
+ add #6,sp
+ jmp EXIT
+
+ .data
+fmt: .asciz "system call %d not implemented"
+.align 2
--- /dev/null
+.define .nop
+
+ .text
+.nop:
+ move.l hol0,-(sp)
+ pea fmt
+ jsr .diagnos
+ add.l #8,sp
+ rts
+
+ .data
+fmt: .asciz "test %d\n"
+.align 2
--- /dev/null
+.define _printf
+.define _putchar
+.define _getal
+.define _char
+.bss
+_getal:
+ .space 12
+_char:
+ .space 1
+.data
+sav:
+ .long 0
+.text
+_printf:
+ movem.l d0/d1/d3/a0/a1/a2/a3/a4/a5/a6,.savreg
+ move.l (sp)+,sav !return address
+ move.l sp,a6 !a6 <- address of arguments
+ move.l (a6)+,a5 !a5 <- address of format
+ clr.l d0 !d0 <- char to be printed
+next: move.b (a5)+,d0
+ beq out
+ cmp.b #'%',d0
+ beq procnt
+put: move.l d0,-(sp)
+ jsr _putchar !argument is long en op de stack
+ tst.l (sp)+
+ jmp next
+
+procnt: move.b (a5)+,d0
+ cmp.b #'d',d0 !NOTE: %d means unsigned.
+ beq digit
+ cmp.b #'s',d0
+ beq string
+ cmp.b #'%',d0 !second % has to be printed.
+ beq put
+ tst.b -(a5) !normal char should be printed
+ jmp next
+
+string: move.l (a6)+,a2 !a2 <- address of string
+sloop: move.b (a2)+,d0
+ beq next
+ move.l d0,-(sp)
+ jsr _putchar !argument is long en op de stack
+ tst.l (sp)+
+ jmp sloop
+
+digit: move.l (a6)+,d1 !d1 <- integer
+ move.l #_getal+12,a3 !a3 <- ptr to last part of buf
+ move.b #0,-(a3) !stringterminator
+dloop: move.l d1,-(sp)
+ move.l #10,-(sp)
+ jsr .dvu !d1 <- quotient d3 <- remainder
+ add.l #'0',d3
+ move.b d3,-(a3)
+ tst.l d1 !if quotient = 0 then ready
+ bne dloop
+ move.l a3,a2
+ jmp sloop !print digitstring.
+
+out:
+ move.l sav,-(sp)
+ movem.l .savreg,d0/d1/d3/a0/a1/a2/a3/a4/a5/a6
+ rts
+
+
+_putchar:
+ movem.l d0,.savreg
+ move.l 4(sp),d0
+ move.b d0,_char
+ move.l #1,-(sp)
+ move.l #_char,-(sp)
+ move.l #1,-(sp)
+ jsr _write
+ add.l #12,sp
+ movem.l .savreg,d0
+ rts
+.align 2
--- /dev/null
+.define .rck
+
+ .text
+.rck:
+ movem.l d0/a0,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,a0 ! descriptor address
+ move.l (sp),d0
+ cmp.l (a0),d0
+ blt 1f
+ cmp.l 2(a0),d0
+ ble 2f
+1:
+ move.l #ERANGE,-(sp)
+ jsr .trp
+2:
+ movem.l .savreg,d0/a0
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .ret
+
+ .text
+.ret:
+ beq 3f
+ cmp #2,d0
+ bne 1f
+ move (sp)+,d0
+ bra 3f
+1:
+ cmp #4,d0
+ bne 2f
+ move.l (sp)+,d0
+ bra 3f
+2:
+ cmp #8,d0
+ bne 4f
+ move.l (sp)+,d0
+ move.l (sp)+,d1
+3:
+ unlk a6
+ rts
+4:
+ move.w #EILLINS,-(sp)
+ jmp .fat
+.align 2
--- /dev/null
+.define .savd0
+.define .savret
+.define .savreg
+
+.data
+.savd0:
+ .long 0
+.savret:
+ .long 0
+.savreg:
+ .space 128
+.text
+.align 2
--- /dev/null
+.define .set
+
+ ! d0 : setsize in bytes
+ ! d1 : bitnumber
+ .text
+.set:
+ movem.l d1/d2/a1,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,d1
+ move.l d0,d2
+ asr.l #2,d2
+1:
+ clr.l -(sp) !create empty set
+ sub.l #1,d2
+ bgt 1b
+ move.l sp,a1 ! set base
+ move.l d1,d2
+ asr.l #4,d2
+ !bchg #0,d2
+ cmp.l d0,d2
+ bcs 1f
+ move.w #ESET,-(sp)
+ move.l .savret,-(sp)
+ jmp .trp
+1:
+ add.l d2,a1
+ move.l (a1),d2
+ bset d1,d2
+ move.l d2,(a1)
+ movem.l .savreg,d1/d2/a1
+ move.l .savret,-(sp)
+ rts
--- /dev/null
+.define .strhp
+
+ .text
+.strhp:
+ move.l d0,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,d0 ! heap pointer
+ move.l d0,.reghp
+ cmp.l .limhp,d0
+ blt 1f
+ add.l #0x400,d0
+ and.l #~0x3ff,d0
+ move.l d0,.limhp
+ cmp.l d0,sp
+ ble 2f
+1:
+ move.l .savreg,d0
+ move.l .savret,-(sp)
+ rts
+2:
+ move.w #EHEAP,-(sp)
+ jmp .fat
+.align 2
--- /dev/null
+.define .sig
+
+ .text
+.sig:
+ movem.l a1/a2,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,a1 ! trap pc
+ move.l .trppc,-(sp)
+ move.l a1,.trppc
+ movem.l .savreg,a1/a2
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .sts
+
+ ! d0 : # bytes
+ ! a0 : destination address
+ .text
+.sts:
+ movem.l d0/a0,.savreg
+ move.l (sp)+,.savret
+ move.l (sp)+,d0
+ move.l (sp)+,a0
+ cmp #1,d0
+ bne 1f
+ move.l (sp)+,d0
+ move.b d0,(a0)
+ bra 4f
+
+1: cmp #2,d0
+ bne 2f
+ move.l (sp)+,d0
+ add.l #2,a0
+ move.w d0,(a0)
+ bra 4f
+2:
+ asr #2,d0
+ sub.l #1,d0
+3:
+ move.l (sp)+,(a0)+
+ dbf d0,3b
+4:
+ movem.l .savreg,d0/a0
+ move.l .savret,-(sp)
+ rts
+.align 2
--- /dev/null
+.define .trp
+
+ .text
+.trp:
+ move.l (sp)+,a2 ! return address
+ move.w (sp)+,d0 ! error number
+ move.l a2,-(sp)
+ move.w d0,-(sp)
+ cmp #16,d0
+ bcc 1f
+ btst d0,.trpim
+ bne 3f
+1:
+ move.l .trppc,a0
+ move.l a0,d0
+ beq 9f
+ clr.l .trppc
+ jsr (a0)
+3:
+ add #2,sp
+ rts
+9:
+ pea fmt
+ jsr .diagnos
+ jmp EXIT
+
+ .data
+fmt: .asciz "trap %d called\n"
+.align 2