Command? read purged 33 Posted: Mon Dec 15, 1986 3:44 AM PST Msg: OGIG-2504-3098 From: CHHU To: chhu Subj: to Maynard from John Baker Dear Maynard, I got the stuff, thanks!!! Your start on listing cross references is great! I've just started with it so I'll give a report soon. I'm afraid that the GOYES/RTNYES stuff is needed but, heck, thats just another fun challenge to meet, right! Regarding the listing problems you noted, the HP code for listings is on drugs. Actually, not quite (but almost) that bad. The cause is VERY simple but the result is a disaster. Geoff Nichols (the assembler author) made a booboo in the listing code. He set the FORTH system to DECIMAL mode to report page numbers in the listing, but forgot to reset it to HEX for showing the symbols. As a result, the symbols are ALL screwed up. All told, there are five (yes, 5) known bugs in the FORTH assembler. I wrote a FORTH screen to be LOADFed to repair the damage. Some of the bugs are downright fatal, such as two incorrect opcodes, others are just various shades of annoying. While I was rewriting the code to do the listings properly, I decided to have the assembler report the decimal value of the symbol as well as the hex value. As the largest hex value is FFFFF, this transltes to 1048575 decimal. As a result, 7 places are needed to show a full decimal number as opposed to 5 for hex. It would have been easy to also show octal or binary, but that seemed like fluff. I also added a field next to each symbol to show whether it is a label or an equate. As all this information is stored in the symbol table, it is a piece of cake to show it. The reason I did not do a more expanded listing at actual assembly time is that that is all the information stored with each symbol. Short of adding a whole bunch more code to spew it out during assembly, thus slowing things down even more, the only other approach is to use a postprocessor acting on a listing file. I will upload the assembler source file for you. To fully understand it though, you will most likely need the FORTH source code sold by CHHU. I wrote the update initially to fix the bugs in the asembler. I cannot take credit for the idea though. The original fix for two of the bugs was written by Bob Miller of HP who was the FORTH system author. I received that fix from HP as their way of saying thankyou since I had discovered one of the two bugs. After finding a few more bugs, I took Bob Millers original idea, and greatly expanded it. While it started out simple, it wound up growing like topsy. I used it as a method to help me learn more about FORTH in general. It proved to be a very worthwhile lesson. Regards, John [618] ps, HP listing cross reference lines look live this... =======Sample======= =OUT1TK Abs 11499 #02CEB - 268 264 1184 | | | | | | | | | | | | +-----+- lines in the source file which | | | | | call this symbol | | | | | | | | | +- this is the line in the source code in | | | | which the symbol is defined | | | | | | | +- this is the hex value of the symbol 0-FFFFF | | | | | +- this is the decimal value of the symbol 0-1048575 | | | +- this shows whether the symbol was defined in this 'module' or | is external to this module | +- this is the actual symbol. The leading = sign shows whether the symbol is local to this module, or is global to all modules. Symbols with the leading = sign, cannot be redefined in another module. Symbols without the leading = sign, can be defined differently in other modules. The assembler HP used to create the 71, is a modular linking assembler. The above format is produced by each modules assembly, prior to running the linker. As the FORTH/assembler is NOT a linking assembler, certain features are not necessary. For example, leading = signs are not supported, they are ignored by the FORTH/assembler. Likewise, the field showing ABS/EXT is of no significance. The altered FORTH/assembler I did, produces both a decimal as well as hex value, like HPs, as opposed to only hex by the FORTH. It also shows whether the symbol is a label or an equate. When I first did the write, I thought it would be meaningful to also show whether the equate was for pass 1 or 2 of the assembler. As it turns out though, by the time the code is done, all equates show as pass 2 equates. Therefore, I think I'll revise the code to show only 'EQUate'. This would allow using a six character field to show 'EQUate' or 'Label '. My original desire, and intent, for adding the cross references, was to modify only the symbol table, NOT the actual code portion of the listing. As the assembler will accept and ignore = signs, we should allow space for them. Also, since the maximum text line number is 9999 decimal, we need allocate only 4 spaces for the line number. My concept of the listing is as above only with the 'ABS/EXT' field deleted. Your point regarding the interactions of memory size, versus assembly from mass storage are well taken. I had forgotten the bugs associated with lack of memory. As some of my source code has grown quite large, 100000+ bytes, the listing files would indeed be huge. You would undoubtedly convulse at the mere thought of what I have done in the past to S T R E T C H every possible byte of memory out so as to allow assembling large code. For example, I unplug every ROM except the FORTH/assembler. I assemble from mass storage. I coldstart the machine (yes... INIT3). I then resize the command stack to size 1. All these tricks, plus even more, get every available byte for the assembly. I'd have to stop and think about it, but, it might be possible to rewrite the assembler code to allow sending the listing file back to a media as well as reading the source from it. I'll have to ponder it awhile. Regards, John Baker [618]