                    *   *   ***  *   *  ***   ***                 ** **  *   * **  * *         *                 * * *  *   * * * *  ***    **                 *   *  *   * *  **     *     *                 *   *   ***  *   *  ***   ***                          14-DEC-84                            Hisoft                       MONS3 - ZX Spectrum Monitor	SECTION 1 GETTING STARTED	MONS3 is supplied in a relocatable form; you simply loadit at the address that you wish it to execute from and enterMONS3 via that
 address. If you wish to enter MONS3 again (havingreturned from MONS3 to BASIC) then you should execute an address29 (decimal) greater than the original address.Example:Say you want to load MONS3 at address #C000(49152 decimal) -proceed as follows:LOAD "MONS3" CODE 49152RANDOMIZE USR 49152	To enter MONS3 again use RANDOMIZE USR 49181 - 	 thisavoids the section of code that relocates the addresses withinMONS3 on the first entry.	MONS3 is roughly 5K in length once it has been relocatedbut you should allow nea
rer 6K bytes on loading MONS3 owing tothe table of relocation addresses which comes after the maincode. MONS3 contains its own internal stack so that it is aself-contained program.	Once you have entered MONS3 the message '*MONS3 CCopyright Hisoft 1983*' will appear for a few seconds to bereplaced by a 'front panel' display (see the Appendix for anexample display). This consists of the Z80 registers and flagstogether with their contents plus a 24 byte section of memorycentred (using '>' and '<') around the c
urrent value of theMemory Pointer which is initially set to address 0. On the topline of the display is a dis-assembly of the instructionaddressed by the Memory Pointer.	On entry to MONS3, all the addresses displayed withinthe Front Panel are given in hexadecimal format (i.e. to base16); you can change this so that the addresses are shown indecimal by using the command SYMBOL SHIFT 3 - see the nextsection. Note, however, that addresses must always be entered inhexadecimal.	Commands are entered from the keyb
oard in response tothe prompt '>' under the memory display and may be entered inupper or lower case. Some commands, whose effect might bedisasterous if used in error, require you to press SYMBOL SHIFTas well as the command letter. Throughout this manual the use ofthe SYMBOL SHIFT key may be represented by the symbol '^' e.g.^Z means hold the SYMBOL SHIFT and Z key down together.	Commands take effect immediately - there is no need toterminate them with 'ENTER'. Invalid commands are simplyignored. The entire 
'front panel' display is updated after eachcommand is processed so that you can observe any results of theparticular command.	Many commands require the input of a hexadecimal number- when entering a hexadecimal number you may enter as manyhexadecimal digits (0-9 and A-F or a-f) as you wish andterminate them with any non-hex digit. If the terminator is avalid command then the command is obeyed after any previouscommand has been processed. If the terminator is a minus sign'-' then the negative of the hexadec
imal number entered isreturned - in two's complement form e.g. 1800- gives E800. Ifyou enter more than 4 digits when typing a hexadecimal numberthen only the last 4 typed are retained and displayed on thescreen.	If, at any stage, you wish to return to the BASICinterpreter from MONS3 then simply press CAPS SHIFT 1.	IMPORTANT NOTE MONS3 disables interrupts in order toensure correct functioning - the user should ensure thatinterrupts are not re-enabled during a session with MONS3.	SECTION 2 THE COMMANDS AVAILA
BLE.	The following commands are available from within MONS3.In this section, whenever ENTER is used to terminate ahexadecimal number this in fact can be any non-hex character(see Section 1). Also '_' is used to denote a space whereapplicable.SYMBOL SHIFT 3flip the number base in which addresses are displayed betweenbase 16 (hexadecimal) and base 10 (denary). On entry to MONS3,addresses are shown in hexadecimal, use ^3 to flip to a decimaldisplay and ^3 again to revert to the hexadecimal format. Thisaffects 
all addresses displayed by MONS3 including thosegenerated by the dis-assembler but it does not change thedisplay of memory contents - this is always given inhexadecimal.SYMBOL SHIFT 4 OR '$'display a page of dis-assembly starting from the address held inin the Memory Pointer. Useful to look ahead of your currentposition to see what instructions are coming up. Hit ^4 again toreturn to the 'Front Panel' display or another key to get afurther page of dis-assembly.ENTERincrement the Memory Pointer by one so tha
t the 24 byte memorydisplay is now centred around an address one greater than it waspreviously. CAPS SHIFT 7decrement the Memory Pointer by one.CAPS SHIFT 5decrement the Memory Pointer by eight - used to step backwardsquickly.CAPS SHIFT 8increment the Memory Pointer by eight - used to step forwardquickly.',' (comma)update the Memory Pointer so that it contains the addresscurrently on the stack (indicated by SP). This is useful whenyou want to look around the return address of the called routineetc.'G'searc
h memory for a specified string ('G'et a string).You are prompted with a ':' and you should then enter the firstbyte for which you want to search followed by 'ENTER' - now keepentering subsequent bytes (and 'ENTER') in response to the ':'until you have defined the whole string. Then just press 'ENTER'in response to the ':'; this will terminate the definition ofthe string and search the memory, starting from the currentMemory Pointer address, for the first occurrence of thespecified string. When the string i
s found the 'front panel'display will be updated so that the Memory Pointer is positionedat the first character of the string. Example:Say that you wish to search memory, starting from #8000, foroccurrences of the pattern #3E #FF (2 bytes) proceed as follows;M:8000 ENTER		Set the Memory Pointer to #8000.G:3E ENTER		define the first byte of the string.FF ENTER		define the second byte of the string.ENTER			terminate the string.After the final ENTER  (or any non-hex character) 'G' proceedsto search memory from
 #8000 for the first occurrence of #3E #FF.When found the display is updated - to find subsequentoccurrences of the string use the 'N' command.'H'convert a decimal number to its hexadecimal equivalent.	You are prompted with ':' to enter a decimal numberterminated by any non-digit (i.e. any character other than 0..9inclusive). Once the number has been terminated, an '=' sign isdisplayed on the same line followed by the hexadecimalequivalent of the decimal number. Now hit any key to return tothe command mode.
 Example:H:41472_=A200	here a space was used as the terminator.'I'intelligent copy.This is used to copy a block of memory from one location toanother - it is intelligent in that the block of memory may becopyed to locations where it would overlap its previouslocations.'I' prompts for the inclusive start and the addresses of theblock to be copied ('First:', 'Last:') and then for the addressto which the block is to be moved ('To:'); enter hexadecimalnumbers in response to each of these prompts. If the starta
