A program word will consist of instruction words and operand words. The instruction word will consist of the instruction code and sub-codes. The sub-codes will generally only be used to recreate the original program and will not be used during execution (though there will be a few exceptions). The code will reside in the lower 10 bits of the instruction word, which will allow for 1,024 different codes (which should be sufficient). This leaves the upper 6 bits for the sub-codes.
There are already five sub-codes that need to be stored in the instruction word, including the Parentheses, Colon, LET, Keep and Question sub-codes. This only leaves one bit for another sub-code and there are a lot more commands to implement. The sub-code bit usage needed to be reduced. As it so happens, the LET, Keep and Question sub-codes will never be on the same code, so only one bit is really required for these sub-codes.
To accomplish this, these three sub-codes were replaced with the new Option sub-code. The LET and INPUT translate routines now set this sub-code instead of the individual sub-codes that were removed. This new sub-code also can be reused for other commands requiring an individual sub-code.
The bits of the sub-codes were also rearranged with the sub-codes that will be used in the instruction words (Parentheses, Colon, and Option) in the same bit positions. This will prevent having two sets of sub-code definitions. A new Program Mask sub-code definition was added that will be used the mask the program sub-codes from the other token sub-codes when the instruction is created.
So that the proper sub-code can be output during testing, an option name variable was added to the table entries. Commands used the option sub-code will have the text name of the sub-code in the option name. In the token text routine, if a token has the Option sub-code, the option name is output (or the string "BUG" if the code does not have an option name).
[commit e721a3e3ae]
Sunday, September 22, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)