Adapted to new assembler and made re-entrant.

This commit is contained in:
ceriel 1986-07-22 13:37:16 +00:00
parent f514411cea
commit 399a46eb92
37 changed files with 452 additions and 292 deletions

View file

@ -1,4 +1,4 @@
tail_em.a
libem_s.a
ari.s
ara.s
cvf.s
@ -30,4 +30,3 @@ trp.s
dia.s
printf.s
dvu.s
sav.s

View file

@ -1,17 +1,33 @@
# $Header$
install:
../../install tail_em.a tail_em
../../install end.s end_em
MACH=m68k4
install: all
../../install head_em.o head_em
../../install libem_o.a tail_em.rt
../../install end.o end_em
cmp:
-../../compare tail_em.a tail_em
-../../compare end.s end_em
cmp: all
-../../compare head_em.o head_em
-../../compare libem_o.a tail_em.rt
-../../compare end.o end_em
all: head_em.o libem_o.a end.o
end.o: end.s
$(MACH) -I../../../h -c end.s
head_em.o: head_em.s
$(MACH) -I../../../h -c head_em.s
libem_o.a: libem_s.a
ASAR=aal ; export ASAR ;\
march . libem_o.a
clean:
rm -f *.o
opr :
make pr | opr
pr:
@arch pv tail_em.a | pr -h `pwd`/tail_em.a
@pr `pwd`/head_em.s
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/end.s

View file

@ -1,9 +1,13 @@
.define .outch1,.outch2,.inch1,.inch2
.sect .text
.sect .rom
.sect .data
.sect .bss
! a0,d4 used
! a0,d0 used
! character in d1
.text
.sect .text
.inch1:
move.l #acia1,a0
bra .inch
@ -23,11 +27,10 @@
.outch2:
move.l #acia2,a0
.outch:
move.b (a0),d4
asr #2,d4
move.b (a0),d0
asr #2,d0
bcc .outch
move.b d1,2(a0)
rts
.align 2

View file

@ -1,15 +1,18 @@
.define .sar
.define .lar
.define .aar
.sect .text
.sect .rom
.sect .data
.sect .bss
!register usage:
! a0 : descriptor address
! d0 : index
! a1 : base address
.text
.sect .text
.aar:
movem.l d0/d1/a0/a1,.savreg
move.l (sp)+,.retara ! return address
move.l (sp)+,d2 ! return address
move.l (sp)+,a0 ! descriptor address
move.l (sp)+,d0 ! index
move.l (sp)+,a1 ! base address
@ -19,85 +22,77 @@
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
move.l d2,-(sp)
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)+,d2 ! 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)
move.l 8(a0),d0
move.l d0,-(sp)
jsr .mlu
add.l d1,a1 ! address of element
add.l d2,a1 ! a1++ because of predecrement
add.l 8(a0),a1 ! a1++ because of predecrement
clr.l d1 !?nodig?
asr #1,d2
asr #1,d0
bne 3f
move.b -(a1),d1 ! 1 byte element
move.l d1,-(sp)
bra 5f
3:
asr #1,d2
asr #1,d0
bne 4f
move.w -(a1),d1 ! 2 byte element
move.l d1,-(sp)
bra 5f
4:
sub.l #1,d2
sub.l #1,d0
1:
move.l -(a1),-(sp) ! 4n byte element (n = 1,2,...)
dbf d2,1b
dbf d0,1b
5:
move.l .retara,-(sp)
movem.l .savreg,d0/d1/d2/a0/a1
move.l d2,-(sp)
rts
.sar:
!register usage: same as lar
movem.l d0/d1/a0/a1,.savreg
move.l (sp)+,.retara
move.l (sp)+,d2
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)
move.l 8(a0),d0 ! # bytes / element
move.l d0,-(sp)
jsr .mlu
add.l d1,a1
clr.l d1 !?nodig?
asr #1,d2
asr #1,d0
bne 3f
move.l (sp)+,d1
move.b d1,(a1) ! 1 byte element
bra 4f
3:
asr #1,d2
asr #1,d0
bne 5f
move.l (sp)+,d1
move.w d1,(a1) ! 2 byte element
bra 4f
5:
sub.l #1,d2
sub.l #1,d0
1:
move.l (sp)+,(a1)+ ! 4n byte element (n = 1,2,...)
dbf d2,1b
dbf d0,1b
4:
move.l .retara,-(sp)
movem.l .savreg,d0/d1/a0/a1
move.l d2,-(sp)
rts
.data
.retara: .long 0
.align 2

