TODO nearly 100% compatible - only some header bytes are different - needs a bit more

fiddling - data+text bytes are OK
This commit is contained in:
Oliver Lehmann 2008-05-02 20:47:15 +00:00
parent 3bab4c852c
commit 449c91fc5e
1 changed files with 187 additions and 161 deletions

View File

@ -1,161 +1,187 @@
/************************************************************************** .seg
***************************************************************************
.data
W E G A - Quelle
KERN 3.2 Modul : clist.s .byte "@[$]clist.s Rev : 4.1 09/16/83 03:43:09"
.byte %25
Bearbeiter : O. Lehmann .byte %30
Datum : 02.05.08 .byte %30
Version : 1.0
.code
***************************************************************************
**************************************************************************/ _putcf::
{
.seg ldctl r1,fcw
.psec data di vi,nvi
.data ldl rr4,_cfreelist
ldl @rr6,rr4
ldl _cfreelist,rr6
fp := r15; ldctl fcw,r1
sp := rr14; ret
_clistwstr:: } /* _putcf */
.byte %40
.byte %5b _getcf::
.byte %24 {
.byte %5d ldctl r1,fcw
.byte %63 di vi,nvi
.byte %6c ldl rr2,_cfreelist
.byte %69 testl rr2
.byte %73 jr z,~egetcf
.byte %74
.byte %2e ldl rr4,@rr2
.byte %73 ldl _cfreelist,rr4
.byte %9
.byte %52 subl rr6,rr6
.byte %65 ldl @rr2,rr6
.byte %76 ld r0,_cfreelist+4
.byte %20 ld rr2(#4),r0
.byte %3a ~egetcf:
.byte %20 ldctl fcw,r1
.byte %34 ret
.byte %2e }
.byte %31
.byte %9 _getcb::
.byte %30 {
.byte %39 ldctl r1,fcw
.byte %2f di vi,nvi
.byte %31 ldl rr2,rr6(#2)
.byte %36 testl rr2
.byte %2f jr z,~egetcb
.byte %38
.byte %33 ld r0,rr2(#4)
.byte %20 subb rl0,rh0
.byte %30 subb rh0,rh0
.byte %33 ld r4,@rr6
.byte %3a sub r4,r0
.byte %34 ld @rr6,r4
.byte %33 ldl rr4,@rr2
.byte %3a ldl rr6(#2),rr4
.byte %30 testl rr4
.byte %39 jpr ne,~egetcb
.byte %0 subl rr4,rr4
ldl rr6(#6),rr4
.psec ~egetcb:
.code ldctl fcw,r1
ret
_putcf:: }
{
ldctl r1,fcw _putcb::
di vi,nvi {
ldl rr4,_cfreelist ldctl r1,fcw
ldl @rr6,rr4 push @r14,r1
ldl _cfreelist,rr6 di vi,nvi
ldctl fcw,r1 ldl rr2,rr4(#6)
ret testl rr2
} /* _putcf */ jpr ne,~else_putcb
ldl rr4(#2),rr6
_getcf:: ldl rr4(#6),rr6
{ jpr ~endif_putcb
ldctl r1,fcw ~else_putcb:
di vi,nvi ldl rr4(#6),rr6
ldl rr2,_cfreelist ldl @rr2,rr6
testl rr2 ~endif_putcb:
jr z,~egetcf subl rr0,rr0
ldl @rr6,rr0
ldl rr4,@rr2 ld r1,rr6(#4)
ldl _cfreelist,rr4 subb rl1,rh1
subb rh1,rh1
subl rr6,rr6 ld r0,@rr4
ldl @rr2,rr6 add r0,r1
ld r0,_cfreelist+4 ld @rr4,r0
ld rr2(#4),r0 pop r1,@rr14
~egetcf: ldctl fcw,r1
ldctl fcw,r1 ret
ret }
}
_getc::
_getcb:: {
{ ldctl r1,fcw
ldctl r1,fcw push @r14,r1
di vi,nvi di vi,nvi
ldl rr2,rr6(#2) dec @rr6,#1
testl rr2 jpr lt,~else_getc
jr z,~egetcb ldl rr2,rr6(#2)
lda rr4,rr2(#4)
ld r0,rr2(#4) ldb rl1,@rr4
subb rh7,rh0 // FIXME incb @rr4,#1
subb rh0,rh0 subb rh1,rh1
ld r4,@rr6 ldb rl0,rr2(#5)
sub r4,r0 cpb rl0,@rr4
ld @rr6,r4 jr eq,~endif_getc
ldl rr4,@rr2 inc r5,#2
ldl rr6(#2),rr4 add r5,r1
testl rr4 ldb rl2,@rr4
jpr ne,~egetcb subb rh2,rh2
subl rr4,rr4 ~egetc:
ldl rr6(#6),rr4 pop r1,@rr14
~egetcb: ldctl fcw,r1
ldctl fcw,r1 ret
ret ~else_getc:
} inc @rr6,#1
ld r2,#-1
_putcb:: jpr ~egetc
{ ~endif_getc:
ldctl r1,fcw inc r5,#2
push @r14,r1 add r5,r1
di vi,nvi ldb rl0,@rr4
ldl rr2,rr4(#6) ldl rr4,@rr2
testl rr2 ldl rr6(#2),rr4
jpr ne,~else_putcb testl rr4
ldl rr4(#2),rr6 jpr ne,~else2_getc
ldl rr4(#6),rr6 ldl rr6(#6),rr4
jpr ~endif_putcb ~else2_getc:
~else_putcb: ldl rr4,_cfreelist //get link to first free cblock
ldl rr4(#6),rr6 ldl @rr2,rr4 //put it into link of new free cblock
ldl @rr2,rr6 ldl _cfreelist,rr2 //put address of new free cblock into cfreelist
~endif_putcb: ldb rl2,rl0
subl rr0,rr0 subb rh2,rh2
ldl @rr6,rr0 jpr ~egetc
ld r1,rr6(#4) }
subb rh7,rh1 // FIXME
subb rh1,rh1 _putc::
ld r0,@rr4 {
add r0,r1 ldctl r6,fcw
ld @rr4,r0 di vi,nvi
pop r1,@rr14 ldl rr2,rr4(#6)
ldctl fcw,r1 testl rr2
ret jpr eq,~else_putc
} ~L0:
ldb rl0,rr2(#5)
_getc:: subb rh0,rh0
{ cp r0,_cfreelist+4
ldctl r1,fcw jpr ge,~endif2_putc
push @r14,r1 inc @rr4,#1
di vi,nvi lda rr4,rr2(#6)
add r5,r0
pop r1,@rr14 ldb @rr4,rl7
ldctl fcw,r1 incb rl0,#1
ret ldb rr2(#5),rl0
} clr r2
.psec data ~eputc:
.data ldctl fcw,r6
ret
~else_putc:
ldl rr2,_cfreelist
testl rr2
jpr eq,~endif_putc
ldl rr4(#2),rr2
~L1:
ldl rr0,@rr2
ldl _cfreelist,rr0
clr @rr2
subl rr0,rr0
ldl rr2(#2),rr0
ldl rr4(#6),rr2
jpr ~L0
~endif_putc:
ld r2,#-1
jpr ~eputc
~endif2_putc:
ldl rr0,_cfreelist
testl rr0
jpr eq,~endif_putc
ldl @rr2,rr0
ldl rr2,rr0
jpr ~L1
}