thomasw@vlsi1.CS.Concordia.CA (Thomas Wieland 1728423) (10/18/89)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # mon68.tbl.s # mon68.ch3.doc # This archive created: Tue Oct 17 19:47:57 1989 export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'mon68.tbl.s'" '(7821 characters)' if test -f 'mon68.tbl.s' then echo shar: "will not over-write existing file 'mon68.tbl.s'" else cat << \SHAR_EOF > 'mon68.tbl.s' **************************** * * * MON68K * * * * A 68000 Monitor Program * * * * VERSION 2.2 15-JUL-84 * * * **************************** * * * mon68.tbl.s: data area: vector/jump tables, text/mask tables for * disassembler, monitor texts, monitor data area * * * Source code donated to the public domain, 17 Oct 1989 * * You may use this code in any way you see fit, including * incorporating some or all of it into a project of your own, * commercial or otherwise. I would appreciate receiving some * credit if you decide to use some of my code, but as this is * quite unenforceable it remains a wish, not a condition. * * Naturally, I can make no guarantees as to the code's correctness * or suitability for any purpose, although I would hope that it is * both reasonably correct and suitable for something, and I know * that it works on my equipment. * * If you wish to contact me, you can write to me at the address * below or send me e-mail (until April 90) at: * * thomasw@jupiter.cs.concordia.ca * or: thomasw@concour.cs.concordia.ca * * Written by: Thomas Wieland * 4615 Walkley #21 * Montreal, PQ * H4B 2K7 * Canada * * * * ********************** * TABLES FOR MONITOR * ********************** * * * MONITOR VERSION NUMBER * VERSION DC.W $0784 * * TABLE OF COMMAND LETTERS * CMDTBL DC.B 'A','B','G','H','I','J','L' DC.B 'M','O','P','Q','R','S','T' DC.B 'V','X',':',';','=','+','-' DC.B '*','/','<','>','(',')','&','!' CMDTEND DC.B '^' * * JUMPTABLE TO COMMAND SUBROUTINES * JMPTBL DC.W ASMSUB DC.W BRKSUB DC.W GOUSER DC.W HELP DC.W INSERT DC.W FILL DC.W LIST DC.W MOVE DC.W OUTSUB DC.W PRINTER DC.W QUIT DC.W REGSUB DC.W SEARCH DC.W TRACE DC.W VERIFY DC.W XAMINE DC.W CHANGE DC.W COLON DC.W CONVERT DC.W PLUS DC.W MINUS DC.W MULT DC.W DIVID DC.W SHFTL DC.W SHFTR DC.W ROL DC.W ROR DC.W AND DC.W OR DC.W EOR * * VECTOR TABLE FOR I/O ROUTINES * IOTBL DC.W GETLIN0,GETRLST,GETBYTE,SENDBYTE DC.W GETNUM,HEXNUM,DECNUM,BINNUM DC.W PRTTEXT,PRTNCHR,PRTREG,PRTSFCT DC.W PRTLHEX,PRTWHEX,PRTHEX,PRTADR DC.W PRTLDEC,PRTWDEC,PRTDEC,BINDEC DC.W PRTLBIN,PRTWBIN,PRTBIN DC.W PRTLASC,PRTWASC,PRTASC * * ADDRESSES OF CTRL-CHAR. ROUTINES * CTRLTBL DC.W IGNORECC ;CTRL-@ DC.W CTRLA DC.W CTRLB DC.W CTRLC DC.W CTRLD DC.W CTRLE DC.W CTRLE ;CTRL-F, SAME AS CTRL-E DC.W ECHOCC ;CTRL-G DC.W CTRLH DC.W CTRLI DC.W CTRLJ DC.W CTRLI ;CTRL-K, SAME AS CTRL-I DC.W CTRLL DC.W CTRLM DC.W CTRLN DC.W CTRLI ;CTRL-O, SAME AS CTRL-I DC.W CTRLI ;CTRL-P, SAME AS CTRL-I DC.W CTRLQ DC.W CTRLR DC.W IGNORECC ;CTRL-S DC.W IGNORECC ;CTRL-T DC.W CTRLU DC.W CTRLV DC.W IGNORECC ;CTRL-W DC.W CTRLX DC.W IGNORECC ;CTRL-Y DC.W IGNORECC ;CTRL-Z * * ADDRESSES OF EXCEPTION HANDLERS * EVECTBL DC.W SPURHDL DC.W AERRHDL DC.W ILINHDL DC.W ZDIVHDL DC.W CHKHDL DC.W TRPVHDL DC.W PRIVHDL DC.W TRACHDL DC.W EMULHDL DC.W EMULHDL DC.W TRAPHDL ;TRAP #0 DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL DC.W TRAPHDL ;TRAP #15 * FLGLST ASC 'TSXNZVC' FLGXLST ASC 'T-S-----XNZVC' * * * DISASSEMBLER TABLES * * * TABLE OF CONDITIONALS * CONDTBL ACZ 'T' ACZ 'F' ACZ 'HI' ACZ 'LS' ACZ 'CC' ACZ 'CS' ACZ 'NE' ACZ 'EQ' ACZ 'VC' ACZ 'VS' ACZ 'PL' ACZ 'MI' ACZ 'GE' ACZ 'LT' ACZ 'GT' ACZ 'LE' * * TABLE OF OPCODES * OPCTBL ACZ 'MOVEP' ;GROUP 0 ACZ 'BTST' ACZ 'BCHG' ACZ 'BCLR' ACZ 'BSET' ACZ 'ORI' ACZ 'ANDI' ACZ 'SUBI' ACZ 'ADDI' ACZ 'EORI' ACZ 'CMPI' ACZ 'MOVE' ;GROUPS 1,2,3 ACZ 'MOVEA' ACZ 'DB' ;GROUP 5 ACZ 'S' ACZ 'ADDQ' ACZ 'SUBQ' ACZ 'BRA' ;GROUP 6 ACZ 'BSR' ACZ 'MOVEQ' ;GROUP 7 ACZ 'DIV' ;GROUP 8 ACZ 'OR' ACZ 'SBCD' ACZ 'SUBA' ;GROUP 9 ACZ 'SUB' ACZ 'SUBX' ACZ 'CMPA' ;GROUP B ACZ 'CMP' ACZ 'CMPM' ACZ 'EOR' ACZ 'MUL' ;GROUP C ACZ 'AND' ACZ 'ABCD' ACZ 'EXG' ACZ 'ADDA' ;GROUP D ACZ 'ADD' ACZ 'ADDX' ACZ 'AS' ;GROUP E ACZ 'LS' ACZ 'ROX' ACZ 'RO' * ACZ 'NEGX' ;GROUP 4 ACZ 'CLR' ACZ 'NEG' ACZ 'NOT' ACZ 'TAS' ACZ 'TST' ACZ 'CHK' ACZ 'LEA' ACZ 'NBCD' ACZ 'SWAP' ACZ 'PEA' ACZ 'EXT' ACZ 'MOVEM' ACZ 'ILLEGAL' ACZ 'JSR' ACZ 'JMP' ACZ 'TRAP' ACZ 'LINK' ACZ 'UNLK' ACZ 'RESET' ACZ 'NOP' ACZ 'STOP' ACZ 'RTE' DC.B 00 ;NO INSTRUCTION $4E74 ACZ 'RTS' ACZ 'TRAPV' ACZ 'RTR' * ACZ 'CCR' ACZ 'SR' ACZ 'USP' * * ADDRESSES OF OPCODE GROUP HANDLERS * GRADRTBL DC.W GR0,GR1,GR2,GR3 DC.W GR4,GR5,GR6,GR7 DC.W GR8,GR9,GRA,GRB DC.W GRC,GRD,GRE,GRF * * TABLES FOR GROUP 4 * * JUMPTABLE FOR GROUP 4 GR4TBL DC.W GR4STD,MOVEM,TAS,ILLOPC DC.W EXT,PEASW,NBCD,MOVSPEC DC.W GR4E,LEACHK * JUMPTABLE FOR GROUP $4EXX GR4ETBL DC.W GR4E7,MOVUSP,ULINK,TRAP DC.W ILLOPC,JUMP * AND/CMP CONSTANTS FOR GROUP 4 AND4TBL DC.W $F100,$FF00,$F9C0 DC.W $FFC0,$FFC0,$FFB8 DC.W $FF80,$FFC0,$FB80 CMP4TBL DC.W $4100,$4E00,$40C0 DC.W $4800,$4840,$4880 DC.W $4C00,$4AC0,$4880 * AND/CMP CONSTANTS FOR GROUP $4EXX AND4ETBL DC.W $FF80,$FFC0,$FFF0 DC.W $FFF0,$FFF0 CMP4ETBL DC.W $4E80,$4E00,$4E40 DC.W $4E50,$4E60 * * ADDRESSES OF <EA> SUBROUTINES * EATBL DC.W DREGD,AREGD,AREGIND,AREGPI DC.W AREGPD,AREGID,AREGII DC.W GPIWORD0,GPILONG0,PCINDD,PCINDI DC.W IMMDAT,ILLOPC,ILLOPC,ILLOPC * * *************************** * MONITOR TEXTS & PROMPTS * *************************** * * HEADTXT ASC ' MON68K Version 2.2 July 84' DC.B CR,CR ACZ 'User RAM from $' ACZ ' to $' DC.B CR,CR ASC ' Enter "H" for help-screen' DC.B CR,NUL * * EXCEPTION MESSAGES * EXCEPTXT ACZ 'Spurious interrupt' ACZ 'Address error' ILLOPTXT ACZ 'Illegal instruction' ACZ 'Division by zero' ACZ 'Register o.o. bounds' ACZ 'Arithmetic overflow' ACZ 'Privilege violation' UNIMPTXT ACZ 'Unimplemented opcode' ACZ 'TRAP encountered' APRTXT ASC ' approx.' ATTXT ACZ ' at $' ACADRTXT ACZ 'Accessed address : $' FCTCDTXT ACZ 'Function codes : %' OPCODTXT ACZ 'Opcode : $' LLIMTXT ASC 'Program Counter < lower limit' DC.B CR,BEL,NUL HLIMTXT ASC 'Program Counter > upper limit' DC.B CR,BEL,NUL MBRKTXT1 ASC 'Memory - ' BRKTXT1 ACZ 'Breakpoint #' ACZ ' at $' * * ERROR MESSAGES * ERRTXT ASC 'Command not implemented' DC.B CR,NUL ASC 'Missing command character' DC.B CR,NUL ASC 'Missing address' DC.B CR,NUL ASC 'Missing data' DC.B CR,NUL ASC 'Too many data items' DC.B CR,NUL DIV0TXT ASC 'Divide by zero attempted' DC.B CR,NUL ERRTXT1 ACZ 'Continue execution (Y/N) ? ' * FLAGTXT ACZ 'SYS: ' ACZ 'CCR: ' MBRKTXT ASC 'Memory - ' BRKTXT ACZ 'Breakpoints : ' ASC 'None' DC.B CR,NUL LADRTXT ACZ 'Low ' HADRTXT ASC 'High' ACZ ' address : $' MBTBLTXT ASC 'MEM' BTBLTXT ACZ 'BRK' OTBLTXT ASC 'MEMOUT' ASC ' table overflow' DC.B CR,BEL,NUL CMDHTXT ACZ 'High address I,J,S commands : $' * * * ********************* * MONITOR WORK AREA * ********************* * * VARIABLES * RAMLOW DC.L BUFTOP ;LOWEST USER RAM = END OF CODE & BUFFERS RAMHIGH DC.L 0 ;HIGHEST USER RAM CMDHIGH DC.L 0 ;HIGHEST ADDRESS I,J,S PCADR DC.L BUFTOP ;DEFAULT ADDRESS FOR LIST ETC. NXTADR DC.L BUFTOP ;DEFAULT ADR FOR MEMORY CMDS LASTRES DC.L 0 ;DEFAULT RESULT FOR ARITHM. CMDS USRREG DS.L 15 ;USER REGISTERS SAVE AREA USRSP DS.L 1 ;USER STACK POINTER USRSTAT DS.W 1 ;STATUS REGISTER * * TABLES * LWLIM DC.L BUFTOP ;LOWER LIMIT FOR TRACE HILIM DC.L 0 ;UPPER LIMIT FOR TRACE BRKTBL DS.B 6*NTBL ;BREAKPOINT TABLE MBRKTBL DS.B 6*NTBL ;MEMORY BREAK TABLE MBRKXTBL DS.B 4*NTBL ;EXTENDED TABLE FOR MEM CONTENTS * REGMASK DS.L 1 ;REG SELECT MASK OUTTBL DS.B 6*NTBL ;MEMORY OUTPUT TABLE * * DC.L 0 ;END OF CODE * * MONITOR STACK AREA AND BUFFERS FOLLOW HERE * (see definitions for INBUF etc. in mon68.main.s) * * NOLIST SHAR_EOF if test 7821 -ne "`wc -c < 'mon68.tbl.s'`" then echo shar: "error transmitting 'mon68.tbl.s'" '(should have been 7821 characters)' fi fi echo shar: "extracting 'mon68.ch3.doc'" '(39010 characters)' if test -f 'mon68.ch3.doc' then echo shar: "will not over-write existing file 'mon68.ch3.doc'" else cat << \SHAR_EOF > 'mon68.ch3.doc' 3. The monitor mode =================== This chapter will describe the various commands available to you in monitor mode. ! Please remember that all the commands described in ! ! this chapter deal with memory on the DTACK board ! ! only, Apple memory will not be affected by them. ! As this chapter is a fairly lengthy one, it has been divided into several sub-chapters, each focussing on some particular subset of commands: 3.1. Prompts, line editor and control characters 3.2. Syntax, number formats, bytelists, command line 3.3. Arithmetic commands 3.4. Memory commands 3.5. Debugging commands 3.6. Miscellaneous commands For a complete, alphabetically sorted summary of all commands available in monitor mode, please refer to chapter six. A special word about "modes": I know some of you will not particularly like the idea of having different "modes" in this program. However, one of my goals writing the monitor has been to keep the commands as short as possible and the only way to achieve this goal, considering the number of commands available, has been to group certain commands into submodes with, as I hope, closely resembling syntax. The alternative, using multi-character commands, seemed much less appealing to me, so I hope no one will be scared away by my use of different modes (or command levels). 3.1. Prompts, line editor and control characters ------------------------------------------------ 3.1.1. Prompts -------------- Switching from EXEC mode into monitor mode, you will notice that the prompt characters have changed from "E>" (for EXEC mode) to "M>" (for monitor mode). Throughout MON68K, the CP/M-type prompt is used to indicate which mode (or submode, see discussion of B,O and R commands) you are presently in. Some characters (commands) typed by you have different effects depending on the mode you are in, so whenever you feel unsure which mode you are in, the prompt will be there to tell you. 3.1.2. Line editor and control characters ----------------------------------------- Entering the 68000 monitor, you will also notice that the cursor marker has changed from a blinking square (or checkerboard in case of the Apple//e) to a solid inverse square. This is to show you that the 68000 line editor is active. When in monitor mode, all input from the keyboard (with three exceptions) is passed on to the 68000 which in turn is to decide what to do with the input. The Apple is in essence reduced to a terminal, its function is mostly to react to control characters received by the 68000. The three exceptions mentioned above are: ESC Typing ESC will abort the current command executed by the 68000 and force it back into the input receiving routine. No monitor variables or 68000 memory will be changed by typing ESC. This is especially useful to regain control of the 68000 when a user program has gone astray. CTRL-Z This is an "emergency exit" out of monitor mode. Should the 68000 code be seriously damaged or the communi- cation between the processors be fouled up, typing CTRL-Z will let you return to EXEC mode. Thus it should not be necessary to resort to the RESET key except for the most extreme cases. CTRL-S This is used to temporarily suspend output from the 68000. Output is enabled again by typing any key. All other characters typed on the keyboard are stored in a 256 byte buffer in the Apple and sent on to the 68000 as soon as it is ready to receive data. The line you are entering is kept in a separate buffer on the DTACK board and may be edited using the following control-character commands: Cursor movement commands: CTRL-B : move cursor to the beginning of the line. CTRL-H : move cursor one character to the left (left arrow, <-). CTRL-I : move cursor one line up. (*) CTRL-J : move cursor one character to the left. CTRL-K : move cursor one line down. (*) CTRL-L : move cursor one character to the right. CTRL-N : move cursor to the end of the line. CTRL-O : move cursor to the top of the screen. (*) CTRL-P : move cursor to the top of the screen and clear the screen. (*) CTRL-U : move cursor one character to the right (right arrow,->) (*) CTRL-I,K,O,P commands may only be typed in as the first characters on a line, later they will not have any effect. Line editing commands: CTRL-A : add (insert) characters at cursor position. Insertion is cancelled by any other control character. CTRL-D : delete one character at cursor position. CTRL-M : accept the current input line as it is (<RETURN>). CTRL-Q : truncate input line at cursor position and accept line. CTRL-R : recover and retype last input line. Tries to restore a valid input line from the contents of the line input buffer. Should this be impossible, the bell will ring. CTRL-X : cancel the current input line and flush the buffer. Miscellaneous commands: CTRL-C : convert the letter under the cursor to opposite case. CTRL-E : clear the screen to the end of the line and truncate the current input line to the right of the cursor. CTRL-F : clear the screen to the end of the page and truncate the current input line to the right of the cursor. CTRL-G : ring bell. CTRL-V : enter a character not available on the regular Apple ][ keyboard. The character typed after CTRL-V is converted if it is one of the three special characters, otherwise CTRL-V is ignored. The special characters are: "]" : is converted to : "[" "/" : is converted to : "\" "." : is converted to : "_" After hitting <RETURN> or CTRL-Q, the input line will be con- verted to uppercase, except for items enclosed in apostrophes or quotation marks (" and ' respectively). 3.2. Syntax, number formats, bytelists, command line ---------------------------------------------------- 3.2.1. Syntax used to describe commands --------------------------------------- When describing the monitor commands, I will use a sort of formal language to specify the format of commands. In it, CAPITAL letters are used for the command letter while variable parts of the command like addresses or data are represented by lowercase variables. The name of the variable indicates what kind of input is expected in its place. The variables used are: "adr" (or "data") stands for any 32-bit number denoting an address (or data) element. "cnt" stands for count, a number used for example to specify the number of bytes an instruction is to process. "size" is for a size suffix after an address, this may be "B" for byte, "W" for word or "L" for longword values. "blst" stands for a list of byte values (see 3.2.3.) "reglst" is a list of 68000 register names in standard Motorola notation, that is, items of the list are separated by "/" and a range of registers is indicated by "-". "SP" may be used instead of A7 and "SR" is used to denote the status register. Optional parts of the command are enclosed in curly brackets, "{" and "}". If optional items are not specified, the appropriate default values will be used instead. 3.2.2. Number formats --------------------- Whenever a monitor command expects an address or a data item, it tries to parse the input line into a number, starting at the current position in the buffer. With the exception of byte lists (see paragraph 3.2.3.), spaces are ignored during number conversion. The result of the conversion is a right-justified 32-bit number. Conversion will be stopped by any command letter, base prefix or the special characters "." and ";". You may specify any number in several ways, as a binary, decimal or hexadecimal number (base 2,10 or 16, respectively) or as an ASCII string (MSB clear or set), whichever seems appro- priate or convenient to you. The result will always be treated as a 32-bit number, no matter how you specified it. You may select the base for number conversion by using a base prefix in front of your number. Base prefices are "%" for binary, "#" for decimal and "$" for hexadecimal numbers. Using the "$" prefix is optional as the default base used during conversion is hexadecimal. Strings are delimited using apostrophes "'" or quotation marks '"'. A string delimited by apostrophes will be evaluated as low ASCII (bit7=0), one delimited by quotation marks will evaluate as high ASCII (bit7=1). Some examples of numbers and strings you may input are: 37AF89 = $37AF89 = #3649417 %0110111001 = $1B9 = #441 'Atom' = $41746F6D = #1098149741 "HI THERE" = $C8C9A0D4 (remember, 32-bits maximum !) 3.2.3. Byte lists ----------------- Even though the 68000 is a word (16 bits) rather than a byte oriented processor, its smallest directly addressable memory cell is still a byte (8 bits). Therefore, and as I felt that it is more natural doing it this way, when it comes to handling data which is to be put into memory, searched or displayed, MON68K is a byte-oriented monitor. As a result, several commands which need a list of data items to process, will be looking for a "bytelist". The items of this list must be separated by blanks unless the beginning of the following data byte can be determined out of the context of the list. Each item in the list represents one 8-bit byte and may consist of either a number, an ASCII character or the special wildcard character "*". Numbers may be given in any base using the prefices described above. Characters may be given as single characters or strings, delimited by "'" or '"'. In the case of a string, each character of the string represents one byte of the list. The wildcard character "*" does not represent any value, instead it specifies that the byte at its position is not to be changed or is to be treated as a "don't care" byte, depending on the command. A possible example of a list would be: 31'ABC'#1234 5F$EC C9*%10010111"XYZ" Its equivalent hexadecimal value would be: 31 41 42 43 D2 5F EC C9 ?? 97 D8 D9 DA ^ ^ ^ will be treated as wildcard #1234 = $4D2, however, only byte values will be used 3.2.4. The command line ----------------------- When you have typed in and edited your commands, you tell the monitor that you are finished with the current input line (max. 256 bytes) by typing either a <RETURN> or a CTRL-Q. Typing <RETURN> will accept the contents of the line buffer as it is, the line will not be truncated at the current cursor position. Typing CTRL-Q will truncate the input line from the current cursor position to the right. After you have accepted the input line, the line editor will process it, converting all lowercase characters to uppercase (except for those enclosed in apostrophes or quotes) and setting up some pointers to the input buffer. The monitor command processor will then process the contents of the input buffer sequentially from left to right. The command processor has the ability to detect some syntactic errors (like a missing address) and will tell you accordingly. It will retype the input buffer from the start up to the character where the error was detected, place a carat "^" below that character and will print the appropriate error message. Following this, you will be asked whether you want to continue with the execution of the command line. Answering with a "N"o will return you to the line editor and you may then input the next command(s). If you answered "Y"es, the command interpreter will skip all characters up to the next semicolon and will then continue to interpret the command line as before. If no semi- colon is found, you will be returned to the line editor. The semicolon thus acts as a delimiter between several commands on the command line, making it possible to have multiple commands on the same line. 3.3. Arithmetic Commands ------------------------ Using these commands, you may perform basic arithmetic and logical operations on 32-bit operands. The result of an operation will be displayed in all three number bases (hex, decimal and binary) and as an ASCII string. The result of the last operation performed is saved in a special location by the monitor and may be used as the first operand for the next arithmetic operation. ================================================================ data = : convert and display data ================================================================ This command displays the 32-bit number "data" in all number bases and as a string. The output format is: $HHHHHHHH #DDDDDDDDDD AAAA %BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB with "H..H" being the hexadecimal, "D..D" the decimal, "A..A" the ASCII and "B..B" the binary representation of the input data. Control characters will be displayed in inverse. ================================================================ {data1} <o> data2 : perform operation <o> and display the result ================================================================ <o> stands for one of the symbols in the following list. If "data1" is not given, the result of the last performed operation will be used as a default. The result of the operation is displayed using the same format as the data conversion command "=". Symbol | Operation performed ---------------------------------------------------------------- + | 32-bit addition. (Note 1) - | 32-bit subtraction. (Note 1) * | 16-bit by 16-bit multiplication. (Note 2) / | 32-bit by 16-bit division. (Note 3) < | shift data1 left, data2 times. > | shift data1 right, data2 times. ( | rotate data1 left, data2 times. (Note 4) ) | rotate data1 right, data2 times. (Note 4) & | AND data1 with data2. ! | OR data1 with data2. ^ | EOR data1 with data2. Note 1 : A resulting carry or borrow will be flagged. Note 2 : This is a straightforward implementation of the 68000's MULU command. Only the low-order 16 bits of the two operands are used to calculate the 32-bit result. Note 3 : A simple implementation of the DIVU command. The result will be displayed as two numbers, the first number being the result of the integer division (data1 DIV data2), the second the remainder (data1 MOD data2). Should the result of the division be too large to be expressed in 16 bits, an overflow will be flagged, the bell will ring, the first operand ("data1") will be unchanged and the remainder will be cleared. Note 4 : This is equivalent to a ROL or ROR instruction, that is, the rotate will not be through the carry. To calculate the ones-complement of data1 use data1^$FFFFFFFF, to calculate the twos-complement of data2 use 0-data2. To get a quick $FFFFFFFF, use 0-1. 3.4. Memory commands -------------------- All of the commands discussed in this section allow you to handle data in memory on the DTACK board. The monitor keeps two special locations in conjunction with memory commands: - For all commands with an optional start address, the last opened (accessed) address+1 will be used as the default address if a start address is omitted. The last opened address is initialized to the lowest user RAM address ($3A00 in the current version) and will be updated by any memory command. - For the I,J and S commands, the default end address is kept in a special location. Initially, this location is set to the highest RAM address, but it may be set to a different address using the H option in the O submode (see chapter 3.5). ================================================================ {adr1} : blst : change memory ================================================================ This command changes memory starting at address "adr1" to the byte data given in the bytelist "blst" following the colon. ================================================================ {adr1}{.adr2} I blst : insert data ================================================================ This command inserts the data in the bytelist "blst" into memory starting at address "adr1". First, the contents of memory from address "adr1" through address "adr2" are being moved up by the number of bytes in the bytelist. Next, memory starting at address "adr1" is changed to the data given in the bytelist until the list is exhausted. Memory above "adr2" will not be affected by this command. ================================================================ {adr1}{.adr2} J blst : fill memory with pattern ================================================================ This command fills the memory from "adr1" through "adr2" with the byte pattern contained in the bytelist "blst". If the data in the list is exhausted before the memory range has been filled, the pattern in the list will be repeated from the start. ================================================================ adr1.adr2 M adr3 : move memory ================================================================ This command will move the contents of the block of memory from address "adr1" through address "adr2" to the block starting at address "adr3". Contrary to the Apple ][ monitor move command, this is a non-destructive memory move, that is, no care has to be exercised whether the source and destination block overlap. The trick you may be used to from the Apple monitor for filling a memory range with a pattern by using overlapping source and destination ranges will not work here. To do this, use the J command instead. Please note that all three addresses have to be specified for this command. A move command will not have any effect on the setting of the last opened address. ================================================================ {adr1}{.adr2} S blst : search memory for pattern ================================================================ Using this command, you may search the memory range from "adr1" through "adr2" for the pattern given in the bytelist "blst". For every occurence of the pattern, the address of its first byte is displayed on the screen. ================================================================ adr1.adr2 V adr3 : compare two memory ranges ================================================================ The memory range from address "adr1" through "adr2" will be compared to the block of memory starting at address "adr3". For every byte in which the two ranges differ, the addresses of the bytes as well as their hex and ASCII interpretations will be given. As with the M command, note that all three addresses have to be specified for this command. A compare command will not have any effect on the setting of the last opened address. ================================================================ {adr1}{.adr2} X / {adr} X {cnt} : display (examine) memory ================================================================ You may view the contents of the specified memory range using this command. The data is displayed bytewise in its hex and ASCII interpretation. Printable characters are displayed in normal, control characters in inverse, no difference is made between high and low "flavours" of ASCII. The memory range for this command may be specified either by giving a start- and endaddress or by giving a startaddress and a count for the number of bytes you want to be displayed. If no endaddress or count is given, a count of eight bytes is used. ================================================================ adr1{.adr2} : display memory ================================================================ This alternate form of the X command was included for your convenience to provide a notation similar to the Apple ][ monitor. The display format is the same as in the X command. Leaving out the endaddress "adr2" of the command will display eight bytes as a default. Naturally, there is no way to specify a count for the number of bytes to be displayed. 3.5 Debugging commands ---------------------- This section will discuss the commands used in debugging of programs and related commands, like setting processor registers. The monitor remembers the last address of a disassembly or program execution in a special location, this address will be used as the default address whenever the start address for a debugging command is not specified. Furthermore, the monitor program provides the user with a separate register set, including stackpointer and status register. This user register set is kept in memory and will only be loaded into the processor registers at the start of execution of a user program. When the user program ends, the register contents will be saved again in memory. This way, you are completely free as to which registers to use in your program. ================================================================ B : breakpoint submode ================================================================ With MON68K, you may set several breakpoints to interrupt your program at strategic locations during debugging. All breakpoints can be set, displayed and deleted using the breakpoint submode. When a break condition arises during the execution of your program, the monitor will display the user registers and stop the execution of your program. A break condition can be caused by hitting a breakpoint or exceeding the PC address limits, which can be set separately (see H and L subcommands). MON68K knows two differrent kinds of breakpoints, code (regular) breakpoints and memory breakpoints: - Code breakpoints are the ones you are likely to be accustomed to if you have been using any debugger at all. Setting a code breakpoint at an address means that a break condition arises whenever your program reaches the address where the code breakpoint has been set. In MON68K, this concept has been taken one step further, allowing you to specify a count together with the address of the breakpoint. If the count is omitted, a count of zero will be assumed, meaning your program will stop the first time that address is reached. Otherwise, the count associated with the breakpoint will be decremented each time the breakpoint's address is reached and program execution continues as long as the count is not zero. This is useful, for example, for the debugging of loops. - Memory breakpoints can be set to stop the execution of a program at the moment the memory location where the memory breakpoint has been set reaches a certain value. When setting a memory breakpoint, you have to specify the address of the data you want to be checked and the contents of this address at which a breakcondition should occur. Optionally, a size suffix may be appended to the address, which will specify the length of the data to be tested for. As currently configured, there is a maximum of eight code and memory breakpoints each. The following commands are available in the breakpoint submode: ---------------------------------------------------------------- adr{,cnt} : set code breakpoint ---------------------------------------------------------------- Typing an address "adr", optionally followed by a count "cnt", sets a code breakpoint. Example: Typing "4100,10" will set a code breakpoint at address $4100 with a count of $10. This results in a break condition arising when your program passes location $4100 for the 16th time. ---------------------------------------------------------------- M adr{.size},cont : set memory breakpoint ---------------------------------------------------------------- This command allows setting a memory breakpoint at address "adr" with the associated contents "cont". Both the address and the contents to test for must be given. The size suffix "size" is optional, if it is not specified, a size of word (W) will be assumed. The size suffix may be either byte (B), word (W) or longword (L). Odd addresses for sizes W or L will result in the address being rounded off to an even address. Examples of memory breakpoints : Typing.. | ..will result in a breakcondition when.. ---------------------------------------------------------------- | M6000,1234 | locations $6000 and $6001 contain $1234. M6005.B,FF | location $6005 contains $FF. M6011.L,F0001234 | locations $6010 through $6013 contain | $F0001234 (odd addresses rounded off). ---------------------------------------------------------------- H adr : set high address for program execution ---------------------------------------------------------------- This command allows you to specify the highest value of the program counter which is allowed during the execution of your program. Whenever the processor's PC surpasses the limit set by you, a break will occur. The highest address is initially set to the top of RAM. Odd addresses will be truncated to even ones. ---------------------------------------------------------------- L adr : set low address for program execution ---------------------------------------------------------------- This command allows you to specify the lowest value of the program counter which is allowed during the execution of your program. Whenever the processor's PC is below the limit set by you, a break will occur. The lowest address is initially set to the start of the user RAM space (currently $3A00). Odd addresses will be truncated to even ones. ---------------------------------------------------------------- X adr : delete breakpoint at adr ---------------------------------------------------------------- With this command, you may delete single breakpoints you have set. First, the list of code breakpoints will be searched, then, if no corresponding entry is found there, the list of memory breakpoints will be searched and the entry with the corres- ponding address will be deleted if it is found. ---------------------------------------------------------------- K : delete ("kill") all breakpoints ---------------------------------------------------------------- This command will delete all breakpoints previously set and will also initialize the low and high limits for the PC. It is recommended to use this command when entering MON68K for the first time to clear all breakpoints. ---------------------------------------------------------------- P : display (print) all breakpoints ---------------------------------------------------------------- This will display a list of all code and memory breakpoints set as well as show the current low and high PC limits. ---------------------------------------------------------------- Q : quit breakpoint submode ---------------------------------------------------------------- Using this command, finally, you may leave the breakpoint submode to return to the main command level. ================================================================ {adr} G : execute user program ================================================================ Using the G(o) command, you may execute one of your programs under monitor control. With the G command, all the breakpoints and register contents you have set are in effect, however, there will be no diagnostic output as with the T(race command. Your program will run either until it is finished or until a break condition arises. As this command works by single-stepping your program using the 68000's built-in trace facility, execution of your program will need a lot more time than running it directly without inter- vention from the monitor. Also, if your program uses any of the 68000's privileged instructions, a "privilege violation" exception will occur. To return to MON68K, your program should have a RTS instruction at its end. ================================================================ {adr} GG : execute user program w/o monitor control ================================================================ To enable you to execute your program at full speed and without any intervention by the monitor, this second version of the G command has been included. The "GG" command will load your preset register contents as did the "G" command, after that, however, the monitor will jump directly to your program and execute it, so no breakpoints will be in effect and your program is solely responsible for returning to MON68K. To return to MON68K, your program should have a RTS instruction at its end and should be careful not to manipulate the stack in a way as to destroy the return address saved on it when jumping (actually, JSRing) to its start. ================================================================ {adr1}{.adr2} L / {adr} L {cnt} : disassemble instructions ================================================================ To disassemble 68000 programs, use this command. The output from this command will list the start address of each instruction, the words making up this instruction and the mnemnonic repre- sentation of this instruction. If you do not specify address "adr1", the address+1 of the last disassembled byte will be used instead. If no endaddress "adr2" or count "cnt" is given, a count of eight will be assumed. The count, in this command only, counts the number of instructions to disassemble, not the number of bytes as in other commands. ================================================================ O : output control submode ================================================================ This submode is to control the output produced by your tracing of a program. It allows you to select either all or a subset of the 68000's registers as well as to select up to eight different memory locations to be displayed during a trace operation. ---------------------------------------------------------------- reglist : select registers for display ---------------------------------------------------------------- Each register given in the register list "reglist" will be selected for display during a trace. Naming the same register several times has no effect on the display. ---------------------------------------------------------------- M adr{.size} : select memory location for display ---------------------------------------------------------------- The data stored at memory address "adr" will be selected for display during a trace. To specify the size of the data, you may append a size suffix "size" to the address. The size may be any of byte (B), word (W) or longword (L). If the size suffix is omitted, a size of word will be assumed. For word and longword sized data, the address will be rounded down to an even address. ---------------------------------------------------------------- X reglist : delete registers from display ---------------------------------------------------------------- Each register in the register list will be deleted from the display, deleting the same register several times has no effect. ---------------------------------------------------------------- X adr : delete memory location from display ---------------------------------------------------------------- The list of memory locations to be displayed will be searched for the given address and, if found, this address will be deleted. ---------------------------------------------------------------- K : delete all registers and memory locations from display ---------------------------------------------------------------- This will delete all registers and memory locations from the display, leaving you with an "output" of three blank lines during a trace. It is recommended to use this command when entering MON68K for the first time to clear all memory locations from the display. ---------------------------------------------------------------- P : display (print) a sample output ---------------------------------------------------------------- Using this command, you get a sample output with all the registers and memory locations you have selected up to now. This is the same output that you would get at any step when tracing or single-stepping a program. ---------------------------------------------------------------- Q : quit output control submode ---------------------------------------------------------------- To leave the output control submode and get back to the main monitor command level, type "Q". ---------------------------------------------------------------- H {adr} : display/set highest address for I,J,S commands ---------------------------------------------------------------- Using this command you may display without altering (when not giving an address) or set the highest address used by the I (insert), J (fill) and S (search) commands. Initially, this address is set to the top of RAM, meaning that these three commands will use the top of RAM as their default endaddress. This may be inconvenient to you if you have large amounts of RAM available, so you are able to specify a different address using this command. ================================================================ R : register submode ================================================================ Using the commands in register submode, you may set selected processor registers and/or flags to the value needed by your program. All the commands in this submode (except for the "P" command) work on the user register set kept in memory. This register set will be loaded into the processor registers prior to the execution of any user program. After each change to the registers, all registers will be displayed again with their current contents. The setting of the flags in the status register is indicated by their display mode. Flagnames displayed in normal mode indicate reset (zero) flags, flagnames displayed in reverse mode indicate set (one) flags. The interrupt level is displayed as a number from zero to seven which is derived from the setting of the interrupt mask bits in the processor status register. ---------------------------------------------------------------- reglist data : set registers to data ---------------------------------------------------------------- All the registers contained in the registerlist "reglist" will be set to the 32-bit number "data". In the case of the status- register, the number will be truncated to 16 bits. ---------------------------------------------------------------- T|S|X|N|Z|V|C data01 : set/reset flags ---------------------------------------------------------------- Using the flagname and either a "0" or "1", you may set any one of the flags in the status register to the desired state. Data larger than one will result in an error. Please note, that you may set the T(race) and S(upervisor) flags to any state, but that they will be set to the appropriate values by the G,GG and T commands. ---------------------------------------------------------------- I data07 : set interrupt mask ---------------------------------------------------------------- This command sets the interrupt mask bits to the interrupt level indicated by "data07". "Data07" means that any number between zero and seven is allowed with this command, higher numbers will result in an error. ---------------------------------------------------------------- K : clear all registers ---------------------------------------------------------------- Using this command, you may clear all registers simultaneously. Registers D0 through D7, A0 through A6 and the status register will be cleared to zero and the stackpointer A7 will be set to the highest RAM address+1, that is, your program stack will be located at the top of memory unless you change this. ---------------------------------------------------------------- P : display processor registers ---------------------------------------------------------------- Unlike all the other commands in the register submode, this command allows you to take a look at the current contents of the 68000's registers. This command does not have any effect on the user registers in memory and is used for debugging. ---------------------------------------------------------------- Q : quit register submode ---------------------------------------------------------------- Allows you to return to the main monitor command level. ================================================================ {adr1}{.adr2} T / {adr} T {cnt} ================================================================ When you select this command, the user register set will be moved into the processor registers and execution will be begun at address "adr1", or the last disassembled or executed address plus one. Following this, the program will be executed step by step using the 68000's trace facility, up to address "adr2" or "cnt" bytes. If no endaddress or count is given, a count of eight bytes is assumed. During a trace, the instruction which is to be executed next is displayed together with the registers and memory locations you selected in the output control mode. After each step, the monitor checks for your input and continues with the next step according to your input. To select single-stepping through a program, press the spacebar. To select tracing through a program, press any key other than the spacebar or a control-key. To abort the trace or single-step, input any control-character. 3.6. Miscellaneous commands --------------------------- ================================================================ H {cmdletter} : display help information ================================================================ This command provides a short overview of the commands available and the associated command syntax, much like the command summary in chapter six. Typing a command letter after the "H" will show only the descripton for this one command. The help facility may be disabled using the CONFIGURE program as the helpfile takes up around 3500 bytes in Apple memory. If the help command is disabled, you will get the message "System not configured for HELP" when requesting help information. ================================================================ P : toggle printer on/off ================================================================ This command selects whether screen output will be echoed on the printer. The system is set up to use a printer in slot #1 with an Epson interface card. Should you need a different setup, the system can be reconfigured using the CONFIGURE program. For more information on printer drivers refer to chapter five. ================================================================ Q : quit monitor ================================================================ This returns you to EXEC mode. None of the system variables and no memory is affected by this, so if you return to the monitor you can continue exactly in the same environment that you left off (provided, of course, that you did not destroy the monitor code somehow). SHAR_EOF if test 39010 -ne "`wc -c < 'mon68.ch3.doc'`" then echo shar: "error transmitting 'mon68.ch3.doc'" '(should have been 39010 characters)' fi fi exit 0 # End of shell archive