WESTUM OPERMTIONS "179
6640 SW 173 AVENUE, BEAVERTON, OREGON 97007 IIS II Ii < IM If TlNBt CMP.
because Basic is more powerful and flexible, or because it is faster and takes less memory? No—Assembly language has all these advantages; the reason for Basic's popularity is that it's so much easierto use.
Part of the difficulty of learning to program in Assembly language is that such a large first step must be taken. A programming aspirant must first gain at least a mild familiarity with Assembly mnemonics from literature, then purchase, for a hefty price, an assembler and learn its operation and syntax.
It is remarkable how few products have been designed to help Basic programmers clear these initial hurdles. Enter Singular Systems, stage right with INTASM, a mini-Assembly-language development system. INTASM is composed of two machine-language modules, ASM1 and ASM2.
ASM1 is an Assembly-language interpreter which recognizes a limited subset of Z80 Assembly-language source statements. The Basic editor composes a program consisting of a combination of Basio statements, Z80 Assembly instructions, machine code, break points, and single-stepping commands.
ASM2 is a mini-assembler which accepts the same source instructions as ASM1 and assembles them into memory for subsequent execution.
1K, 32K and 48K versions of these programs are supplied on tape in Level II system format. They are disk compatible and can be dumped to disk by using a utility such as TRSDOS' Tapedisk. The programs are run by loading one of them into your machine and entering Level II or Disk Basic. Reserve memory so Basic doesn't stomp on the machine-code module stored in high memory.
Another admirable feature of INTASM is that it has no new editing commands to learn—the same old Basic ones are used. There are only 54 out of the Z80's more than 700 mnemonic codes to learn, but you do have the option of executing other instructions if you want to enter their machine codes.
You are not limited to using only hexadecimal numbers—INTASM accepts base 10 constants. You can reference instructions with line numbers, so instead of jumping to or calling a memory location, you jump to or call a line number. This makes up, in part, for labels not being supported. The break and shift @ keys operate during the execution of ASM1 just like they do in Basic, making it a simple matter to stop program execution. The jump from the Basic to the Assembly portion of the user's program is made with an ordinary user call, and the return is made by adding the command, Basic. Once your program is written in ASM1, it can be run by simply entering the Basic command, Run.
ASM1 has two instructions which help locate bugs. You can use the Break instruction within the program to interrupt the program flow. This causes the current register contents to be displayed on the screen. You now have the option of continuing or returning to Basic. The Step-On instruction executes the program one step at a time. Effectively, a Break is executed from that point on until a Step-Off instruction is entered. You can use the single-step option to follow each instruction's effect on the registers. This not only helps in
10 POKE 16526,OiPOKE 16527,96 20 X = USR(30):END
30 CALL 01C9H ;REM ROUTINE TO CLEAR SCREEN 40 BASIC ;RETURN TO BASIC
Program Listing debugging, but it's also just about the fastest and easiest way to gain familiarity with each Z80 instruction's function.
Once you have gained some experience programming with ASM1, you can get the feel of working with an assembler by using ASM2. You use the same mnemonics, but this time you are required to assemble your program before running it.
A sample program which can be written and run in the 16K version of ASM1 is shown in the Program Listing. Line 10 tells Basic where INTASM resides. Line 20 transfers execution from Basic to the Assembly-language routine located at line 30. The USR parameter is used to identify the line number. Line 30 is the beginning and end of our unambitious Assembly-language subroutine. It clears the screen for future bigger and better things. Line 40 is essentially a return execution to Basic, it is all very logical and consistent with familiar Basic procedures.
There are two sides to every coin. With fYou can use the Break instruction within the program to interrupt the program flow."
all the advantages INTASM has, there are a number of drawbacks as well. It is definitely easy to use, but the very features that make it simple also limit its power. The most obvious of these features is the limited number of mnemonic codes it accepts; 54 out of over 700 instructions is a very small subset. There are many unsupported Z80 instructions whose functions must each be accomplished by twisted contortions of INTASM's bare commands. For example, it recognizes LDIR but you cannot use LD BC,NN or LD DE,NN to load the BC or DE registers. Since LDIR's operation depends on the contents of these registers, and there is no single instruction to load either of them, LDIR loses a lot of its ordinary ease of operation. Although it is very convenient for debugging purposes to assemble to memory, INTASM does not have the ability to assemble to disk. This prevents you from using your Assembly-language routines independently from INTASM.
ASM2 limits the user to only 1900 bytes of machine code and 80 bytes of stack
Was this article helpful?