View file

@ -1,36 +1,36 @@
.define .sari
.define .lari
.define .aari
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.aari:
move.l (sp)+,.retari ! return address
move.l (sp)+,d0 ! return address
cmp.l #4, (sp)+ ! size of descriptor elements
bne 9f
jsr .aar
move.l .retari,-(sp)
rts
move.l d0,-(sp)
jmp .aar
.lari:
move.l (sp)+,.retari ! return address
move.l (sp)+,d0 ! return address
cmp.l #4, (sp)+ ! size of descriptor elements
bne 9f
jsr .lar
move.l .retari,-(sp)
rts
move.l d0,-(sp)
jmp .lar
9:
move.w #EILLINS,-(sp)
jmp .fat
.sari:
move.l (sp)+,.retari ! return address
move.l (sp)+,d0 ! return address
cmp.l #4, (sp)+ ! size of descriptor elements
bne 9b
jsr .sar
move.l .retari,-(sp)
rts
.data
.retari: .long 0
move.l d0,-(sp)
jmp .sar
.align 2

View file

@ -1,8 +1,11 @@
.define .cii
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .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
@ -19,6 +22,6 @@
dbf d0,2b
3:
move.l a0,-(sp)
movem.l .savreg,a0/d0/d1
rts
.align 2

View file

@ -1,12 +1,15 @@
.define .cmi, .cmi_
.sect .text
.sect .rom
.sect .data
.sect .bss
! NUM == 4
! result in d1
.text
.sect .text
.cmi:
.cmi_:
move.l (sp)+,.savret
move.l d0,.savd0
move.l (sp)+,d2
move.l #1,d1
move.l (sp)+,d0
cmp.l (sp)+,d0
@ -16,7 +19,7 @@
ble 2f
neg.l d1
2:
move.l .savd0,d0
move.l .savret,-(sp)
move.l d2,-(sp)
rts
.align 2

View file

@ -1,9 +1,12 @@
.define .cmp
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.cmp:
move.l (sp)+,.savret ! return address
move.l d0,.savd0
move.l (sp)+,d2 ! return address
move.l #1,d1
move.l (sp)+,d0
cmp.l (sp)+,d0
@ -13,7 +16,7 @@
bcs 2f
neg.l d1
2:
move.l .savd0,d0
move.l .savret,-(sp)
move.l d2,-(sp)
rts
.align 2

View file

@ -1,8 +1,12 @@
.define .cms
.sect .text
.sect .rom
.sect .data
.sect .bss
! d0 contains set size
.text
.sect .text
.cms:
move.l (sp)+,a2 ! return address
move.l sp,a0

View file

@ -1,12 +1,15 @@
.define .cmu
.sect .text
.sect .rom
.sect .data
.sect .bss
! d0 : # bytes of 1 block
.text
.sect .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 #4,a0
move.l a0,a1
add.l d0,a1 ! lower block
move.l d0,d2
asr.l #2,d0
@ -22,8 +25,8 @@
neg.l d1 ! less
3:
asl.l #1,d2
move.l (sp)+,a0
add.l d2,sp ! new sp
move.l a2,-(sp)
movem.l .savreg,d2/a0/a1/a2
rts
jmp (a0)
.align 2

View file

@ -1,8 +1,11 @@
.define .csa
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .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
@ -21,9 +24,9 @@
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

View file

