MaxZ80 - Appendix
The following is the contents of ALIAS.CMD, which contains the ARUNZ
aliases.
; please see alias.def for a discussion of these aliases
sa get 100 spaces;/sa1
sa1 $"Enter search string : "silent poke 119 "$'L1`save 1 foo.txt
r;zfind14 *.txt $'L1 >bar.txt;/sa2
sa2 if ex bar.txt;silent concat16 $dy$dm$dd$dh.$dn$da=foo.txt
bar.txt;export $dy$dm$dd$dh.$dn$da;silent era $dy$dm$dd$dh.$dn$da`era
bar.txt;fi;/sa3
sa3 silent era foo.txt
Dosdira dosdir ...\*.*
>cmd dbase $0
>bas m$tt0ic $tn0
>dsk echo d%>o you know where your ramdisk is?
>hlp lhh :$tn0
>mnu menu $tn0
>mse mouse-p $0
>sub zex $tn0 $*
>zex zex $tn0 $*
>ndr jetldr $0
>tin tiny
?=help lhh $*
again? if pause 10 %>quit %<y%>/n ? ;shctrl p;fi
ata2 at +0:1 ring daily !#keyin ^^.9#/cows.mse
atal at /p;silent go +0:1 every 1:1 !#echo w%>rite daily^a^g!^b^j
auto /wobla;silent ldtimmyz /r;ldtimmyz;silent jetldr
a1:saved.ndr;/raminit;/ramload;drunz
clh silent shctrl p`era a1:lsh.var`lsh
crcchk if eq $# 0;/crcex;else;/crcchk1 $1;$hb:;fi
crcchk1 $1:;crcz /sq;if er;/ge $1;else;echo $1 %>is aok^a!^b^j;fi
crcex echo u%>sage: crcchk a0 or crcchk a1 etc.
cursoroff=off echo ^[.1
cursoron=on echo ^[.3
dir zxd $*
dump rdump $*
duok p $ae
echo echo $*
edit zde $*
exit /ramsave;x $1 -o
form,feed echo %p^l
ge echo %>pg er cd = $@h+m0006 - mismatch on $1:
mhz if eq $# 0;/mhzex;else;poke $+e002b $1;fi
mhzex echo %>mhz 20 (hex) for 32 (dec) mhz, mhz 80 (hex) for 128 (dec)
mhz etc.
mybug,s bugs -c -w $1;/cursoron
myldr get $an saved.ndr
note,q note
pndr p $an
quat get 100 quatris.com;poke 124 $1;zp;go
raminit if ~ex d0:!!!time&.dat;silent putds -d=d -s;d1:;silent r;fi
ramload silent copy b8:*.* d1: /e
ramsave silent era b8:*.*`copy d1:*.* b8: /e
paws echo p%>ausing 5 seconds ...;sak22 /p5
remind remind a0:remind.rem $1
scroll /twoff;sc2;/twon
setfil11 setfile $*
skunkify shset skunk&cmd&/again?
submit sub $*
timechk ztime /m;pause /p10 %>^j^apausing 10 seconds ...^b^m^j;ztime /e
tp get 100 turbo.com;poke 103 5a 33 45 4e 56 01 00 00;go
turboa terminal lines=24;turbo
twoff terminal wrap=off
twon terminal wrap=on
ver echo ^jf%>ile system last changed on 8/16/2010^j^m
woblu=wobla colour $0
-------------------------------------------------------------------------
The following is a discussion of the ARUNZ aliases defined in the file
ALIAS.CMD. ARUNZ is an extended command processor. It runs when commands
can't be resolved by ZCPR 3.4.
These aliases may be used at the command line, in menu scripts or in zfiler
macros. They illustrate many of the capabilities of Z-System.
It should be noted that these all developed due to personal needs and
interests. Each Z-System user tends to create his / her own aliases. It is
well worth trying a few of these just to learn some of the features of Z-
System. The file ARUNZ09U.DOC contains the details on all the parameters
supported by ARUNZ.
-------------------------------------------------------------------------
sa
This is a "search alias," thus the name. It is a complicated alias and uses
many advanced arunz parameters. It searches for user-specified text in all
.txt files in the currently logged drive / user area and reports what files
the text is in. Therefore, you should use it only if you are logged into a
directory with a bunch of .txt files. It is implemented as a sequence of 4
aliases; sa does a certain thing and then launches sa1, sa1 does a certain
thing and then launches sa2, etc. The key program used by sa is zfind14.
It is broken up into pieces because of the limitations of the multiple
command line, which can hold "only" about 200 characters.
sa loads what's in the tiny file named spaces into memory, starting at hex
location 100. spaces must be in the currently logged drive / user area. It
contains a carriage return / line feed followed by the text "Your search
string was " (w/o the quotes) followed by a bunch of spaces and then a
carriage return / line feed.
sa1 prompts you with "Enter search string : ". What you type is then poked
into memory just past the "Your search string was " loaded by the
previous alias. The record (128 bytes) at hex 100-17f is saved in foo.txt.
zfind14 runs against all .txt files looking for the user-supplied search
string and outputs what it finds to the terminal and into bar.txt. If there
are no hits, bar.txt will not be created.
sa2 concatenates what's in foo.txt and bar.txt (if bar.txt exists) and puts
the result in a file whose name reflects the date and time it was created.
This file is exported to DOS and then erased. The work file bar.txt is also
erased.
sa3 erases the work file foo.txt.
The results displayed by zfind14 may be all you need to help you locate
what file your search string is in but the exported file might come in
handy as well.
--------------------------------------------------------------------------
Dosdira dosdir ...\*.*
This alias will show you all the files in the root directory of your PC. The
leading ...\ relies on your having the 4DOS command processor on your
computer. The fact that Dosdira is capitalized is not that important but it
does show how you can differentiate between so-called "hidden or system"
aliases and "non-system" aliases. The utility adir (alias directory) will only
show you non-hidden ones unless you use the /s option. "hidden" aliases
start w/ lower-case letters.
---------------------------------------------------------------------------
>bas m$tt0ic $tn0
This and the next few definitions use the arunz feature that lets you
associate file types with programs. This one associates the mbasic
interpreter with files that end in .bas. For example, if you type
skunk16c.bas
at the prompt, it will be equivalent to typing
mbasic skunk16c
The $tt0 in the definition means "the file type of the 0th command token"
i.e. of the command itself. The $tn0 means "the file name of the 0th
command token." We could have defined it
>bas mbasic $tn0
but we use $tt0 to show a use for the $tt0 parm and also to show that
it can be used in several of the other similar aliases below.
-------------------------------------------------------------------------
>cmd dbase $0
lets you type things like
menu.cmd
to run dbase menu.cmd
-------------------------------------------------------------------------
>dsk echo d%>o you know where your ramdisk is?
causes the question
Do you know where your ramdisk is?
to appear at the Z-System command prompt if you launch the emulator with
something like
c:\maxz80>myz80 foo.dsk
It works because the utility drunz is part of the auto alias (see below).
drunz is a program that lets you pass a command you want to run from the
DOS command line to the Z-System command line.
-------------------------------------------------------------------------
>hlp lhh :$tn0
If you type
menu.hlp
it is equivalent to typing
lhh :menu
lhh is a help utility which can deal with lzh compressed help files that
are in library files. Here, lhh is asked to process an uncompressed help
file that is not in a library (which it can also do).
-------------------------------------------------------------------------
>mnu menu $tn0
If you type
menu.mnu
the menu shell will run and show the screens and process the associated
command scripts in menu.mnu.
-------------------------------------------------------------------------
>mse mouse-p $0
If you type
cows.mse
the Mouse language interpreter mouse-p will run and the Mouse program
cows.mse will be executed. The $0 parm (the entire command itself) is
needed here because the Mouse interpreter does not assume anything
about the file type of Mouse programs.
-------------------------------------------------------------------------
>sub zex $tn0 $*
>zex zex $tn0 $*
sub.com is like the submit command of standard CP/M. This program runs
a series of commands that are put in "batch" files. Here, we use the
more powerful memory-based command file processor zex.
If you type
clean.zex b
zex will run and process the commands in the file clean.zex. The first and
only parameter used by this script will be set to b. This zex script is used
to defragment the virtual disk files a.dsk, b.dsk and c.dsk.
-------------------------------------------------------------------------
>ndr jetldr $0
saved.ndr for example, would load the named directory from the file saved.ndr
>tin tiny
nim.tin would launch the tiny interpreter. Since this interpreter does
not support command tail processing, you need to tell it what program
you want it to run.
-------------------------------------------------------------------------
?=help lhh $*
? or help will run lhh, the help utility discussed above. If there is no
command tail, lhh's default library and help files will be used. The F1 key
has been programmed to generate the string help . Therefore, if
you press F1, lhh will run and use lhh's default library (hlpfiles) and
default help file (menu). These default files have been built to provide a
good introduction to many of the features of this software system.
-------------------------------------------------------------------------
again? if pause 10 %>quit %<y%>/n ? ;shctrl p;fi
skunkify shset skunk&cmd&/again?
again? is used in the skunkify alias and serves as the escape
mechanism. If you don't respond to the quit Y/n ? prompt within 10
seconds or if you press y, the shell stack will get popped and the "run
skunk - issue any command - again?" shell sequence (that skunkify
establishes) will end. If you press n, the sequence will repeat.
-------------------------------------------------------------------------
ata2 at +0:1 ring daily !#keyin ^^.9#/cows.mse
This uses the at command scheduler to launch the command cows.mse a
minute after you issue the command. at is an RSX (Resident System
eXtension). keyin ^^.9 causes a 9 to automatically get entered when cows.mse
prompts for input. This in turn causes 9 screens of cows to get displayed
after which cows.mse will prompt you to enter another command (like x to
exit or > to multiply the current cow screens factor by 10 etc.). To work,
the keyin IOP must be loaded. (This is done via jetldr a1:keyiniop.zrl.) The
ring and daily parameters cause a beep and a new instance of this command
to be scheduled a day later (in case you're in the habit of leaving your
computer on all the time ...)
-------------------------------------------------------------------------
atal at /p;silent go +0:1 every 1:1 !#echo w%>rite daily^a^g!^b^j
This is another alias that uses the at command scheduler. A minute after it
is issued (and subsequently every 1 hour and 1 minute) the message Write
daily! will appear on your screen.
-------------------------------------------------------------------------
auto /wobla;silent ldtimmyz /r;ldtimmyz;silent jetldr
a1:saved.ndr;/raminit;/ramload;drunz
The auto alias was added to the command tail when nzblitz was used to
create the myz80go system image and is therefore run when you boot up.
It gives you a white on black screen, removes the clock module (if it's
loaded), loads the clock module, loads the named directory, initializes the
ramdisk, loads the ramdisk and runs any command tail given at the DOS
prompt.
-------------------------------------------------------------------------
clh silent shctrl p`era a1:lsh.var`lsh
This is the clear history alias. If you are running the Log SHell and are
saving each command you type but want to start a fresh command
history, type
clh
It works by popping the shell stack, thus getting rid of the Log SHell,
deleting this shell's history file and then relaunching lsh. This is all
done without your seeing anything thanks to the services of the silent
utility. silent has been configured to use the ` character as the
multiple command separator.
-------------------------------------------------------------------------
crcchk if eq $# 0;/crcex;else;/crcchk1 $1;$hb:;fi
crcchk1 $1:;crcz /sq;if er;/ge $1;else;echo $1 %>is aok^a!^b^j;fi
crcex echo %>usage: crcchk a0 or crcchk a1 etc.
ge echo %>pg er cd = $@h+m0006 - mismatch on $1:
These aliases all work together and provide a method to check the integrity
of the files on drive / user areas a0:, a1: and a2: (or on any drive / user
area that has a crckfile.crc file). It works by checking whether a drive /
user tail was provided and if not it shows examples of how it should be
invoked. Otherwise it logs into the drive / user area and runs the crcz
utility. This utility sets the program error code if there are any mismatches
between a crc in the crckfile.crc file and a crc of a file. The support alias
ge ("get error") runs when there is an error and tells you that there's a
mismatch. It also tells you the value of the program error code. If no
mismatch is found you'll see a message that a0 is aok! for example.
-------------------------------------------------------------------------
cursoroff=off echo ^[.1
cursoron=on echo ^[.3
mybug,s bugs -c -w $1;/cursoron
The first two turn your cursor off and on. The turn cursor on alias was
tacked onto the end of the mybug alias since the only way to stop the
bugs program is to hit a key repeatedly or hit ctrl-c, leaving the cursor
in an off state.
-------------------------------------------------------------------------
dir zxd $*
If you type
dir
at the prompt (note the leading space) you'll run the zxd directory
program instead of dir.com. This directory program shows date / time
information whereas dir.com does not.
-------------------------------------------------------------------------
duok p $ae
This alias doesn't really have much to do with the duok byte in the
environment. It uses the resident peek command and shows the 128-byte
environment. If you are familiar with the offsets of things like the duok
byte (2E) you'll be able to tell if the duok byte is set or not.
-------------------------------------------------------------------------
edit zde $*
edit runs zde, the Z-System display editor.
-------------------------------------------------------------------------
exit /ramsave;x $1 -o
exit sends you back to DOS, saving the ramdisk first. The -o option is
there to make the exit unconditional (i.e. not complain if there are any files
on the ramdisk). The $1 is there to support error levels.
-------------------------------------------------------------------------
form,feed echo %p^l
sends a form feed to the printer
-------------------------------------------------------------------------
mhz if eq $# 0;/mhzex;else;poke $+e002b $1;fi
mhzex echo %>mhz 20 (hex) for 32 (dec) mhz, mhz 80 (hex) for 128 (dec) mhz
etc.
timechk ztime /m;pause /p10 %>^j^apausing 10 seconds ...^b^m^j;ztime /e
This is another "companion" group.
mhz lets you tweak the speed byte.
Run timechk to see if it returns in 10 seconds. Play with mhz
til it does return in 10 seconds.
-------------------------------------------------------------------------
myldr get $an saved.ndr
If you change the named directory and then save it (with savndr) you can
use this alias to load the names back in. There are other ways to load
named directories. jetldr loads any segment type (ndr among them). This
is an interesting example of how you can use get and an arunz Z-System
segment-aware parameter.
pndr p $an
peek at the named directory (who needs pwd, show or editnd?). See
myldr discussion above.
-------------------------------------------------------------------------
quat get 100 quatris.com;poke 124 $1;zp;go
This runs the game of Quatris. It supports one parameter which controls how
fast Quatris runs.
An appropriate use for a 160 MHz machine would be
quat a0
This will load quatris.com into memory, poke the hex value a0 (decimal 160)
into memory location hex 124 (which is where Quatris looks to know how
fast to run), runs zp (just so you may verify your a0 is where you put it)
and then (after you exit out of zp) runs Quatris.
-------------------------------------------------------------------------
raminit if ~ex d0:!!!time&.dat;silent putds -d=d -s;d1:;silent r;fi
ramload silent copy b8:*.* d1: /e
ramsave silent era b8:*.*`copy d1:*.* b8: /e
paws echo p%>ausing 5 seconds ...;sak22 /p5
These aliases are used by the auto and exit aliases.
raminit puts a timestamp file on d0: if it does not exist and then logs
into d1:. It then does a disk reset.
ramload silently copies b8: to d1:.
ramsave silently erases b8: and copies d1: to b8:.
If you use any user area on the ramdisk other than 1, it won't get saved
or restored unless you do it manually.
-------------------------------------------------------------------------
remind remind a0:remind.rem $1
This runs the remind utility showing you reminders that have been placed
in a remind.rem file on a0:.
-------------------------------------------------------------------------
scroll /twoff;sc2;/twon
twoff terminal wrap=off
twon terminal wrap=on
These are used in menu.mnu and support the scrolling of the four system
files. The 2nd menu in menu.mnu looks like this:
Menu 2
System file 1 : $f1 System file 2 : $f2
System file 3 : $f3 System file 4 : $f4
~ or ` - Scroll files
E. EDIT $f1 with ZDE
M. MBASIC
B. BASCOM $n1
L. L80 z3hdr,cmd,$n1,$n1/n/e
S. Establish System file n
P. EXPORT $f1
Z. Issue Z-System command
#
~ silent /scroll
` silent /scroll
? !echo ^j^i^ip%>ress ^[(%^%<c^[) %>to exit %<menu^j
d !dosdir "filespec "
m mbasic
b bascom =$n1/z/o
l l80 z3hdr,cmd,$n1,$n1/n/e
e !zde $f1
w !ws $f1
p !export $f1
s silent setfile "file # ? " "file ? "
z !"Your command: "
#
Due to arunz's lack of a shell variable file name parameter, we use sc2, a
"standalone" alias. These aliases do have a shell variable file name
parameter ($F0). sc2 contains:
CLS
SILENT SHFILE $F1
SETFILEQ 1 $F2
SETFILEQ 2 $F3
SETFILEQ 3 $F4
SETFILEQ 4 $F0
-------------------------------------------------------------------------
ver shows the date the file system was last changed
|