ddress is greater than the end address then the command isaborted - otherwise the block is moved as directed.'J'execute code from a specified address.This command prompts, via ':', for a hexadecimal number - oncethis is entered the internal stack is reset, the screen clearedand execution transferred to the specified address. If you wishto return to the 'front panel' after axecuting code then set abreakpoint (see the 'W' command) at the point where you wish toreturn to the display.Example:J:B000 ENTER 	execu
tes the code starting at #B000.You may abort this command before you terminate the address byusing CAPS SHIFT 5.Note that 'J' corrupts the Z80 registers before executing thecode; thus the machine code program should make no assumptionsas to the values held in registers. If you wish to execute codewith the registers set to particular values then you should usethe SYMBOL SHIFT K command - see below.'SYMBOL SHIFT K'continue execution from the address currently held in theProgram Counter (PC).This command will 
probably be used most frequently inconjunction with the 'W' command - an example should help toclarify this usage:say you are single-stepping (using '^Z') through the code givenbelow and you have reached address #8920. You are now notinterested in stepping through the subroutine at #9000 but wishto see how the flags are set up after the call to the subroutineat #8800.891E 3EFF         LD    A,-18920 CD0090       CALL  #90008923 2A0080       LD    HL,(#8000)8926 7E           LD    A,(HL)8927 111488       LD 
   DE,#8814892A CD0088       CALL  #8800892D 2003         JR    NZ,lab1892F 320280       LD    (#8002),A8932 211488 lab1  LD    HL,#8814Proceed as follows: set a breakpoint, using 'W', at location#892D  (remember to use 'M' first to set the Memory Pointer)and then issue a '^K' command. Execution continues from theaddress held in the PC which, in this case, is #8920. Executionwill then continue until the address at which the breakpoint wasset (#892D) at which point the display will be updated and youcan ins
