home *** CD-ROM | disk | FTP | other *** search
- u
- B A S S E M
- Fernando Buelna Sanchez
- from Compute! Gazette
- April/May 1990
- Part III
-
-
- PROGRAMMING AIDS
-
- In addition to the commands which
- affet how your programs assemble,
- BASSEM also has commands that aid
- program development. Although most of
- these commands are intended to be used
- only in immediate mode, some can be in
- cluded in your source file.
-
-
- LABEL <((number/label/string)
- <,<(number/label/string)>>/CLR)>
-
- Displays the labels defined by
- BASSEM. Once you have assembled your
- source file, typing LABEL displays all
- the labels defined in your program
- along with their hexadecimal values.
- Press <CTRL> to slow the display,
- <SHIFT> to freeze it, or <STOP> to
- stop it.
-
- You can display a range of labels
- by typing the LABEL command followed
- by the first and last values of the
- range, separated by a comma. For
- example
-
- LABEL $A000, 49152
-
- displays all the labels with values
- between 40960 and 49152. The LABEL
- command is similar to BASIC's LIST
- command in that you can specify
- open-ended ranges by leaving off one
- of the range delimiters.
-
- LABEL ,&021
- LABEL $FF81
-
- Also note that you can use any of the
- numeric formats (binary, octal,
- decimal, or hexadecimal) supported by
- BASEM.
-
- Another feature of the
- LABEL command allows you to display
- the value of a specific label or the
- values of a range of labels using the
- label names.
-
- LABEL CHROUT
- LABEL FRELO1,ENV3
-
- If you can't remember exactly how a
- label name is spelled or you need to
- know the values of several labels with
- similar names, you can search for them
- using a wildcard string. As with C=DOS
- commands, use the question mark to
- match any one character and the
- asterisk <*> to match any number of
- characters.
-
- LABEL "?E*"
-
- HERE = $C000 RESET = $FEC3
- 2 LABELS DEFINED
-
- Once you have viewed all the
- defined labels, you can erase them
- with the LABEL command's CLR option.
- Typing LABEL CLR clears or erases the
- label buffer as defined by the SET
- command.
-
-
- FIND chr string chr
-
- Searches the source code in memory
- for the given string and lists all
- lines in which a match is found. The
- [string] parameter is the string you
- want to search for and the [chr]
- parameters are the delimiting
- characters. You can use any character
- that is not found in the search string
- as your delimiter. If you use the
- double-quote mark <"> as the
- delimiter, the search string will be
- used as is; otherwise, the string will
- be tokenized before the search begins.
-
- As BASSEM searches, it lists each
- line containing a string that matches
- the search string. If the lines begin
- to scroll off the scree, you can slow
- the display by pressing <CTRL>, freeze
- it with <SHIFT>, or stop it with
- <STOP>. The followinig are some
- examples of valid search commands:
-
- NOTE: Because of the way BASSEM
- tokenizes the new commands, you may
- have lines that do not contain your
- search string when it is a command.
-
- FIND /PRINT/
- (search for PRINT command)
-
- FIND "PRINT"
- (search fo the work "PRINT")
-
- FIND ZXYZ
- (search for the varable XY)
-
- FIND _LOOP_
- (search for label _LOOP)
-
-
- AUTO <increment>
-
- Prints line numbers automatically.
- The increment parameter determines how
- BASSEM calculates the next line
- number. To hve BASSEM print the line
- numbers for you, enter the AUTO
- command with the increment valuse and
- then enter your first line of code.
- When you press <RETURN> to enter the
- line, BASSEM prints the next line
- number. The line number it prints is
- the current line number plus the
- increment value.
-
- For example, if you enter the
- command AUTO 10 and then type
-
- 100 'WORLD'S GREATEST PROGRAM
-
- BASSEM will print 110 as the next line
- number. To turn off the automatic line
- number option, enter AUTO command by
- itself. Valid increment values are 0 -
- 65535.
-
- When you are in AUTO mode, if a
- new line number already exists, the
- computer prints a <'> prior to the
- line number. If this happens, you can
- press <RETURN> and the old line won't
- be changed.
-
- You can stop AUTO in one of three
- ways: by pressing <RETURN> on a line
- beginning with a <'>, press <RETURN>
- over an empty line, or Press <Shift-
- RETURN> anywhere.
-
-
- RENUM <start line <,increment>>
-
- Changes the line number of the
- program so that they increment by a
- constant value. The first parameter
- indicates the line number for the
- first line of the program. The second
- parameter gives the step values used
- between successive line numbers.
-
- For example,
-
- RENUM 100,5
-
- will renumber the program so the first
- line number is 100, and all other
- lines are by 5's. Entering RENUM
- without any parameters uses the
- default values of 10,10. This command
- does [NOT] change any GOTO or GOSUB
- line numbers. (Not particularly useful
- -- Ed.)
-
-
- DEL (line# <- <line#>>/-line#)
-
- Works just like LIST, except that
- lines in the given range disappear
- forever.
-
-
- OLD
-
- Recovers a source file erased
- using BASIC's NEW command. Does not
- rescue a program erased with the DEL
- command.
-
-
- LFT (SET/CLR)
-
- List FormaT -- displays LISTing of
- program in an easy-to-read style. You
- can add new lines while in LFT SET
- mode, but [do not] edit a line that is
- formated. LFT CLR turns off feature.
-
-
- DISK COMMANDS
-
- In addition to all the above,
- BASSEM adds seven commands for
- controlling your disk drive. These
- default to drive 8 unless you specify
- otherwise. Also, commands that require
- a string or filename as a parameter
- can accept up to 41 characters.
-
-
- DISK <(string <,dev>/new default dev)>
-
- Sends string to the disk drive
- command channel, displays drive
- status, or sets default device drive
- number. If you enter DISK followed by
- a string, BASSEM send the string to
- the default drive's command channel.
- This is useful for performing tasks
- such as scratching files or validating
- disks. When typed alond, DISK displays
- the drives current status.
-
- Another feature of DISK is that it
- allows you to change the default
- drive, with
-
- DISK dev
-
- where dev is a device number (8-11).
-
-
- DIR <string <,dev>>
-
- Displays a disk directory on the
- screen. By itself, DIR lists the whole
- directory. The string parameter is
- like using LOAD"$:b?.*",dv (except
- with DIR, your program is not
- bothered). And the dev parameter lets
- you get directories from any drive.
-
-
- WRITE filename <,dev>
-
- Writes the object code generated
- by BASSEM to disk. Do not forget the
- ",P,W" extension on the filename! You
- can write to any drive by including
- the dev parameter.
-
- For BASSEM to write the object
- code correctly, you must place the
- WRITE command before the BAS and PASS
- 1 commands. This is all handled for
- you if you use SHELL.BC.
-
-
- PUT (line# <-<line#>>/-line#),filename
- <,dev>
-
- Saves protions of the source code
- in given range to filename. Sort of
- LIST meets SAVE!
-
-
- AFFIX filename <,dev>
-
- Appends a source file to the end
- of the program in memory. AFFIX works
- like LOAD, except the file doesn't
- overwrite the current program.
-
- AFFIX does not merge the file from
- the disk with the program in memory.
- It does no replace existing lines. It
- does not arrange the two files in
- line-number order. It just AFFIXes!
-
-
- DLIST filename <,dev>
-
- Lists a source program file from
- disk without disturbing memory. You
- can control how the listing scrolls
- with <CTRL>, <SHIFT>, and <STOP>.
- (Note: Excellent for recovering lines
- that got screwed up. DLIST the BC
- file, stop the listing at the right
- place, then press <RETURN> over each
- line to be replaced.)
-
-
- MERGE filename <,dev>
-
- Merges a program from disk with
- the one in memory by reading the
- program from the disk, listing each
- line to the screen, and adding it to
- the program in memory. When programs
- have common line number, the merged
- line takes precedence. (Be sure LFT is
- CLR before using MERGE.)
-
-
- ERROR MESSAGES
-
- To help you debug your program,
- BASSEM adds several error and warning
- messages to BASIC.
-
-
- OUT OF LABEL MEMORY
-
- The buffer you SET is full. Make
- it bigger.
-
-
- LABEL ALREADY EXISTS
-
- You have tried to define a label
- that is already there. To fix the
- problem,
-
- FIND _LABEL_
-
- then change one instant or set of the
- offending of the label.
-
-
- LABEL NOT FOUND
-
- You have referenced a label that
- has not been assigned. (I have found
- that this error will occur is
- something in your code has disturbed
- memory during assembly and testing.
- Save your file (GOTO60000), reset your
- computer, load BASSEM, the load your
- .BC code again and RUN.)
-
-
- BRANCH TOO LONG
-
- You are attempting a relative
- branch beyond the -128 to +127 jump
- range.
-
-
- DIRECT MODE ONLY
-
- You have tried to use a command in
- your source code that is only allowed
- in immediate mode.
-
-
- ?ZERO VALUE IN xxxxx
- ?ZERO ADDRESS IN xxxxx
-
- These messages are warning that
- indicate an instruct has a zero value
- for its argument. You can turn off
- these warning with the OPZ command.
-
-
- NOTES AND PROGRAMMING TIPS
-
- BASSEM is a two-pass assembler. In
- the first pass, it calculates the
- addresses of labels not directly
- assigned, using a program counter.
- When you define the starting address
- for your program with BAS, you are
- actually setting the PC. As it goes
- through the first pass, BASSEM
- determins the length of each
- instruction and adds the value to the
- PC. When it encounters a label that is
- not followed by <=>, it assigns the
- current PC to that label. This has the
- effect of giving the current address
- to the label.
-
- BASSEM has some other features,
- such as being able to link source
- codes into one object code. I have
- found that assemblies of more than
- four kilobytes become too slow and
- unwieldy. Better to create smaller
- modules -- even if these need to be
- reassembled.
-
- We hope you enjoy BASSEM. If you
- have not jumped in to the world of ML,
- BASSEM is a good way to get your feet
- wet. Perhaps we will publish a ML
- tutorial soon to encourage you to try
- your hand at bits and bytes!
-
- DMM
-
-
-