mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-06-09 12:29:29 +00:00
Initial checkin. These sources correspond to the GNO v2.0.4 build.
This commit is contained in:
parent
13962cbe8c
commit
227a5d4165
93
bin/mkdir/mkdir.asm
Normal file
93
bin/mkdir/mkdir.asm
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* MKDIR.ASM - Version 1.0
|
||||||
|
* Written by Tim Meekins
|
||||||
|
* Copyright (C) 1991 by Procyon, Inc.
|
||||||
|
* This program is hereby donated to the public domain.
|
||||||
|
*
|
||||||
|
* This program creates a new directory in the current (or specified)
|
||||||
|
* directory.
|
||||||
|
*
|
||||||
|
* TODO:
|
||||||
|
* o Add -p option.
|
||||||
|
* o Should I support creating multiple directories like Unix?
|
||||||
|
*
|
||||||
|
* HISTORY:
|
||||||
|
* 1.0 11/29/91 First version.
|
||||||
|
*
|
||||||
|
**************************************************************************
|
||||||
|
|
||||||
|
keep mkdir
|
||||||
|
mcopy mkdir.mac
|
||||||
|
|
||||||
|
mkdir START
|
||||||
|
jml ~GNO_COMMAND
|
||||||
|
END
|
||||||
|
|
||||||
|
main START
|
||||||
|
|
||||||
|
arg equ 0
|
||||||
|
retval equ arg+4
|
||||||
|
space equ retval+2
|
||||||
|
|
||||||
|
subroutine (2:argc,4:argv),space
|
||||||
|
|
||||||
|
stz retval
|
||||||
|
|
||||||
|
lda argc
|
||||||
|
dec a
|
||||||
|
bne part2
|
||||||
|
ErrWriteCString #usage
|
||||||
|
jmp error
|
||||||
|
part2 dec a
|
||||||
|
beq part3
|
||||||
|
ErrWriteCString #oneerr
|
||||||
|
jmp error
|
||||||
|
|
||||||
|
part3 ldy #4
|
||||||
|
lda [argv],y
|
||||||
|
sta arg
|
||||||
|
iny2
|
||||||
|
lda [argv],y
|
||||||
|
sta arg+2
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
short a
|
||||||
|
loop lda [arg],y
|
||||||
|
beq part4
|
||||||
|
sta pathname+2,y
|
||||||
|
iny
|
||||||
|
bra loop
|
||||||
|
|
||||||
|
part4 long a
|
||||||
|
sty pathname
|
||||||
|
Create createparm
|
||||||
|
bcc done
|
||||||
|
|
||||||
|
sta errval
|
||||||
|
|
||||||
|
ErrWriteCString #errleadin
|
||||||
|
Error errval
|
||||||
|
|
||||||
|
error inc retval
|
||||||
|
|
||||||
|
done return 2:retval
|
||||||
|
|
||||||
|
createparm dc i2'5'
|
||||||
|
createpath dc i4'pathname'
|
||||||
|
dc i2'$C3'
|
||||||
|
dc i2'$0F'
|
||||||
|
dc i4'$0000'
|
||||||
|
dc i2'$0D'
|
||||||
|
|
||||||
|
errval dc i2'0'
|
||||||
|
|
||||||
|
usage dc c'Usage: mkdir directory.',h'0d0a00'
|
||||||
|
oneerr dc c'mkdir: too many arguments.',h'0d0a00'
|
||||||
|
errleadin dc c'mkdir: ',h'00'
|
||||||
|
|
||||||
|
pathname dc i2'0'
|
||||||
|
ds 256 ;I dread any person entering a pathname
|
||||||
|
; ;this long!
|
||||||
|
|
||||||
|
END
|
111
bin/mkdir/mkdir.c
Normal file
111
bin/mkdir/mkdir.c
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
#pragma optimize -1
|
||||||
|
#pragma stacksize 2048
|
||||||
|
|
||||||
|
#include<stdio.h>
|
||||||
|
#include<stdlib.h>
|
||||||
|
#include<string.h>
|
||||||
|
#include<memory.h>
|
||||||
|
#include<gsos.h>
|
||||||
|
#include<errno.h>
|
||||||
|
|
||||||
|
void usage(char *callname)
|
||||||
|
|
||||||
|
{
|
||||||
|
fprintf(stderr,"usage: %s -[s|V] <dir1> <dir2> ...\n",callname);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main(int argc, char **argv)
|
||||||
|
|
||||||
|
{
|
||||||
|
FileInfoRecGS *InfoStruct;
|
||||||
|
int i = 1, exitFlag=0, silent = FALSE;
|
||||||
|
|
||||||
|
InfoStruct = (FileInfoRecGS *) malloc (sizeof(FileInfoRecGS));
|
||||||
|
InfoStruct->pathname = malloc (256);
|
||||||
|
InfoStruct->access = 0xC3;
|
||||||
|
InfoStruct->fileType = 0x0F;
|
||||||
|
InfoStruct->pCount = 3;
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
usage(argv[0]);
|
||||||
|
|
||||||
|
else if (!strcmp(argv[1],"-s"))
|
||||||
|
|
||||||
|
{
|
||||||
|
silent = TRUE;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (!strcmp(argv[1],"-V"))
|
||||||
|
|
||||||
|
{
|
||||||
|
printf("mkdir v1.1\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (argv[1][0] == '-') /* invalid option */
|
||||||
|
usage(argv[0]);
|
||||||
|
|
||||||
|
while(argv[i] != NULL) /* create subdirectories */
|
||||||
|
|
||||||
|
{
|
||||||
|
InfoStruct->pathname->length = (word) strlen(argv[i]);
|
||||||
|
strcpy(InfoStruct->pathname->text,argv[i]);
|
||||||
|
Create(InfoStruct);
|
||||||
|
errno = toolerror();
|
||||||
|
|
||||||
|
if (errno)
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!silent)
|
||||||
|
fprintf(stderr,"error $%x creating %s",errno,argv[i]);
|
||||||
|
if (errno == 0x40)
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!silent)
|
||||||
|
fprintf(stderr,": invalid pathname syntax\n");
|
||||||
|
exitFlag=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (errno == 0x44)
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!silent)
|
||||||
|
fprintf(stderr,": subdirectory does not exist\n");
|
||||||
|
exitFlag=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (errno == 0x47)
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!silent)
|
||||||
|
fprintf(stderr,": duplicate directory name\n");
|
||||||
|
exitFlag=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (errno == 0x2B)
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!silent)
|
||||||
|
fprintf(stderr,": volume write protected\n");
|
||||||
|
exitFlag=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!silent)
|
||||||
|
fprintf(stderr,"\n");
|
||||||
|
exitFlag=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(InfoStruct->pathname);
|
||||||
|
free(InfoStruct);
|
||||||
|
exit(exitFlag);
|
||||||
|
}
|
247
bin/mkdir/mkdir.mac
Normal file
247
bin/mkdir/mkdir.mac
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
macro
|
||||||
|
&lab subroutine &parms,&work
|
||||||
|
&lab anop
|
||||||
|
aif c:&work,.a
|
||||||
|
lclc &work
|
||||||
|
&work setc 0
|
||||||
|
.a
|
||||||
|
gbla &totallen
|
||||||
|
gbla &worklen
|
||||||
|
&worklen seta &work
|
||||||
|
&totallen seta 0
|
||||||
|
aif c:&parms=0,.e
|
||||||
|
lclc &len
|
||||||
|
lclc &p
|
||||||
|
lcla &i
|
||||||
|
&i seta c:&parms
|
||||||
|
.b
|
||||||
|
&p setc &parms(&i)
|
||||||
|
&len amid &p,2,1
|
||||||
|
aif "&len"=":",.c
|
||||||
|
&len amid &p,1,2
|
||||||
|
&p amid &p,4,l:&p-3
|
||||||
|
ago .d
|
||||||
|
.c
|
||||||
|
&len amid &p,1,1
|
||||||
|
&p amid &p,3,l:&p-2
|
||||||
|
.d
|
||||||
|
&p equ &totallen+3+&work
|
||||||
|
&totallen seta &totallen+&len
|
||||||
|
&i seta &i-1
|
||||||
|
aif &i,^b
|
||||||
|
.e
|
||||||
|
tsc
|
||||||
|
sec
|
||||||
|
sbc #&work
|
||||||
|
tcs
|
||||||
|
inc a
|
||||||
|
phd
|
||||||
|
tcd
|
||||||
|
phb
|
||||||
|
phk
|
||||||
|
plb
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab return &r
|
||||||
|
&lab anop
|
||||||
|
lclc &len
|
||||||
|
aif c:&r,.a
|
||||||
|
lclc &r
|
||||||
|
&r setc 0
|
||||||
|
&len setc 0
|
||||||
|
ago .h
|
||||||
|
.a
|
||||||
|
&len amid &r,2,1
|
||||||
|
aif "&len"=":",.b
|
||||||
|
&len amid &r,1,2
|
||||||
|
&r amid &r,4,l:&r-3
|
||||||
|
ago .c
|
||||||
|
.b
|
||||||
|
&len amid &r,1,1
|
||||||
|
&r amid &r,3,l:&r-2
|
||||||
|
.c
|
||||||
|
aif &len<>2,.d
|
||||||
|
ldy &r
|
||||||
|
ago .h
|
||||||
|
.d
|
||||||
|
aif &len<>4,.e
|
||||||
|
ldx &r+2
|
||||||
|
ldy &r
|
||||||
|
ago .h
|
||||||
|
.e
|
||||||
|
aif &len<>10,.g
|
||||||
|
ldy #&r
|
||||||
|
ldx #^&r
|
||||||
|
ago .h
|
||||||
|
.g
|
||||||
|
mnote 'Not a valid return length',16
|
||||||
|
mexit
|
||||||
|
.h
|
||||||
|
aif &totallen=0,.i
|
||||||
|
lda &worklen+1
|
||||||
|
sta &worklen+&totallen+1
|
||||||
|
lda &worklen
|
||||||
|
sta &worklen+&totallen
|
||||||
|
.i
|
||||||
|
plb
|
||||||
|
pld
|
||||||
|
tsc
|
||||||
|
clc
|
||||||
|
adc #&worklen+&totallen
|
||||||
|
tcs
|
||||||
|
aif &len=0,.j
|
||||||
|
tya
|
||||||
|
.j
|
||||||
|
rtl
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab ErrWriteCString &a1
|
||||||
|
&lab ph4 &a1
|
||||||
|
Tool $210c
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab ERROR &a1
|
||||||
|
&lab p16 $105,&a1
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab Create &a1
|
||||||
|
&lab gsos $2001,&a1
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab tool &a1
|
||||||
|
&lab ldx #&a1
|
||||||
|
jsl $e10000
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab p16 &a1,&a2
|
||||||
|
&lab jsl $E100A8
|
||||||
|
dc i2'&a1'
|
||||||
|
dc i4'&a2'
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab gsos &a1,&a2
|
||||||
|
&lab jsl $E100A8
|
||||||
|
dc i2'&a1'
|
||||||
|
dc i4'&a2'
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab ph4 &parm
|
||||||
|
lclc &char
|
||||||
|
lclc &char1
|
||||||
|
lclc &char2
|
||||||
|
&lab anop
|
||||||
|
&char amid &parm,1,1
|
||||||
|
aif "&char"="#",.immediate
|
||||||
|
aif "&char"="@",.at
|
||||||
|
aif s:longa=1,.chk1
|
||||||
|
rep #%00100000
|
||||||
|
.chk1
|
||||||
|
aif "&char"<>"{",.chk2
|
||||||
|
&char amid &parm,l:&parm,1
|
||||||
|
aif "&char"<>"}",.error
|
||||||
|
&parm amid &parm,2,l:&parm-2
|
||||||
|
ldy #2
|
||||||
|
lda (&parm),y
|
||||||
|
pha
|
||||||
|
lda (&parm)
|
||||||
|
pha
|
||||||
|
ago .shorten
|
||||||
|
.chk2
|
||||||
|
aif "&char"<>"[",.absolute
|
||||||
|
ldy #2
|
||||||
|
lda &parm,y
|
||||||
|
pha
|
||||||
|
lda &parm
|
||||||
|
pha
|
||||||
|
ago .shorten
|
||||||
|
.absolute
|
||||||
|
lda &parm+2
|
||||||
|
pha
|
||||||
|
lda &parm
|
||||||
|
pha
|
||||||
|
ago .shorten
|
||||||
|
.at
|
||||||
|
&char1 amid &parm,2,1
|
||||||
|
&char2 setc &char1
|
||||||
|
ph&char1
|
||||||
|
aif l:&parm<3,.chk2a
|
||||||
|
&char2 amid &parm,3,1
|
||||||
|
.chk2a
|
||||||
|
ph&char2
|
||||||
|
ago .shorten
|
||||||
|
.immediate
|
||||||
|
&parm amid &parm,2,l:&parm-1
|
||||||
|
pea +(&parm)|-16
|
||||||
|
pea &parm
|
||||||
|
ago .done
|
||||||
|
.shorten
|
||||||
|
aif s:longa=1,.done
|
||||||
|
sep #%00100000
|
||||||
|
.done
|
||||||
|
mexit
|
||||||
|
.error
|
||||||
|
mnote "Missing closing '}'",16
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab long &stat
|
||||||
|
&lab anop
|
||||||
|
lcla &t
|
||||||
|
lcla &len
|
||||||
|
lclc &ch
|
||||||
|
&t seta 0
|
||||||
|
&len seta l:&stat
|
||||||
|
.a
|
||||||
|
aif &len=0,.b
|
||||||
|
&ch amid &stat,&len,1
|
||||||
|
aif ("&ch"="x").or.("&ch"="y").or.("&ch"="i"),.i
|
||||||
|
aif ("&ch"="a").or.("&ch"="m"),.m
|
||||||
|
.c
|
||||||
|
&len seta &len-1
|
||||||
|
ago ^a
|
||||||
|
.i
|
||||||
|
longi on
|
||||||
|
&t seta &t+16
|
||||||
|
ago ^c
|
||||||
|
.m
|
||||||
|
longa on
|
||||||
|
&t seta &t+32
|
||||||
|
ago ^c
|
||||||
|
.b
|
||||||
|
aif &t=0,.d
|
||||||
|
rep #&t
|
||||||
|
.d
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab short &stat
|
||||||
|
&lab anop
|
||||||
|
lcla &t
|
||||||
|
lcla &len
|
||||||
|
lclc &ch
|
||||||
|
&t seta 0
|
||||||
|
&len seta l:&stat
|
||||||
|
.a
|
||||||
|
aif &len=0,.b
|
||||||
|
&ch amid &stat,&len,1
|
||||||
|
aif ("&ch"="x").or.("&ch"="y").or.("&ch"="i"),.i
|
||||||
|
aif ("&ch"="a").or.("&ch"="m"),.m
|
||||||
|
.c
|
||||||
|
&len seta &len-1
|
||||||
|
ago ^a
|
||||||
|
.i
|
||||||
|
longi off
|
||||||
|
&t seta &t+16
|
||||||
|
ago ^c
|
||||||
|
.m
|
||||||
|
longa off
|
||||||
|
&t seta &t+32
|
||||||
|
ago ^c
|
||||||
|
.b
|
||||||
|
aif &t=0,.d
|
||||||
|
sep #&t
|
||||||
|
.d
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab iny2
|
||||||
|
&lab iny
|
||||||
|
iny
|
||||||
|
mend
|
93
bin/mkdir/mkdir2.asm
Normal file
93
bin/mkdir/mkdir2.asm
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* MKDIR.ASM - Version 1.0
|
||||||
|
* Written by Tim Meekins
|
||||||
|
* Copyright (C) 1991 by Procyon, Inc.
|
||||||
|
* This program is hereby donated to the public domain.
|
||||||
|
*
|
||||||
|
* This program creates a new directory in the current (or specified)
|
||||||
|
* directory.
|
||||||
|
*
|
||||||
|
* TODO:
|
||||||
|
* o Add -p option.
|
||||||
|
* o Should I support creating multiple directories like Unix?
|
||||||
|
*
|
||||||
|
* HISTORY:
|
||||||
|
* 1.0 11/29/91 First version.
|
||||||
|
*
|
||||||
|
**************************************************************************
|
||||||
|
|
||||||
|
keep mkdir
|
||||||
|
mcopy mkdir.mac
|
||||||
|
|
||||||
|
mkdir START
|
||||||
|
jml ~GNO_COMMAND
|
||||||
|
END
|
||||||
|
|
||||||
|
main START
|
||||||
|
|
||||||
|
arg equ 0
|
||||||
|
retval equ arg+4
|
||||||
|
space equ retval+2
|
||||||
|
|
||||||
|
subroutine (2:argc,4:argv),space
|
||||||
|
|
||||||
|
stz retval
|
||||||
|
|
||||||
|
lda argc
|
||||||
|
dec a
|
||||||
|
bne part2
|
||||||
|
ErrWriteCString #usage
|
||||||
|
jmp error
|
||||||
|
part2 dec a
|
||||||
|
beq part3
|
||||||
|
ErrWriteCString #oneerr
|
||||||
|
jmp error
|
||||||
|
|
||||||
|
part3 ldy #4
|
||||||
|
lda [argv],y
|
||||||
|
sta arg
|
||||||
|
iny2
|
||||||
|
lda [argv],y
|
||||||
|
sta arg+2
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
short a
|
||||||
|
loop lda [arg],y
|
||||||
|
beq part4
|
||||||
|
sta pathname+2,y
|
||||||
|
iny
|
||||||
|
bra loop
|
||||||
|
|
||||||
|
part4 long a
|
||||||
|
sty pathname
|
||||||
|
Create createparm
|
||||||
|
bcc done
|
||||||
|
|
||||||
|
sta errval
|
||||||
|
|
||||||
|
ErrWriteCString #errleadin
|
||||||
|
Error errval
|
||||||
|
|
||||||
|
error inc retval
|
||||||
|
|
||||||
|
done return 2:retval
|
||||||
|
|
||||||
|
createparm dc i2'5'
|
||||||
|
createpath dc i4'pathname'
|
||||||
|
dc i2'$C3'
|
||||||
|
dc i2'$0F'
|
||||||
|
dc i4'$0000'
|
||||||
|
dc i2'$0D'
|
||||||
|
|
||||||
|
errval dc i2'0'
|
||||||
|
|
||||||
|
usage dc c'Usage: mkdir directory.',h'0d0a00'
|
||||||
|
oneerr dc c'mkdir: too many arguments.',h'0d0a00'
|
||||||
|
errleadin dc c'mkdir: ',h'00'
|
||||||
|
|
||||||
|
pathname dc i2'0'
|
||||||
|
ds 256 ;I dread any person entering a pathname
|
||||||
|
; ;this long!
|
||||||
|
|
||||||
|
END
|
247
bin/mkdir/mkdir2.mac
Normal file
247
bin/mkdir/mkdir2.mac
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
macro
|
||||||
|
&lab subroutine &parms,&work
|
||||||
|
&lab anop
|
||||||
|
aif c:&work,.a
|
||||||
|
lclc &work
|
||||||
|
&work setc 0
|
||||||
|
.a
|
||||||
|
gbla &totallen
|
||||||
|
gbla &worklen
|
||||||
|
&worklen seta &work
|
||||||
|
&totallen seta 0
|
||||||
|
aif c:&parms=0,.e
|
||||||
|
lclc &len
|
||||||
|
lclc &p
|
||||||
|
lcla &i
|
||||||
|
&i seta c:&parms
|
||||||
|
.b
|
||||||
|
&p setc &parms(&i)
|
||||||
|
&len amid &p,2,1
|
||||||
|
aif "&len"=":",.c
|
||||||
|
&len amid &p,1,2
|
||||||
|
&p amid &p,4,l:&p-3
|
||||||
|
ago .d
|
||||||
|
.c
|
||||||
|
&len amid &p,1,1
|
||||||
|
&p amid &p,3,l:&p-2
|
||||||
|
.d
|
||||||
|
&p equ &totallen+3+&work
|
||||||
|
&totallen seta &totallen+&len
|
||||||
|
&i seta &i-1
|
||||||
|
aif &i,^b
|
||||||
|
.e
|
||||||
|
tsc
|
||||||
|
sec
|
||||||
|
sbc #&work
|
||||||
|
tcs
|
||||||
|
inc a
|
||||||
|
phd
|
||||||
|
tcd
|
||||||
|
phb
|
||||||
|
phk
|
||||||
|
plb
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab return &r
|
||||||
|
&lab anop
|
||||||
|
lclc &len
|
||||||
|
aif c:&r,.a
|
||||||
|
lclc &r
|
||||||
|
&r setc 0
|
||||||
|
&len setc 0
|
||||||
|
ago .h
|
||||||
|
.a
|
||||||
|
&len amid &r,2,1
|
||||||
|
aif "&len"=":",.b
|
||||||
|
&len amid &r,1,2
|
||||||
|
&r amid &r,4,l:&r-3
|
||||||
|
ago .c
|
||||||
|
.b
|
||||||
|
&len amid &r,1,1
|
||||||
|
&r amid &r,3,l:&r-2
|
||||||
|
.c
|
||||||
|
aif &len<>2,.d
|
||||||
|
ldy &r
|
||||||
|
ago .h
|
||||||
|
.d
|
||||||
|
aif &len<>4,.e
|
||||||
|
ldx &r+2
|
||||||
|
ldy &r
|
||||||
|
ago .h
|
||||||
|
.e
|
||||||
|
aif &len<>10,.g
|
||||||
|
ldy #&r
|
||||||
|
ldx #^&r
|
||||||
|
ago .h
|
||||||
|
.g
|
||||||
|
mnote 'Not a valid return length',16
|
||||||
|
mexit
|
||||||
|
.h
|
||||||
|
aif &totallen=0,.i
|
||||||
|
lda &worklen+1
|
||||||
|
sta &worklen+&totallen+1
|
||||||
|
lda &worklen
|
||||||
|
sta &worklen+&totallen
|
||||||
|
.i
|
||||||
|
plb
|
||||||
|
pld
|
||||||
|
tsc
|
||||||
|
clc
|
||||||
|
adc #&worklen+&totallen
|
||||||
|
tcs
|
||||||
|
aif &len=0,.j
|
||||||
|
tya
|
||||||
|
.j
|
||||||
|
rtl
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab ErrWriteCString &a1
|
||||||
|
&lab ph4 &a1
|
||||||
|
Tool $210c
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab ERROR &a1
|
||||||
|
&lab p16 $105,&a1
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab Create &a1
|
||||||
|
&lab gsos $2001,&a1
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab tool &a1
|
||||||
|
&lab ldx #&a1
|
||||||
|
jsl $e10000
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab p16 &a1,&a2
|
||||||
|
&lab jsl $E100A8
|
||||||
|
dc i2'&a1'
|
||||||
|
dc i4'&a2'
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab gsos &a1,&a2
|
||||||
|
&lab jsl $E100A8
|
||||||
|
dc i2'&a1'
|
||||||
|
dc i4'&a2'
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab ph4 &parm
|
||||||
|
lclc &char
|
||||||
|
lclc &char1
|
||||||
|
lclc &char2
|
||||||
|
&lab anop
|
||||||
|
&char amid &parm,1,1
|
||||||
|
aif "&char"="#",.immediate
|
||||||
|
aif "&char"="@",.at
|
||||||
|
aif s:longa=1,.chk1
|
||||||
|
rep #%00100000
|
||||||
|
.chk1
|
||||||
|
aif "&char"<>"{",.chk2
|
||||||
|
&char amid &parm,l:&parm,1
|
||||||
|
aif "&char"<>"}",.error
|
||||||
|
&parm amid &parm,2,l:&parm-2
|
||||||
|
ldy #2
|
||||||
|
lda (&parm),y
|
||||||
|
pha
|
||||||
|
lda (&parm)
|
||||||
|
pha
|
||||||
|
ago .shorten
|
||||||
|
.chk2
|
||||||
|
aif "&char"<>"[",.absolute
|
||||||
|
ldy #2
|
||||||
|
lda &parm,y
|
||||||
|
pha
|
||||||
|
lda &parm
|
||||||
|
pha
|
||||||
|
ago .shorten
|
||||||
|
.absolute
|
||||||
|
lda &parm+2
|
||||||
|
pha
|
||||||
|
lda &parm
|
||||||
|
pha
|
||||||
|
ago .shorten
|
||||||
|
.at
|
||||||
|
&char1 amid &parm,2,1
|
||||||
|
&char2 setc &char1
|
||||||
|
ph&char1
|
||||||
|
aif l:&parm<3,.chk2a
|
||||||
|
&char2 amid &parm,3,1
|
||||||
|
.chk2a
|
||||||
|
ph&char2
|
||||||
|
ago .shorten
|
||||||
|
.immediate
|
||||||
|
&parm amid &parm,2,l:&parm-1
|
||||||
|
pea +(&parm)|-16
|
||||||
|
pea &parm
|
||||||
|
ago .done
|
||||||
|
.shorten
|
||||||
|
aif s:longa=1,.done
|
||||||
|
sep #%00100000
|
||||||
|
.done
|
||||||
|
mexit
|
||||||
|
.error
|
||||||
|
mnote "Missing closing '}'",16
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab long &stat
|
||||||
|
&lab anop
|
||||||
|
lcla &t
|
||||||
|
lcla &len
|
||||||
|
lclc &ch
|
||||||
|
&t seta 0
|
||||||
|
&len seta l:&stat
|
||||||
|
.a
|
||||||
|
aif &len=0,.b
|
||||||
|
&ch amid &stat,&len,1
|
||||||
|
aif ("&ch"="x").or.("&ch"="y").or.("&ch"="i"),.i
|
||||||
|
aif ("&ch"="a").or.("&ch"="m"),.m
|
||||||
|
.c
|
||||||
|
&len seta &len-1
|
||||||
|
ago ^a
|
||||||
|
.i
|
||||||
|
longi on
|
||||||
|
&t seta &t+16
|
||||||
|
ago ^c
|
||||||
|
.m
|
||||||
|
longa on
|
||||||
|
&t seta &t+32
|
||||||
|
ago ^c
|
||||||
|
.b
|
||||||
|
aif &t=0,.d
|
||||||
|
rep #&t
|
||||||
|
.d
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab short &stat
|
||||||
|
&lab anop
|
||||||
|
lcla &t
|
||||||
|
lcla &len
|
||||||
|
lclc &ch
|
||||||
|
&t seta 0
|
||||||
|
&len seta l:&stat
|
||||||
|
.a
|
||||||
|
aif &len=0,.b
|
||||||
|
&ch amid &stat,&len,1
|
||||||
|
aif ("&ch"="x").or.("&ch"="y").or.("&ch"="i"),.i
|
||||||
|
aif ("&ch"="a").or.("&ch"="m"),.m
|
||||||
|
.c
|
||||||
|
&len seta &len-1
|
||||||
|
ago ^a
|
||||||
|
.i
|
||||||
|
longi off
|
||||||
|
&t seta &t+16
|
||||||
|
ago ^c
|
||||||
|
.m
|
||||||
|
longa off
|
||||||
|
&t seta &t+32
|
||||||
|
ago ^c
|
||||||
|
.b
|
||||||
|
aif &t=0,.d
|
||||||
|
sep #&t
|
||||||
|
.d
|
||||||
|
mend
|
||||||
|
macro
|
||||||
|
&lab iny2
|
||||||
|
&lab iny
|
||||||
|
iny
|
||||||
|
mend
|
Loading…
Reference in New Issue
Block a user