pect the state of the flags etc. after the call to thesubroutine at #8800. Then you can resume single-stepping throughthe code.	So '^K' is useful for executing code without firstresetting the stack or corrupting the registers, as 'J' does.'L'tabulate, or list, a block of memory starting from the addresscurrently held in the Memory Pointer.	'L' clears the screen and displays the hexadecimalrepresentation and ASCII equivalents of the 80 bytes of memorystarting from the current value of the Memory Pointer. Add
resseswill be shown in either hexadecimal or decimal depending on thecurrent state of the Front Panel (see ^3 above). The displayconsists of 20 rows with 4 bytes per row, the ASCII beeing shownat the end of each row. For the purposes of the ASCII displayany values above 127 are decremented by 128 and any valuesbetween 0 and 31 inclusive are shown as '.' .	At the end of a page of the list you have the option ofreturning to the main 'front panel' display by pressing CAPSSHIFT 5 or continuing with the next pag
e of 80 bytes by pressingany other key (other than CAPS SHIFT 1).'M'set the Memory Pointer to a specified address.You are prompted with ':' to enter a hexadecimal address (seeSection 1). The Memory Pointer is then updated with the addressentered and the memory display of the 'front panel' changesaccordingly.'M' is essential as a prelude to entering code, tabulatingmemory etc.'N'find the next occurrence of the hex string last specified by the'G' command.'G' allows you to define a string and then searches for
 thefirst occurrence of it; if you want further occurrences of thestring then use 'N'.'N' begins searching from the memory Pointer and updates thememory display when the next occurrence of the string is found.'O'go to the destination of a relative displacement.The command takes the byte currently addressed by the MemoryPointer, treats it as a relative displacement and updates thememory display accordingly. Example:say the Memory Pointer is set to #6800 and that the contents oflocations #67FF and #6800 are 
#20 and #16 respectively - thiscould be interpreted as a JR NZ,$+24 instruction. To find outwhere this branch would go on a Non-Zero condition simply press'O' when the Memory Pointer is addressing the displacement byte#16. The display will then update to centre around #6817, therequired destination of the branch.Remember that relative displacements of greater then #7F (127)are treated as negative by the Z80 processor; 'O' takes thisinto account.See also the 'U' command in connention with 'O'.'P'fill memory 
between specified limits with a specified byte.'P' prompts for 'First:', 'Last:' and 'With:'. Enter hexadecimalnumbers in response to these prompts; respectively, the startand end addresses (inclusive) of the block that you wish to filland the byte with which you want to fill the block of memory.Example.PFirst:7000 ENTERLast:77FF ENTERWith:55 ENTERwill fill locations #7000 to #77FF (inclusive) with the byte#55('U').If the start address is greater than the end address then 'P'will be aborted.'Q'flip register
 sets.On entry to the 'front panel' display the set of registersdisplayed is the Standard register set (AF, HL, DE, BC). Theuse of 'Q' will display the Alternate register set (AF', HL',DE', BC') which is distinguished from the standard set by thesingle quote "'" after the register name.If 'Q' is used when the Alternate register set is displayed thenthe Standard set will be shown.'SYMBOL SHIFT T'set a breakpoint after the current instruction and continueexecution.Example:9000 B7              OR    A9001 C20
