Home » Archimedes archive » Micro User » MU 1991-04.adf » PD-Stuff » Mod_Dis/Manual
Mod_Dis/Manual
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Micro User » MU 1991-04.adf » PD-Stuff |
Filename: | Mod_Dis/Manual |
Read OK: | ✔ |
File size: | 44DF bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
>Manual Directory Structure =================== MOD_DIS | +--------+----+-----+----+----------+-----------+-----------+---------+ | | | | | | | | | GetStarted | Changes | Checker MODULES ORIGINALS SCRIPTS SOURCES | | | | | | Manual ModDis201 ---+--- ---+--- ---+--- ---+--- GetStarted Text How to start quickly without reading the manual Manual Text The manual Changes Text Major changes since version 1.04 ModDis201 BASIC The main program Checker BASIC Checks the validity of a re-assembled module MODULES Dir Newly-assembled modules are saved here ORIGINALS Dir The module to be disassembled should be put here SCRIPTS Dir User responses are stored here SOURCES Dir Disassembled modules are stored here This is version 2.01 of ModDis, and replaces those versions previously published (0.E, 0.F and 1.04). It has various bug fixes and enhancements not available in previous versions. If you already have version 1.04, see the file Changes for details of important changes. If you don't want to read this manual yet try reading GetStarted and following its instructions. ModDis a semi-intelligent module disassembler. It will read a relocatable module file from the ORIGINALS directory and attempt to disassemble it into a form suitable for the BASIC assembler. If successful, the output file is stored in the SOURCES directory, under the same filename as the module. If, as is likely, the program cannot resolve the disassembly unaided, it will prompt the user for help, hence the "semi-intelligent" description. These responses can be stored in the SCRIPTS directory and played back later to re-create the disassembly. The validity of the disassembly can be tested by re-assembling, which makes a new version in the MODULES directory. The BASIC program Checker can then be used to do a byte-by-byte comparison of the original and new versions. I had already disassembled several modules by hand, and, while it is relatively easy, it becomes quite tedious as the module size increases. This program started as a quick utility to do some of the mechanical "donkey-work" aspects of disassembly, but has grown out of all proportion to its original aims. I have successfully disassembled about 30 of the RISC OS modules, and there are usually only a handful of errors to sort out in the output assembler listing (see the Problems section for details). You should be warned, however, that some of the larger RISC OS modules can produce thousands of lines of assembler listing. There are more enhancements in the pipeline, but it will probably be some time before they become available. In use ====== Start by making ModDis your current directory, and load the ModDis201 program. There is one feature which the user can change, located in PROCinit, around line 8000: debug%=TRUE If debug% is TRUE, extra information is printed out in cyan while the program is running. I find it reassuring to be able to see what the program is doing. Setting it to FALSE will supress this printout, and there will be sometimes be long pauses when it is not obvious if the program is doing anything. How the program works ===================== The program identifies the "type" of each byte of the module, according to the following scheme: type description -4 'Acorn'-format compressed string -3 Padded string, ie a string padded with zeros up to a fixed length -2 Carriage-return-terminated string -1 Zero-terminated string 0 Don't know 1 A byte of data 2 A word (2 bytes of data) 3 Address, ie a 4-byte number pointing to another point in the module 4 A double word (4 bytes of data) 5 ARM code 6 Alignment bytes, 1, 2 or 3 bytes to bring us to a word boundary 7 External. See below The first pass through the module is made armed with the entry points, eg initialisation code, finalisation code, etc. At this stage, ModDis is just setting the "type" of each byte it comes across, code, data or whatever. If it finds code, it follows it, and investigates branches and subroutine calls recursively, asking the user for help with identifying what it has found, where necessary. The program is smart enough to spot when the code ends, so it doesn't "fall off" into following data. It also recognises such things as SWI "OS_Exit", the zero-terminated string which always follows SWI "OS_WriteS", and stuff like that. After investigating all the entry points, it does one sequential pass through the module, searching for any bytes whose type has not yet been identified, and asking the user what they are. Once all the types have been sorted out, the disassembly proper starts. If parts of the module are marked as data, they are expanded with EQU directives. The code is disassembled with calls to the Debugger module, but the following enhancements are made to its output: 1. Labels are placed at all necessary points, as .xABCD where ABCD is the offset in hex from the module start. 2. Wherever possible, sensible label names are constructed, eg SWI tables, Keyword code, etc. 3. Branches are expanded to refer to labels. 4. Subroutines are identified by sABCD, rather than xABCD 5. PC-relative addressing is expanded as the ADR macro. 6. SWI names are enclosed in quotes. 7. The 2 instructions making up a 'long ADR' are recognised and represented by a macro, FNadrl, to aid readability. The "What's this?" prompt ========================= During the first pass through the module, the program will ask for help if it finds a reference to another part of the module, asking whether this reference is code to be disassembled, or data, in which case it wants to know what kind of data it is. The display looks like this: [ ] This is the line currently being disassembled [ Block of ] and the three following, to show the context. [ yellow text ] [ ] [ ] [ Block of ] A few lines preceding the reference [ white text ] [ ] [ RED LINE ] The address being referred to [ ] [ More ] A few lines after the reference [ white text ] [ ] What's this? The prompt The program expects a numeric response in the range -4 to 7. It should be easy to tell if it's a string. Most strings are zero-terminated (type -1), but OS_CLI strings may be CR-terminated (-2). RISC OS menu labels are usually padded with zeros to 12 bytes; if you reply -3 you will be asked for the length of the padded string. 'Acorn'-format strings contain ASCII 27 to indicate compressed dictionary entries; although zero-terminated they may also contain ASCII 0 immediately after ASCII 27. Try to avoid replying 0 (don't know) if at all possible, because you'll have to answer sooner or later, and this may be your best oppertunity. There are however, two occasions when it is useful to answer 0. One is when the offset in question is obviously something like the module's title string, help string, or some other known entry point which is going to be recognised by the program later on. If you identify this offset now, it may not be fully followed-up by the program later. The other case is when the offset is pointing to the middle of an instruction, somewhere where a label cannnot be placed. See 'Odd labels' in the Problems section for more details. Byte, word and address (1,2,3) are fairly rare. Make sure that the reference is word-aligned before replying 4 or 5 (double or code); getting this wrong will almost certainly cause an execution error later on. It is unlikely that a reference will be made to alignment bytes (6). See the External section below for details of type 7. The "bytes of unknown type" prompt ================================== This prompt will occur during the final sequential pass through the module. The display looks like this: [ ] [ Block of ] A few lines preceding the address [ white text ] [ ] [ RED LINE ] The address being referred to [ ] [ More ] A few lines after the address [ white text ] [ ] n byte(s) at ABC of unknown type The prompt This is your last chance to work out unresolved byte types. Note that if n is 69, this means that there is a block of more than 68 bytes whose types are unknown. The allowed responses are the similar to those above, with the following changes: You must NOT reply "don't know" (0) at this prompt. If you answer 1,2,3 or 4 (byte, word, address, double) the program will ask you how many of these items there are. If you answer 5 (code), you may get some more "What's this?" type prompts as the program re-enters its recursive code-following phase, but it will eventually return to where it left off. Alignment bytes (6) are easily recognised as 1, 2 or 3 zeros at the end of a string, bringing it to a word boundary. See the External section below for details of type 7. If you can see by inspection that the block of bytes contains more than one "type", simply reply with the type number of whatever comes first, and the program will re-prompt you for the remainder. The external type (7) ===================== Rather than making the program general enough to cope with anything, I have allowed for the heading "none of the above" by creating type 7. If your module contains something weird, you can edit the program to cope with it, by writing your own PROCexternal, which marks the weird block as type 7, and PROCdisexternal, which copes with the disassembly of the block. For example, the RISC OS Desktop module contains 5 template files embedded in it (these appear under the DeskFS filing system). The PROCexternal supplied simply marks these 5 blocks as type 7 throughout, and PROCdisexternal loads the files in and increments the assembler counters O% and P% to jump over them. Something similar would be needed for the 6502 emulator module, which contains embedded the BASIC ROM from the BBC. Another good use for PROCexternal is if you know that the module contains a large block of, say, zero-terminated strings. rather than identifying each one individually at run time, you could put something like this in PROCexternal: FOR offset%=&1234 TO &2468 type%(offset%)=-1 NEXT This will mark the block en-masse before the program proper starts. CHECKER ======= To verify that the disassembly worked, you can re-assemble the module; the new version is stored in directory MODULES. The program Checker does a byte-by-byte comparison of the original and new module, reporting on any differences it finds, as a disassembled instruction from each version. Any differences should be unimportant, as outlined in the Problems section below. PROBLEMS ======== This is a list of known problem areas with ModDis. In most cases the problems are obscure, or difficult to correct in the program, but easy to spot and fix in the final assembler listing. Immediate constants ------------------- An immediate constant is expressed as an 8-bit value with a 4-bit rotation applied to it. This means that there can be more than one way of expressing a constant, eg #1 can be represented as #1 with 0 rotation, #4 with a rotation of 2, etc. The BASIC assembler hides this process from the programmer, who merely supplies the required constant and lets the assembler figure out how to represent it. If the original module has #1 stored as 4>>2, the disassembler will convert this to #1, and the BASIC assembler will reassemble it as 1>>0. This is functionally identical, but a byte-by-byte comparison of the two modules will show a difference. Another related problem is that the program sometimes fails to expand the constant at all, giving something like MOV R0,#0,24, ie 0 rotated by 24, which is still 0. This format, which the program generates through the debugger module, is not valid for the BASIC assembler and should be replaced by MOV R0,#0. Some of these are detected and translated by the this version of the program, but it's not foolproof, and some still slip through. This problem is caused by a bug in the Debugger module. To solve it permanently, you need to modify the Debugger module itself, changing offset &920 from &1A000028 to &FA000028, effectively changing a BNE to a BNV. This seems to solve the problem, although I haven't tested this fix exhaustively, so proceed with caution. The ADR directive ----------------- ADR Rn,#address is converted by the assembler into either SUB Rn,PC,#offset or ADD Rn,PC,#offset, depending on whether the address comes before or after the current PC value. A problem arises in that ADD Rn,PC,#0 is functionally identical to SUB Rn,PC,#0. The BASIC assembler always chooses the former, so if the latter occurs in a module it will be converted from SUB to ADD leading to an apparent difference between the modules when compared byte-by-byte. It should have no effect on running the module. Long labels ----------- The assembler mnemonics start in column 20, leaving room for long labels. Sometimes, however, the labels are too long, in which case the mnemonic is moved to the next line, this being still syntactically correct. But if the label is exactly 19 characters long then it 'touches' the mnemonic, and BASIC sees this as one big label with a bad mnemonic after it. It's rare, so fix it manually if it happens. The comment field ----------------- The program generates a comment field which may be useful. If, however, it contains a colon, the BASIC assembler thinks this is a new statement starting. It's rare, so fix it manually. I also had a case once when the comment field contained the character &8D, which BASIC tried to tokenise. I did consider removing the commenr field altogether, as the simplest way of solving these problems, but overall it's too useful to lose, despite its problems. SWI branch table ---------------- The program attempts to match the SWI names to the SWI branch table, but it sometimes fails to identify the branch table as belonging to the SWI routine. In this case it substitutes labels of the type xABCD, so the assembly is still syntactically correct (and logically) correct. I think this is one of those things you're going to have to live with. Embedded text ------------- Something that cropped up in the NetPrint module was like this: BL s1234 EQUS "A message" More code... where the subroutine at s1234 adjusts the return address to skip the string. While ModDis recognises this if used with SWI "OS_WriteS", it cannot check for a user routine which does the same. ModDis will try to interpret the string as code, giving a warning message if this is not possible. It's up to you to be aware of this pitfall and watch out for it. Floating point -------------- Although ModDis could disassemble instructions intended for the FPU, in practice there isn't much point, since the BASIC assembler doesn't recognise them, so you could not re-assemble the module. Instead, it assumes that any FPU instruction it comes across is a mistake caused by an incorrect user response, and gives a warning message. I may do something about FPU at some time, but it's a low priority. In the meantime, if you want to disassemble a module which contains some FPU instructions, you will have to mark them as words (4-byte data). Odd labels ---------- Sometimes a reference is made to, for example, the byte BEFORE a block of data, the pointer being incremented before use. Something like: ADR xF6F ........ MOV PC,R14 .xF70 EQUS "...." It is not possible to place a label at &F6F, since it lies in the middle of an instruction. Instead, you should manually substitute something like this: ADR xF70-1 This sort of thing is usually fairly easy to spot. ALIGN ----- When assembling a module, the ALIGN directive is used to move to a word boundary, simply incrementing the pointer by 1, 2 or 3. The bytes "skipped" like this are not explicitly set to zero, and will contain whatever was there at the time the module was originally compiled. When recompiling after running ModDis, these 'skipped" bytes may well have different values, and the Checker program will detect this, but since they play no part in the module, they are unimportant. THE END ======= My thanks to those users who reported bugs in the previous versions of ModDis, and to those who made suggestions on improving it. If you have any problems or (constructive) comments about ModDis, please get in touch with me. If you have any ideas for improving it, or if you extend it yourself, I'd be very glad to hear from you. Lorcan Mongey 56 Salisbury Court Dublin Road Belfast BT7 1DD Tel: 0232 234386 I can also be reached at the following BBS: BBS Telephone Username Number --- --------- -------- ------ CIX 081 390 1244 lorcan@cix.uucp The World of Cryton 0749 670030 lorcan #237 Arcade 081 654 2212 lorcan #417
00000000 3e 4d 61 6e 75 61 6c 0a 0a 44 69 72 65 63 74 6f |>Manual..Directo| 00000010 72 79 20 53 74 72 75 63 74 75 72 65 0a 3d 3d 3d |ry Structure.===| 00000020 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |================| 00000030 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |.. | 00000040 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000050 20 20 20 20 20 20 4d 4f 44 5f 44 49 53 0a 20 20 | MOD_DIS. | 00000060 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000080 20 20 20 20 20 7c 0a 20 20 20 2b 2d 2d 2d 2d 2d | |. +-----| 00000090 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2b 2d |---+----+-----+-| 000000a0 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d |---+----------+-| 000000b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d |----------+-----| 000000c0 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d |------+---------| 000000d0 2b 0a 20 20 20 7c 20 20 20 20 20 20 20 20 7c 20 |+. | | | 000000e0 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 7c 20 | | | | | 000000f0 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | | | 00000100 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | | | 00000110 20 7c 20 20 20 20 20 20 20 20 20 7c 0a 47 65 74 | | |.Get| 00000120 53 74 61 72 74 65 64 20 20 7c 20 43 68 61 6e 67 |Started | Chang| 00000130 65 73 20 20 7c 20 43 68 65 63 6b 65 72 20 20 20 |es | Checker | 00000140 20 4d 4f 44 55 4c 45 53 20 20 20 20 4f 52 49 47 | MODULES ORIG| 00000150 49 4e 41 4c 53 20 20 20 20 53 43 52 49 50 54 53 |INALS SCRIPTS| 00000160 20 20 20 53 4f 55 52 43 45 53 0a 20 20 20 20 20 | SOURCES. | 00000170 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | | | 00000180 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | | | 00000190 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 7c 20 | | | | 000001a0 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | | | 000001b0 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 4d 61 | |. Ma| 000001c0 6e 75 61 6c 20 20 20 20 20 4d 6f 64 44 69 73 32 |nual ModDis2| 000001d0 30 31 20 20 20 20 20 20 20 20 2d 2d 2d 2b 2d 2d |01 ---+--| 000001e0 2d 20 20 20 20 20 2d 2d 2d 2b 2d 2d 2d 20 20 20 |- ---+--- | 000001f0 20 20 2d 2d 2d 2b 2d 2d 2d 20 20 20 2d 2d 2d 2b | ---+--- ---+| 00000200 2d 2d 2d 0a 0a 0a 20 20 20 20 47 65 74 53 74 61 |---... GetSta| 00000210 72 74 65 64 20 20 20 20 20 54 65 78 74 20 20 20 |rted Text | 00000220 20 48 6f 77 20 74 6f 20 73 74 61 72 74 20 71 75 | How to start qu| 00000230 69 63 6b 6c 79 20 77 69 74 68 6f 75 74 20 72 65 |ickly without re| 00000240 61 64 69 6e 67 20 74 68 65 20 6d 61 6e 75 61 6c |ading the manual| 00000250 0a 20 20 20 20 4d 61 6e 75 61 6c 20 20 20 20 20 |. Manual | 00000260 20 20 20 20 54 65 78 74 20 20 20 20 54 68 65 20 | Text The | 00000270 6d 61 6e 75 61 6c 0a 20 20 20 20 43 68 61 6e 67 |manual. Chang| 00000280 65 73 20 20 20 20 20 20 20 20 54 65 78 74 20 20 |es Text | 00000290 20 20 4d 61 6a 6f 72 20 63 68 61 6e 67 65 73 20 | Major changes | 000002a0 73 69 6e 63 65 20 76 65 72 73 69 6f 6e 20 31 2e |since version 1.| 000002b0 30 34 0a 20 20 20 20 4d 6f 64 44 69 73 32 30 31 |04. ModDis201| 000002c0 20 20 20 20 20 20 42 41 53 49 43 20 20 20 54 68 | BASIC Th| 000002d0 65 20 6d 61 69 6e 20 70 72 6f 67 72 61 6d 0a 20 |e main program. | 000002e0 20 20 20 43 68 65 63 6b 65 72 20 20 20 20 20 20 | Checker | 000002f0 20 20 42 41 53 49 43 20 20 20 43 68 65 63 6b 73 | BASIC Checks| 00000300 20 74 68 65 20 76 61 6c 69 64 69 74 79 20 6f 66 | the validity of| 00000310 20 61 20 72 65 2d 61 73 73 65 6d 62 6c 65 64 20 | a re-assembled | 00000320 6d 6f 64 75 6c 65 0a 20 20 20 20 4d 4f 44 55 4c |module. MODUL| 00000330 45 53 20 20 20 20 20 20 20 20 44 69 72 20 20 20 |ES Dir | 00000340 20 20 4e 65 77 6c 79 2d 61 73 73 65 6d 62 6c 65 | Newly-assemble| 00000350 64 20 6d 6f 64 75 6c 65 73 20 61 72 65 20 73 61 |d modules are sa| 00000360 76 65 64 20 68 65 72 65 0a 20 20 20 20 4f 52 49 |ved here. ORI| 00000370 47 49 4e 41 4c 53 20 20 20 20 20 20 44 69 72 20 |GINALS Dir | 00000380 20 20 20 20 54 68 65 20 6d 6f 64 75 6c 65 20 74 | The module t| 00000390 6f 20 62 65 20 64 69 73 61 73 73 65 6d 62 6c 65 |o be disassemble| 000003a0 64 20 73 68 6f 75 6c 64 20 62 65 20 70 75 74 20 |d should be put | 000003b0 68 65 72 65 0a 20 20 20 20 53 43 52 49 50 54 53 |here. SCRIPTS| 000003c0 20 20 20 20 20 20 20 20 44 69 72 20 20 20 20 20 | Dir | 000003d0 55 73 65 72 20 72 65 73 70 6f 6e 73 65 73 20 61 |User responses a| 000003e0 72 65 20 73 74 6f 72 65 64 20 68 65 72 65 0a 20 |re stored here. | 000003f0 20 20 20 53 4f 55 52 43 45 53 20 20 20 20 20 20 | SOURCES | 00000400 20 20 44 69 72 20 20 20 20 20 44 69 73 61 73 73 | Dir Disass| 00000410 65 6d 62 6c 65 64 20 6d 6f 64 75 6c 65 73 20 61 |embled modules a| 00000420 72 65 20 73 74 6f 72 65 64 20 68 65 72 65 0a 0a |re stored here..| 00000430 0a 54 68 69 73 20 69 73 20 76 65 72 73 69 6f 6e |.This is version| 00000440 20 32 2e 30 31 20 6f 66 20 4d 6f 64 44 69 73 2c | 2.01 of ModDis,| 00000450 20 61 6e 64 20 72 65 70 6c 61 63 65 73 20 74 68 | and replaces th| 00000460 6f 73 65 20 76 65 72 73 69 6f 6e 73 20 70 72 65 |ose versions pre| 00000470 76 69 6f 75 73 6c 79 0a 70 75 62 6c 69 73 68 65 |viously.publishe| 00000480 64 20 28 30 2e 45 2c 20 30 2e 46 20 61 6e 64 20 |d (0.E, 0.F and | 00000490 31 2e 30 34 29 2e 20 49 74 20 68 61 73 20 76 61 |1.04). It has va| 000004a0 72 69 6f 75 73 20 62 75 67 20 66 69 78 65 73 20 |rious bug fixes | 000004b0 61 6e 64 20 65 6e 68 61 6e 63 65 6d 65 6e 74 73 |and enhancements| 000004c0 20 6e 6f 74 0a 61 76 61 69 6c 61 62 6c 65 20 69 | not.available i| 000004d0 6e 20 70 72 65 76 69 6f 75 73 20 76 65 72 73 69 |n previous versi| 000004e0 6f 6e 73 2e 20 49 66 20 79 6f 75 20 61 6c 72 65 |ons. If you alre| 000004f0 61 64 79 20 68 61 76 65 20 76 65 72 73 69 6f 6e |ady have version| 00000500 20 31 2e 30 34 2c 20 73 65 65 20 74 68 65 0a 66 | 1.04, see the.f| 00000510 69 6c 65 20 43 68 61 6e 67 65 73 20 66 6f 72 20 |ile Changes for | 00000520 64 65 74 61 69 6c 73 20 6f 66 20 69 6d 70 6f 72 |details of impor| 00000530 74 61 6e 74 20 63 68 61 6e 67 65 73 2e 20 49 66 |tant changes. If| 00000540 20 79 6f 75 20 64 6f 6e 27 74 20 77 61 6e 74 20 | you don't want | 00000550 74 6f 20 72 65 61 64 0a 74 68 69 73 20 6d 61 6e |to read.this man| 00000560 75 61 6c 20 79 65 74 20 74 72 79 20 72 65 61 64 |ual yet try read| 00000570 69 6e 67 20 47 65 74 53 74 61 72 74 65 64 20 61 |ing GetStarted a| 00000580 6e 64 20 66 6f 6c 6c 6f 77 69 6e 67 20 69 74 73 |nd following its| 00000590 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 0a 0a | instructions...| 000005a0 4d 6f 64 44 69 73 20 61 20 73 65 6d 69 2d 69 6e |ModDis a semi-in| 000005b0 74 65 6c 6c 69 67 65 6e 74 20 6d 6f 64 75 6c 65 |telligent module| 000005c0 20 64 69 73 61 73 73 65 6d 62 6c 65 72 2e 20 49 | disassembler. I| 000005d0 74 20 77 69 6c 6c 20 72 65 61 64 20 61 20 72 65 |t will read a re| 000005e0 6c 6f 63 61 74 61 62 6c 65 0a 6d 6f 64 75 6c 65 |locatable.module| 000005f0 20 66 69 6c 65 20 66 72 6f 6d 20 74 68 65 20 4f | file from the O| 00000600 52 49 47 49 4e 41 4c 53 20 64 69 72 65 63 74 6f |RIGINALS directo| 00000610 72 79 20 61 6e 64 20 61 74 74 65 6d 70 74 20 74 |ry and attempt t| 00000620 6f 20 64 69 73 61 73 73 65 6d 62 6c 65 20 69 74 |o disassemble it| 00000630 20 69 6e 74 6f 0a 61 20 66 6f 72 6d 20 73 75 69 | into.a form sui| 00000640 74 61 62 6c 65 20 66 6f 72 20 74 68 65 20 42 41 |table for the BA| 00000650 53 49 43 20 61 73 73 65 6d 62 6c 65 72 2e 20 49 |SIC assembler. I| 00000660 66 20 73 75 63 63 65 73 73 66 75 6c 2c 20 74 68 |f successful, th| 00000670 65 20 6f 75 74 70 75 74 20 66 69 6c 65 20 69 73 |e output file is| 00000680 0a 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 53 |.stored in the S| 00000690 4f 55 52 43 45 53 20 64 69 72 65 63 74 6f 72 79 |OURCES directory| 000006a0 2c 20 75 6e 64 65 72 20 74 68 65 20 73 61 6d 65 |, under the same| 000006b0 20 66 69 6c 65 6e 61 6d 65 20 61 73 20 74 68 65 | filename as the| 000006c0 20 6d 6f 64 75 6c 65 2e 20 49 66 2c 0a 61 73 20 | module. If,.as | 000006d0 69 73 20 6c 69 6b 65 6c 79 2c 20 74 68 65 20 70 |is likely, the p| 000006e0 72 6f 67 72 61 6d 20 63 61 6e 6e 6f 74 20 72 65 |rogram cannot re| 000006f0 73 6f 6c 76 65 20 74 68 65 20 64 69 73 61 73 73 |solve the disass| 00000700 65 6d 62 6c 79 20 75 6e 61 69 64 65 64 2c 20 69 |embly unaided, i| 00000710 74 20 77 69 6c 6c 0a 70 72 6f 6d 70 74 20 74 68 |t will.prompt th| 00000720 65 20 75 73 65 72 20 66 6f 72 20 68 65 6c 70 2c |e user for help,| 00000730 20 68 65 6e 63 65 20 74 68 65 20 22 73 65 6d 69 | hence the "semi| 00000740 2d 69 6e 74 65 6c 6c 69 67 65 6e 74 22 20 64 65 |-intelligent" de| 00000750 73 63 72 69 70 74 69 6f 6e 2e 20 54 68 65 73 65 |scription. These| 00000760 0a 72 65 73 70 6f 6e 73 65 73 20 63 61 6e 20 62 |.responses can b| 00000770 65 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 |e stored in the | 00000780 53 43 52 49 50 54 53 20 64 69 72 65 63 74 6f 72 |SCRIPTS director| 00000790 79 20 61 6e 64 20 70 6c 61 79 65 64 20 62 61 63 |y and played bac| 000007a0 6b 20 6c 61 74 65 72 20 74 6f 0a 72 65 2d 63 72 |k later to.re-cr| 000007b0 65 61 74 65 20 74 68 65 20 64 69 73 61 73 73 65 |eate the disasse| 000007c0 6d 62 6c 79 2e 20 54 68 65 20 76 61 6c 69 64 69 |mbly. The validi| 000007d0 74 79 20 6f 66 20 74 68 65 20 64 69 73 61 73 73 |ty of the disass| 000007e0 65 6d 62 6c 79 20 63 61 6e 20 62 65 20 74 65 73 |embly can be tes| 000007f0 74 65 64 20 62 79 0a 72 65 2d 61 73 73 65 6d 62 |ted by.re-assemb| 00000800 6c 69 6e 67 2c 20 77 68 69 63 68 20 6d 61 6b 65 |ling, which make| 00000810 73 20 61 20 6e 65 77 20 76 65 72 73 69 6f 6e 20 |s a new version | 00000820 69 6e 20 74 68 65 20 4d 4f 44 55 4c 45 53 20 64 |in the MODULES d| 00000830 69 72 65 63 74 6f 72 79 2e 20 54 68 65 20 42 41 |irectory. The BA| 00000840 53 49 43 0a 70 72 6f 67 72 61 6d 20 43 68 65 63 |SIC.program Chec| 00000850 6b 65 72 20 63 61 6e 20 74 68 65 6e 20 62 65 20 |ker can then be | 00000860 75 73 65 64 20 74 6f 20 64 6f 20 61 20 62 79 74 |used to do a byt| 00000870 65 2d 62 79 2d 62 79 74 65 20 63 6f 6d 70 61 72 |e-by-byte compar| 00000880 69 73 6f 6e 20 6f 66 20 74 68 65 0a 6f 72 69 67 |ison of the.orig| 00000890 69 6e 61 6c 20 61 6e 64 20 6e 65 77 20 76 65 72 |inal and new ver| 000008a0 73 69 6f 6e 73 2e 0a 0a 49 20 68 61 64 20 61 6c |sions...I had al| 000008b0 72 65 61 64 79 20 64 69 73 61 73 73 65 6d 62 6c |ready disassembl| 000008c0 65 64 20 73 65 76 65 72 61 6c 20 6d 6f 64 75 6c |ed several modul| 000008d0 65 73 20 62 79 20 68 61 6e 64 2c 20 61 6e 64 2c |es by hand, and,| 000008e0 20 77 68 69 6c 65 20 69 74 20 69 73 0a 72 65 6c | while it is.rel| 000008f0 61 74 69 76 65 6c 79 20 65 61 73 79 2c 20 69 74 |atively easy, it| 00000900 20 62 65 63 6f 6d 65 73 20 71 75 69 74 65 20 74 | becomes quite t| 00000910 65 64 69 6f 75 73 20 61 73 20 74 68 65 20 6d 6f |edious as the mo| 00000920 64 75 6c 65 20 73 69 7a 65 20 69 6e 63 72 65 61 |dule size increa| 00000930 73 65 73 2e 20 54 68 69 73 0a 70 72 6f 67 72 61 |ses. This.progra| 00000940 6d 20 73 74 61 72 74 65 64 20 61 73 20 61 20 71 |m started as a q| 00000950 75 69 63 6b 20 75 74 69 6c 69 74 79 20 74 6f 20 |uick utility to | 00000960 64 6f 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 6d |do some of the m| 00000970 65 63 68 61 6e 69 63 61 6c 0a 22 64 6f 6e 6b 65 |echanical."donke| 00000980 79 2d 77 6f 72 6b 22 20 61 73 70 65 63 74 73 20 |y-work" aspects | 00000990 6f 66 20 64 69 73 61 73 73 65 6d 62 6c 79 2c 20 |of disassembly, | 000009a0 62 75 74 20 68 61 73 20 67 72 6f 77 6e 20 6f 75 |but has grown ou| 000009b0 74 20 6f 66 20 61 6c 6c 20 70 72 6f 70 6f 72 74 |t of all proport| 000009c0 69 6f 6e 20 74 6f 0a 69 74 73 20 6f 72 69 67 69 |ion to.its origi| 000009d0 6e 61 6c 20 61 69 6d 73 2e 20 49 20 68 61 76 65 |nal aims. I have| 000009e0 20 73 75 63 63 65 73 73 66 75 6c 6c 79 20 64 69 | successfully di| 000009f0 73 61 73 73 65 6d 62 6c 65 64 20 61 62 6f 75 74 |sassembled about| 00000a00 20 33 30 20 6f 66 20 74 68 65 20 52 49 53 43 20 | 30 of the RISC | 00000a10 4f 53 0a 6d 6f 64 75 6c 65 73 2c 20 61 6e 64 20 |OS.modules, and | 00000a20 74 68 65 72 65 20 61 72 65 20 75 73 75 61 6c 6c |there are usuall| 00000a30 79 20 6f 6e 6c 79 20 61 20 68 61 6e 64 66 75 6c |y only a handful| 00000a40 20 6f 66 20 65 72 72 6f 72 73 20 74 6f 20 73 6f | of errors to so| 00000a50 72 74 20 6f 75 74 20 69 6e 20 74 68 65 0a 6f 75 |rt out in the.ou| 00000a60 74 70 75 74 20 61 73 73 65 6d 62 6c 65 72 20 6c |tput assembler l| 00000a70 69 73 74 69 6e 67 20 28 73 65 65 20 74 68 65 20 |isting (see the | 00000a80 50 72 6f 62 6c 65 6d 73 20 73 65 63 74 69 6f 6e |Problems section| 00000a90 20 66 6f 72 20 64 65 74 61 69 6c 73 29 2e 20 59 | for details). Y| 00000aa0 6f 75 20 73 68 6f 75 6c 64 0a 62 65 20 77 61 72 |ou should.be war| 00000ab0 6e 65 64 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 |ned, however, th| 00000ac0 61 74 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 6c |at some of the l| 00000ad0 61 72 67 65 72 20 52 49 53 43 20 4f 53 20 6d 6f |arger RISC OS mo| 00000ae0 64 75 6c 65 73 20 63 61 6e 20 70 72 6f 64 75 63 |dules can produc| 00000af0 65 0a 74 68 6f 75 73 61 6e 64 73 20 6f 66 20 6c |e.thousands of l| 00000b00 69 6e 65 73 20 6f 66 20 61 73 73 65 6d 62 6c 65 |ines of assemble| 00000b10 72 20 6c 69 73 74 69 6e 67 2e 0a 0a 54 68 65 72 |r listing...Ther| 00000b20 65 20 61 72 65 20 6d 6f 72 65 20 65 6e 68 61 6e |e are more enhan| 00000b30 63 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 70 |cements in the p| 00000b40 69 70 65 6c 69 6e 65 2c 20 62 75 74 20 69 74 20 |ipeline, but it | 00000b50 77 69 6c 6c 20 70 72 6f 62 61 62 6c 79 20 62 65 |will probably be| 00000b60 20 73 6f 6d 65 0a 74 69 6d 65 20 62 65 66 6f 72 | some.time befor| 00000b70 65 20 74 68 65 79 20 62 65 63 6f 6d 65 20 61 76 |e they become av| 00000b80 61 69 6c 61 62 6c 65 2e 0a 0a 49 6e 20 75 73 65 |ailable...In use| 00000b90 0a 3d 3d 3d 3d 3d 3d 0a 53 74 61 72 74 20 62 79 |.======.Start by| 00000ba0 20 6d 61 6b 69 6e 67 20 4d 6f 64 44 69 73 20 79 | making ModDis y| 00000bb0 6f 75 72 20 63 75 72 72 65 6e 74 20 64 69 72 65 |our current dire| 00000bc0 63 74 6f 72 79 2c 20 61 6e 64 20 6c 6f 61 64 20 |ctory, and load | 00000bd0 74 68 65 20 4d 6f 64 44 69 73 32 30 31 0a 70 72 |the ModDis201.pr| 00000be0 6f 67 72 61 6d 2e 20 54 68 65 72 65 20 69 73 20 |ogram. There is | 00000bf0 6f 6e 65 20 66 65 61 74 75 72 65 20 77 68 69 63 |one feature whic| 00000c00 68 20 74 68 65 20 75 73 65 72 20 63 61 6e 20 63 |h the user can c| 00000c10 68 61 6e 67 65 2c 20 6c 6f 63 61 74 65 64 20 69 |hange, located i| 00000c20 6e 0a 50 52 4f 43 69 6e 69 74 2c 20 61 72 6f 75 |n.PROCinit, arou| 00000c30 6e 64 20 6c 69 6e 65 20 38 30 30 30 3a 0a 20 20 |nd line 8000:. | 00000c40 20 20 20 20 20 20 20 20 64 65 62 75 67 25 3d 54 | debug%=T| 00000c50 52 55 45 0a 49 66 20 64 65 62 75 67 25 20 69 73 |RUE.If debug% is| 00000c60 20 54 52 55 45 2c 20 65 78 74 72 61 20 69 6e 66 | TRUE, extra inf| 00000c70 6f 72 6d 61 74 69 6f 6e 20 69 73 20 70 72 69 6e |ormation is prin| 00000c80 74 65 64 20 6f 75 74 20 69 6e 20 63 79 61 6e 20 |ted out in cyan | 00000c90 77 68 69 6c 65 20 74 68 65 0a 70 72 6f 67 72 61 |while the.progra| 00000ca0 6d 20 69 73 20 72 75 6e 6e 69 6e 67 2e 20 49 20 |m is running. I | 00000cb0 66 69 6e 64 20 69 74 20 72 65 61 73 73 75 72 69 |find it reassuri| 00000cc0 6e 67 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f |ng to be able to| 00000cd0 20 73 65 65 20 77 68 61 74 20 74 68 65 20 70 72 | see what the pr| 00000ce0 6f 67 72 61 6d 0a 69 73 20 64 6f 69 6e 67 2e 20 |ogram.is doing. | 00000cf0 53 65 74 74 69 6e 67 20 69 74 20 74 6f 20 46 41 |Setting it to FA| 00000d00 4c 53 45 20 77 69 6c 6c 20 73 75 70 72 65 73 73 |LSE will supress| 00000d10 20 74 68 69 73 20 70 72 69 6e 74 6f 75 74 2c 20 | this printout, | 00000d20 61 6e 64 20 74 68 65 72 65 20 77 69 6c 6c 20 62 |and there will b| 00000d30 65 0a 73 6f 6d 65 74 69 6d 65 73 20 62 65 20 6c |e.sometimes be l| 00000d40 6f 6e 67 20 70 61 75 73 65 73 20 77 68 65 6e 20 |ong pauses when | 00000d50 69 74 20 69 73 20 6e 6f 74 20 6f 62 76 69 6f 75 |it is not obviou| 00000d60 73 20 69 66 20 74 68 65 20 70 72 6f 67 72 61 6d |s if the program| 00000d70 20 69 73 20 64 6f 69 6e 67 0a 61 6e 79 74 68 69 | is doing.anythi| 00000d80 6e 67 2e 0a 0a 48 6f 77 20 74 68 65 20 70 72 6f |ng...How the pro| 00000d90 67 72 61 6d 20 77 6f 72 6b 73 0a 3d 3d 3d 3d 3d |gram works.=====| 00000da0 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |================| 00000db0 0a 54 68 65 20 70 72 6f 67 72 61 6d 20 69 64 65 |.The program ide| 00000dc0 6e 74 69 66 69 65 73 20 74 68 65 20 22 74 79 70 |ntifies the "typ| 00000dd0 65 22 20 6f 66 20 65 61 63 68 20 62 79 74 65 20 |e" of each byte | 00000de0 6f 66 20 74 68 65 20 6d 6f 64 75 6c 65 2c 20 61 |of the module, a| 00000df0 63 63 6f 72 64 69 6e 67 20 74 6f 0a 74 68 65 20 |ccording to.the | 00000e00 66 6f 6c 6c 6f 77 69 6e 67 20 73 63 68 65 6d 65 |following scheme| 00000e10 3a 0a 0a 74 79 70 65 20 20 20 20 20 20 64 65 73 |:..type des| 00000e20 63 72 69 70 74 69 6f 6e 0a 2d 34 20 20 20 20 20 |cription.-4 | 00000e30 20 20 20 27 41 63 6f 72 6e 27 2d 66 6f 72 6d 61 | 'Acorn'-forma| 00000e40 74 20 63 6f 6d 70 72 65 73 73 65 64 20 73 74 72 |t compressed str| 00000e50 69 6e 67 0a 2d 33 20 20 20 20 20 20 20 20 50 61 |ing.-3 Pa| 00000e60 64 64 65 64 20 73 74 72 69 6e 67 2c 20 69 65 20 |dded string, ie | 00000e70 61 20 73 74 72 69 6e 67 20 70 61 64 64 65 64 20 |a string padded | 00000e80 77 69 74 68 20 7a 65 72 6f 73 20 75 70 20 74 6f |with zeros up to| 00000e90 20 61 20 66 69 78 65 64 20 6c 65 6e 67 74 68 0a | a fixed length.| 00000ea0 2d 32 20 20 20 20 20 20 20 20 43 61 72 72 69 61 |-2 Carria| 00000eb0 67 65 2d 72 65 74 75 72 6e 2d 74 65 72 6d 69 6e |ge-return-termin| 00000ec0 61 74 65 64 20 73 74 72 69 6e 67 0a 2d 31 20 20 |ated string.-1 | 00000ed0 20 20 20 20 20 20 5a 65 72 6f 2d 74 65 72 6d 69 | Zero-termi| 00000ee0 6e 61 74 65 64 20 73 74 72 69 6e 67 0a 20 30 20 |nated string. 0 | 00000ef0 20 20 20 20 20 20 20 44 6f 6e 27 74 20 6b 6e 6f | Don't kno| 00000f00 77 0a 20 31 20 20 20 20 20 20 20 20 41 20 62 79 |w. 1 A by| 00000f10 74 65 20 6f 66 20 64 61 74 61 0a 20 32 20 20 20 |te of data. 2 | 00000f20 20 20 20 20 20 41 20 77 6f 72 64 20 28 32 20 62 | A word (2 b| 00000f30 79 74 65 73 20 6f 66 20 64 61 74 61 29 0a 20 33 |ytes of data). 3| 00000f40 20 20 20 20 20 20 20 20 41 64 64 72 65 73 73 2c | Address,| 00000f50 20 69 65 20 61 20 34 2d 62 79 74 65 20 6e 75 6d | ie a 4-byte num| 00000f60 62 65 72 20 70 6f 69 6e 74 69 6e 67 20 74 6f 20 |ber pointing to | 00000f70 61 6e 6f 74 68 65 72 20 70 6f 69 6e 74 20 69 6e |another point in| 00000f80 20 74 68 65 20 6d 6f 64 75 6c 65 0a 20 34 20 20 | the module. 4 | 00000f90 20 20 20 20 20 20 41 20 64 6f 75 62 6c 65 20 77 | A double w| 00000fa0 6f 72 64 20 28 34 20 62 79 74 65 73 20 6f 66 20 |ord (4 bytes of | 00000fb0 64 61 74 61 29 0a 20 35 20 20 20 20 20 20 20 20 |data). 5 | 00000fc0 41 52 4d 20 63 6f 64 65 0a 20 36 20 20 20 20 20 |ARM code. 6 | 00000fd0 20 20 20 41 6c 69 67 6e 6d 65 6e 74 20 62 79 74 | Alignment byt| 00000fe0 65 73 2c 20 31 2c 20 32 20 6f 72 20 33 20 62 79 |es, 1, 2 or 3 by| 00000ff0 74 65 73 20 74 6f 20 62 72 69 6e 67 20 75 73 20 |tes to bring us | 00001000 74 6f 20 61 20 77 6f 72 64 20 62 6f 75 6e 64 61 |to a word bounda| 00001010 72 79 0a 20 37 20 20 20 20 20 20 20 20 45 78 74 |ry. 7 Ext| 00001020 65 72 6e 61 6c 2e 20 53 65 65 20 62 65 6c 6f 77 |ernal. See below| 00001030 0a 0a 54 68 65 20 66 69 72 73 74 20 70 61 73 73 |..The first pass| 00001040 20 74 68 72 6f 75 67 68 20 74 68 65 20 6d 6f 64 | through the mod| 00001050 75 6c 65 20 69 73 20 6d 61 64 65 20 61 72 6d 65 |ule is made arme| 00001060 64 20 77 69 74 68 20 74 68 65 20 65 6e 74 72 79 |d with the entry| 00001070 20 70 6f 69 6e 74 73 2c 20 65 67 0a 69 6e 69 74 | points, eg.init| 00001080 69 61 6c 69 73 61 74 69 6f 6e 20 63 6f 64 65 2c |ialisation code,| 00001090 20 66 69 6e 61 6c 69 73 61 74 69 6f 6e 20 63 6f | finalisation co| 000010a0 64 65 2c 20 65 74 63 2e 20 41 74 20 74 68 69 73 |de, etc. At this| 000010b0 20 73 74 61 67 65 2c 20 4d 6f 64 44 69 73 20 69 | stage, ModDis i| 000010c0 73 20 6a 75 73 74 0a 73 65 74 74 69 6e 67 20 74 |s just.setting t| 000010d0 68 65 20 22 74 79 70 65 22 20 6f 66 20 65 61 63 |he "type" of eac| 000010e0 68 20 62 79 74 65 20 69 74 20 63 6f 6d 65 73 20 |h byte it comes | 000010f0 61 63 72 6f 73 73 2c 20 63 6f 64 65 2c 20 64 61 |across, code, da| 00001100 74 61 20 6f 72 20 77 68 61 74 65 76 65 72 2e 20 |ta or whatever. | 00001110 49 66 0a 69 74 20 66 69 6e 64 73 20 63 6f 64 65 |If.it finds code| 00001120 2c 20 69 74 20 66 6f 6c 6c 6f 77 73 20 69 74 2c |, it follows it,| 00001130 20 61 6e 64 20 69 6e 76 65 73 74 69 67 61 74 65 | and investigate| 00001140 73 20 62 72 61 6e 63 68 65 73 20 61 6e 64 20 73 |s branches and s| 00001150 75 62 72 6f 75 74 69 6e 65 20 63 61 6c 6c 73 0a |ubroutine calls.| 00001160 72 65 63 75 72 73 69 76 65 6c 79 2c 20 61 73 6b |recursively, ask| 00001170 69 6e 67 20 74 68 65 20 75 73 65 72 20 66 6f 72 |ing the user for| 00001180 20 68 65 6c 70 20 77 69 74 68 20 69 64 65 6e 74 | help with ident| 00001190 69 66 79 69 6e 67 20 77 68 61 74 20 69 74 20 68 |ifying what it h| 000011a0 61 73 20 66 6f 75 6e 64 2c 0a 77 68 65 72 65 20 |as found,.where | 000011b0 6e 65 63 65 73 73 61 72 79 2e 20 54 68 65 20 70 |necessary. The p| 000011c0 72 6f 67 72 61 6d 20 69 73 20 73 6d 61 72 74 20 |rogram is smart | 000011d0 65 6e 6f 75 67 68 20 74 6f 20 73 70 6f 74 20 77 |enough to spot w| 000011e0 68 65 6e 20 74 68 65 20 63 6f 64 65 20 65 6e 64 |hen the code end| 000011f0 73 2c 20 73 6f 0a 69 74 20 64 6f 65 73 6e 27 74 |s, so.it doesn't| 00001200 20 22 66 61 6c 6c 20 6f 66 66 22 20 69 6e 74 6f | "fall off" into| 00001210 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 61 74 61 2e | following data.| 00001220 20 49 74 20 61 6c 73 6f 20 72 65 63 6f 67 6e 69 | It also recogni| 00001230 73 65 73 20 73 75 63 68 20 74 68 69 6e 67 73 20 |ses such things | 00001240 61 73 0a 53 57 49 20 22 4f 53 5f 45 78 69 74 22 |as.SWI "OS_Exit"| 00001250 2c 20 74 68 65 20 7a 65 72 6f 2d 74 65 72 6d 69 |, the zero-termi| 00001260 6e 61 74 65 64 20 73 74 72 69 6e 67 20 77 68 69 |nated string whi| 00001270 63 68 20 61 6c 77 61 79 73 20 66 6f 6c 6c 6f 77 |ch always follow| 00001280 73 20 53 57 49 0a 22 4f 53 5f 57 72 69 74 65 53 |s SWI."OS_WriteS| 00001290 22 2c 20 20 61 6e 64 20 73 74 75 66 66 20 6c 69 |", and stuff li| 000012a0 6b 65 20 74 68 61 74 2e 0a 0a 41 66 74 65 72 20 |ke that...After | 000012b0 69 6e 76 65 73 74 69 67 61 74 69 6e 67 20 61 6c |investigating al| 000012c0 6c 20 74 68 65 20 65 6e 74 72 79 20 70 6f 69 6e |l the entry poin| 000012d0 74 73 2c 20 69 74 20 64 6f 65 73 20 6f 6e 65 20 |ts, it does one | 000012e0 73 65 71 75 65 6e 74 69 61 6c 20 70 61 73 73 0a |sequential pass.| 000012f0 74 68 72 6f 75 67 68 20 74 68 65 20 6d 6f 64 75 |through the modu| 00001300 6c 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f |le, searching fo| 00001310 72 20 61 6e 79 20 62 79 74 65 73 20 77 68 6f 73 |r any bytes whos| 00001320 65 20 74 79 70 65 20 68 61 73 20 6e 6f 74 20 79 |e type has not y| 00001330 65 74 20 62 65 65 6e 0a 69 64 65 6e 74 69 66 69 |et been.identifi| 00001340 65 64 2c 20 61 6e 64 20 61 73 6b 69 6e 67 20 74 |ed, and asking t| 00001350 68 65 20 75 73 65 72 20 77 68 61 74 20 74 68 65 |he user what the| 00001360 79 20 61 72 65 2e 0a 0a 4f 6e 63 65 20 61 6c 6c |y are...Once all| 00001370 20 74 68 65 20 74 79 70 65 73 20 68 61 76 65 20 | the types have | 00001380 62 65 65 6e 20 73 6f 72 74 65 64 20 6f 75 74 2c |been sorted out,| 00001390 20 74 68 65 20 64 69 73 61 73 73 65 6d 62 6c 79 | the disassembly| 000013a0 20 70 72 6f 70 65 72 20 73 74 61 72 74 73 2e 20 | proper starts. | 000013b0 49 66 0a 70 61 72 74 73 20 6f 66 20 74 68 65 20 |If.parts of the | 000013c0 6d 6f 64 75 6c 65 20 61 72 65 20 6d 61 72 6b 65 |module are marke| 000013d0 64 20 61 73 20 64 61 74 61 2c 20 74 68 65 79 20 |d as data, they | 000013e0 61 72 65 20 65 78 70 61 6e 64 65 64 20 77 69 74 |are expanded wit| 000013f0 68 20 45 51 55 0a 64 69 72 65 63 74 69 76 65 73 |h EQU.directives| 00001400 2e 20 54 68 65 20 63 6f 64 65 20 69 73 20 64 69 |. The code is di| 00001410 73 61 73 73 65 6d 62 6c 65 64 20 77 69 74 68 20 |sassembled with | 00001420 63 61 6c 6c 73 20 74 6f 20 74 68 65 20 44 65 62 |calls to the Deb| 00001430 75 67 67 65 72 20 6d 6f 64 75 6c 65 2c 20 62 75 |ugger module, bu| 00001440 74 0a 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 |t.the following | 00001450 65 6e 68 61 6e 63 65 6d 65 6e 74 73 20 61 72 65 |enhancements are| 00001460 20 6d 61 64 65 20 74 6f 20 69 74 73 20 6f 75 74 | made to its out| 00001470 70 75 74 3a 0a 0a 31 2e 20 4c 61 62 65 6c 73 20 |put:..1. Labels | 00001480 61 72 65 20 70 6c 61 63 65 64 20 61 74 20 61 6c |are placed at al| 00001490 6c 20 6e 65 63 65 73 73 61 72 79 20 70 6f 69 6e |l necessary poin| 000014a0 74 73 2c 20 61 73 20 2e 78 41 42 43 44 20 77 68 |ts, as .xABCD wh| 000014b0 65 72 65 20 41 42 43 44 20 69 73 20 74 68 65 0a |ere ABCD is the.| 000014c0 20 20 20 6f 66 66 73 65 74 20 69 6e 20 68 65 78 | offset in hex| 000014d0 20 66 72 6f 6d 20 74 68 65 20 6d 6f 64 75 6c 65 | from the module| 000014e0 20 73 74 61 72 74 2e 0a 32 2e 20 57 68 65 72 65 | start..2. Where| 000014f0 76 65 72 20 70 6f 73 73 69 62 6c 65 2c 20 73 65 |ver possible, se| 00001500 6e 73 69 62 6c 65 20 6c 61 62 65 6c 20 6e 61 6d |nsible label nam| 00001510 65 73 20 61 72 65 20 63 6f 6e 73 74 72 75 63 74 |es are construct| 00001520 65 64 2c 20 65 67 20 53 57 49 20 74 61 62 6c 65 |ed, eg SWI table| 00001530 73 2c 0a 20 20 20 4b 65 79 77 6f 72 64 20 63 6f |s,. Keyword co| 00001540 64 65 2c 20 65 74 63 2e 0a 33 2e 20 42 72 61 6e |de, etc..3. Bran| 00001550 63 68 65 73 20 61 72 65 20 65 78 70 61 6e 64 65 |ches are expande| 00001560 64 20 74 6f 20 72 65 66 65 72 20 74 6f 20 6c 61 |d to refer to la| 00001570 62 65 6c 73 2e 0a 34 2e 20 53 75 62 72 6f 75 74 |bels..4. Subrout| 00001580 69 6e 65 73 20 61 72 65 20 69 64 65 6e 74 69 66 |ines are identif| 00001590 69 65 64 20 62 79 20 73 41 42 43 44 2c 20 72 61 |ied by sABCD, ra| 000015a0 74 68 65 72 20 74 68 61 6e 20 78 41 42 43 44 0a |ther than xABCD.| 000015b0 35 2e 20 50 43 2d 72 65 6c 61 74 69 76 65 20 61 |5. PC-relative a| 000015c0 64 64 72 65 73 73 69 6e 67 20 69 73 20 65 78 70 |ddressing is exp| 000015d0 61 6e 64 65 64 20 61 73 20 74 68 65 20 41 44 52 |anded as the ADR| 000015e0 20 6d 61 63 72 6f 2e 0a 36 2e 20 53 57 49 20 6e | macro..6. SWI n| 000015f0 61 6d 65 73 20 61 72 65 20 65 6e 63 6c 6f 73 65 |ames are enclose| 00001600 64 20 69 6e 20 71 75 6f 74 65 73 2e 0a 37 2e 20 |d in quotes..7. | 00001610 54 68 65 20 32 20 69 6e 73 74 72 75 63 74 69 6f |The 2 instructio| 00001620 6e 73 20 6d 61 6b 69 6e 67 20 75 70 20 61 20 27 |ns making up a '| 00001630 6c 6f 6e 67 20 41 44 52 27 20 61 72 65 20 72 65 |long ADR' are re| 00001640 63 6f 67 6e 69 73 65 64 20 61 6e 64 20 72 65 70 |cognised and rep| 00001650 72 65 73 65 6e 74 65 64 0a 20 20 20 62 79 20 61 |resented. by a| 00001660 20 6d 61 63 72 6f 2c 20 46 4e 61 64 72 6c 2c 20 | macro, FNadrl, | 00001670 74 6f 20 61 69 64 20 72 65 61 64 61 62 69 6c 69 |to aid readabili| 00001680 74 79 2e 0a 0a 0a 54 68 65 20 22 57 68 61 74 27 |ty....The "What'| 00001690 73 20 74 68 69 73 3f 22 20 70 72 6f 6d 70 74 0a |s this?" prompt.| 000016a0 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |================| 000016b0 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 44 75 72 69 6e 67 |=========.During| 000016c0 20 74 68 65 20 66 69 72 73 74 20 70 61 73 73 20 | the first pass | 000016d0 74 68 72 6f 75 67 68 20 74 68 65 20 6d 6f 64 75 |through the modu| 000016e0 6c 65 2c 20 74 68 65 20 70 72 6f 67 72 61 6d 20 |le, the program | 000016f0 77 69 6c 6c 20 61 73 6b 20 66 6f 72 20 68 65 6c |will ask for hel| 00001700 70 20 69 66 0a 69 74 20 66 69 6e 64 73 20 61 20 |p if.it finds a | 00001710 72 65 66 65 72 65 6e 63 65 20 74 6f 20 61 6e 6f |reference to ano| 00001720 74 68 65 72 20 70 61 72 74 20 6f 66 20 74 68 65 |ther part of the| 00001730 20 6d 6f 64 75 6c 65 2c 20 61 73 6b 69 6e 67 20 | module, asking | 00001740 77 68 65 74 68 65 72 20 74 68 69 73 0a 72 65 66 |whether this.ref| 00001750 65 72 65 6e 63 65 20 69 73 20 63 6f 64 65 20 74 |erence is code t| 00001760 6f 20 62 65 20 64 69 73 61 73 73 65 6d 62 6c 65 |o be disassemble| 00001770 64 2c 20 6f 72 20 64 61 74 61 2c 20 69 6e 20 77 |d, or data, in w| 00001780 68 69 63 68 20 63 61 73 65 20 69 74 20 77 61 6e |hich case it wan| 00001790 74 73 20 74 6f 0a 6b 6e 6f 77 20 77 68 61 74 20 |ts to.know what | 000017a0 6b 69 6e 64 20 6f 66 20 64 61 74 61 20 69 74 20 |kind of data it | 000017b0 69 73 2e 20 54 68 65 20 64 69 73 70 6c 61 79 20 |is. The display | 000017c0 6c 6f 6f 6b 73 20 6c 69 6b 65 20 74 68 69 73 3a |looks like this:| 000017d0 0a 0a 5b 20 20 20 20 20 20 20 20 20 20 20 20 20 |..[ | 000017e0 20 20 20 20 5d 20 20 20 20 20 20 20 20 54 68 69 | ] Thi| 000017f0 73 20 69 73 20 74 68 65 20 6c 69 6e 65 20 63 75 |s is the line cu| 00001800 72 72 65 6e 74 6c 79 20 62 65 69 6e 67 20 64 69 |rrently being di| 00001810 73 61 73 73 65 6d 62 6c 65 64 0a 5b 20 20 20 20 |sassembled.[ | 00001820 42 6c 6f 63 6b 20 6f 66 20 20 20 20 20 5d 20 20 |Block of ] | 00001830 20 20 20 20 20 20 61 6e 64 20 74 68 65 20 74 68 | and the th| 00001840 72 65 65 20 66 6f 6c 6c 6f 77 69 6e 67 2c 20 74 |ree following, t| 00001850 6f 20 73 68 6f 77 20 74 68 65 20 63 6f 6e 74 65 |o show the conte| 00001860 78 74 2e 0a 5b 20 20 20 79 65 6c 6c 6f 77 20 74 |xt..[ yellow t| 00001870 65 78 74 20 20 20 5d 0a 5b 20 20 20 20 20 20 20 |ext ].[ | 00001880 20 20 20 20 20 20 20 20 20 20 5d 0a 20 20 20 20 | ]. | 00001890 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0a 5b | .[| 000018a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000018b0 20 5d 0a 5b 20 20 20 20 42 6c 6f 63 6b 20 6f 66 | ].[ Block of| 000018c0 20 20 20 20 20 5d 20 20 20 20 20 20 20 20 41 20 | ] A | 000018d0 66 65 77 20 6c 69 6e 65 73 20 70 72 65 63 65 64 |few lines preced| 000018e0 69 6e 67 20 74 68 65 20 72 65 66 65 72 65 6e 63 |ing the referenc| 000018f0 65 0a 5b 20 20 20 20 77 68 69 74 65 20 74 65 78 |e.[ white tex| 00001900 74 20 20 20 5d 0a 5b 20 20 20 20 20 20 20 20 20 |t ].[ | 00001910 20 20 20 20 20 20 20 20 5d 0a 0a 5b 20 20 20 20 | ]..[ | 00001920 20 52 45 44 20 4c 49 4e 45 20 20 20 20 5d 20 20 | RED LINE ] | 00001930 20 20 20 20 20 20 54 68 65 20 61 64 64 72 65 73 | The addres| 00001940 73 20 62 65 69 6e 67 20 72 65 66 65 72 72 65 64 |s being referred| 00001950 20 74 6f 0a 0a 5b 20 20 20 20 20 20 20 20 20 20 | to..[ | 00001960 20 20 20 20 20 20 20 5d 0a 5b 20 20 20 20 20 20 | ].[ | 00001970 4d 6f 72 65 20 20 20 20 20 20 20 5d 20 20 20 20 |More ] | 00001980 20 20 20 20 41 20 66 65 77 20 6c 69 6e 65 73 20 | A few lines | 00001990 61 66 74 65 72 20 74 68 65 20 72 65 66 65 72 65 |after the refere| 000019a0 6e 63 65 0a 5b 20 20 20 20 77 68 69 74 65 20 74 |nce.[ white t| 000019b0 65 78 74 20 20 20 5d 0a 5b 20 20 20 20 20 20 20 |ext ].[ | 000019c0 20 20 20 20 20 20 20 20 20 20 5d 0a 0a 57 68 61 | ]..Wha| 000019d0 74 27 73 20 74 68 69 73 3f 20 20 20 20 20 20 20 |t's this? | 000019e0 20 20 20 20 20 20 20 20 54 68 65 20 70 72 6f 6d | The prom| 000019f0 70 74 0a 0a 54 68 65 20 70 72 6f 67 72 61 6d 20 |pt..The program | 00001a00 65 78 70 65 63 74 73 20 61 20 6e 75 6d 65 72 69 |expects a numeri| 00001a10 63 20 72 65 73 70 6f 6e 73 65 20 69 6e 20 74 68 |c response in th| 00001a20 65 20 72 61 6e 67 65 20 2d 34 20 74 6f 20 37 2e |e range -4 to 7.| 00001a30 0a 0a 49 74 20 73 68 6f 75 6c 64 20 62 65 20 65 |..It should be e| 00001a40 61 73 79 20 74 6f 20 74 65 6c 6c 20 69 66 20 69 |asy to tell if i| 00001a50 74 27 73 20 61 20 73 74 72 69 6e 67 2e 20 4d 6f |t's a string. Mo| 00001a60 73 74 20 73 74 72 69 6e 67 73 20 61 72 65 20 7a |st strings are z| 00001a70 65 72 6f 2d 74 65 72 6d 69 6e 61 74 65 64 0a 28 |ero-terminated.(| 00001a80 74 79 70 65 20 2d 31 29 2c 20 62 75 74 20 4f 53 |type -1), but OS| 00001a90 5f 43 4c 49 20 73 74 72 69 6e 67 73 20 6d 61 79 |_CLI strings may| 00001aa0 20 62 65 20 43 52 2d 74 65 72 6d 69 6e 61 74 65 | be CR-terminate| 00001ab0 64 20 28 2d 32 29 2e 20 52 49 53 43 20 4f 53 20 |d (-2). RISC OS | 00001ac0 6d 65 6e 75 20 6c 61 62 65 6c 73 0a 61 72 65 20 |menu labels.are | 00001ad0 75 73 75 61 6c 6c 79 20 70 61 64 64 65 64 20 77 |usually padded w| 00001ae0 69 74 68 20 7a 65 72 6f 73 20 74 6f 20 31 32 20 |ith zeros to 12 | 00001af0 62 79 74 65 73 3b 20 69 66 20 79 6f 75 20 72 65 |bytes; if you re| 00001b00 70 6c 79 20 2d 33 20 79 6f 75 20 77 69 6c 6c 20 |ply -3 you will | 00001b10 62 65 20 61 73 6b 65 64 0a 66 6f 72 20 74 68 65 |be asked.for the| 00001b20 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 70 | length of the p| 00001b30 61 64 64 65 64 20 73 74 72 69 6e 67 2e 20 27 41 |added string. 'A| 00001b40 63 6f 72 6e 27 2d 66 6f 72 6d 61 74 20 73 74 72 |corn'-format str| 00001b50 69 6e 67 73 20 63 6f 6e 74 61 69 6e 20 41 53 43 |ings contain ASC| 00001b60 49 49 20 32 37 0a 74 6f 20 69 6e 64 69 63 61 74 |II 27.to indicat| 00001b70 65 20 63 6f 6d 70 72 65 73 73 65 64 20 64 69 63 |e compressed dic| 00001b80 74 69 6f 6e 61 72 79 20 65 6e 74 72 69 65 73 3b |tionary entries;| 00001b90 20 61 6c 74 68 6f 75 67 68 20 7a 65 72 6f 2d 74 | although zero-t| 00001ba0 65 72 6d 69 6e 61 74 65 64 20 74 68 65 79 20 6d |erminated they m| 00001bb0 61 79 0a 61 6c 73 6f 20 63 6f 6e 74 61 69 6e 20 |ay.also contain | 00001bc0 41 53 43 49 49 20 30 20 69 6d 6d 65 64 69 61 74 |ASCII 0 immediat| 00001bd0 65 6c 79 20 61 66 74 65 72 20 41 53 43 49 49 20 |ely after ASCII | 00001be0 32 37 2e 0a 0a 54 72 79 20 74 6f 20 61 76 6f 69 |27...Try to avoi| 00001bf0 64 20 72 65 70 6c 79 69 6e 67 20 30 20 28 64 6f |d replying 0 (do| 00001c00 6e 27 74 20 6b 6e 6f 77 29 20 69 66 20 61 74 20 |n't know) if at | 00001c10 61 6c 6c 20 70 6f 73 73 69 62 6c 65 2c 20 62 65 |all possible, be| 00001c20 63 61 75 73 65 20 79 6f 75 27 6c 6c 20 68 61 76 |cause you'll hav| 00001c30 65 0a 74 6f 20 61 6e 73 77 65 72 20 73 6f 6f 6e |e.to answer soon| 00001c40 65 72 20 6f 72 20 6c 61 74 65 72 2c 20 61 6e 64 |er or later, and| 00001c50 20 74 68 69 73 20 6d 61 79 20 62 65 20 79 6f 75 | this may be you| 00001c60 72 20 62 65 73 74 20 6f 70 70 65 72 74 75 6e 69 |r best oppertuni| 00001c70 74 79 2e 20 54 68 65 72 65 20 61 72 65 0a 68 6f |ty. There are.ho| 00001c80 77 65 76 65 72 2c 20 74 77 6f 20 6f 63 63 61 73 |wever, two occas| 00001c90 69 6f 6e 73 20 77 68 65 6e 20 69 74 20 69 73 20 |ions when it is | 00001ca0 75 73 65 66 75 6c 20 74 6f 20 61 6e 73 77 65 72 |useful to answer| 00001cb0 20 30 2e 20 4f 6e 65 20 69 73 20 77 68 65 6e 20 | 0. One is when | 00001cc0 74 68 65 20 6f 66 66 73 65 74 0a 69 6e 20 71 75 |the offset.in qu| 00001cd0 65 73 74 69 6f 6e 20 69 73 20 6f 62 76 69 6f 75 |estion is obviou| 00001ce0 73 6c 79 20 73 6f 6d 65 74 68 69 6e 67 20 6c 69 |sly something li| 00001cf0 6b 65 20 74 68 65 20 6d 6f 64 75 6c 65 27 73 20 |ke the module's | 00001d00 74 69 74 6c 65 20 73 74 72 69 6e 67 2c 20 68 65 |title string, he| 00001d10 6c 70 0a 73 74 72 69 6e 67 2c 20 6f 72 20 73 6f |lp.string, or so| 00001d20 6d 65 20 6f 74 68 65 72 20 6b 6e 6f 77 6e 20 65 |me other known e| 00001d30 6e 74 72 79 20 70 6f 69 6e 74 20 77 68 69 63 68 |ntry point which| 00001d40 20 69 73 20 67 6f 69 6e 67 20 74 6f 20 62 65 20 | is going to be | 00001d50 72 65 63 6f 67 6e 69 73 65 64 20 62 79 0a 74 68 |recognised by.th| 00001d60 65 20 70 72 6f 67 72 61 6d 20 6c 61 74 65 72 20 |e program later | 00001d70 6f 6e 2e 20 49 66 20 79 6f 75 20 69 64 65 6e 74 |on. If you ident| 00001d80 69 66 79 20 74 68 69 73 20 6f 66 66 73 65 74 20 |ify this offset | 00001d90 6e 6f 77 2c 20 69 74 20 6d 61 79 20 6e 6f 74 20 |now, it may not | 00001da0 62 65 20 66 75 6c 6c 79 0a 66 6f 6c 6c 6f 77 65 |be fully.followe| 00001db0 64 2d 75 70 20 62 79 20 74 68 65 20 70 72 6f 67 |d-up by the prog| 00001dc0 72 61 6d 20 6c 61 74 65 72 2e 20 54 68 65 20 6f |ram later. The o| 00001dd0 74 68 65 72 20 63 61 73 65 20 69 73 20 77 68 65 |ther case is whe| 00001de0 6e 20 74 68 65 20 6f 66 66 73 65 74 20 69 73 0a |n the offset is.| 00001df0 70 6f 69 6e 74 69 6e 67 20 74 6f 20 74 68 65 20 |pointing to the | 00001e00 6d 69 64 64 6c 65 20 6f 66 20 61 6e 20 69 6e 73 |middle of an ins| 00001e10 74 72 75 63 74 69 6f 6e 2c 20 73 6f 6d 65 77 68 |truction, somewh| 00001e20 65 72 65 20 77 68 65 72 65 20 61 20 6c 61 62 65 |ere where a labe| 00001e30 6c 20 63 61 6e 6e 6e 6f 74 20 62 65 0a 70 6c 61 |l cannnot be.pla| 00001e40 63 65 64 2e 20 53 65 65 20 27 4f 64 64 20 6c 61 |ced. See 'Odd la| 00001e50 62 65 6c 73 27 20 69 6e 20 74 68 65 20 50 72 6f |bels' in the Pro| 00001e60 62 6c 65 6d 73 20 73 65 63 74 69 6f 6e 20 66 6f |blems section fo| 00001e70 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a |r more details..| 00001e80 0a 42 79 74 65 2c 20 77 6f 72 64 20 61 6e 64 20 |.Byte, word and | 00001e90 61 64 64 72 65 73 73 20 28 31 2c 32 2c 33 29 20 |address (1,2,3) | 00001ea0 61 72 65 20 66 61 69 72 6c 79 20 72 61 72 65 2e |are fairly rare.| 00001eb0 20 4d 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 | Make sure that | 00001ec0 74 68 65 20 72 65 66 65 72 65 6e 63 65 0a 69 73 |the reference.is| 00001ed0 20 77 6f 72 64 2d 61 6c 69 67 6e 65 64 20 62 65 | word-aligned be| 00001ee0 66 6f 72 65 20 72 65 70 6c 79 69 6e 67 20 34 20 |fore replying 4 | 00001ef0 6f 72 20 35 20 28 64 6f 75 62 6c 65 20 6f 72 20 |or 5 (double or | 00001f00 63 6f 64 65 29 3b 20 67 65 74 74 69 6e 67 20 74 |code); getting t| 00001f10 68 69 73 20 77 72 6f 6e 67 0a 77 69 6c 6c 20 61 |his wrong.will a| 00001f20 6c 6d 6f 73 74 20 63 65 72 74 61 69 6e 6c 79 20 |lmost certainly | 00001f30 63 61 75 73 65 20 61 6e 20 65 78 65 63 75 74 69 |cause an executi| 00001f40 6f 6e 20 65 72 72 6f 72 20 6c 61 74 65 72 20 6f |on error later o| 00001f50 6e 2e 20 49 74 20 69 73 20 75 6e 6c 69 6b 65 6c |n. It is unlikel| 00001f60 79 20 74 68 61 74 0a 61 20 72 65 66 65 72 65 6e |y that.a referen| 00001f70 63 65 20 77 69 6c 6c 20 62 65 20 6d 61 64 65 20 |ce will be made | 00001f80 74 6f 20 61 6c 69 67 6e 6d 65 6e 74 20 62 79 74 |to alignment byt| 00001f90 65 73 20 28 36 29 2e 20 53 65 65 20 74 68 65 20 |es (6). See the | 00001fa0 45 78 74 65 72 6e 61 6c 20 73 65 63 74 69 6f 6e |External section| 00001fb0 0a 62 65 6c 6f 77 20 66 6f 72 20 64 65 74 61 69 |.below for detai| 00001fc0 6c 73 20 6f 66 20 74 79 70 65 20 37 2e 0a 0a 54 |ls of type 7...T| 00001fd0 68 65 20 22 62 79 74 65 73 20 6f 66 20 75 6e 6b |he "bytes of unk| 00001fe0 6e 6f 77 6e 20 74 79 70 65 22 20 70 72 6f 6d 70 |nown type" promp| 00001ff0 74 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |t.==============| 00002000 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |================| 00002010 3d 3d 3d 3d 0a 54 68 69 73 20 70 72 6f 6d 70 74 |====.This prompt| 00002020 20 77 69 6c 6c 20 6f 63 63 75 72 20 64 75 72 69 | will occur duri| 00002030 6e 67 20 74 68 65 20 66 69 6e 61 6c 20 73 65 71 |ng the final seq| 00002040 75 65 6e 74 69 61 6c 20 70 61 73 73 20 74 68 72 |uential pass thr| 00002050 6f 75 67 68 20 74 68 65 20 6d 6f 64 75 6c 65 2e |ough the module.| 00002060 0a 54 68 65 20 64 69 73 70 6c 61 79 20 6c 6f 6f |.The display loo| 00002070 6b 73 20 6c 69 6b 65 20 74 68 69 73 3a 0a 0a 5b |ks like this:..[| 00002080 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002090 20 5d 0a 5b 20 20 20 20 42 6c 6f 63 6b 20 6f 66 | ].[ Block of| 000020a0 20 20 20 20 20 5d 20 20 20 20 20 20 20 20 20 20 | ] | 000020b0 20 20 20 20 20 20 41 20 66 65 77 20 6c 69 6e 65 | A few line| 000020c0 73 20 70 72 65 63 65 64 69 6e 67 20 74 68 65 20 |s preceding the | 000020d0 61 64 64 72 65 73 73 0a 5b 20 20 20 20 77 68 69 |address.[ whi| 000020e0 74 65 20 74 65 78 74 20 20 20 5d 0a 5b 20 20 20 |te text ].[ | 000020f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5d 0a | ].| 00002100 0a 5b 20 20 20 20 20 52 45 44 20 4c 49 4e 45 20 |.[ RED LINE | 00002110 20 20 20 5d 20 20 20 20 20 20 20 20 20 20 20 20 | ] | 00002120 20 20 20 20 54 68 65 20 61 64 64 72 65 73 73 20 | The address | 00002130 62 65 69 6e 67 20 72 65 66 65 72 72 65 64 20 74 |being referred t| 00002140 6f 0a 0a 5b 20 20 20 20 20 20 20 20 20 20 20 20 |o..[ | 00002150 20 20 20 20 20 5d 0a 5b 20 20 20 20 20 20 4d 6f | ].[ Mo| 00002160 72 65 20 20 20 20 20 20 20 5d 20 20 20 20 20 20 |re ] | 00002170 20 20 20 20 20 20 20 20 20 20 41 20 66 65 77 20 | A few | 00002180 6c 69 6e 65 73 20 61 66 74 65 72 20 74 68 65 20 |lines after the | 00002190 61 64 64 72 65 73 73 0a 5b 20 20 20 20 77 68 69 |address.[ whi| 000021a0 74 65 20 74 65 78 74 20 20 20 5d 0a 5b 20 20 20 |te text ].[ | 000021b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5d 0a | ].| 000021c0 0a 6e 20 62 79 74 65 28 73 29 20 61 74 20 41 42 |.n byte(s) at AB| 000021d0 43 20 6f 66 20 75 6e 6b 6e 6f 77 6e 20 74 79 70 |C of unknown typ| 000021e0 65 20 20 20 54 68 65 20 70 72 6f 6d 70 74 0a 0a |e The prompt..| 000021f0 54 68 69 73 20 69 73 20 79 6f 75 72 20 6c 61 73 |This is your las| 00002200 74 20 63 68 61 6e 63 65 20 74 6f 20 77 6f 72 6b |t chance to work| 00002210 20 6f 75 74 20 75 6e 72 65 73 6f 6c 76 65 64 20 | out unresolved | 00002220 62 79 74 65 20 74 79 70 65 73 2e 20 4e 6f 74 65 |byte types. Note| 00002230 20 74 68 61 74 20 69 66 0a 6e 20 69 73 20 36 39 | that if.n is 69| 00002240 2c 20 74 68 69 73 20 6d 65 61 6e 73 20 74 68 61 |, this means tha| 00002250 74 20 74 68 65 72 65 20 69 73 20 61 20 62 6c 6f |t there is a blo| 00002260 63 6b 20 6f 66 20 6d 6f 72 65 20 74 68 61 6e 20 |ck of more than | 00002270 36 38 20 62 79 74 65 73 20 77 68 6f 73 65 20 74 |68 bytes whose t| 00002280 79 70 65 73 0a 61 72 65 20 75 6e 6b 6e 6f 77 6e |ypes.are unknown| 00002290 2e 20 54 68 65 20 61 6c 6c 6f 77 65 64 20 72 65 |. The allowed re| 000022a0 73 70 6f 6e 73 65 73 20 61 72 65 20 74 68 65 20 |sponses are the | 000022b0 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 6f 73 65 |similar to those| 000022c0 20 61 62 6f 76 65 2c 20 77 69 74 68 20 74 68 65 | above, with the| 000022d0 0a 66 6f 6c 6c 6f 77 69 6e 67 20 63 68 61 6e 67 |.following chang| 000022e0 65 73 3a 0a 0a 59 6f 75 20 6d 75 73 74 20 4e 4f |es:..You must NO| 000022f0 54 20 72 65 70 6c 79 20 22 64 6f 6e 27 74 20 6b |T reply "don't k| 00002300 6e 6f 77 22 20 28 30 29 20 61 74 20 74 68 69 73 |now" (0) at this| 00002310 20 70 72 6f 6d 70 74 2e 20 49 66 20 79 6f 75 20 | prompt. If you | 00002320 61 6e 73 77 65 72 20 31 2c 32 2c 33 20 6f 72 20 |answer 1,2,3 or | 00002330 34 0a 28 62 79 74 65 2c 20 77 6f 72 64 2c 20 61 |4.(byte, word, a| 00002340 64 64 72 65 73 73 2c 20 64 6f 75 62 6c 65 29 20 |ddress, double) | 00002350 74 68 65 20 70 72 6f 67 72 61 6d 20 77 69 6c 6c |the program will| 00002360 20 61 73 6b 20 79 6f 75 20 68 6f 77 20 6d 61 6e | ask you how man| 00002370 79 20 6f 66 20 74 68 65 73 65 0a 69 74 65 6d 73 |y of these.items| 00002380 20 74 68 65 72 65 20 61 72 65 2e 20 49 66 20 79 | there are. If y| 00002390 6f 75 20 61 6e 73 77 65 72 20 35 20 28 63 6f 64 |ou answer 5 (cod| 000023a0 65 29 2c 20 79 6f 75 20 6d 61 79 20 67 65 74 20 |e), you may get | 000023b0 73 6f 6d 65 20 6d 6f 72 65 20 22 57 68 61 74 27 |some more "What'| 000023c0 73 0a 74 68 69 73 3f 22 20 74 79 70 65 20 70 72 |s.this?" type pr| 000023d0 6f 6d 70 74 73 20 61 73 20 74 68 65 20 70 72 6f |ompts as the pro| 000023e0 67 72 61 6d 20 72 65 2d 65 6e 74 65 72 73 20 69 |gram re-enters i| 000023f0 74 73 20 72 65 63 75 72 73 69 76 65 20 63 6f 64 |ts recursive cod| 00002400 65 2d 66 6f 6c 6c 6f 77 69 6e 67 0a 70 68 61 73 |e-following.phas| 00002410 65 2c 20 62 75 74 20 69 74 20 77 69 6c 6c 20 65 |e, but it will e| 00002420 76 65 6e 74 75 61 6c 6c 79 20 72 65 74 75 72 6e |ventually return| 00002430 20 74 6f 20 77 68 65 72 65 20 69 74 20 6c 65 66 | to where it lef| 00002440 74 20 6f 66 66 2e 20 41 6c 69 67 6e 6d 65 6e 74 |t off. Alignment| 00002450 20 62 79 74 65 73 0a 28 36 29 20 61 72 65 20 65 | bytes.(6) are e| 00002460 61 73 69 6c 79 20 72 65 63 6f 67 6e 69 73 65 64 |asily recognised| 00002470 20 61 73 20 31 2c 20 32 20 6f 72 20 33 20 7a 65 | as 1, 2 or 3 ze| 00002480 72 6f 73 20 61 74 20 74 68 65 20 65 6e 64 20 6f |ros at the end o| 00002490 66 20 61 20 73 74 72 69 6e 67 2c 0a 62 72 69 6e |f a string,.brin| 000024a0 67 69 6e 67 20 69 74 20 74 6f 20 61 20 77 6f 72 |ging it to a wor| 000024b0 64 20 62 6f 75 6e 64 61 72 79 2e 20 53 65 65 20 |d boundary. See | 000024c0 74 68 65 20 45 78 74 65 72 6e 61 6c 20 73 65 63 |the External sec| 000024d0 74 69 6f 6e 20 62 65 6c 6f 77 20 66 6f 72 20 64 |tion below for d| 000024e0 65 74 61 69 6c 73 0a 6f 66 20 74 79 70 65 20 37 |etails.of type 7| 000024f0 2e 0a 0a 49 66 20 79 6f 75 20 63 61 6e 20 73 65 |...If you can se| 00002500 65 20 62 79 20 69 6e 73 70 65 63 74 69 6f 6e 20 |e by inspection | 00002510 74 68 61 74 20 74 68 65 20 62 6c 6f 63 6b 20 6f |that the block o| 00002520 66 20 62 79 74 65 73 20 63 6f 6e 74 61 69 6e 73 |f bytes contains| 00002530 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 0a 22 | more than one."| 00002540 74 79 70 65 22 2c 20 73 69 6d 70 6c 79 20 72 65 |type", simply re| 00002550 70 6c 79 20 77 69 74 68 20 74 68 65 20 74 79 70 |ply with the typ| 00002560 65 20 6e 75 6d 62 65 72 20 6f 66 20 77 68 61 74 |e number of what| 00002570 65 76 65 72 20 63 6f 6d 65 73 20 66 69 72 73 74 |ever comes first| 00002580 2c 20 61 6e 64 20 74 68 65 0a 70 72 6f 67 72 61 |, and the.progra| 00002590 6d 20 77 69 6c 6c 20 72 65 2d 70 72 6f 6d 70 74 |m will re-prompt| 000025a0 20 79 6f 75 20 66 6f 72 20 74 68 65 20 72 65 6d | you for the rem| 000025b0 61 69 6e 64 65 72 2e 0a 20 20 20 20 20 20 20 20 |ainder.. | 000025c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 000025e0 20 20 20 20 0a 0a 54 68 65 20 65 78 74 65 72 6e | ..The extern| 000025f0 61 6c 20 74 79 70 65 20 28 37 29 0a 3d 3d 3d 3d |al type (7).====| 00002600 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |================| 00002610 3d 0a 52 61 74 68 65 72 20 74 68 61 6e 20 6d 61 |=.Rather than ma| 00002620 6b 69 6e 67 20 74 68 65 20 70 72 6f 67 72 61 6d |king the program| 00002630 20 67 65 6e 65 72 61 6c 20 65 6e 6f 75 67 68 20 | general enough | 00002640 74 6f 20 63 6f 70 65 20 77 69 74 68 20 61 6e 79 |to cope with any| 00002650 74 68 69 6e 67 2c 20 49 20 68 61 76 65 0a 61 6c |thing, I have.al| 00002660 6c 6f 77 65 64 20 66 6f 72 20 74 68 65 20 68 65 |lowed for the he| 00002670 61 64 69 6e 67 20 22 6e 6f 6e 65 20 6f 66 20 74 |ading "none of t| 00002680 68 65 20 61 62 6f 76 65 22 20 62 79 20 63 72 65 |he above" by cre| 00002690 61 74 69 6e 67 20 74 79 70 65 20 37 2e 20 49 66 |ating type 7. If| 000026a0 20 79 6f 75 72 0a 6d 6f 64 75 6c 65 20 63 6f 6e | your.module con| 000026b0 74 61 69 6e 73 20 73 6f 6d 65 74 68 69 6e 67 20 |tains something | 000026c0 77 65 69 72 64 2c 20 79 6f 75 20 63 61 6e 20 65 |weird, you can e| 000026d0 64 69 74 20 74 68 65 20 70 72 6f 67 72 61 6d 20 |dit the program | 000026e0 74 6f 20 63 6f 70 65 20 77 69 74 68 20 69 74 2c |to cope with it,| 000026f0 0a 62 79 20 77 72 69 74 69 6e 67 20 79 6f 75 72 |.by writing your| 00002700 20 6f 77 6e 20 50 52 4f 43 65 78 74 65 72 6e 61 | own PROCexterna| 00002710 6c 2c 20 77 68 69 63 68 20 6d 61 72 6b 73 20 74 |l, which marks t| 00002720 68 65 20 77 65 69 72 64 20 62 6c 6f 63 6b 20 61 |he weird block a| 00002730 73 20 74 79 70 65 20 37 2c 0a 61 6e 64 20 50 52 |s type 7,.and PR| 00002740 4f 43 64 69 73 65 78 74 65 72 6e 61 6c 2c 20 77 |OCdisexternal, w| 00002750 68 69 63 68 20 63 6f 70 65 73 20 77 69 74 68 20 |hich copes with | 00002760 74 68 65 20 64 69 73 61 73 73 65 6d 62 6c 79 20 |the disassembly | 00002770 6f 66 20 74 68 65 20 62 6c 6f 63 6b 2e 0a 46 6f |of the block..Fo| 00002780 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 52 |r example, the R| 00002790 49 53 43 20 4f 53 20 44 65 73 6b 74 6f 70 20 6d |ISC OS Desktop m| 000027a0 6f 64 75 6c 65 20 63 6f 6e 74 61 69 6e 73 20 35 |odule contains 5| 000027b0 20 74 65 6d 70 6c 61 74 65 20 66 69 6c 65 73 20 | template files | 000027c0 65 6d 62 65 64 64 65 64 0a 69 6e 20 69 74 20 28 |embedded.in it (| 000027d0 74 68 65 73 65 20 61 70 70 65 61 72 20 75 6e 64 |these appear und| 000027e0 65 72 20 74 68 65 20 44 65 73 6b 46 53 20 66 69 |er the DeskFS fi| 000027f0 6c 69 6e 67 20 73 79 73 74 65 6d 29 2e 20 54 68 |ling system). Th| 00002800 65 20 50 52 4f 43 65 78 74 65 72 6e 61 6c 0a 73 |e PROCexternal.s| 00002810 75 70 70 6c 69 65 64 20 73 69 6d 70 6c 79 20 6d |upplied simply m| 00002820 61 72 6b 73 20 74 68 65 73 65 20 35 20 62 6c 6f |arks these 5 blo| 00002830 63 6b 73 20 61 73 20 74 79 70 65 20 37 20 74 68 |cks as type 7 th| 00002840 72 6f 75 67 68 6f 75 74 2c 20 61 6e 64 0a 50 52 |roughout, and.PR| 00002850 4f 43 64 69 73 65 78 74 65 72 6e 61 6c 20 6c 6f |OCdisexternal lo| 00002860 61 64 73 20 74 68 65 20 66 69 6c 65 73 20 69 6e |ads the files in| 00002870 20 61 6e 64 20 69 6e 63 72 65 6d 65 6e 74 73 20 | and increments | 00002880 74 68 65 20 61 73 73 65 6d 62 6c 65 72 20 63 6f |the assembler co| 00002890 75 6e 74 65 72 73 0a 4f 25 20 61 6e 64 20 50 25 |unters.O% and P%| 000028a0 20 74 6f 20 6a 75 6d 70 20 6f 76 65 72 20 74 68 | to jump over th| 000028b0 65 6d 2e 20 53 6f 6d 65 74 68 69 6e 67 20 73 69 |em. Something si| 000028c0 6d 69 6c 61 72 20 77 6f 75 6c 64 20 62 65 20 6e |milar would be n| 000028d0 65 65 64 65 64 20 66 6f 72 20 74 68 65 20 36 35 |eeded for the 65| 000028e0 30 32 0a 65 6d 75 6c 61 74 6f 72 20 6d 6f 64 75 |02.emulator modu| 000028f0 6c 65 2c 20 77 68 69 63 68 20 63 6f 6e 74 61 69 |le, which contai| 00002900 6e 73 20 65 6d 62 65 64 64 65 64 20 74 68 65 20 |ns embedded the | 00002910 42 41 53 49 43 20 52 4f 4d 20 66 72 6f 6d 20 74 |BASIC ROM from t| 00002920 68 65 20 42 42 43 2e 0a 0a 41 6e 6f 74 68 65 72 |he BBC...Another| 00002930 20 67 6f 6f 64 20 75 73 65 20 66 6f 72 20 50 52 | good use for PR| 00002940 4f 43 65 78 74 65 72 6e 61 6c 20 69 73 20 69 66 |OCexternal is if| 00002950 20 79 6f 75 20 6b 6e 6f 77 20 74 68 61 74 20 74 | you know that t| 00002960 68 65 20 6d 6f 64 75 6c 65 20 63 6f 6e 74 61 69 |he module contai| 00002970 6e 73 20 61 0a 6c 61 72 67 65 20 62 6c 6f 63 6b |ns a.large block| 00002980 20 6f 66 2c 20 73 61 79 2c 20 7a 65 72 6f 2d 74 | of, say, zero-t| 00002990 65 72 6d 69 6e 61 74 65 64 20 73 74 72 69 6e 67 |erminated string| 000029a0 73 2e 20 72 61 74 68 65 72 20 74 68 61 6e 20 69 |s. rather than i| 000029b0 64 65 6e 74 69 66 79 69 6e 67 20 65 61 63 68 0a |dentifying each.| 000029c0 6f 6e 65 20 69 6e 64 69 76 69 64 75 61 6c 6c 79 |one individually| 000029d0 20 61 74 20 72 75 6e 20 74 69 6d 65 2c 20 79 6f | at run time, yo| 000029e0 75 20 63 6f 75 6c 64 20 70 75 74 20 73 6f 6d 65 |u could put some| 000029f0 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 69 73 20 |thing like this | 00002a00 69 6e 0a 50 52 4f 43 65 78 74 65 72 6e 61 6c 3a |in.PROCexternal:| 00002a10 0a 0a 20 20 20 20 46 4f 52 20 6f 66 66 73 65 74 |.. FOR offset| 00002a20 25 3d 26 31 32 33 34 20 54 4f 20 26 32 34 36 38 |%=&1234 TO &2468| 00002a30 0a 20 20 20 20 20 20 74 79 70 65 25 28 6f 66 66 |. type%(off| 00002a40 73 65 74 25 29 3d 2d 31 0a 20 20 20 20 4e 45 58 |set%)=-1. NEX| 00002a50 54 0a 0a 54 68 69 73 20 77 69 6c 6c 20 6d 61 72 |T..This will mar| 00002a60 6b 20 74 68 65 20 62 6c 6f 63 6b 20 65 6e 2d 6d |k the block en-m| 00002a70 61 73 73 65 20 62 65 66 6f 72 65 20 74 68 65 20 |asse before the | 00002a80 70 72 6f 67 72 61 6d 20 70 72 6f 70 65 72 20 73 |program proper s| 00002a90 74 61 72 74 73 2e 0a 0a 43 48 45 43 4b 45 52 0a |tarts...CHECKER.| 00002aa0 3d 3d 3d 3d 3d 3d 3d 0a 54 6f 20 76 65 72 69 66 |=======.To verif| 00002ab0 79 20 74 68 61 74 20 74 68 65 20 64 69 73 61 73 |y that the disas| 00002ac0 73 65 6d 62 6c 79 20 77 6f 72 6b 65 64 2c 20 79 |sembly worked, y| 00002ad0 6f 75 20 63 61 6e 20 72 65 2d 61 73 73 65 6d 62 |ou can re-assemb| 00002ae0 6c 65 20 74 68 65 20 6d 6f 64 75 6c 65 3b 20 74 |le the module; t| 00002af0 68 65 0a 6e 65 77 20 76 65 72 73 69 6f 6e 20 69 |he.new version i| 00002b00 73 20 73 74 6f 72 65 64 20 69 6e 20 64 69 72 65 |s stored in dire| 00002b10 63 74 6f 72 79 20 4d 4f 44 55 4c 45 53 2e 20 54 |ctory MODULES. T| 00002b20 68 65 20 70 72 6f 67 72 61 6d 20 43 68 65 63 6b |he program Check| 00002b30 65 72 20 64 6f 65 73 20 61 0a 62 79 74 65 2d 62 |er does a.byte-b| 00002b40 79 2d 62 79 74 65 20 63 6f 6d 70 61 72 69 73 6f |y-byte compariso| 00002b50 6e 20 6f 66 20 74 68 65 20 6f 72 69 67 69 6e 61 |n of the origina| 00002b60 6c 20 61 6e 64 20 6e 65 77 20 6d 6f 64 75 6c 65 |l and new module| 00002b70 2c 20 72 65 70 6f 72 74 69 6e 67 20 6f 6e 20 61 |, reporting on a| 00002b80 6e 79 0a 64 69 66 66 65 72 65 6e 63 65 73 20 69 |ny.differences i| 00002b90 74 20 66 69 6e 64 73 2c 20 61 73 20 61 20 64 69 |t finds, as a di| 00002ba0 73 61 73 73 65 6d 62 6c 65 64 20 69 6e 73 74 72 |sassembled instr| 00002bb0 75 63 74 69 6f 6e 20 66 72 6f 6d 20 65 61 63 68 |uction from each| 00002bc0 20 76 65 72 73 69 6f 6e 2e 20 41 6e 79 0a 64 69 | version. Any.di| 00002bd0 66 66 65 72 65 6e 63 65 73 20 73 68 6f 75 6c 64 |fferences should| 00002be0 20 62 65 20 75 6e 69 6d 70 6f 72 74 61 6e 74 2c | be unimportant,| 00002bf0 20 61 73 20 6f 75 74 6c 69 6e 65 64 20 69 6e 20 | as outlined in | 00002c00 74 68 65 20 50 72 6f 62 6c 65 6d 73 20 73 65 63 |the Problems sec| 00002c10 74 69 6f 6e 20 62 65 6c 6f 77 2e 0a 0a 0a 50 52 |tion below....PR| 00002c20 4f 42 4c 45 4d 53 0a 3d 3d 3d 3d 3d 3d 3d 3d 0a |OBLEMS.========.| 00002c30 54 68 69 73 20 69 73 20 61 20 6c 69 73 74 20 6f |This is a list o| 00002c40 66 20 6b 6e 6f 77 6e 20 70 72 6f 62 6c 65 6d 20 |f known problem | 00002c50 61 72 65 61 73 20 77 69 74 68 20 4d 6f 64 44 69 |areas with ModDi| 00002c60 73 2e 20 49 6e 20 6d 6f 73 74 20 63 61 73 65 73 |s. In most cases| 00002c70 20 74 68 65 0a 70 72 6f 62 6c 65 6d 73 20 61 72 | the.problems ar| 00002c80 65 20 6f 62 73 63 75 72 65 2c 20 6f 72 20 64 69 |e obscure, or di| 00002c90 66 66 69 63 75 6c 74 20 74 6f 20 63 6f 72 72 65 |fficult to corre| 00002ca0 63 74 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 |ct in the progra| 00002cb0 6d 2c 20 62 75 74 20 65 61 73 79 20 74 6f 0a 73 |m, but easy to.s| 00002cc0 70 6f 74 20 61 6e 64 20 66 69 78 20 69 6e 20 74 |pot and fix in t| 00002cd0 68 65 20 66 69 6e 61 6c 20 61 73 73 65 6d 62 6c |he final assembl| 00002ce0 65 72 20 6c 69 73 74 69 6e 67 2e 0a 0a 49 6d 6d |er listing...Imm| 00002cf0 65 64 69 61 74 65 20 63 6f 6e 73 74 61 6e 74 73 |ediate constants| 00002d00 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |.---------------| 00002d10 2d 2d 2d 2d 0a 41 6e 20 69 6d 6d 65 64 69 61 74 |----.An immediat| 00002d20 65 20 63 6f 6e 73 74 61 6e 74 20 69 73 20 65 78 |e constant is ex| 00002d30 70 72 65 73 73 65 64 20 61 73 20 61 6e 20 38 2d |pressed as an 8-| 00002d40 62 69 74 20 76 61 6c 75 65 20 77 69 74 68 20 61 |bit value with a| 00002d50 20 34 2d 62 69 74 20 72 6f 74 61 74 69 6f 6e 0a | 4-bit rotation.| 00002d60 61 70 70 6c 69 65 64 20 74 6f 20 69 74 2e 20 54 |applied to it. T| 00002d70 68 69 73 20 6d 65 61 6e 73 20 74 68 61 74 20 74 |his means that t| 00002d80 68 65 72 65 20 63 61 6e 20 62 65 20 6d 6f 72 65 |here can be more| 00002d90 20 74 68 61 6e 20 6f 6e 65 20 77 61 79 20 6f 66 | than one way of| 00002da0 20 65 78 70 72 65 73 73 69 6e 67 0a 61 20 63 6f | expressing.a co| 00002db0 6e 73 74 61 6e 74 2c 20 65 67 20 23 31 20 63 61 |nstant, eg #1 ca| 00002dc0 6e 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 |n be represented| 00002dd0 20 61 73 20 23 31 20 77 69 74 68 20 30 20 72 6f | as #1 with 0 ro| 00002de0 74 61 74 69 6f 6e 2c 20 23 34 20 77 69 74 68 20 |tation, #4 with | 00002df0 61 0a 72 6f 74 61 74 69 6f 6e 20 6f 66 20 32 2c |a.rotation of 2,| 00002e00 20 65 74 63 2e 20 54 68 65 20 42 41 53 49 43 20 | etc. The BASIC | 00002e10 61 73 73 65 6d 62 6c 65 72 20 68 69 64 65 73 20 |assembler hides | 00002e20 74 68 69 73 20 70 72 6f 63 65 73 73 20 66 72 6f |this process fro| 00002e30 6d 20 74 68 65 0a 70 72 6f 67 72 61 6d 6d 65 72 |m the.programmer| 00002e40 2c 20 77 68 6f 20 6d 65 72 65 6c 79 20 73 75 70 |, who merely sup| 00002e50 70 6c 69 65 73 20 74 68 65 20 72 65 71 75 69 72 |plies the requir| 00002e60 65 64 20 63 6f 6e 73 74 61 6e 74 20 61 6e 64 20 |ed constant and | 00002e70 6c 65 74 73 20 74 68 65 20 61 73 73 65 6d 62 6c |lets the assembl| 00002e80 65 72 0a 66 69 67 75 72 65 20 6f 75 74 20 68 6f |er.figure out ho| 00002e90 77 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 69 |w to represent i| 00002ea0 74 2e 20 49 66 20 74 68 65 20 6f 72 69 67 69 6e |t. If the origin| 00002eb0 61 6c 20 6d 6f 64 75 6c 65 20 68 61 73 20 23 31 |al module has #1| 00002ec0 20 73 74 6f 72 65 64 20 61 73 0a 34 3e 3e 32 2c | stored as.4>>2,| 00002ed0 20 74 68 65 20 64 69 73 61 73 73 65 6d 62 6c 65 | the disassemble| 00002ee0 72 20 77 69 6c 6c 20 63 6f 6e 76 65 72 74 20 74 |r will convert t| 00002ef0 68 69 73 20 74 6f 20 23 31 2c 20 61 6e 64 20 74 |his to #1, and t| 00002f00 68 65 20 42 41 53 49 43 20 61 73 73 65 6d 62 6c |he BASIC assembl| 00002f10 65 72 20 77 69 6c 6c 0a 72 65 61 73 73 65 6d 62 |er will.reassemb| 00002f20 6c 65 20 69 74 20 61 73 20 31 3e 3e 30 2e 20 54 |le it as 1>>0. T| 00002f30 68 69 73 20 69 73 20 66 75 6e 63 74 69 6f 6e 61 |his is functiona| 00002f40 6c 6c 79 20 69 64 65 6e 74 69 63 61 6c 2c 20 62 |lly identical, b| 00002f50 75 74 20 61 20 62 79 74 65 2d 62 79 2d 62 79 74 |ut a byte-by-byt| 00002f60 65 0a 63 6f 6d 70 61 72 69 73 6f 6e 20 6f 66 20 |e.comparison of | 00002f70 74 68 65 20 74 77 6f 20 6d 6f 64 75 6c 65 73 20 |the two modules | 00002f80 77 69 6c 6c 20 73 68 6f 77 20 61 20 64 69 66 66 |will show a diff| 00002f90 65 72 65 6e 63 65 2e 0a 0a 41 6e 6f 74 68 65 72 |erence...Another| 00002fa0 20 72 65 6c 61 74 65 64 20 70 72 6f 62 6c 65 6d | related problem| 00002fb0 20 69 73 20 74 68 61 74 20 74 68 65 20 70 72 6f | is that the pro| 00002fc0 67 72 61 6d 20 73 6f 6d 65 74 69 6d 65 73 20 66 |gram sometimes f| 00002fd0 61 69 6c 73 20 74 6f 20 65 78 70 61 6e 64 20 74 |ails to expand t| 00002fe0 68 65 0a 63 6f 6e 73 74 61 6e 74 20 61 74 20 61 |he.constant at a| 00002ff0 6c 6c 2c 20 67 69 76 69 6e 67 20 73 6f 6d 65 74 |ll, giving somet| 00003000 68 69 6e 67 20 6c 69 6b 65 20 4d 4f 56 20 52 30 |hing like MOV R0| 00003010 2c 23 30 2c 32 34 2c 20 69 65 20 30 20 72 6f 74 |,#0,24, ie 0 rot| 00003020 61 74 65 64 20 62 79 20 32 34 2c 0a 77 68 69 63 |ated by 24,.whic| 00003030 68 20 69 73 20 73 74 69 6c 6c 20 30 2e 20 54 68 |h is still 0. Th| 00003040 69 73 20 66 6f 72 6d 61 74 2c 20 77 68 69 63 68 |is format, which| 00003050 20 74 68 65 20 70 72 6f 67 72 61 6d 20 67 65 6e | the program gen| 00003060 65 72 61 74 65 73 20 74 68 72 6f 75 67 68 20 74 |erates through t| 00003070 68 65 0a 64 65 62 75 67 67 65 72 20 6d 6f 64 75 |he.debugger modu| 00003080 6c 65 2c 20 69 73 20 6e 6f 74 20 76 61 6c 69 64 |le, is not valid| 00003090 20 66 6f 72 20 74 68 65 20 42 41 53 49 43 20 61 | for the BASIC a| 000030a0 73 73 65 6d 62 6c 65 72 20 61 6e 64 20 73 68 6f |ssembler and sho| 000030b0 75 6c 64 20 62 65 20 72 65 70 6c 61 63 65 64 0a |uld be replaced.| 000030c0 62 79 20 4d 4f 56 20 52 30 2c 23 30 2e 20 53 6f |by MOV R0,#0. So| 000030d0 6d 65 20 6f 66 20 74 68 65 73 65 20 61 72 65 20 |me of these are | 000030e0 64 65 74 65 63 74 65 64 20 61 6e 64 20 74 72 61 |detected and tra| 000030f0 6e 73 6c 61 74 65 64 20 62 79 20 74 68 65 20 74 |nslated by the t| 00003100 68 69 73 20 76 65 72 73 69 6f 6e 0a 6f 66 20 74 |his version.of t| 00003110 68 65 20 70 72 6f 67 72 61 6d 2c 20 62 75 74 20 |he program, but | 00003120 69 74 27 73 20 6e 6f 74 20 66 6f 6f 6c 70 72 6f |it's not foolpro| 00003130 6f 66 2c 20 61 6e 64 20 73 6f 6d 65 20 73 74 69 |of, and some sti| 00003140 6c 6c 20 73 6c 69 70 20 74 68 72 6f 75 67 68 2e |ll slip through.| 00003150 20 54 68 69 73 0a 70 72 6f 62 6c 65 6d 20 69 73 | This.problem is| 00003160 20 63 61 75 73 65 64 20 62 79 20 61 20 62 75 67 | caused by a bug| 00003170 20 69 6e 20 74 68 65 20 44 65 62 75 67 67 65 72 | in the Debugger| 00003180 20 6d 6f 64 75 6c 65 2e 20 54 6f 20 73 6f 6c 76 | module. To solv| 00003190 65 20 69 74 20 70 65 72 6d 61 6e 65 6e 74 6c 79 |e it permanently| 000031a0 2c 0a 79 6f 75 20 6e 65 65 64 20 74 6f 20 6d 6f |,.you need to mo| 000031b0 64 69 66 79 20 74 68 65 20 44 65 62 75 67 67 65 |dify the Debugge| 000031c0 72 20 6d 6f 64 75 6c 65 20 69 74 73 65 6c 66 2c |r module itself,| 000031d0 20 63 68 61 6e 67 69 6e 67 20 6f 66 66 73 65 74 | changing offset| 000031e0 20 26 39 32 30 20 66 72 6f 6d 0a 26 31 41 30 30 | &920 from.&1A00| 000031f0 30 30 32 38 20 20 74 6f 20 26 46 41 30 30 30 30 |0028 to &FA0000| 00003200 32 38 2c 20 65 66 66 65 63 74 69 76 65 6c 79 20 |28, effectively | 00003210 63 68 61 6e 67 69 6e 67 20 61 20 42 4e 45 20 74 |changing a BNE t| 00003220 6f 20 61 20 42 4e 56 2e 20 54 68 69 73 20 73 65 |o a BNV. This se| 00003230 65 6d 73 20 74 6f 0a 73 6f 6c 76 65 20 74 68 65 |ems to.solve the| 00003240 20 70 72 6f 62 6c 65 6d 2c 20 61 6c 74 68 6f 75 | problem, althou| 00003250 67 68 20 49 20 68 61 76 65 6e 27 74 20 74 65 73 |gh I haven't tes| 00003260 74 65 64 20 74 68 69 73 20 66 69 78 20 65 78 68 |ted this fix exh| 00003270 61 75 73 74 69 76 65 6c 79 2c 20 73 6f 0a 70 72 |austively, so.pr| 00003280 6f 63 65 65 64 20 77 69 74 68 20 63 61 75 74 69 |oceed with cauti| 00003290 6f 6e 2e 0a 0a 0a 54 68 65 20 41 44 52 20 64 69 |on....The ADR di| 000032a0 72 65 63 74 69 76 65 0a 2d 2d 2d 2d 2d 2d 2d 2d |rective.--------| 000032b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 41 44 52 20 52 6e |---------.ADR Rn| 000032c0 2c 23 61 64 64 72 65 73 73 20 69 73 20 63 6f 6e |,#address is con| 000032d0 76 65 72 74 65 64 20 62 79 20 74 68 65 20 61 73 |verted by the as| 000032e0 73 65 6d 62 6c 65 72 20 69 6e 74 6f 20 65 69 74 |sembler into eit| 000032f0 68 65 72 20 53 55 42 20 52 6e 2c 50 43 2c 23 6f |her SUB Rn,PC,#o| 00003300 66 66 73 65 74 0a 6f 72 20 41 44 44 20 52 6e 2c |ffset.or ADD Rn,| 00003310 50 43 2c 23 6f 66 66 73 65 74 2c 20 64 65 70 65 |PC,#offset, depe| 00003320 6e 64 69 6e 67 20 6f 6e 20 77 68 65 74 68 65 72 |nding on whether| 00003330 20 74 68 65 20 61 64 64 72 65 73 73 20 63 6f 6d | the address com| 00003340 65 73 20 62 65 66 6f 72 65 20 6f 72 20 61 66 74 |es before or aft| 00003350 65 72 0a 74 68 65 20 63 75 72 72 65 6e 74 20 50 |er.the current P| 00003360 43 20 76 61 6c 75 65 2e 20 41 20 70 72 6f 62 6c |C value. A probl| 00003370 65 6d 20 61 72 69 73 65 73 20 69 6e 20 74 68 61 |em arises in tha| 00003380 74 20 41 44 44 20 52 6e 2c 50 43 2c 23 30 20 69 |t ADD Rn,PC,#0 i| 00003390 73 20 66 75 6e 63 74 69 6f 6e 61 6c 6c 79 0a 69 |s functionally.i| 000033a0 64 65 6e 74 69 63 61 6c 20 74 6f 20 53 55 42 20 |dentical to SUB | 000033b0 52 6e 2c 50 43 2c 23 30 2e 20 54 68 65 20 42 41 |Rn,PC,#0. The BA| 000033c0 53 49 43 20 61 73 73 65 6d 62 6c 65 72 20 61 6c |SIC assembler al| 000033d0 77 61 79 73 20 63 68 6f 6f 73 65 73 20 74 68 65 |ways chooses the| 000033e0 20 66 6f 72 6d 65 72 2c 20 73 6f 0a 69 66 20 74 | former, so.if t| 000033f0 68 65 20 6c 61 74 74 65 72 20 6f 63 63 75 72 73 |he latter occurs| 00003400 20 69 6e 20 61 20 6d 6f 64 75 6c 65 20 69 74 20 | in a module it | 00003410 77 69 6c 6c 20 62 65 20 63 6f 6e 76 65 72 74 65 |will be converte| 00003420 64 20 66 72 6f 6d 20 53 55 42 20 74 6f 20 41 44 |d from SUB to AD| 00003430 44 0a 6c 65 61 64 69 6e 67 20 74 6f 20 61 6e 20 |D.leading to an | 00003440 61 70 70 61 72 65 6e 74 20 64 69 66 66 65 72 65 |apparent differe| 00003450 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 20 |nce between the | 00003460 6d 6f 64 75 6c 65 73 20 77 68 65 6e 20 63 6f 6d |modules when com| 00003470 70 61 72 65 64 0a 62 79 74 65 2d 62 79 2d 62 79 |pared.byte-by-by| 00003480 74 65 2e 20 49 74 20 73 68 6f 75 6c 64 20 68 61 |te. It should ha| 00003490 76 65 20 6e 6f 20 65 66 66 65 63 74 20 6f 6e 20 |ve no effect on | 000034a0 72 75 6e 6e 69 6e 67 20 74 68 65 20 6d 6f 64 75 |running the modu| 000034b0 6c 65 2e 0a 0a 0a 4c 6f 6e 67 20 6c 61 62 65 6c |le....Long label| 000034c0 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 54 68 |s.-----------.Th| 000034d0 65 20 61 73 73 65 6d 62 6c 65 72 20 6d 6e 65 6d |e assembler mnem| 000034e0 6f 6e 69 63 73 20 73 74 61 72 74 20 69 6e 20 63 |onics start in c| 000034f0 6f 6c 75 6d 6e 20 32 30 2c 20 6c 65 61 76 69 6e |olumn 20, leavin| 00003500 67 20 72 6f 6f 6d 20 66 6f 72 20 6c 6f 6e 67 20 |g room for long | 00003510 6c 61 62 65 6c 73 2e 0a 53 6f 6d 65 74 69 6d 65 |labels..Sometime| 00003520 73 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 65 20 |s, however, the | 00003530 6c 61 62 65 6c 73 20 61 72 65 20 74 6f 6f 20 6c |labels are too l| 00003540 6f 6e 67 2c 20 69 6e 20 77 68 69 63 68 20 63 61 |ong, in which ca| 00003550 73 65 20 74 68 65 20 6d 6e 65 6d 6f 6e 69 63 20 |se the mnemonic | 00003560 69 73 0a 6d 6f 76 65 64 20 74 6f 20 74 68 65 20 |is.moved to the | 00003570 6e 65 78 74 20 6c 69 6e 65 2c 20 74 68 69 73 20 |next line, this | 00003580 62 65 69 6e 67 20 73 74 69 6c 6c 20 73 79 6e 74 |being still synt| 00003590 61 63 74 69 63 61 6c 6c 79 20 63 6f 72 72 65 63 |actically correc| 000035a0 74 2e 20 42 75 74 20 69 66 20 74 68 65 0a 6c 61 |t. But if the.la| 000035b0 62 65 6c 20 69 73 20 65 78 61 63 74 6c 79 20 31 |bel is exactly 1| 000035c0 39 20 63 68 61 72 61 63 74 65 72 73 20 6c 6f 6e |9 characters lon| 000035d0 67 20 74 68 65 6e 20 69 74 20 27 74 6f 75 63 68 |g then it 'touch| 000035e0 65 73 27 20 74 68 65 20 6d 6e 65 6d 6f 6e 69 63 |es' the mnemonic| 000035f0 2c 20 61 6e 64 20 42 41 53 49 43 0a 73 65 65 73 |, and BASIC.sees| 00003600 20 74 68 69 73 20 61 73 20 6f 6e 65 20 62 69 67 | this as one big| 00003610 20 6c 61 62 65 6c 20 77 69 74 68 20 61 20 62 61 | label with a ba| 00003620 64 20 6d 6e 65 6d 6f 6e 69 63 20 61 66 74 65 72 |d mnemonic after| 00003630 20 69 74 2e 20 49 74 27 73 20 72 61 72 65 2c 20 | it. It's rare, | 00003640 73 6f 20 66 69 78 20 69 74 0a 6d 61 6e 75 61 6c |so fix it.manual| 00003650 6c 79 20 69 66 20 69 74 20 68 61 70 70 65 6e 73 |ly if it happens| 00003660 2e 0a 0a 54 68 65 20 63 6f 6d 6d 65 6e 74 20 66 |...The comment f| 00003670 69 65 6c 64 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |ield.-----------| 00003680 2d 2d 2d 2d 2d 2d 0a 54 68 65 20 70 72 6f 67 72 |------.The progr| 00003690 61 6d 20 67 65 6e 65 72 61 74 65 73 20 61 20 63 |am generates a c| 000036a0 6f 6d 6d 65 6e 74 20 66 69 65 6c 64 20 77 68 69 |omment field whi| 000036b0 63 68 20 6d 61 79 20 62 65 20 75 73 65 66 75 6c |ch may be useful| 000036c0 2e 20 49 66 2c 20 68 6f 77 65 76 65 72 2c 20 69 |. If, however, i| 000036d0 74 0a 63 6f 6e 74 61 69 6e 73 20 61 20 63 6f 6c |t.contains a col| 000036e0 6f 6e 2c 20 74 68 65 20 42 41 53 49 43 20 61 73 |on, the BASIC as| 000036f0 73 65 6d 62 6c 65 72 20 74 68 69 6e 6b 73 20 74 |sembler thinks t| 00003700 68 69 73 20 69 73 20 61 20 6e 65 77 20 73 74 61 |his is a new sta| 00003710 74 65 6d 65 6e 74 0a 73 74 61 72 74 69 6e 67 2e |tement.starting.| 00003720 20 49 74 27 73 20 72 61 72 65 2c 20 73 6f 20 66 | It's rare, so f| 00003730 69 78 20 69 74 20 6d 61 6e 75 61 6c 6c 79 2e 20 |ix it manually. | 00003740 49 20 61 6c 73 6f 20 68 61 64 20 61 20 63 61 73 |I also had a cas| 00003750 65 20 6f 6e 63 65 20 77 68 65 6e 20 74 68 65 0a |e once when the.| 00003760 63 6f 6d 6d 65 6e 74 20 66 69 65 6c 64 20 63 6f |comment field co| 00003770 6e 74 61 69 6e 65 64 20 74 68 65 20 63 68 61 72 |ntained the char| 00003780 61 63 74 65 72 20 26 38 44 2c 20 77 68 69 63 68 |acter &8D, which| 00003790 20 42 41 53 49 43 20 74 72 69 65 64 20 74 6f 20 | BASIC tried to | 000037a0 74 6f 6b 65 6e 69 73 65 2e 20 49 0a 64 69 64 20 |tokenise. I.did | 000037b0 63 6f 6e 73 69 64 65 72 20 72 65 6d 6f 76 69 6e |consider removin| 000037c0 67 20 74 68 65 20 63 6f 6d 6d 65 6e 72 20 66 69 |g the commenr fi| 000037d0 65 6c 64 20 61 6c 74 6f 67 65 74 68 65 72 2c 20 |eld altogether, | 000037e0 61 73 20 74 68 65 20 73 69 6d 70 6c 65 73 74 20 |as the simplest | 000037f0 77 61 79 20 6f 66 0a 73 6f 6c 76 69 6e 67 20 74 |way of.solving t| 00003800 68 65 73 65 20 70 72 6f 62 6c 65 6d 73 2c 20 62 |hese problems, b| 00003810 75 74 20 6f 76 65 72 61 6c 6c 20 69 74 27 73 20 |ut overall it's | 00003820 74 6f 6f 20 75 73 65 66 75 6c 20 74 6f 20 6c 6f |too useful to lo| 00003830 73 65 2c 20 64 65 73 70 69 74 65 20 69 74 73 0a |se, despite its.| 00003840 70 72 6f 62 6c 65 6d 73 2e 0a 0a 53 57 49 20 62 |problems...SWI b| 00003850 72 61 6e 63 68 20 74 61 62 6c 65 0a 2d 2d 2d 2d |ranch table.----| 00003860 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 54 68 65 |------------.The| 00003870 20 70 72 6f 67 72 61 6d 20 61 74 74 65 6d 70 74 | program attempt| 00003880 73 20 74 6f 20 6d 61 74 63 68 20 74 68 65 20 53 |s to match the S| 00003890 57 49 20 6e 61 6d 65 73 20 74 6f 20 74 68 65 20 |WI names to the | 000038a0 53 57 49 20 62 72 61 6e 63 68 20 74 61 62 6c 65 |SWI branch table| 000038b0 2c 20 62 75 74 20 69 74 0a 73 6f 6d 65 74 69 6d |, but it.sometim| 000038c0 65 73 20 66 61 69 6c 73 20 74 6f 20 69 64 65 6e |es fails to iden| 000038d0 74 69 66 79 20 74 68 65 20 62 72 61 6e 63 68 20 |tify the branch | 000038e0 74 61 62 6c 65 20 61 73 20 62 65 6c 6f 6e 67 69 |table as belongi| 000038f0 6e 67 20 74 6f 20 74 68 65 20 53 57 49 0a 72 6f |ng to the SWI.ro| 00003900 75 74 69 6e 65 2e 20 49 6e 20 74 68 69 73 20 63 |utine. In this c| 00003910 61 73 65 20 69 74 20 73 75 62 73 74 69 74 75 74 |ase it substitut| 00003920 65 73 20 6c 61 62 65 6c 73 20 6f 66 20 74 68 65 |es labels of the| 00003930 20 74 79 70 65 20 78 41 42 43 44 2c 20 73 6f 20 | type xABCD, so | 00003940 74 68 65 0a 61 73 73 65 6d 62 6c 79 20 69 73 20 |the.assembly is | 00003950 73 74 69 6c 6c 20 73 79 6e 74 61 63 74 69 63 61 |still syntactica| 00003960 6c 6c 79 20 63 6f 72 72 65 63 74 20 28 61 6e 64 |lly correct (and| 00003970 20 6c 6f 67 69 63 61 6c 6c 79 29 20 63 6f 72 72 | logically) corr| 00003980 65 63 74 2e 20 49 20 74 68 69 6e 6b 0a 74 68 69 |ect. I think.thi| 00003990 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 6f 73 |s is one of thos| 000039a0 65 20 74 68 69 6e 67 73 20 79 6f 75 27 72 65 20 |e things you're | 000039b0 67 6f 69 6e 67 20 74 6f 20 68 61 76 65 20 74 6f |going to have to| 000039c0 20 6c 69 76 65 20 77 69 74 68 2e 0a 0a 45 6d 62 | live with...Emb| 000039d0 65 64 64 65 64 20 74 65 78 74 0a 2d 2d 2d 2d 2d |edded text.-----| 000039e0 2d 2d 2d 2d 2d 2d 2d 2d 0a 53 6f 6d 65 74 68 69 |--------.Somethi| 000039f0 6e 67 20 74 68 61 74 20 63 72 6f 70 70 65 64 20 |ng that cropped | 00003a00 75 70 20 69 6e 20 74 68 65 20 4e 65 74 50 72 69 |up in the NetPri| 00003a10 6e 74 20 6d 6f 64 75 6c 65 20 77 61 73 20 6c 69 |nt module was li| 00003a20 6b 65 20 74 68 69 73 3a 0a 20 20 20 20 20 20 20 |ke this:. | 00003a30 20 20 20 42 4c 20 20 20 20 73 31 32 33 34 0a 20 | BL s1234. | 00003a40 20 20 20 20 20 20 20 20 20 45 51 55 53 20 20 22 | EQUS "| 00003a50 41 20 6d 65 73 73 61 67 65 22 0a 20 20 20 20 20 |A message". | 00003a60 20 20 20 20 20 4d 6f 72 65 20 63 6f 64 65 2e 2e | More code..| 00003a70 2e 0a 77 68 65 72 65 20 74 68 65 20 73 75 62 72 |..where the subr| 00003a80 6f 75 74 69 6e 65 20 61 74 20 73 31 32 33 34 20 |outine at s1234 | 00003a90 61 64 6a 75 73 74 73 20 74 68 65 20 72 65 74 75 |adjusts the retu| 00003aa0 72 6e 20 61 64 64 72 65 73 73 20 74 6f 20 73 6b |rn address to sk| 00003ab0 69 70 20 74 68 65 20 73 74 72 69 6e 67 2e 0a 57 |ip the string..W| 00003ac0 68 69 6c 65 20 4d 6f 64 44 69 73 20 72 65 63 6f |hile ModDis reco| 00003ad0 67 6e 69 73 65 73 20 74 68 69 73 20 69 66 20 75 |gnises this if u| 00003ae0 73 65 64 20 77 69 74 68 20 53 57 49 20 22 4f 53 |sed with SWI "OS| 00003af0 5f 57 72 69 74 65 53 22 2c 20 69 74 20 63 61 6e |_WriteS", it can| 00003b00 6e 6f 74 20 63 68 65 63 6b 0a 66 6f 72 20 61 20 |not check.for a | 00003b10 75 73 65 72 20 72 6f 75 74 69 6e 65 20 77 68 69 |user routine whi| 00003b20 63 68 20 64 6f 65 73 20 74 68 65 20 73 61 6d 65 |ch does the same| 00003b30 2e 20 4d 6f 64 44 69 73 20 77 69 6c 6c 20 74 72 |. ModDis will tr| 00003b40 79 20 74 6f 20 69 6e 74 65 72 70 72 65 74 20 74 |y to interpret t| 00003b50 68 65 0a 73 74 72 69 6e 67 20 61 73 20 63 6f 64 |he.string as cod| 00003b60 65 2c 20 67 69 76 69 6e 67 20 61 20 77 61 72 6e |e, giving a warn| 00003b70 69 6e 67 20 6d 65 73 73 61 67 65 20 69 66 20 74 |ing message if t| 00003b80 68 69 73 20 69 73 20 6e 6f 74 20 70 6f 73 73 69 |his is not possi| 00003b90 62 6c 65 2e 20 49 74 27 73 20 75 70 20 74 6f 0a |ble. It's up to.| 00003ba0 79 6f 75 20 74 6f 20 62 65 20 61 77 61 72 65 20 |you to be aware | 00003bb0 6f 66 20 74 68 69 73 20 70 69 74 66 61 6c 6c 20 |of this pitfall | 00003bc0 61 6e 64 20 77 61 74 63 68 20 6f 75 74 20 66 6f |and watch out fo| 00003bd0 72 20 69 74 2e 0a 0a 46 6c 6f 61 74 69 6e 67 20 |r it...Floating | 00003be0 70 6f 69 6e 74 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |point.----------| 00003bf0 2d 2d 2d 2d 0a 41 6c 74 68 6f 75 67 68 20 4d 6f |----.Although Mo| 00003c00 64 44 69 73 20 63 6f 75 6c 64 20 64 69 73 61 73 |dDis could disas| 00003c10 73 65 6d 62 6c 65 20 69 6e 73 74 72 75 63 74 69 |semble instructi| 00003c20 6f 6e 73 20 69 6e 74 65 6e 64 65 64 20 66 6f 72 |ons intended for| 00003c30 20 74 68 65 20 46 50 55 2c 20 69 6e 0a 70 72 61 | the FPU, in.pra| 00003c40 63 74 69 63 65 20 74 68 65 72 65 20 69 73 6e 27 |ctice there isn'| 00003c50 74 20 6d 75 63 68 20 70 6f 69 6e 74 2c 20 73 69 |t much point, si| 00003c60 6e 63 65 20 74 68 65 20 42 41 53 49 43 20 61 73 |nce the BASIC as| 00003c70 73 65 6d 62 6c 65 72 20 64 6f 65 73 6e 27 74 20 |sembler doesn't | 00003c80 72 65 63 6f 67 6e 69 73 65 0a 74 68 65 6d 2c 20 |recognise.them, | 00003c90 73 6f 20 79 6f 75 20 63 6f 75 6c 64 20 6e 6f 74 |so you could not| 00003ca0 20 72 65 2d 61 73 73 65 6d 62 6c 65 20 74 68 65 | re-assemble the| 00003cb0 20 6d 6f 64 75 6c 65 2e 20 49 6e 73 74 65 61 64 | module. Instead| 00003cc0 2c 20 69 74 20 61 73 73 75 6d 65 73 20 74 68 61 |, it assumes tha| 00003cd0 74 20 61 6e 79 0a 46 50 55 20 69 6e 73 74 72 75 |t any.FPU instru| 00003ce0 63 74 69 6f 6e 20 69 74 20 63 6f 6d 65 73 20 61 |ction it comes a| 00003cf0 63 72 6f 73 73 20 69 73 20 61 20 6d 69 73 74 61 |cross is a mista| 00003d00 6b 65 20 63 61 75 73 65 64 20 62 79 20 61 6e 20 |ke caused by an | 00003d10 69 6e 63 6f 72 72 65 63 74 20 75 73 65 72 0a 72 |incorrect user.r| 00003d20 65 73 70 6f 6e 73 65 2c 20 61 6e 64 20 67 69 76 |esponse, and giv| 00003d30 65 73 20 61 20 77 61 72 6e 69 6e 67 20 6d 65 73 |es a warning mes| 00003d40 73 61 67 65 2e 20 49 20 6d 61 79 20 64 6f 20 73 |sage. I may do s| 00003d50 6f 6d 65 74 68 69 6e 67 20 61 62 6f 75 74 20 46 |omething about F| 00003d60 50 55 20 61 74 20 73 6f 6d 65 0a 74 69 6d 65 2c |PU at some.time,| 00003d70 20 62 75 74 20 69 74 27 73 20 61 20 6c 6f 77 20 | but it's a low | 00003d80 70 72 69 6f 72 69 74 79 2e 20 49 6e 20 74 68 65 |priority. In the| 00003d90 20 6d 65 61 6e 74 69 6d 65 2c 20 69 66 20 79 6f | meantime, if yo| 00003da0 75 20 77 61 6e 74 20 74 6f 20 64 69 73 61 73 73 |u want to disass| 00003db0 65 6d 62 6c 65 20 61 0a 6d 6f 64 75 6c 65 20 77 |emble a.module w| 00003dc0 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 20 73 6f |hich contains so| 00003dd0 6d 65 20 46 50 55 20 69 6e 73 74 72 75 63 74 69 |me FPU instructi| 00003de0 6f 6e 73 2c 20 79 6f 75 20 77 69 6c 6c 20 68 61 |ons, you will ha| 00003df0 76 65 20 74 6f 20 6d 61 72 6b 20 74 68 65 6d 20 |ve to mark them | 00003e00 61 73 0a 77 6f 72 64 73 20 28 34 2d 62 79 74 65 |as.words (4-byte| 00003e10 20 64 61 74 61 29 2e 0a 0a 4f 64 64 20 6c 61 62 | data)...Odd lab| 00003e20 65 6c 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 53 |els.----------.S| 00003e30 6f 6d 65 74 69 6d 65 73 20 61 20 72 65 66 65 72 |ometimes a refer| 00003e40 65 6e 63 65 20 69 73 20 6d 61 64 65 20 74 6f 2c |ence is made to,| 00003e50 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 | for example, th| 00003e60 65 20 62 79 74 65 20 42 45 46 4f 52 45 20 61 20 |e byte BEFORE a | 00003e70 62 6c 6f 63 6b 20 6f 66 0a 64 61 74 61 2c 20 74 |block of.data, t| 00003e80 68 65 20 70 6f 69 6e 74 65 72 20 62 65 69 6e 67 |he pointer being| 00003e90 20 69 6e 63 72 65 6d 65 6e 74 65 64 20 62 65 66 | incremented bef| 00003ea0 6f 72 65 20 75 73 65 2e 20 53 6f 6d 65 74 68 69 |ore use. Somethi| 00003eb0 6e 67 20 6c 69 6b 65 3a 0a 20 20 20 20 20 20 20 |ng like:. | 00003ec0 20 20 20 41 44 52 20 20 20 78 46 36 46 0a 20 20 | ADR xF6F. | 00003ed0 20 20 20 20 20 20 20 20 2e 2e 2e 2e 2e 2e 2e 2e | ........| 00003ee0 0a 20 20 20 20 20 20 20 20 20 20 4d 4f 56 20 20 |. MOV | 00003ef0 20 50 43 2c 52 31 34 0a 2e 78 46 37 30 20 20 20 | PC,R14..xF70 | 00003f00 20 20 45 51 55 53 20 20 22 2e 2e 2e 2e 22 0a 49 | EQUS "....".I| 00003f10 74 20 69 73 20 6e 6f 74 20 70 6f 73 73 69 62 6c |t is not possibl| 00003f20 65 20 74 6f 20 70 6c 61 63 65 20 61 20 6c 61 62 |e to place a lab| 00003f30 65 6c 20 61 74 20 26 46 36 46 2c 20 73 69 6e 63 |el at &F6F, sinc| 00003f40 65 20 69 74 20 6c 69 65 73 20 69 6e 20 74 68 65 |e it lies in the| 00003f50 20 6d 69 64 64 6c 65 20 6f 66 0a 61 6e 20 69 6e | middle of.an in| 00003f60 73 74 72 75 63 74 69 6f 6e 2e 20 49 6e 73 74 65 |struction. Inste| 00003f70 61 64 2c 20 79 6f 75 20 73 68 6f 75 6c 64 20 6d |ad, you should m| 00003f80 61 6e 75 61 6c 6c 79 20 73 75 62 73 74 69 74 75 |anually substitu| 00003f90 74 65 20 73 6f 6d 65 74 68 69 6e 67 20 6c 69 6b |te something lik| 00003fa0 65 20 74 68 69 73 3a 0a 20 20 20 20 20 20 20 20 |e this:. | 00003fb0 20 20 41 44 52 20 20 20 78 46 37 30 2d 31 0a 54 | ADR xF70-1.T| 00003fc0 68 69 73 20 73 6f 72 74 20 6f 66 20 74 68 69 6e |his sort of thin| 00003fd0 67 20 69 73 20 75 73 75 61 6c 6c 79 20 66 61 69 |g is usually fai| 00003fe0 72 6c 79 20 65 61 73 79 20 74 6f 20 73 70 6f 74 |rly easy to spot| 00003ff0 2e 0a 0a 41 4c 49 47 4e 0a 2d 2d 2d 2d 2d 0a 57 |...ALIGN.-----.W| 00004000 68 65 6e 20 61 73 73 65 6d 62 6c 69 6e 67 20 61 |hen assembling a| 00004010 20 6d 6f 64 75 6c 65 2c 20 74 68 65 20 41 4c 49 | module, the ALI| 00004020 47 4e 20 64 69 72 65 63 74 69 76 65 20 69 73 20 |GN directive is | 00004030 75 73 65 64 20 74 6f 20 6d 6f 76 65 20 74 6f 20 |used to move to | 00004040 61 20 77 6f 72 64 0a 62 6f 75 6e 64 61 72 79 2c |a word.boundary,| 00004050 20 73 69 6d 70 6c 79 20 69 6e 63 72 65 6d 65 6e | simply incremen| 00004060 74 69 6e 67 20 74 68 65 20 70 6f 69 6e 74 65 72 |ting the pointer| 00004070 20 62 79 20 31 2c 20 32 20 6f 72 20 33 2e 20 54 | by 1, 2 or 3. T| 00004080 68 65 20 62 79 74 65 73 20 22 73 6b 69 70 70 65 |he bytes "skippe| 00004090 64 22 0a 6c 69 6b 65 20 74 68 69 73 20 61 72 65 |d".like this are| 000040a0 20 6e 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 20 | not explicitly | 000040b0 73 65 74 20 74 6f 20 7a 65 72 6f 2c 20 61 6e 64 |set to zero, and| 000040c0 20 77 69 6c 6c 20 63 6f 6e 74 61 69 6e 20 77 68 | will contain wh| 000040d0 61 74 65 76 65 72 20 77 61 73 0a 74 68 65 72 65 |atever was.there| 000040e0 20 61 74 20 74 68 65 20 74 69 6d 65 20 74 68 65 | at the time the| 000040f0 20 6d 6f 64 75 6c 65 20 77 61 73 20 6f 72 69 67 | module was orig| 00004100 69 6e 61 6c 6c 79 20 63 6f 6d 70 69 6c 65 64 2e |inally compiled.| 00004110 20 57 68 65 6e 20 72 65 63 6f 6d 70 69 6c 69 6e | When recompilin| 00004120 67 20 61 66 74 65 72 0a 72 75 6e 6e 69 6e 67 20 |g after.running | 00004130 4d 6f 64 44 69 73 2c 20 74 68 65 73 65 20 27 73 |ModDis, these 's| 00004140 6b 69 70 70 65 64 22 20 62 79 74 65 73 20 6d 61 |kipped" bytes ma| 00004150 79 20 77 65 6c 6c 20 68 61 76 65 20 64 69 66 66 |y well have diff| 00004160 65 72 65 6e 74 20 76 61 6c 75 65 73 2c 20 61 6e |erent values, an| 00004170 64 20 74 68 65 0a 43 68 65 63 6b 65 72 20 70 72 |d the.Checker pr| 00004180 6f 67 72 61 6d 20 77 69 6c 6c 20 64 65 74 65 63 |ogram will detec| 00004190 74 20 74 68 69 73 2c 20 62 75 74 20 73 69 6e 63 |t this, but sinc| 000041a0 65 20 74 68 65 79 20 70 6c 61 79 20 6e 6f 20 70 |e they play no p| 000041b0 61 72 74 20 69 6e 20 74 68 65 20 6d 6f 64 75 6c |art in the modul| 000041c0 65 2c 0a 74 68 65 79 20 61 72 65 20 75 6e 69 6d |e,.they are unim| 000041d0 70 6f 72 74 61 6e 74 2e 0a 0a 0a 54 48 45 20 45 |portant....THE E| 000041e0 4e 44 0a 3d 3d 3d 3d 3d 3d 3d 0a 0a 4d 79 20 74 |ND.=======..My t| 000041f0 68 61 6e 6b 73 20 74 6f 20 74 68 6f 73 65 20 75 |hanks to those u| 00004200 73 65 72 73 20 77 68 6f 20 72 65 70 6f 72 74 65 |sers who reporte| 00004210 64 20 62 75 67 73 20 69 6e 20 74 68 65 20 70 72 |d bugs in the pr| 00004220 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 20 |evious versions | 00004230 6f 66 0a 4d 6f 64 44 69 73 2c 20 61 6e 64 20 74 |of.ModDis, and t| 00004240 6f 20 74 68 6f 73 65 20 77 68 6f 20 6d 61 64 65 |o those who made| 00004250 20 73 75 67 67 65 73 74 69 6f 6e 73 20 6f 6e 20 | suggestions on | 00004260 69 6d 70 72 6f 76 69 6e 67 20 69 74 2e 20 49 66 |improving it. If| 00004270 20 79 6f 75 20 68 61 76 65 20 61 6e 79 0a 70 72 | you have any.pr| 00004280 6f 62 6c 65 6d 73 20 6f 72 20 28 63 6f 6e 73 74 |oblems or (const| 00004290 72 75 63 74 69 76 65 29 20 63 6f 6d 6d 65 6e 74 |ructive) comment| 000042a0 73 20 61 62 6f 75 74 20 4d 6f 64 44 69 73 2c 20 |s about ModDis, | 000042b0 70 6c 65 61 73 65 20 67 65 74 20 69 6e 20 74 6f |please get in to| 000042c0 75 63 68 20 77 69 74 68 0a 6d 65 2e 20 49 66 20 |uch with.me. If | 000042d0 79 6f 75 20 68 61 76 65 20 61 6e 79 20 69 64 65 |you have any ide| 000042e0 61 73 20 66 6f 72 20 69 6d 70 72 6f 76 69 6e 67 |as for improving| 000042f0 20 69 74 2c 20 6f 72 20 69 66 20 79 6f 75 20 65 | it, or if you e| 00004300 78 74 65 6e 64 20 69 74 20 79 6f 75 72 73 65 6c |xtend it yoursel| 00004310 66 2c 0a 49 27 64 20 62 65 20 76 65 72 79 20 67 |f,.I'd be very g| 00004320 6c 61 64 20 74 6f 20 68 65 61 72 20 66 72 6f 6d |lad to hear from| 00004330 20 79 6f 75 2e 0a 0a 4c 6f 72 63 61 6e 20 4d 6f | you...Lorcan Mo| 00004340 6e 67 65 79 0a 35 36 20 53 61 6c 69 73 62 75 72 |ngey.56 Salisbur| 00004350 79 20 43 6f 75 72 74 0a 44 75 62 6c 69 6e 20 52 |y Court.Dublin R| 00004360 6f 61 64 0a 42 65 6c 66 61 73 74 20 42 54 37 20 |oad.Belfast BT7 | 00004370 31 44 44 0a 54 65 6c 3a 20 30 32 33 32 20 32 33 |1DD.Tel: 0232 23| 00004380 34 33 38 36 0a 0a 49 20 63 61 6e 20 61 6c 73 6f |4386..I can also| 00004390 20 62 65 20 72 65 61 63 68 65 64 20 61 74 20 74 | be reached at t| 000043a0 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 42 42 53 |he following BBS| 000043b0 3a 0a 0a 42 42 53 20 20 20 20 20 20 20 20 20 20 |:..BBS | 000043c0 20 20 20 20 20 20 20 20 20 20 54 65 6c 65 70 68 | Teleph| 000043d0 6f 6e 65 20 20 20 20 20 20 55 73 65 72 6e 61 6d |one Usernam| 000043e0 65 20 20 20 20 20 20 20 20 20 4e 75 6d 62 65 72 |e Number| 000043f0 0a 2d 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 |.--- | 00004400 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d | --------| 00004410 2d 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 20 |- -------- | 00004420 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 0a 43 | ------.C| 00004430 49 58 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |IX | 00004440 20 20 20 20 20 20 30 38 31 20 33 39 30 20 31 32 | 081 390 12| 00004450 34 34 20 20 20 6c 6f 72 63 61 6e 40 63 69 78 2e |44 lorcan@cix.| 00004460 75 75 63 70 20 20 0a 54 68 65 20 57 6f 72 6c 64 |uucp .The World| 00004470 20 6f 66 20 43 72 79 74 6f 6e 20 20 20 20 30 37 | of Cryton 07| 00004480 34 39 20 36 37 30 30 33 30 20 20 20 20 6c 6f 72 |49 670030 lor| 00004490 63 61 6e 20 20 20 20 20 20 20 20 20 20 20 23 32 |can #2| 000044a0 33 37 0a 41 72 63 61 64 65 20 20 20 20 20 20 20 |37.Arcade | 000044b0 20 20 20 20 20 20 20 20 20 20 30 38 31 20 36 35 | 081 65| 000044c0 34 20 32 32 31 32 20 20 20 6c 6f 72 63 61 6e 20 |4 2212 lorcan | 000044d0 20 20 20 20 20 20 20 20 20 20 23 34 31 37 0a | #417.| 000044df