From: "arobase, Salle multimédia" Newsgroups: comp.os.cpm Subject: How to Disassemble ASM86.COM Date: Fri, 15 Jun 2001 14:02:13 +0200 Organization: Wanadoo, l'internet avec France Telecom Lines: 208 Message-ID: <9gct41$3to$1@wanadoo.fr> NNTP-Posting-Host: apoitiers-102-2-1-54.abo.wanadoo.fr X-Trace: wanadoo.fr 992606145 4024 193.253.213.54 (15 Jun 2001 11:55:45 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 15 Jun 2001 11:55:45 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 ASM86.TXT --------- "How to disassemble ASM86.COM Ver 1.0" -------------------------------------- Last night, circa 1 o'clock of the morning, VDE told me "I/O error" when I finally decided to save the first version of this report... This time, I hope that everything will work! So. 2 days ago, someone named "Randy" told me where to find ASM86.COM, that is to say the 8086 assembler used by Digital Research under CP/M-80 to "boot" their programs on the IBM Clown (That's the chicken and egg problem). How could I resist such temptation? Since I am an Old Timer, I printed a dump of the file, then went to inspect it with SID (DDT would have sufficed, but my main tools are MAC and SID), and wrote down, on the dump, the various areas: bytes, words, strings, jump tables, etc. ASM86 is a standard 8080 CP/M COMmand file: the code starts at 0100H. The only thing noticeable in this file is the number of jump tables, and the way they are arranged: the subroutines are between the PCHL instruction and the addresses of the subroutines. The first jump table is at 016C, and contains 3 addresses: 015A, 0160, and 0166. The second jump table is at 01F3: 01BB, 01BE, 01CB, 01DB, 01E3, 01EB. The third jump table is at 023A: 0225, 022B, 0231, 0237. Everything else is "straight" 8080 assembly language. We now reach, at 03A8, a table of byte/word values, whose purpose I had not enough time to find (also, I know almost nothing about the 8086: the only doc that I have is the ASM86 doc found on the Internet...). The first entry is: 00 00 00 00 37 06 The second entry is: 00 00 00 02 D5 0A 06 The third entry is: 00 00 00 02 D4 0A 06 Then, it seems to be variable entries, during 3 pages. Then, there is a table (starting at 1133) containing only the opcodes. The format is: address, length of opcode, address in previous table, opcode in ASCII Then, at 14E9, there are the addresses of the opcodes entries (but not the first one, TEST), then 3 strings: LABELS, VARIABLES, and NUMBERS. Then, back to code (during 2 pages). Another strings (A86, H86, LST, SYM, A, H, P, S, F) at 1E88. I will now gives the start of the jump tables, and their length: 2163: 4 addresses 2636: 6 293D: 5 2B44: 4 One funny thing: a patch (00 00 00) at 2C94... The register "names" and pseudo-ops at 2EF8: 34 two letters keywords 11 three letters keywords 13 four letters keywords 6 five letters keywords 4 six letters keywords 2 seven letters keywords 2 eight letters keywords 2 nine letters keywords followed by a table of words. The first 10 entries are the addresses of 2 bytes, then the bytes holding the number of x letters keywords. After that, it must be the value of the register or pseudo-ops, then there are 2 addresses in RAM, then the addresses (inside the table of words) corresponding to the registers/pseudo-ops. Then back to code (at 314F). Another jump table at 3260: 31F3, 322C, and 3253. Then the error messages, starting at 32C6, each terminated by a 00 byte. Then the addresses of the error messages (and a byte). Then 3 strings used in error messages. Then some unknown bytes (from 00 to 1F: at first, I was thinking that is was the error numbers, but my ASM86 doc says that there are only 24 errors... since there happens to be 32 error messages in the above table, they must be their numbers? (but why?...)). Then back to code at 2718. Then the console messages at 380F: Y(es), N(o), then "ASM86 VER 1.0 ". Some addresses after "END OF PASS 2", some unknown bytes (81, 82, 83, 84, 85, 86, 87, 88 ???), then back to code at 3906. Back to some jump tables: 3BD3: 8 addresses 41E3: 5 436B: 5 45D4: 5 4778: 6 4ABA: 4 4BFD: 3 4ED0: 3 519E: 3 54B0: 4 55F3: 3 56F0: 3 5929: 4 59E9: 8 5B27: 13 60A1: 31 619B: 9 (There are also a few areas of bytes values which seem to be copied by subroutines, but your disassembler should be able to find them. (The C-register holds the number of bytes to be copied.)) Now, some strange thing: the string: ", Digital ResearchBox 579, Pacific Grove, Ca. " ??? (Personally, I think that this is some garbage left in RAM that found its way inside a DS pseudo-op. For instance, the (HUGE!) initialisation subroutine starts just after... Anyway, there are 46 bytes available for patches...) Then the huge initialisation subroutine, starting at 6320. Back to some jump tables: 6526: 5 addresses Some ASCII chars (ACDEMRSXBWDS) at 6917. 6C8D: 21 addresses And, finally, the CP/M End-Of-File byte (1A) at 6FEB. Those 21 bytes are also available, of course, for patching... So, here lies the problem (for me): ASM86 is just under 32 KiloBytes long... But, everytime that I have disassembled a file, the resultant ASM file, straight from the disassembler, was 10 times bigger than the COM file, and (a few weeks later...) my recreated source code was 20 TIMES that... 32 x 20 = 640 KB... That's a much too big file for my computers (4 MHz Z-80 and 12 MHz 286). For instance, when manipulating a 240 KB file, WS takes more than one minute to go from the beginning to the end of the file... I simply can't imagine waiting 3 minutes for each "Find and Replace" to take place, since there will be thousands of them to be done. I won't be able to buy a powerfuler computer in the near (and far) future. (If someone in Europe has a 400 MHz 64 MB PIII that he no longer use, I know someone who need something as powerful as this, and who will really use it...) By the way, under CP/M-86 Plus all the editors and word- processors found so far thinks that they have only (at most) a 64 KB segment for buffering the file. If someone has the source code of a 32 bit file editor (a 32 bit version of ED would be enough: I don't need a word-processor to do several thousands of "Find and Replace": just the quickest possible file editor: that is to say: editing this 640 KB file in RAM. If someone has more knowledge about the 16 and 32 bit Intel processors, such a 32 bit file editor is missing for CP/M-86 Plus (and CP/M-86). (I have the source code of at least two old CP/M file editors which were 3 KB long, and maybe others could be found in the archives. All that is needed is a 32 bit version of those old tools. If someone is interested, let me know.) (I would also be interested in any Intel doc dealing with the 32 bit processors, and how to use them from CP/M-86 Plus.) Yours Sincerely, "French Luser" Post-Scriptum Once the source code of ASM86 will have been re-created, it will be very easy to add macros... since I already have disassembled MAC (but not RMAC yet). Then, we will have MAC86... running under CP/M-80!... Enjoy!