098          CALL  NZ,#98009004 010000          LD    BC,09800 21FFFF          LD    HL,-1You are single-stepping the above code and have reached #9001with a non-zero value in register A, thus the Zero flag will bein a NZ state after the OR A instruction. If you now use '^Z' tocontinue single-stepping then execution will continue at address#9800, the address of the subroutine. If you do not wish tosingle-step through this routine then issue the ^T command whenat address #9001 and the CALL will be obeyed aut
omatically andexecution stopped at address #9004 for you to continuesingle-stepping.Remember, ^T sets a breakpoint after the current instruction andthen issues a ^K command.See the '^K' command for an extended example of single stepping.'T'dis-assemble a block of code, optionally to the printer.You are first prompted to enter the 'First:' and 'Last:'addresses of the code that you wish to dis-assemble - enterthese in hexadecimal as detailed in Section 1. If the startaddress is greater than the end address th
en the command isaborted. After entering these addresses you will be promptedwith 'Printer?'; answer 'Y' (capital 'Y' only) to direct thedis-assembly to your Printer stream or any other value to sendoutput to the screen.Now you are prompted with 'Text:' to enter, in hexadecimal, thestart address of any textfile that you wish the dis-assemler toproduce. If you do not want a textfile to be generated thensimply press ENTER after this prompt. If you specify an addressthen a textfile of the dis-assembly will be 
produced, startingat that address, in a form suitable for use by GENS3. If youwant to use a textfile with GENS3 then you must either generateit at or move it to, the first address given by the assemblereditor's 'X' command because this is the address of the start ofthe text expected by GENS3. You must also tell GENS3 where theend of the textfile is; do this by taking the 'End of text'address given by the disassembler (see below) and patching itinto the TEXTEND location of GENS3 - see the GENS3 manual,Sectio
n 3.2. Then you must enter GENS3 by the warm start entrypoint, to preserve the text.If, at any stage when you are generating a textfile, the textwould overwrite MONS3 then the dis-assembly is aborted - pressany key to return to the Front Panel.If you specified a textfile address you are now asked to specifya 'Workspace:' address- this should be the start of a spare areaof memory which is used as a primitive symbol table for anylabels generated by the dis-assembler. The amount of memoryneeded is 2 bytes for 
each label generated. If you default bysimply hitting ENTER then the address of #6000(hex) is assumed.After this, you are asked repeatedly for the 'First:' and'Last:' (inclusive) addresses of any data areas that existswithin the block that you wish to dis-assemble. Data areas areareas of, say, text that you do not wish to be interpreted asZ80 instructions - instead these data areas cause DEFB assemblerdirectives to be generated by the dis-assembler. If the value ofthe data byte is between 32 and 127 (#20 a
nd #7F) inclusive thenthe ASCII interpretation of the byte is given e.g. #41 ischanged to "A" after a DEFB. When you have finished specifyingdata areas, or if you do not wish to specify any, simply typeENTER in response to both prompts. The 'T' command uses an areaat the end of MONS3 to store the data area addresses and so youmay set as many data areas as there is memory available; eachdata area requires 4 bytes of storage. Note that using 'T'destroys any breakpoints that were previously set - see the 'W'co
mmand.The screen will now be cleared. If you asked for a textfile tobe created then there will be a short delay (depending on howlarge a section of memory you wish to dis-assemble) while thesymbol table is constructed. This having been done, thedis-assembly listing will appear on the screen or printer - youmay pause the listing at the end of a line by hitting ENTER orSPACE, subsequently hit CAPS SHIFT 5  to return to the 'frontpanel' display or any other key (except CAPS SHIFT 1) tocontinue the dis-assembly
. If an invalid opcode is encounteredthen it is dis-assembled as NOP and flagged with an asterisk '*'after the opcode in the listing.At the end of the dis-assembly the display will pause and, ifyou have asked for a textfile to be produced, the message 'Endof text xxxxx' will be displayed; xxxxx is the address (inhexadecimal or decimal) that should be POKEd (low order bytefirst) into the GENS3 location TEXTEND in order that theassembler can pick up this dis-assembled textfile on a warmstart. When the dis-ass
embly has finished, press any key toreturn to the 'front panel' display, apart from CAPS SHIFT 1which will return you to BASIC.Labels are generated, where relevant (e.g. in C30078), in theform LXXXX where 'XXXX' is the absolute hex address of the labelbut only if the address concerned is within the limits of thedis-assembly. If the address lies outside this range then alabel is not generated, simply the hexadecimal or decimaladdress is given. For example, if we were dis-assembling between#7000 and #8000, th
en the instruction C30078 would bedisassembled as JP L7800; on the other hand, if we weredis-assembling between #9000 and #9800 then the C30078instruction would be dis-assembled as JP #7800 or JP 30720 if adecimal display is being used. If a particular address has beenreferenced in an instruction within the dis-assembly then itslabel will appear in the label field (before the mnemonic) ofthe dis-assembly of the instruction at the address but only ifthe listing is directed to a textfile. Example:TFirst:8B EN
TERLast:9E ENTERPrinter?YText: ENTERFirst:95 ENTERLast:9E ENTERFirst: ENTERLast: ENTER008B FE16          CP     #16008D 3801          JR     C,L0090008F 23            INC    HL0090 37            SCF0091 225D5C        LD     (#5C5D),HL0094 C9            RET0095 BF524E        DEFB   #BF,"R","N"0098 C4494E        DEFB   #C4,"I","N"009B 4B4559        DEFB   "K","E","Y"009E A4            DEFB   #A4'U'used in conjunction with the 'O' command.Remember that 'O' updates the memory display according to arelative dis
placement i.e. it shows the effect of a JR or DJNZinstruction. 'U' is used to update the memory display back towhere the last 'O' was issued. Example:        7200 47             71F3 77        7201 20             71F4 C9       <7202 F2<           <71F5 F5<        7203 06             71F6 C5       display 1           display 2You are on display 1 and wish to know where the relative jump 20 F2 branches. So you press 'O' and the memory display updatesto display 2. Now you investigate the code following #71F5 f
or awhile and then wish to return to the code following the originalrelative jump in order to see what happens if the zero flag isset. So press 'U' and the memory display will return to display1.Note that you can only use 'U' to return to the last occurrenceof the 'O' command, all previous uses of 'O' are lost.'V'used in conjunction with the 'X' command.'V' is similar to the 'U' command in effect except that itupdates the memory display to where it was before the last 'X'command was issued. Example:        
8702 AF             842D        8703 CD             842E A2       >8704 2F<            842F E5        8705 44             8430 21       display 1           display 2You are on display 1 and wish to look at the subroutine at#842F. So you press 'X' with the display centred as shown; thedisplay then updates to display 2. You look at this routine fora while and then wish to return to the code after the originalcall to the subroutine. So press 'V' and display 1 willreappear. As with 'U' you can use this command 
only to reach theaddress at which the last 'X' command was issued, all previousaddresses at which 'X' was used are lost.'W'sets a breakpoint at the Memory Pointer.A 'breakpoint', as far as MONS3 is concerned, is simply a CALLinstruction into a routine within MONS3 that displays the 'frontpanel' thus enabling the programmer to halt the execution of aprogram and inspect the Z80 registers, flags and any relevantmemory locations. Thus, if you wish to halt the execution of aprogram at #9876, say, then use the '
M' command to set theMemory Pointer to #9876 and then use 'W' to set a breakpoint atthat address. The 3 bytes of code that were originally at #9876are saved and then replaced with a CALL instruction that haltsthe execution when obeyed. When this CALL instruction is reachedit causes the original 3 bytes to be replaced at #9876 and the'front panel' to be displayed with all registers and flags inthe state they were just before the breakpoint was executed. Youcan now use any of the facilities of MONS3 in the us
ual way.Notes:MONS3 uses the area, at the end of itself, that originallycontained the relocation addresses in order to store breakpointinformation. This means that you may set as many breakpoints asthere is memory available; each breakpoint requires 5 bytes ofstorage. When a breakpoint is executed MONS3 will automaticallyrestore the memory contents that existed prior to the setting ofthat breakpoint. Note that, since the 'T' command also uses thisarea, all breakpoints are lost when the 'T' command is used.B
reakpoints can only be set in RAM. Since a breakpoint consistsof a 3 byte CALL instruction a certain amount of care must beexercised in certain exceptional cases e.g. consider the code:        8000 3E            8008 00        8001 01            8009 00        8002 18            800A 06        8003 06            800B 02       >8004 AF<           800C 18        8005 0E            800D F7        8006 FF            800E 06        8007 01            800F 44If you set a breeakpoint at #8004 and then begin execut
ion ofthe code from location #8000 then register A will be loaded withthe value 1, execution transferred to #800A, register B loadedwith the value 2 and execution transferred to location #8005.But #8005 has been overwritten with the low byte of thebreakpoint call and thus we now have corrupted code andunpredictable results will occur. This type of situation israther unusual but you must attempt to guard against it in thissingle case - stepping the code would provide the answer; seethe ^Z command below for t
he detailed example ofsingle-stepping.'X'used to update the Memory Pointer with the destination of anabsolute CALL or JP instruction.'X' takes the 16 bit address specified by the byte at the MemoryPointer and the byte at the Memory Pointer +1 and then updatesthe memory display so that it is centred around that address.Remember that the low order half of the address is specified bythe first byte and the high order half of the address is givenby the second byte - Intel format. Example:say you wish to look at
 the routine that the code CD0563 calls;set the Memory Pointer (using 'M') so that it addresses the 05within the CALL instruction and then press 'X'. The memorydisplay will be updated so that it is centred around location#6305.See also the 'V' command in connection with 'X'.'Y'enter ASCII from the Memory Pointer.'Y' gives you a new line on which you can enter ASCII charactersdirectly from the keyboard. These characters are echoed andtheir hexadecimal equivalents are entered into memory startingfrom the curr
