Projeto MicroBug

Sistema Gerenciador de Módulos

COORD. RENATO DEGIOVANI - BRASIL - 1984
(C) ATI-EDITORA - "REVISTA MICRO SISTEMAS"

(Text extracted of the docs of Einar Saukas, in tkpak001.zip)

INTRODUCTION

The "MICRO BUG" is a complete development utility for ZX81 compatible machines (including the several brazilian clones TK82C, TK83, TK85, CP200, AS1000, etc). It is described as a "SGM" ("Sistema Gerenciador de Modulos": Modules Manager System) because it implements only a basic set of commands (for memory edition and program development) but its functionality can be easily extended implementing a loadable external "MO" ("Modulo Operacional": Operating Module).

This project was produced by the development team of the brazilian magazine "Micro Sistemas" (coordenated by the editor Renato Degiovani) and published in the magazine issues of Abril to December in 1984. It had a great historical importance for brazilian users of Sinclair machines for two main reasons:

1. The magazine published the complete assembler source code of the system, including detailed comments and explanations about its internal structure and implementation, for 9 months (about 4 pages a month). Since it was the most important brazilian computer magazine at the time, it motivated a lot of brazilian ZX81 users to learn Z80 assembler programming and improved the quantity and quality of brazilian programmers.

2. The flexibility of the system provided a common base for the implementation of assembler utilities, as a consequence in the following years several (good) operating modules were produced by the magazine readers: DISASSEMBLER, ED-ART, TRACE, RENUMERGE, etc.

LOADING INSTRUCTIONS

After loading MICRO BUG from tape, the SGM will be installed into memory, the presentation screen will appear and it will wait for a key. Then the system will execute a NEW to reserve the RAMTOP and it will be ready. To enter into the MICRO BUG, execute:

RAND USR 31210