@ -1,8 +1,11 @@
.define .csb
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .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
@ -23,6 +26,5 @@
move.l (a0)+,a1 ! get jump address
4:
move.l a1,-(sp)
movem.l .savreg,d0/d1/a0/a1
rts
.align 2

View file

@ -1,8 +1,12 @@
.define .ciu
.define .cui
.define .cuu
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.ciu:
.cui:
.cuu:
@ -18,4 +22,5 @@
clr -(sp)
dbf d0,2b
jmp (a0)
.align 2

View file

@ -1,6 +1,10 @@
.define .cfi,.cif,.cfu,.cuf,.cff
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
! this is a dummy float conversion routine
.cfi:
@ -13,4 +17,5 @@
sub (sp)+,d0 ! diff. in sizes
sub d0,sp
jmp (a0)
.align 2

View file

@ -1,12 +1,16 @@
.define .diagnos
.sect .text
.sect .rom
.sect .data
.sect .bss
space = 040
del = 0177
.text
.sect .text
.diagnos:
move.l hol0,-(sp)
move.l hol0+FILN_AD,d2
move.l hol0+4,d2
beq 1f
move.l d2,a0
move.l #40,d0
@ -31,7 +35,7 @@ del = 0177
move.l #unknwn,d2
bra 2b
.data
.sect .data
fmt: .asciz "%s, line %d: "
unknwn: .asciz "unknown file"
.align 2

View file

@ -1,12 +1,15 @@
.define .dvi
.sect .text
.sect .rom
.sect .data
.sect .bss
! signed long divide
.text
.sect .text
.dvi:
movem.l d0/d4,.savdvi
move.l (sp)+,.retdvi
move.l (sp)+,d0
move.l (sp)+,d1
move.l 4(sp),d0
move.l 8(sp),d1
move.l d4,-(sp)
clr.l d4
tst.l d0 ! divisor
bpl 1f
@ -32,11 +35,10 @@
bpl 6f
neg.l d2 ! remainder
6:
movem.l .savdvi,d0/d4
move.l .retdvi,-(sp)
move.l (sp)+,d4
move.l (sp)+,a0
add.l #8,sp
move.l a0,-(sp)
rts
.data
.savdvi: .space 12
.retdvi: .long 0
.text
.align 2

View file

@ -1,4 +1,8 @@
.define .dvu
.sect .text
.sect .rom
.sect .data
.sect .bss
! unsigned long divide
! register usage:
@ -6,12 +10,11 @@
! d1 dividend
! exit : d1 quotient
! d2 remainder
.text
.sect .text
.dvu:
movem.l d0/d3,.savreg
move.l (sp)+,.savret
move.l (sp)+,d0
move.l (sp)+,d1
move.l 4(sp),d0
move.l 8(sp),d1
move.l d3,-(sp)
tst.l d0
bne 0f
move.w #EIDIVZ,-(sp)
@ -28,7 +31,10 @@
add #1,d1
4:
dbf d3,3b
movem.l .savreg,d0/d3
move.l .savret,-(sp)
move.l (sp)+,d3
move.l (sp)+,a0
add.l #8,sp
move.l a0,-(sp)
rts
.align 2

View file

@ -1,15 +1,16 @@
.define endtext,enddata,endbss
.define _end, _etext, _edata
.define endtext,enddata,endbss,_etext,_edata,_end
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .end ! only for declaration of _end and endbss.
.text
.sect .text
endtext:
_etext:
.align 4
.data
.sect .data
enddata:
_edata:
.align 4
.bss
.align 4
endbss:
.sect .end
_end:
endbss:

View file

@ -1,10 +1,13 @@
.define .exg
.sect .text
.sect .rom
.sect .data
.sect .bss
! d0 : exchange size in bytes
.text
.sect .text
.exg:
move.l (sp)+,.savret
movem.l d1/a1/a2,.savreg
move.l (sp)+,d2
move.l sp,a1
sub.l d0,sp
move.l sp,a2
@ -21,6 +24,5 @@
sub #1,d1
bgt 1b
move.l a1,sp
movem.l .savreg,d1/a1/a2
move.l .savret,-(sp)
move.l d2,-(sp)
rts

