This is asm version 1.1 of date(1), also by Phil Vandry. There are still

no GNO v2.0.6 specific changes.
This commit is contained in:
gdr-ftp 1998-04-10 18:03:48 +00:00
parent 98f457ebec
commit 027b934919
2 changed files with 237 additions and 13 deletions

View File

@ -4,6 +4,7 @@
mcopy date.mac
keep date
copy 13/asmdefs/gno/e16.ioctl
cline gequ 0
@ -34,7 +35,7 @@ lpp20 lda [cline],y
and #$ff
cmp #'V'
beq showvers
cmp #'u'
cmp #'c'
beq updateflag
showusg ~ErrWriteCString #usage
bra getoutPASS
@ -46,7 +47,31 @@ ok anop
jsr handle
lda #15 ; SIGTERM
jsr handle
refresh pha
pha
pea 2 ; stdout
pea TIOCGETP|-16
pea TIOCGETP
pea sgttyb|-16
pea sgttyb
pea errno|-16
pea errno
ldx #$2603
jsl $e10008
pla
lda sgttyb+4
sta oldflags
and #$ffef
sta sgttyb+4
jsr csetp
lda oldflags
sta sgttyb+4
refresh anop
pha
pha
pha
pha
@ -94,18 +119,34 @@ refresh pha
sta weekday
lda weekdays-2,x
sta weekday+1
~WriteString #ramit
WriteGS ramit
lda uflag
beq exitall
pea 0
pea 1
case on
jsl sleep
case off
brl refresh
exitall ~WriteString #justnewl
exitall WriteGS justnewl
jsr csetp
getout QuitGS qtrec
csetp anop
pha
pea 2
pea TIOCSETP|-16
pea TIOCSETP
pea sgttyb|-16
pea sgttyb
pea errno|-16
pea errno
ldx #$2603
jsl $e10008
pla
rts
uflag ds 2
handler anop
phb
plx
@ -181,7 +222,15 @@ qtrec dc i'2'
dc a4'0'
dc i'$4000'
ramit dc i1'strend-strbeg'
ramit dc i'4'
dc i'2'
dc a4'strbeg'
dc i4'strend-strbeg'
ds 4
sgttyb ds 6
oldflags ds 2
strbeg anop
weekday dc c'xxx '
@ -196,13 +245,19 @@ year dc c'xxxx'
strend anop
justnewl dc h'01 0a'
justnewl dc i'4'
dc i'2'
dc a4'justnewl1'
dc i4'1'
ds 4
justnewl1 dc h'0a'
weekdays dc c'SunMonTueWedThuFriSat'
months dc c'JanFebMarAprMayJunJulAugSepOctNovDec'
versstr dc c'date utility, asm version 1.0'
versstr dc c'date utility, asm version 1.1'
dc h'0d 0a'
usage dc c'usage: date [-uV]',h'0d 0a'
usage dc c'usage: date [-cV]',h'0d 0a'
dc h'0'
end
@ -210,10 +265,6 @@ errno data
ds 2
end
uflag data
ds 2
end
copy modsleep.asm
dpstk data ~Direct

173
bin/date/date.mac Normal file
View File

@ -0,0 +1,173 @@
macro
&l ~Int2Dec &p1,&p2,&p3,&p4
&l ph2 &p1
ph4 &p2
ph2 &p3
ph2 &p4
ldx #$260B
jsl $E10000
mend
macro
&l ~ReadTimeHex
&l ldx #$0D03
jsl $E10000
mend
macro
&l long &a,&b
lclb &i
lclb &m
&a amid &a,1,1
&m setb ("&a"="M").or.("&a"="m")
&i setb ("&a"="I").or.("&a"="i")
aif c:&b=0,.a
&b amid &b,1,1
&m setb ("&b"="M").or.("&b"="m").or.&m
&i setb ("&b"="I").or.("&b"="i").or.&i
.a
&l rep #&m*32+&i*16
aif .not.&m,.b
longa on
.b
aif .not.&i,.c
longi on
.c
mend
macro
&l ph2 &n1
aif "&n1"="*",.f
lclc &c
&l anop
&c amid &n1,1,1
aif "&c"="#",.d
aif s:longa=1,.a
rep #%00100000
.a
aif "&c"<>"{",.b
&c amid &n1,l:&n1,1
aif "&c"<>"}",.g
&n1 amid &n1,2,l:&n1-2
lda (&n1)
pha
ago .e
.b
aif "&c"="<",.c
lda &n1
pha
ago .e
.c
pei &n1
ago .e
.d
&n1 amid &n1,2,l:&n1-1
pea &n1
ago .f
.e
aif s:longa=1,.f
sep #%00100000
.f
mexit
.g
mnote "Missing closing '}'",16
mend
macro
&l ph4 &n1
aif "&n1"="*",.f
lclc &c
&l anop
&c amid &n1,1,1
aif "&c"="#",.d
aif s:longa=1,.a
rep #%00100000
.a
aif "&c"<>"{",.b
&c amid &n1,l:&n1,1
aif "&c"<>"}",.g
&n1 amid &n1,2,l:&n1-2
ldy #2
lda (&n1),y
pha
lda (&n1)
pha
ago .e
.b
aif "&c"<>"[",.c
ldy #2
lda &n1,y
pha
lda &n1
pha
ago .e
.c
aif "&c"<>"<",.c1
pei &n1+2
pei &n1
ago .e
.c1
lda &n1+2
pha
lda &n1
pha
ago .e
.d
&n1 amid &n1,2,l:&n1-1
pea +(&n1)|-16
pea &n1
ago .f
.e
aif s:longa=1,.f
sep #%00100000
.f
mexit
.g
mnote "Missing closing '}'",16
mend
macro
&l short &a,&b
lclb &i
lclb &m
&a amid &a,1,1
&m setb ("&a"="M").or.("&a"="m")
&i setb ("&a"="I").or.("&a"="i")
aif c:&b=0,.a
&b amid &b,1,1
&m setb ("&b"="M").or.("&b"="m").or.&m
&i setb ("&b"="I").or.("&b"="i").or.&i
.a
&l sep #&m*32+&i*16
aif .not.&m,.b
longa off
.b
aif .not.&i,.c
longi off
.c
mend
macro
&l quitgs &p
&l jsl $E100A8
dc i2'$2029'
dc i4'&p'
mend
macro
&l writegs &p
&l jsl $E100A8
dc i2'$2013'
dc i4'&p'
mend
macro
&l ~ErrWriteCString &p1
&l ph4 &p1
ldx #$210C
jsl $E10000
mend
macro
&l ~WriteCString &p1
&l ph4 &p1
ldx #$200C
jsl $E10000
mend
macro
&l ~WriteString &p1
&l ph4 &p1
ldx #$1C0C
jsl $E10000
mend