ent value of the Memory Pointer. The string ofcharacters should be terminated by CAPS SHIFT 5 and DELETE (CAPSSHIFT 0) may be used to delete characters from the string. Whenyou have finished entering the ASCII characters (and typed CAPSSHIFT 5) then the display is updated so that the Memory Pointeris positioned just after the end of the string as it was enteredinto memory.'SYMBOL SHIFT Z'single-step.Prior to the use of '^Z (or '^T') both the Program Counter (PC)and the Memory Pointer must be set to the addr
ess of theinstruction that you wish to execute.'^Z' simply executes the current instruction and then updatesthe 'front panel' to reflect the changes caused by the executedinstruction.Note that you can single-step anywhere in the memory map (RAM orROM) but you should ensure that interrupts are not enabled atany time.There now follows an extended example which should clarify theuse of many of the debugging commands available within MONS3 - you are urged to study it carefullyy and try it out foryourself.Let us
 assume that we have the 3 sections of code shown on thenext page in the machine, the first section is the main programwhich loads HL and DE with numbers and then calls a routine tomultiply them together (the second section) with the result inHL and finally calls a routine twice to output the result of themultiplication to the screen (third section).7080 2A0072         LD   HL,(#7200)    ;SECTION 17083 ED5B0272       LD   DE,(#7202)7087 CD0071         CALL Mult708A 7C             LD   A,H708B CD1D71       
  CALL Aout708E 7D             LD   A,L708F CD1D71         CALL Aout7092 210000         LD   HL,0..7100 AF        Mult XOR  A              ;SECTION 27101 ED52           SBC  HL,DE7103 19             ADD  HL,DE7104 3001           JR   NC,Mu17106 EB             EX   DE,HL7107 B2        Mu1  OR   D7108 37             SCF7109 C0             RET  NZ710A B3             OR   E710B 5A             LD   E,D  710C 2007           JR   NZ,Mu4710E EB             EX   DE,HL710F C9             RET7110 EB        Mu2  EX   D
E,HL7111 19             ADD  HL,DE7112 EB             EX   DE,HL7113 29        Mu3  ADD  HL,HL7114 D8             RET  C7115 1F        Mu4  RRA7116 30FB           JR   NC,Mu37118 B7             OR   A7119 20F5           JR   NZ,Mu2711B 19             ADD  HL,DE711C C9             RET711D F5        Aout PUSH AF               ;SECTION 3711E 0F             RRCA711F 0F             RRCA7120 0F             RRCA7121 0F             RRCA7122 CD2671         CALL Nibble7125 F1             POP  AF7126 E60F    Nibble AN
D  %11117128 C690           ADD  A,#90712A 27             DAA712B CE40           ADC  A,#40712D 27             DAA712E FD213A5C       LD   IY,#5C3A7132 D7             RST  #107133 C9             RET..7200 1B2A           DEFW 107797202 0300           DEFW 3Now we wish to investigate the above code either to see if itworks or maybe how it works. We can do this with the followingset of commands - it should be noted that this is merely one wayof stepping through the code, it is not necesarily efficient butshou
ls serve to demonstrate single-stepping:M:7080 ENTER             set Memory Pointer to #7080.7080.                   set Program Counter to #7080.^Z                      single step.^Z                      single step.^Z                      follow the CALL.M:7115 ENTER            skip the pre-processing of the numbers.W                       set a breakpoint.^K                      continue execution from #7100 up to the                        breakpoint.^Z                      single step.^Z              
        follow the relative jump.^Z                      single step.^Z                          "^Z                          "^Z                          "^Z                          "^Z                          "^Z                          "^Z                      return from multiply routine.^Z                      single step.^Z                      follow the CALL.M:7128 ENTER            set Memory Pointer to interesting bit.W                       set breakpoint.^K                      continue execut
ion from #711D to                        breakpoint.^Z                      single step^Z                          "^Z                          "^Z                          ",                       Have a look at the return addressW                       set a breakpoint there^K                      and continue.^Z                      single step,                       return from Aout routineW^K^Z                      single step.^T                      obey the whole CALL to Aout.Please do work through t
he above example, first typing in thecode of the routines (see 'Modifying Memory' below), or usingGENS3, and then obeying the commands detailed above. You willfind the example invaluable as an aid to understanding how totrace a path through a program.'"'SYMBOL SHIFT Pthis command is exactly the same as the 'L'ist command exceptthat the output goes to the Printer stream instead of thescreen. Remember that, at the end of a page, you press CAPSSHIFT 5 to return to the 'front panel' or any other key (exceptCAPS
 SHIFT 1) to get another page.Modifying Memory.The contents of the address given by the Memory Pointer may bemodified by entering a hexadecimal number followed by aterminator (see Section 1). The two least significant hex digits(if only one digit is entered then it is padded to the left witha zero) are entered into the location currently addressed by theMemory Pointer and then the command (if any) specified by theterminator is obeyed. If the terminator is not a valid commandthen it is ignored.Examples:F2 E
NTER              #F2 is entered and the Memory Pointer is                      advanced by 1.123 CAPS SHIFT 8      #23 is entered and the Memory Pointer                      advanced by 8.EM:E00_               #0E is entered at the current Memory                      Pointer and then the Memory Pointer is                      uppdated to #E00. Notice that a space ('_')                      has been used to terminate the 'M' command                      here.8CO                   #8C is entered and then the
 Memory Pointer                      is updated (because of the use of the 'O'                      command) to the destination of the                      relative offset #8C i.e. to its current                      value - 115.2A5D_                 #5D is entered and the Memory Pointer is                      not changed since the terminator is a                      space, not a command.Modifying Registers.If a hexadecimal number is entered in response to the '>' promptand is terminated by a period '.', 
then the number specifiedwill be entered into the Z80 register currently addressed by theright arrow '->'.On entry to MONS3 '->' points to the Program Counter and sousing '.' as a terminator to a hex number initially will modifythe Program Counter. Should you wish to modify any otherregister then use '.' by itself (not as a terminator) and thepointer '->' will circle round the registers PC to AF. Note thatit is not possible to address (and thus change) either the StackPointer (SP) or the IR registers.Exampl
es:Assume that the register pointer '->' is initially addressingthe PC..            point to IY..            point to IX.0.           set IX to zero..            point to HL.123.         set HL to #123..            point to DE..            point to BC.E2A7.        set BC to #E2A7..            point to AF.FF00.        set A to #ff and reset all flags..            point to the PC.8000.        set the PC to #8000.Note that '.' can also be used to modify the Alternate set ifthis is displayed. Use the 'Q' comman
d to flip the display ofthe register sets.APPENDIX AN EXAMPLE FRONT PANEL DISPLAY.         710C  2007        JR   NZ,#7115       -> PC 710C     20 07 EB C9 EB 19 EB          SP D0AF     8A 70 06 03 0A 03 0D          IY CF6A     0D 11 0C 0F 09 18 18          IX D09F     04 03 04 00 00 00 1B          HL 2A1B     DF FE 29 28 02 CF 02          DE 0000     F3 AF 11 FF FF C3 CB          BC 0004     FF C3 CB 11 2A 5D 5C          AF 0304         V          IR 3F7C         7100  AF     7108  37   7110  EB         7
101  ED     7109  C0   7111  19         7102  52     710A  B3   7112  EB         7103  19     710B  5A   7113  29         7104  30    >710C  20<  7114  DB         7105  01     710D  07   7115  1F         7106  EB     710E  EB   7116  30         7107  B2     710F  C9   7117  FB       >Shown above is a fairly typical 'front panel' display - thedisplay is one actually obtained while single-stepping the Multroutine given in the example of the 'SYMBOL SHIFT Z' command.The first 9 lines of the display contain the
 Z80 registers; thename of the register first (PC to IR), then (for PC to BC) thevalue presently held in the register and finally the contents ofthe 7 memory locations starting from the address held in theregister. The Flag register is decoded to show the flagscurrently set in the bit order that they are used within theregister - if the Flag register was set to #FF then the displayfollowing AF would like 00FF  SZ HVNC, indicating the Sign,Zero, Half Carry, Parity/Overflow, Add/Subtract and Carry flagsare se
t.A Register pointer '->' points to the register currentlyaddressed; see Section 2 - Modify Registers.The 24 byte memory display below the register display isorganized as the address (2 bytes, 4 characters) followed by thecontents (1 byte, 2 characters) of the memory at that address.The display is centred around the current Memory Pointer value,indicated by '> <'.Commands (see Section 2) are entered on the bottom line of thescreen in response to the prompt '>'. The display is updatedafter each command is pr
ocessed.
                                                                                                                                                                                                                                                                                                                                                                                  