The commands "A" to "P" are implemented by the SGM system that is installed at the top 2K of the RAM (address from #783D to #7FFF). The commands "Q" and "R" are not available. The commands "S" to "Z" are available to be implemented by an MO that can be loaded in a reserved memory area of 2.5K of RAM (addresses from #6E00 to #77FF for the operating module, addresses from #7800 to #783C for "interface" informations).

COMMANDS


"A $=D" or "A $=H" - Assign numeric base


The MICRO BUG interprets numbers as Hexadecimal values by default, all Decimal values must be preceded by '$'. The command A can be used to assign '$' to the Hexadecimal base (then numbers become interpreted as Decimal by default) and vice-versa. Error message "$=D OU $=H" if syntax error.


"B" - Return to BASIC


Exit to BASIC. Execute "RAND USR 31210" to restart MICRO BUG.


"C" - Load operating module


Load an operating module. If there was already another operating module, it is replaced by the new one. Loading an operating module does not affect BASIC programs.


"D [address]" - Display memory


Display a memory block: address and 8 consecutive bytes. Control keys:

"K" (+) : forward                                         SHIFT-S : print speed
"J" (-) : backward                                        SHIFT-E : address format (hex/dec)
SPACE : break                                           SHIFT-4 : byte format (hex/token)


"E line,size[,c]" - Create REM line


Create a REM line (containing "size" copies of char "c") to store assembler routines into the BASIC program. For example: "E 1,4,*" creates "1 REM ****". The default value for parameter "c" is SPACE. Error message "LINHA ILEGAL" if "line" > 9999, error "LINHA EXISTENTE" if line already exists. 


"F start,end,c" - Fill block with char


Fill block from addresses "start" to "end" with char "c".


"G start" - Execute machine language routine


Insert breakpoint if it is implemented (see commands "K" and "L"), load registers from register buffer (see commands "H" and "N"), call routine at address "start", store registers into register buffer, remove breakpoint. This command is useful to debug routines.


"H" - Print registers values


Print register values stored into register buffer. These values are updated automatically after command "G" or manually using command "N".


"I start,end" - Save block to tape


Save to tape memory contents between addresses "start" and "end". Use SHIFT-F to select save speed (normal=300 bps, high=1600 bps), SPACE to break.


"J start,end" - Load block from tape


Load from tape to memory contents between addresses "start" and "end". Use SHIFT-F to select load speed (normal=300 bps, high=1600 bps), SPACE to break.


"K [address]" - Implement BREAKPOINT


Specify an address to insert a breakpoint. Command "G" will insert a breakpoint (replacing 3 consecutive bytes from the specified address) before calling an external routine, when the routine reachs this address it is interrupted and returns immediatelly to MICRO BUG. The breakpoint is removed automatically after an execution of command "G" or manually with command "L", to re-implement it at the same address the command "K" can be called again without a parameter.


"L" - Remove BREAKPOINT


Cancel the breakpoint implemented by command "K".


"M [address]" - Memory edit


View and edit a memory area. Works like command "D", but it shows only one byte per line. The memory contents can be changed by just typing new values in Hexadecimal. Additional control keys are SHIFT-3 for byte format (hex/dec) and SHIFT-D for input format (hex/dec), in decimal input format it is necessary to press ENTER after typing each number.


"N r,value" - Change values of register pairs


Set the register pair "r" to value "value" in the register buffer. It can be used to debug assembler routines (see command "G"). The complete syntax is:

"N B,value" : set register pair BC.                    "N D,value" : set register pair DE.
"N H,value" : set register pair HL.                    "N A,value" : set register pair AF.
"N N,value" : set all register pairs.


"O start,end,target" - Copy memory blocks


Copy the source block (memory area between addresses "start" and "end") to address "target". The source and target blocks may overlap. Error message "BLOCO ILEGAL" if "start" > "end".


"P start,end" - Sum of a block


Print (last 16 bits of) sum of bytes stored inside a memory block. The result is printed in Hexadecimal. It is useful as a simple data checking method.

Notes:
- In the case of commands that require the specification of a memory area (as "start,end"), the last byte (at address "end") is not considered.
- The symbols "[" and "]" indicate an optional parameter. If the parameter is ommited, the command will continue from the previous execution point.

CONTROL KEYS

The input and output modes of the commands are controlled by the variable MFLAG, stored at address 7926. This is the complete list of control keys:

KEY DESCRIPTION  STORAGE
SHIFT-3 Output format for "M" (hex/dec)

Bit 0 of MFLAG

SHIFT-4 Output format for "D" (hex/token)

Bit 1 of MFLAG

SHIFT-E Address format (hex/dec)

Bit 2 of MFLAG

SHIFT-S Print speed (slow/fast)

Bit 3 of MFLAG

SHIFT-G Available

Bit 4 of MFLAG

SHIFT-A Available

Bit 5 of MFLAG

SHIFT-D Input format for "M" (hex/dec)

Bit 6 of MFLAG

SHIFT-F Save speed (slow/fast)

Bit 7 of MFLAG

SHIFT-9 Graphics mode -----
SHIFT-Q Clear screen -----
SHIFT-1 Reset to initial screen -----
SHIFT-T Copy screen to printer -----

TECHNICAL NOTES

To save the MICRO BUG system into tape, it was necessary to execute this:

>BASIC 
NEW
RAND USR 31210
>E 6,0802,*
>O 7800,7FFF,4082
>E 1,1A,*
>BASIC
2 RAND USR 31210
3 FAST
4 SAVE "MICRO BUG"
5 RAND USR 16514
RUN
>M 4082 (type this block:)
31 EC 6D 21 00 6E 22 04
40 21 DD 40 11 00 78 01
00 08 ED B0 CD 29 02 C3
C3 03
(reset with SHIFT-1)
(start the record tape)
>BASIC

The loading system could be used to copy protected programs:

 1. Remove the area reserved for MO: "POKE 16389,120" and "NEW"
 2. Fill memory with known values: ">F 4400,7700,*"
 3. Load program (at normal speed): ">J 4410,7700"
 4. After the program was loaded, press BREAK and use command "D" to find
 end address of program (first address of memory area only with asteriscs)
 5. Save program: ">I 4410,end"

DEFINING AN OPERATING MODULE

An operating module can define the commands from "S" to "Z" and it can call any MICRO BUG code as sub-routine. The module code size should be at most 2.5K (occupying addresses from #6E00 to #77FF) and the module name should have at most 15 chars.

After the module code is implemented, it must be integrated into MICRO BUG. The start address of each module command must be defined into the module commands table (addresses from #7800 to #780F), the start address #7A34 must be used in undefined commands. The routine $MORG must be typed, defining the module name between addresses #7819 and #7827. The sum obtained executing "P 6E00,783A" must be stored into addresses #783A and #783B, it will be used to check if the operating module was loaded correctly. Finally the operating module must be saved using the command "I 6E00,783C" set at normal speed.

The command "C" can now be used to load the operating module. This command will automatically execute "J 6E00,783C" at normal speed, check the module sum and copy the module commands table into the commands definition table. Now the new commands defined by the module can be used normally and SHIFT-1 will present the module name together with the MICRO BUG logo. 

APPENDIX: USING MICRO BUG WITH EMULATORS

With the EightyOne emulator, is possible to directly load the operational modules with command "C", in the same way that on a real ZX81, since that you has the MO in form of an wav file. The operation is very simple: open the 'Wav Manager' and load the wav file. Press the command "C" in Microbug, select 'Play' in the 'Wav Manager" and wait the MO being loaded.

Is possible to use the MO with the emulator Xtender, but the operation is a more complex that this. Read the complet documentation on the TKPAK001.ZIP for details.


Operational Modules

Here are the Operational Modules produced by the readers of magazine "Micro Sistemas", with a small description of each one:


DELETE-GGMI
Autor: Cláudio de Freitas B. Bittencourt  -  Micro Sistemas Nr. 47 (Agosto 1985)

This operational module implement the command "W", that simule the DELETE function, which erase blocks of BASIC lines. For load it, use the Microbug command "C". The sintaxe of command "W" is: 

W xxxx,yyyy

were xxxx is the first line to be erased, and yyyy, the last. Error mensage "LINHA ILEGAL", if yyyy > xxxx or if sintaxe incomplet. If the line xxxx don´t exist, the next upper line will be the first to be erased. In case of line yyyy don´t exist, the line immediatly lower will be the last to be erased.


DEPURA-ERRO
Autor: Rubens Grazzini Júnior  -  Micro Sistemas Nr. 67 (Abril 1987)

The finallity of this module is help on correction of typed errors of assembler codes published on magazines. It implement the sum of 1 to 16 consecutives bytes, from an address specified by user. The sintaxe is:

S xxxx,yy

were xxxx is the start address, and yy is the sum factor from 1 to16. In case of omit the yy parameter, the sum will be from 8 to 8 bytes.

For sum the blocks, press the key "K"; BREAK or SHIFT 1 for return to Microbug. In case of an error, press SHIFT L and the command "M" will be called automatically; for return, use the BREAK key and will be show the new sum of altered block.


DEPURADOR FHL
Autores: Luiz Fernandes de Moraes e Fernando José Silva  -  Micro Sistemas Nr. 64 (Janeiro 1987)

Operational module of Microbug that adds 3 new commands (X, Y and Z) and a sub-command (W), whose function is to become more powerful the command M.

COMMAND W: when typing W we receive the information that command M was incremented; now, when using command M, also will be presented in the screen the corresponding caracter or token of byte pointed by the address. Load or types any BASIC program and later type M 4082 to see the result.

COMMAND X: list the lines of BASIC program contained in the memory, informing the initial address and the total bytes of each one. The K key advances the screen, until it arrives at the DFILE.

COMMAND Y: show the organization of memory, informing the addresses of DFILE, VARS, ELINE and RAMTOP, amount of bytes of program, of the variables, total of occupied memory, total of available memory and total of bytes above RAMTOP (USR).

COMMAND Z: list the variables giving the address, the total of bytes and identifying if it are numerical, alphanumeric (strings) or  arrays (the number of bytes will come between parentheses). Are shown still, the variables of loop control but always in the format: FOR  variable = A TO B STEP C. If the screen is full, pressures keyboard key K and other blocks will be presented until arrives at the ELINE.


DISASSEMBLER
Autor: Marcos Saito  -  Micro Sistemas Nr. 57 (Junho 1986)

This Operational Module of the MicroBug implements 8 new commands. Before presenting the new commands, let us stipulate:

xxxx - beginning of the first or unique memory block;
yyyy - end of the block initiated by xxxx (the address yyyy does not belong to the delimited block);
zzzz - start of second memory block;
bb - any byte;
cc - another any byte (in the occurrence of this, bb and cc must be in hexadecimal);
eeee - start address.

The commands offered by the Disassembler are the following ones:

S xxxx yyyy bbcc - substitute the occurrence of the byte bb for cc, inside of specified block, printing the addresses where it had the transformation;
T eeee N/L text N/L - insert the determined text, starting in eeee;
U xxxx yyyy zzzz - exchange, between itself, the content of the two blocks of memory;
V xxxx yyyy zzzz - compare the content of the two blocks of memory, printing the addresses that disagree;
W xxxx yyyy - turn to zero the bytes of specified block of memory;
X xxxx yyyy bb - print in the screen the addresses of block that contain the byte bb;
Y xxxx yyyy bbcc - searches the consecutive occurrence of bytes bb and cc;
Z eeee - effects disassembler from the address eeee.

OBS.: In commands S, V, X, Y and Z, the BREAK key interrupts the process, while that the others give to continuity it. The command Z accept operations SHIFT S and SHIFT E to switch speed of execution and address base, respectively (valid too for the commands V, X, Y and S). 

The Disassembler uses only 1536 bytes from the address 7200h, what becomes possible to change the RAMTOP, in the case of needing more memory for the area of BASIC program.


ED-ART
Autor: Cláudio de Freitas B. Bittencourt  -  Micro Sistemas Nr. 54 (Março 1986)

The Ed-Art GGMI is a graphical editor for the preparation of screens, which could be filed in tape and connected to any program.

MEMORY ORGANIZATION

A module of the MicroBug occupies the memory of the address 6E00 until 77FF, but in this case were necessary to increase the space, lowering the initial address for 6B00. Don't worry about this expansion, that occurs automatically when is used for the first time one of the four available commands in the Ed-Art. And the "status quo" is reestablished with the command C of the MicroBug, that load a new module in the place of the Ed-Art. 

Beyond the normal video archive of the computer, that appears in the screen of the TV, the Ed-Art works with more two archives, situated in buffers in the following positions of the memory:

l°) Main - de 27392(6B00) a 28159(6DFF)
2°) Reserve - de 28160(6E00) a 28927(70FF)

COMMAND T

The command T is the editor properly said. Clean the initial screen with SHIFT A. The pixel moves in the eight cardinals directions with the use of the keyboard keys below:

KEY DIRECTION KEY DIRECTION
1 left-up 5 left
2 right-up 6 down
3 right-down 7 up
4 left-down 8 right

The pixel can be moved in the modes PLOT, UNPLOT and "Without Trace", as they have been previously set with keyboard keys K, J or L, the same ones of +, - and = .


MACROCHARACTERS

The pixel is the main edition mode, allowing the access to all the available functions. We can print macrocharacters with the keys N (<) or M (>). The first one prepares a great character (4x4) and the second a giant one (8x8). The symbols "<" and ">" are alternated with the flashing pixel to indicate the assumed condition. The key that you to pressure after that will be macroprinted, except if it will be NEW LINE, FUNCTION, RUBOUT or GRAPHICS, that disactivate the preparation. All the symbols of the Sinclair are valid and the inverse video are prepared by SHIFT N and SHIFT M, instead of N and M. If the space in the screen will be insufficient, the preparation key will not occasion effect. After the macroimpression, the pixel will be in the condition "Without Trace", what by the way occurs after any extraordinary operation.

LINE

Uses the R key to initiate the tracing of a "line", and later dislocates the pixel until the end point. In the origin point remain a flashing pixel, for your orientation. Made this, uses SHIFT R to trace the line. NEW LINE disactivates the preparation of the line.


CIRCLE

Places the pixel in the position that you intend for the center of the circle and pressures the key C. The computer will be waiting that you enter two
numbers relative to the ray of the circumference, from 02 to 35. The first number is of the set of ten and the second is of the unit. The keyboard key that disactivates the preparation of the circle is NEW LINE.


MANIPULATION OF THE ARCHIVES

The manipulation of the archives is one of the most versatile functions of the Ed-Art. It allows to make the interface of two screens, therefore it must be used when you want to give horizontal or vertical continuity to the same ones. The command keys are P (of Principal), H (of Horizontal) and V (of Vertical). The key P presents in the screen the content of the main buffer (the first one in the memory). But, each time that it is used, this content is before changed with what is in the reserve buffer (the second in the memory. The keys H and V provoke in the screen the rolling of the image for the left and top, respectively, making possible the interfaces of the two imagens for the four sides. It is similar to a SCROLL, only that instead of rolling line for line (column for column), the rolling is of half in half of the screen.

The keys H and V can or not change the content of buffers, depending on the situation. The content that occupy the left superior quadrant of the screen will be always of the main buffer. However, caution: before effecting any operation that can compromise the integrity of your work (ex: CLS, SAVE and LOAD of archives), fix the correct content of the main buffer with the key P - it exists for this.


OTHER FUNCTIONS OF THE PIXEL MODE

In the Pixel mode are available the additional functions below, presented in the sequence "key-mnemonic-effect".

9 GRAPHICS inverse video
SHIFT S LPRINT copy the screen on printer
SHIFT A NEW clear screen
SHIFT NEWLINE FUNCTION return to Microbug
SHIFT Y RETURN return to BASIC
NEWLINE - change for the HORIZONTAL WRITE mode

WRITE MODE

The write mode, that can be horizontal or vertical, allows to print all the Sinclair symbols in normal size. The available functions are:

SHIFT 9 GRAPHICS change to inverse characters
SHIFT 0 RUBOUT RUBOUT (horizontal or vertical)
SHIFT NEWLINE FUNCTION return to Microbug (same to the PIXEL mode)
NEWLINE - change mode

THE NEW LINE KEY

The change of the edition mode is effected by keyboard key NEW LINE, obeying the following sequence:

PIXEL -> HORIZONTAL WRITE -> VERTICAL WRITE -> PIXEL ... etc.

The mode in execution is identified by the flashing cursor that is alternated with the character, to which it overlay. This cursor, depending on the case, can be: pixel, H, [H] , V or [V].


AUTO-REPEAT

Almost all the functions of command T are auto-repetitive. To pressured one key, the function is readily executed and in case that you does not liberate it, after a small wait time starts the auto-repetition in quick rhythm. This, besides speeding the work, will allow you to appreciate some dynamic effect with the manipulation of archives.


COMMANDS S and U

Returning to the MicroBug, you will still make use of commands S, U and V. The command S (of SAVE) save in tape the content of the main buffer and
command U loads, also in the main buffer, what will be read from tape. Much attention in the use of these commands, therefore an error of archive can erase a finished work irremediavelmente, without recovery possibility. Always appeals to key P in the pixel mode to fix the correct content of buffers.

For the eventuality to load in the buffer an imperfect archive, that would crash the system when shown in the screen, command U reset the bit 6 of bytes read from tape.


COUPLING IN A LINE PRINT - COMMAND V

Exist diverse ways to insert the screens produced in yours programs. The simplest is through command V that creates in the BASIC a line PRINT with the total or partial content of the main buffer. Its syntax is:

V XXXX,YY

were XXXX is the number of the line that goes to be created and YY is the amount of lines of the main buffer that must be copied (counting from top to bottom). Improper data provoke error messages: same of the command E from the MicroBug and more "HUUUU", that is the Ed-Art hooting if you make YY equal zero or greater that 24. Remember that, in the normal mode, the MicroBug interprets the numbers in the hexadecimal base, unless it has one $ before the number.


COUPLING IN STRING VARIABLE

The MicroBug has some proper commands that can also be used in the coupling, although in less direct way and well more complicated. Amongst these are the commands E that creates lines REM of any size and the command O that transfers contents of the memory of a place to another one. The use of these alternatives requires good knowledge of the organization of memory of the computer and we do not recommend nor for the filling of string variable previously created by instruction DIM. This task is much more easily executed through the proper BASIC, with few lines of programming:

10 LET A$=""
20 FOR F=l TO 22*32
30 LET A$=A$ + CHRS PEEK (27391+F)
40 NEXT F
50 STOP

This copies the 22 first lines of the main buffer in the A$ variable, that can be printed at any time in the normal flow of your program, since that you never use the RUN command (run the program with GOTO X) nor CLEAR, that erase the variables. The program presented as example can and must be modified by you in accordance with  yours conveniences, but before understands it well. Repairs that the number 22 on line 20 is the amount of lines to be copied and that the 27391 on line 30 is equal to the initial address of main buffer less l.


COUPLING IN THE ARCHIVE OF IMAGES OF THE SYSTEM

The most intelligent and logical way of effecting the coupling of a screen are to place it in the proper archive of images of the system at the moment of saving of program on tape. 

The coupling is very simple. Creates, in strategical place inside of your program, the lines below:

XXXX RAND USR 31210
YYYY SAVE "nome do seu programa"

Of course, the MicroBug must be in position in the memory of the computer. After that, run the BASIC program with RUN XXXX or GOTO XXXX, starting with this the MicroBug. Inside of the MicroBug, you can act calmly, loading the Ed-Art if it still will not be in position, loading and/or retouching the opening screen, etc. In this situation, you only do not have to execute commands B, E and V; all others is valid. When will be everything ready, with the Ed-Art (in the pixel mode of command T) showing the chosen screen, start the recorder and uses SHIFT Y, function that returns direct to the BASIC without passing for the MicroBug. The return will be in line YYYY, executing the SAVE with screen and everything. One program thus recorded, being loaded, shows the opening screen and leaves running from the line following the YYYY. Clearly that the flow of the program will not have more to pass for line XXXX.

This line, by the way, can be omitted if will go adopted the following procedure:

1°) Of some forms, uncover the intial address of the line YYYY (will be 16509 if it will be the first of the program);
2°) Start the MicroBug with the direct command RAND USR 31210;
3°) With the command M, change the content of the system variable called NXTLIN, situated at addresses 16425/6, by the initial address of YYYY;
4°) Perform the operations described in the normal process.