View file

@ -1,6 +1,10 @@
.define .fat
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.fat:
jsr .trp
jmp EXIT

View file

@ -1,16 +1,19 @@
.define .inn
.sect .text
.sect .rom
.sect .data
.sect .bss
! d0 : set size in bytes
! d1 : bitnumber
.text
.sect .text
.inn:
movem.l d1/d2/a0/a1,.savreg
move.l (sp)+,.savret
move.l (sp)+,a1
move.l (sp)+,d1
move.l sp,a1
add.l d0,a1
move.l d0,-(sp)
move.l sp,a0
add.l #4,a0
move.l d1,d2
asr.l #4,d2
!bchg.l #0,d2
@ -25,7 +28,7 @@
1:
clr.l d0
2:
move.l a1,sp
movem.l .savreg,d1/d2/a0/a1
move.l .savret,-(sp)
move.l (sp)+,d1
add.l d1,sp
move.l a1,-(sp)
rts

View file

@ -1,6 +1,10 @@
.define .lfr
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.lfr:
move.l (sp)+,a0
cmp #2,d7

View file

@ -1,11 +1,14 @@
.define .los
.sect .text
.sect .rom
.sect .data
.sect .bss
! d0 : # bytes
! a0 : source address
.text
.sect .text
.los:
movem.l d0/a0,.savreg
move.l (sp)+,.savret
move.l (sp)+,a1
move.l (sp)+,d0
move.l (sp)+,a0
cmp.l #1,d0
@ -30,7 +33,5 @@
sub.l #1,d0
bgt 4b
3:
movem.l .savreg,d0/a0
move.l .savret,-(sp)
rts
jmp (a1)
.align 2

View file

@ -1,12 +1,15 @@
.define .mli
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.mli:
move.l d5,.savmli
move.l (sp)+,.retmli
move.l (sp)+,d1
move.l (sp)+,d0
move.l 4(sp),d1
move.l 8(sp),d0
move.l d5,-(sp)
clr d5
tst.l d0
bpl 1f
@ -26,11 +29,9 @@
neg.l d1
negx.l d0
3:
move.l .savmli,d5
move.l .retmli,-(sp)
rts
.data
.savmli: .long 0
.retmli: .long 0
.text
move.l (sp)+,d5
move.l (sp)+,a0
add.l #8,sp
jmp (a0)
.align 2

View file

@ -1,20 +1,24 @@
.define .mlu
.sect .text
.sect .rom
.sect .data
.sect .bss
! entry : d0 multiplicand
! d1 multiplier
! exit : d0 high order result
! d1 low order result
.text
.sect .text
.mlu:
move.l (sp)+,.savret
move.l (sp)+,d1
move.l (sp)+,d0
movem.l d3/d4/d6,-(sp)
move.l 16(sp),d1
move.l 20(sp),d0
cmp.l #32768,d0
bgt 1f
cmp.l #32768,d1
bls 2f
1: movem.l d2/d3/d4/d6,.savreg
1:
move.l d1,d3
move.l d1,d2
swap d2
@ -36,12 +40,13 @@
swap d2
swap d3
add.l d2,d0
add.l d3,d0
movem.l .savreg,d2/d3/d4/d6
move.l .savret,-(sp)
rts
add.l d3,a0
bra 3f
2: mulu d0,d1
clr d0
move.l .savret,-(sp)
rts
3:
movem.l (sp)+,d3/d4/d6
move.l (sp)+,a0
add #8,sp
jmp (a0)
.align 2

View file

@ -1,12 +1,17 @@
.define .mon
.text
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
.mon:
move.l (sp)+,a0
pea fmt
jsr .diagnos
add #6,sp
add #8,sp
jmp EXIT
.data
.sect .data
fmt: .asciz "system call %d not implemented"
.align 2

View file

