Stronger curiosity Or File Corruption?
Pages: 1 2
Steve Drain (222) 1620 posts |
I think that is what the BASIC routine MATCH does with comments after ‘;’. It does not after ‘REM’ comments. However, SE will still do the syntax colouring, which can be confusing. ;-) Another gotcha is putting a ‘:’ in a ‘;’ comment, which the assembler takes as the start of another instruction. |
nemo (145) 2546 posts |
Yup.
Uggh! If only there had been 65280 frames. |
nemo (145) 2546 posts |
And one byte shorter than |
Greg (2474) 144 posts |
Well blow me. Never would of spotted that Martin. I assumed as it was a comment it would of been ignored. Thats 2 things today I have learned. Thanks very much :-) Greg |
Steve Fryatt (216) 2105 posts |
As others have said, any text after This leads to some interesting things, not just the tokenisation of bits of comments after It was finding stuff like this whilst carrying out real world testing which made writing Tokenize such an in interesting and educational exercise. :-) |
Colin Ferris (399) 1814 posts |
StrongED/Zap treat it differently LDR R0,[R1,#0] ;Then help THEN 3 Pity StrongED/Zap can’t change reg ‘0’ into ‘R0’. Help check mistakes – with ‘#0’ being mistaken with ‘0’. |
nemo (145) 2546 posts |
Zap bug. |
Steve Pampling (1551) 8170 posts |
Chase Rick, chase. See Rick chase the bug. :) |
nemo (145) 2546 posts |
Create a Basic file in Zap, then open a new view and put it in byte mode. Type a semicolon and then Alt-140, and wonder at the sight of Zap putting a token after the semicolon, but expanding it to display it, resulting in the cursor being in the wrong place. Place the cursor after the semicolon and before the token, and press Alt-140 again, and wonder at Zap turning the original token into untokenised text while placing the new token before it. Such fun. |
Rick Murray (539) 13840 posts |
Are you sure? Zap has bugs, but this one’s BASIC… *BASIC AU. 10DIM C% 8 20P%=C% 30[ OPT 2 40 LDR R0,[R1,#0] ; Then help THEN 3 50] >SAVE "$._tokerr" Shift-dragging that to Zap shows: ...Þ C% 8....P% = C%....[ OPT 2..(' LDR R0,[R1,#0] ; Then help … ™TC@..2.].ÿ Note what follows “Then help” is the tokenised THEN followed by a line number. If the code was originally written in Zap, it would not have tokenised the stuff in the comments. StrongEd does, and colours it as keyword and line number. So it’s only a Zap bug if you consider a bug to be doing something logical.
Okay, that’s weird. But given as BASIC itself tokenises tokens in assembler comments, I’m not going to give this oddity any more consideration than the time it takes to write this sentence. ;-)
And there I was thinking “such fun” was gently tugging on the cat-handle while said cat was occupied doing something. [health warning: do not do this to a cat that doesn’t consider you to be “an acceptable provider of snacks and strokes”] |
nemo (145) 2546 posts |
I presume that’s a rhetorical question. Have you actually tried doing what I suggested?
The bug I am referring to is that while Basic tokenises assembler comments, as I said here:
…when you type the same thing into Zap it does not tokenise. This is the bug. Basic tokenises assembler comments, and does not tokenise REM. Full stop. If Zap’s Basic mode does something different, then it is wrong. |
Fred Graute (114) 645 posts |
As both Steves have explained BASIC’s tokeniser, which StrongED uses, is line based and it has no idea whether a line is assembly or not. Another problem with assembler comments is using top-bit-set characters, next time the file is loaded they will be converted to keywords. Anyway, thanks to Martin the problem has been found. I’ve changed the error message so that it includes the BASIC line number of the first line with a line number reference. That should make it easier the find out why line numbers aren’t being stripped. |
Martin Avison (27) 1494 posts |
Considerably! Thanks Fred. I had planned to suggest it … but you beat me to it! |
Rick Murray (539) 13840 posts |
Unless BASIC itself is wrong? And, no, hysterical raisins is not an excuse. |
Clive Semmens (2335) 3276 posts |
BASIC is, by definition, perfect – you should know that, Rick. |
Rick Murray (539) 13840 posts |
Yes, I’m wearing a reflective metallic hat and asbestos underwear… |
GavinWraith (26) 1563 posts |
Just recently someone sent me an invoice with their bank sort-code and account number. When I tried to pay, the bank’s software complained that they were inconsistent. I telephoned the sender of the invoice; sure enough there was was a digit wrong, a 1 had become a 5. When I see an error that occurs because a single ASCII code has gained or lost a power of 2, i.e. a single bit, I suspect that a cosmic ray has zapped that bit. The word bit-rot comes to mind. But are there any statistics on bit-rot? Am I just perpetuating an urban myth? |
Pages: 1 2