* * * * PART VI OF DR. FIRMWARE'S M.L. TUT. * * * *
As was previously said, this article is about monitor, assemblers and other methods of entering M.L. programs into memory.
Poking and calling.
To enter a program into memory from BASIC, one can POKE the decimal equivalents of the hex op-codes (the values that the microprocessor understands) into the appropriate range of memory and then calling the subroutine with a 'CALL' statement. This method is quite tedious and complicated due to the fact that one would have to derive the hex codes by oneself by looking them up in the Apple reference manual supplied. This may prove to be even more difficult if one has no such manual.
Monitor is located in the range of memory from $F800-$FFFF. To get into monitor, type 'CALL -151' from the BASIC prompt. A '*' should appear with the cursor beside it. Now you are in monitor. There is a different set of commands availible to you than in BASIC The most simple of these is the <CR> (or carriage return (ctrl-m)). This will display the next 8 location and thier values. to look at a particular location, just type the hex equivalent of the location (ie $300, except with- out the '$' in front). Pressing return will then give you the next 8 locations and their values.
To change the value of a specific location, we must type the location, (in hex, with out the '$', as above) a ':' and then the value we want to change it to. For example, suppose we wanted to change the value in location $300 to a $A9, we would type the following:
*300:A9 ~ 'The '*' is the prompt, so don't type it, it is included here (and most else- where) as a convention. (Oh yeah, add a <CR> to the end.)
In BASIC, to do this, we would have to 'POKE 768,169'. Note that the '300' is the hex equivalent of '768'
Ok, but suppose we wanted to change a whole bunch of locations in a row, and not just one. There is an easier way than to type each location, a colon and then the value. you can just type the first location, then follow with as much data as you can (in hex) spacing between each data element. Like this:
*300:A9 C1 20 FD ED 60
This puts $A9 in $300, $C1 in $301, $20 in $302, etc. There is, of course, only 254 characters that you can enter at one time, but it does cut down on the typing. There is another good feature of monitor that one can make use of which allows you to continue entering values from the point you left off at. To use this, after entering the first bunch of numbers, you can just type a colon and then whatever data, and it will automatically put into the next location. Like this:
*300:A9 C1 20 *:FD ED 60
This will have exactly the same as result as the previous example. Note: When entering data using this feature, it is wise that if you get distracted and go elsewhere to fiddle for awhile, you should then type the location of the next location, otherwise it may be put your data somewhere where it is not appreciated.
Ok, so you've typed your program in. Now you want to check it if it was entered properly. You can always just use the <CR> command and check, but there is a somewaht easier way. The Monitor has a feature which does partial disassemblies. To use it, type the location and then an 'L'. Like this:
What you should see on this screen (if you have done the steps previously outlined, will look something like this:
0300-A9 C1 LDA #$C1 0302-20 ED FD JSR $FDED 0305-60 RTS 0306-00 BRK 0307-00 BRK etc…
This first column (before the '-') is what address (location) we are looking at. The second column is the hex codes contained in the addresses. The third column hold the mnemonics (more on this later.)
You will notice that the addresses do not increment by ones, but by the number of numbers on the right of them. This is because the commands are not all the same length, but vary according thier addressing modes (we've done immediate, absolute, and indexed, but more on these later)
Anyway, these are the basic commands used in monitor. There are commands for moving and comparing ranges of memory. Thier syntax is as follows.
To move a range:
For example: *9600<C600.C700M will move the memory in C600 to C700 to 9600. That is, the value in $C600 will be stored in $9600, the value in $C601 will be stored in $9600, etc. This command's use may not be clear to you but, it is quite helpful at times.
Anyway, so long for now, since i ran out of space, i will do assemblers in the next segment.
* * * * DR. F CAN BE REACHED ON THESE BBS'S * * TESTAMENT: (514)-3326852 * * TRANSFERS (AE/CAT):514-7381247 * * * *