@ -1,6 +1,10 @@
.define .nop
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.nop:
pea 4(sp)
move.l hol0,-(sp)
@ -9,6 +13,6 @@
add.l #12,sp
rts
.data
.sect .data
fmt: .asciz "test %d, sp %d\n"
.align 2

View file

@ -1,78 +1,125 @@
.sect .text;.sect .rom;.sect .data;.sect .bss
.define _printn
.define _printf
.define _putchar
.define _getal
.define _char
.bss
_getal:
.space 12
_char:
.space 1
.align 2
.data
sav:
.long 0
.text
_printf:
movem.l d0/d1/d2/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 d2 <- remainder
add.l #'0',d2
move.b d2,-(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/d2/a0/a1/a2/a3/a4/a5/a6
rts
.extern _printf
.sect .text
_putchar:
movem.l d0,.savreg
move.l 4(sp),d0
move.b d0,_char
move.l #1,-(sp)
move.l #_char,-(sp)
pea 9(sp)
move.l #1,-(sp)
jsr _write
add.l #12,sp
movem.l .savreg,d0
rts
.align 2
_printf:
tst.b -56(sp)
link a6,#-16
!Local -4 into d7
!Local -12 into d6
!Local -8 into a5
!Local 8 into a4
!Local -16 into a3
movem.l d7/d6/a5/a4/a3,-(sp)
move.l 8(a6),a4
lea 12(a6),a1
move.l a1, a5
I0014:
move.l a4, a0
add.l #1,a4
clr.l d0
move.b (a0),d0
move.l d0, d7
cmp.l #37,d7
beq I0015
tst.l d7
beq I0012
move.l d7,-(sp)
jsr _putchar
add #4,sp
jmp I0014
I0015:
move.l a4, a0
add.l #1,a4
clr.l d0
move.b (a0),d0
move.l d0, d7
cmp.l #100,d7
beq I0018
cmp.l #117,d7
bne I0017
I0018:
move.l a5, a0
add.l #4,a5
move.l (a0), d6
cmp.l #100,d7
bne I0019
tst.l d6
bge I0019
clr.l d2
sub.l d6,d2
move.l d2, d6
pea 45
jsr _putchar
add #4,sp
I0019:
move.l d6,-(sp)
jsr _printn
add #4,sp
jmp I0014
I0017:
cmp.l #115,d7
bne I0014
move.l a5, a0
add.l #4,a5
move.l (a0), a3
I001c:
move.l a3, a0
add.l #1,a3
clr.l d0
move.b (a0),d0
move.l d0, d7
tst.l d7
beq I0014
move.l d7,-(sp)
jsr _putchar
add #4,sp
jmp I001c
I0012:
movem.l (sp)+,d7/d6/a5/a4/a3
unlk a6
rts
.extern _printn
_printn:
tst.b -44(sp)
link a6,#-4
!Local -4 into d7
move.l d7,-(sp)
.sect .data
_14:
.data4 808530483
.data4 875902519
.data4 943259648
.sect .text
move.l 8(a6),-(sp)
pea 10
jsr .dvu
move.l d1, d7
tst.l d7
beq I0023
move.l d7,-(sp)
jsr _printn
add #4,sp
I0023:
pea _14
move.l 8(a6),-(sp)
pea 10
jsr .dvu
move.l (sp)+,a1
add.l d2,a1
clr.l d0
move.b (a1),d0
move.l d0,-(sp)
jsr _putchar
add #4,sp
move.l (sp)+,d7
unlk a6
rts

View file

@ -1,9 +1,12 @@
.define .rck
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.rck:
movem.l d0/a0,.savreg
move.l (sp)+,.savret
move.l (sp)+,a1
move.l (sp)+,a0 ! descriptor address
move.l (sp),d0
cmp.l (a0),d0
@ -14,7 +17,6 @@
move.l #ERANGE,-(sp)
jsr .trp
2:
movem.l .savreg,d0/a0
move.l .savret,-(sp)
rts
jmp (a1)
.align 2

View file

@ -1,6 +1,10 @@
.define .ret
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.ret:
beq 3f
cmp #2,d0

View file

@ -1,11 +1,14 @@
.define .set
.sect .text
.sect .rom
.sect .data
.sect .bss
! d0 : setsize in bytes
! d1 : bitnumber
.text
.sect .text
.set:
movem.l d1/d2/a1,.savreg
move.l (sp)+,.savret
move.l (sp)+,a0
move.l (sp)+,d1
move.l d0,d2
asr.l #2,d2
@ -20,13 +23,10 @@
cmp.l d0,d2
bcs 1f
move.w #ESET,-(sp)
move.l .savret,-(sp)
jmp .trp
jsr .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
jmp (a0)

View file

@ -1,9 +1,12 @@
.define .strhp
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.strhp:
move.l d0,.savreg
move.l (sp)+,.savret
move.l (sp)+,a0
move.l (sp)+,d0 ! heap pointer
move.l d0,.reghp
cmp.l .limhp,d0
@ -14,9 +17,7 @@
cmp.l d0,sp
ble 2f
1:
move.l .savreg,d0
move.l .savret,-(sp)
rts
jmp (a0)
2:
move.w #EHEAP,-(sp)
jmp .fat

View file

@ -1,13 +1,14 @@
.define .sig
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.sig:
movem.l a1/a2,.savreg
move.l (sp)+,.savret
move.l (sp)+,a0
move.l (sp)+,a1 ! trap pc
move.l .trppc,-(sp)
move.l a1,.trppc
movem.l .savreg,a1/a2
move.l .savret,-(sp)
rts
jmp (a0)
.align 2

View file

@ -1,11 +1,14 @@
.define .sts
.sect .text
.sect .rom
.sect .data
.sect .bss
! d0 : # bytes
! a0 : destination address
.text
.sect .text
.sts:
movem.l d0/a0,.savreg
move.l (sp)+,.savret
move.l (sp)+,a1
move.l (sp)+,d0
move.l (sp)+,a0
cmp #1,d0
@ -27,7 +30,5 @@
move.l (sp)+,(a0)+
dbf d0,3b
4:
movem.l .savreg,d0/a0
move.l .savret,-(sp)
rts
jmp (a1)
.align 2

View file

@ -1,18 +1,22 @@
.extern _errno
.data
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .data
_errno:
.extern _lseek
.short 0
.text
.sect .text
_lseek:
link a6,#-0
.data
.sect .data
_13:
.short 29561
.short 29489
.short 11875
.short 0
.text
.sect .text
move.l #_13,.filn
move.w #8,.lino
move.w #0,-(sp)

View file

@ -1,7 +1,11 @@
.extern _exit
.sect .text
.sect .rom
.sect .data
.sect .bss
! Fake system call for 68000 running MACSBUG
.text
.sect .text
_exit:
jmp 0x0200f6

View file

@ -1,31 +1,41 @@
.define .trp
.sect .text
.sect .rom
.sect .data
.sect .bss
.text
.sect .text
.trp:
move.l (sp)+,a2 ! return address
move.l (sp)+,d0 ! error number
move.l a2,-(sp)
move.l d0,-(sp)
cmp.l #16,d0
cmp.l #16,4(sp)
bcc 1f
move.l d0,-(sp)
move.l 8(sp),d0
btst d0,.trpim
bne 3f
1:
move.l a0,-(sp)
move.l .trppc,a0
move.l a0,d0
beq 9f
clr.l .trppc
move.l 12(sp),-(sp)
jsr (a0)
add.l #4,sp
move.l (sp)+,a0
3:
add #4,sp
move.l (sp)+,d0
move.l (sp)+,(sp)
rts
9:
move.l (sp)+,a0
move.l (sp)+,d0
move.l 4(sp),-(sp)
pea fmt
jsr .diagnos
add #4,sp
jsr __cleanup
jmp EXIT
.data
.sect .data
fmt: .asciz "trap %d called\n"
.align 2