tvrfan wrote: ↑Mon Dec 30, 2019 7:29 pm
BUT ...
The unintended consequences
Known Unknowns and Unknown Unknowns
Beware of confusing the issue between bit operations and other general operations.
A question prompted by the bits change in style --> B8_R34 to B0_R35.
SAD has always functioned with SYM working on bytes and therefore 0 to 7 bits.
B8 is a new concept as of V4 as far as everyone's existing DIR's are concerned.
Sticking my neck out, not testing it, B8_R34 wouldn't work in any previous version (or is there a trojan horse).
I asked for B0_R35 as it would be defined in existing DIR's whereas B8_R34 would not, at least in DIR's I have seen.
But this makes me ask the question.... If you define a name at R34 and not for R35 e.g.
SYM MyFlags 34
SYM flagname 34 :T 7
ORB R34, 80; flagname = 1;
ORB R34, 40; B6_MyFlags = 1;
what should bit 8 show up as ??
Well it is orB not orW, so no bit8 possible.
No B8_anything in any DIR I've seen to date, nor is it likely considering SYM has only ever worked on Bytes.
In my DIR at least, I have lots of high byte registers defined as bytes and bits. Some because of address modes, others for bit flags.
Ok Ok rip the lid off another tin.
Should the handbook convention be followed, B is byte, W is word, b is to vague for bit in LST, F for flag or T???
ORW R34, 100; B8_Myflags = 1; - - - or - - - ORW R34, 100; is B0_R35 = 1; Which is better for understanding ??
- if the sym commands are
SYM MyName 34
SYM flagname 34 :T 7
SYM Xflags 35
does ORW R34, 100; become B0_Xflags = 1; ???
Now your first reaction may be "well of course"
Yes, yes, yes. Somewhere else R35 will likely be operated on with ORB or AN2B.
Existing complete DIR will have a SYM for R35 but not for B8_R34.
but then there's no obvious link between Xflags and Myflags,
Was there ever an explicit link considering SYM has always been byte centric???
That said I have some like;
SYM Name 34
SYM Name^ 35
So naming fulfills the link with ^ signifying the high byte of a word. This also covers addressing modes.
and there are typically lots of shuffles and maths in other bits of code where this might actually get MORE confusing - say for example
ML2B R34, R36; Myflags *= R36;
LDX R38, R35; R38 = Xflags; <- what should go here? ------- because really the calculation is R38 = (Myflags * R36) /256;
Hmmm they are typically scratch register, but is that the context of the question?
Yes there are lots of code situations where one has to be awake to the total length of multiply etc.
R35 having been defined in DIR as Xflags for the address range or globally, then Xflags it must be..........the 1st commandment.
Being a scratch it may not be flags for the local address range, so user will need to apply appropriate range.
So this leads to another dependent question, and a return to an old topic - Should SYMs have a size (Word, Byte, Long), [Byte would be default] ???
Yum, can number 3. It's not that simple.
Byte - 8 bits
Word - 16 bits
???? - 24 bits
Long - 32 bits
Yes Ford has 24bit length objects in RAM.
You would think they are in endian order, but no that is just to easy.
You would think they would be 3 contiguous bytes, but no still to easy.
You would think they would all be layed out the same, absolutely to easy.
I have;
Name
Name^
Name^^
Of course SYM could have T, Y, W, Wandahalf, L, without causing any grief for existing DIR as it works as T and Y now.
It is one step closer to being able to generate a csv or xdf for definition files, so it has some obvious purpose.
So, by all means go for it, try not to break existing along the way.
if so, how should a WORD symbol (say, e.g. SYM R34 Myname : W) be represented for the opcode
Ldb R38, R35; ? R38 = Myname_H -- or -- R38 = Myname/256 ??
Inevitably the user wants both;
SYM R34 Myname : W
SYM R35 Aname : Y
LDB is a byte operation so should it display the byte name Aname???
If both are ranged then it depends on the address range.
If neither have an address range then it should follow existing DIR. R38=Aname even if the : Y is missing.
If only SYM R34 exists then R38 = Myname/256 is most informative for that use case. It highlights to the uninitiated what has actually occurred,
but so does a comment.
and LDB R35, R38; Myname_H = R38 ? -- or -- Myname |= (R38 *256); ?? (no, |= is not quite right, but for the principle of asking)
Yeah, falls on its face right there. LDB is a byte operation.
The fact that R38 is the result of something to be saved to R35, means R35 is not the rescaled high byte of some word operation.
What makes the most sense ???
ordb, an2b & xorb bit flag operations are not the same as general operations.
B8_R34 is misleading to me. B0_R35 is what I expect to see or its bit name or B0_ByteName.
SYM byte is already the default.
SYM bit is already defined.
A defined SYM 35 "bitname" :T 0 takes precedence SYM 35 "bytename".
B0_bytename in the abscense of a bitname.
bytename if it is not a bit operation.
My approach of samename/^/^ makes sense to me in the context of the bins I have looked at, so I have a bias.
Yes, I can see the purpose of defining sym size, but I expect lots of use cases that will be very messy.
My opinion ?? I don't really have a stake here, after 30 years in IT, it's totally obvious to me that R35 is R34/256 and SHR R34,3 is R34/8 and why there has to be an asrw (arithmetic right shift) but not an arithmetic left shift and so on, to the point I'm not even aware I'm doing it.
Yes, it is something the aspiring disassembler must understand. The auto comments help of course.
I have some early remaining manual comments to remind myself of such things.
SAD was supposed to be for non-techies, so --- Opinions Anyone ? What makes sense to you ?
Yes, anyone else?