LIST
Autor: Luiz Felipe Queiroz Nery  -  Micro Sistemas Nr. 58 (Julho 1986)

The M.O. LIST allows to get the listing of BASIC programs from the MicroBug. After load the M.O. with command C, the command S is available, whose syntax is the following one:

S xxxx

where xxxx are the number of the desired line. The lines of BASIC program are listed one to one in the inferior part of the screen, being that when pressuring any keyboard key is executed one scroll , revealing a new line. Don't forget to observe the base in which MicroBug is operating, since S 100 can list in such a way from line 100 (base 10) as from line 256 (base 16).


RENUMERADOR-GGMI
Autor: Cláudio de Freitas B. Bittencourt  -  Micro Sistemas Nr. 59 (Agosto 1986)

Operational module of the MicroBug that renumbers the lines of BASIC programs. The Renumerador GGMI implements the command X, whose syntax is:

X aaaa,bbbb

where aaaa is the number to be given to the first line, and bbbb is the increment. The Renumerador GGMI corrects automatically all the jump lines that
will be in the form:

GOTO Z
GOSUB Z

where Z is a integer number, not necessarily equal to the one of some existing line. Any jumper line out of this format (ex.: aritmetic expression, fractionary number, numeric variable, VAL "number", etc) will be ignored. The renumber will also not be executed if  imply in line numbers with value equal or upper that 15872, since MSB=62 hinders the program to be executed correctly, generating error message "OUT OF RANGE".

The syntax of command X can be simplified, leaving of to supply one or two arguments, as for example:

X A
X $10,
X ,5
X ,

In this in case, in the absence of data are assumed values 0 and 1 for base and increment, respectively.


TRACE
Autor: Ricardo de Paola  -  Micro Sistemas Nr. 63 (Dezembro 1986)

The Trace program functions as an operational module of the MicroBug, and congregates the functions of Disassembler and simulator of assembler programs. It implements the commands S (simulator of instructions) and T (Disassembler), besides the commands U and V as assistant of command S.

COMMAND T: serves to disassembler stretches of memory. Functions as commands M and D having the following structure: T <address>. If the address will not be typed, it is continued from the following instruction to the last one disassembled. The K key disassembler the next instruction and the BREAK key stop the command. Exist the following SHIFT commands:

- SHIFT E/SHIFT S: as in the other commands of the Microbug.
- SHIFT A: switch the print of bytes of instruction.
- SHIFT 3: switch in decimal/hexa the print of bytes of the instruction. When the print in decimal will be used, in some instructions the bytes will overlap the code of the instruction
- SHIFT D: switch in decimal/hexa the print of bytes of argument of instruction.

COMMAND S: serves to make the simulation step-to-step of a program in Assembler. Its format is S <address>. If the address will not be typed, the last address used in command S is assumed (and not the following it). The command S disassembler the instruction in this address and show, in the two last lines of the screen, the output of command H, where are the main registers of the Z80 (AF, HL, DE, BC), its contents in hexa and the binary value of flags. From here exist the following options:

- Key V: show, in the first line of the screen, the following elements:
* The value of the position of memory pointed for HL, or for IX,IY+d, if the instruction that was disassembled make reference to IX or IY.
* The value of your SP. It is a value different of the SP of the system, and must point to some area of the RAM with at least 20 bytes, more the levels of stack that you go to need. Initially has value 6C00.
* The value of (SP), or either, the next value to be brought of the stack for POP or RET.

- Key K: simulates the instruction that is being shown in the screen and show the following one. To make the simulation  is placed one break-point in the following instruction, the registers are loaded with the values shown in screen and jump for that instruction. Soon later the registers are saved and is shown the next instruction (except in instructions JP, CALL and RET, where the process is other). 
The calls to the ROM are not simulated, and yes executed by complete, because don´t have as to place break-points in the ROM. 

- Key +: makes the same that key K, however the screen is scrolled together with the value of the registers.

- Key N: advances for the instruction that is being shown.

- BREAK: stop the command.

COMMAND U: serves to give a new value to your SP. The format is U <new value>.

COMMAND V: it is identical to command H, however it also shows the value of (HL) or (xy+d), of SP and (SP).

CONSIDERATIONS:

In the addresses 711D and 7158 are the value 7D8D, that is the address of routine $RCP of Microbug. If you want to make some preparation, before each instruction is simulated (such as locate the cursor, change the dfile with the content of a buffer, set FAST mode, or modify the value of IX or IY or any another thing), places in these two positions of memory the address of your routine, remembering to finish it with a JP $RCP.

In the addresses 7127 and 715E is value 7D7C, that is the address of the routine $ARQ. Here is returned, after having been simulated, the instruction of your program. In this situation, you would set the SLOW mode and would come back the value of IX and IY, not being necessary to relocate the cursor nor to come back the screen that was being shown before.

The addresses 4021, 407B and 407C are temporary variables of commands S and T, therefore you must save them, set them with the desired values and later restore them, if you to make use of these positions in your program.

If you go to make use of IX or IY registers, modifie addresses 71CB, 71CC and 71CD, that have the instructions PUSH IX/POP HL, to LD HL,"your IX"; and the addresses 71D1, 71D2 and 71D3 to LD HL,"your IY.


Free Web Hosting