Why:
WAIT &f500,1 work.
But WAIT &f500,1,0 ... don't work? (freezed)
WAIT &f500,1,255 don't work too.
Manual say:
W A I T <port number, , <mask,[, <inversion,]
" The value read is eXclusive 0Red with the <inversion, and then ANDed with the <mask,"
hi,
you do not necessarily need to use inversion
WAIT &F500,1
is ok.
https://www.grimware.org/doku.php/documentations/software/locomotive.basic/startdo=export_xhtml#wait (https://www.grimware.org/doku.php/documentations/software/locomotive.basic/startdo=export_xhtml#wait)
His point is that even using an inversion of 0 which should be completely identical to omitting the parameter, WAIT behaves differently. Sounds like a bug in BASIC to me.
Confirmed - in both BASIC 1.0 and 1.1 if you put anything in the inversion parameter then the mask gets incorrectly set to 0, making it never return :picard2:
More details: Using the disassembly of BASIC 1.1 at https://github.com/Bread80/Amstrad-CPC-BASIC-Source/blob/ae70de4838bbfda0b53d45ff05ff61bd44f0861d/PeekPokeIOBarCall.asm#L40 (https://github.com/Bread80/Amstrad-CPC-BASIC-Source/blob/ae70de4838bbfda0b53d45ff05ff61bd44f0861d/PeekPokeIOBarCall.asm#L40)
The problem is that the call to eval_expr_as_byte_or_error in line 60, which is used to read in both the mask and inversion values, corrupts DE. Since the mask value is stored in D, it gets overwritten by the high byte of the inversion parameter (which is guaranteed to be 0 or it would have thrown an Improper Argument error and not returned.)
Quote from: McArti0 on 01:08, 04 February 22WAIT &f500,1,255 don't work too.
does WAIT &f500,0,1 work?
Quote from: eto on 09:38, 04 February 22
does WAIT &f500,0,1 work?
No :-X
Adding XOR destroys AND
Quotedoes WAIT &f500,0,1 work?
Given the way WAIT works, putting 0 in the mask field will ALWAYS lock the machine up, even when the inversion field is missing. You're asking the machine to wait until a bit is set, but clearing all the bits before you test. So technically, it "works" because locking up is exactly what you asked it to do.
Quote from: gurneyh on 07:40, 04 February 22
hi,
you do not necessarily need to use inversion
but I want to find end time of H-Sync
Lord Alan...
, give my money back ;) :D
Quote from: pelrun on 10:26, 04 February 22Given the way WAIT works, putting 0 in the mask field will ALWAYS lock the machine up
:doh: argl... sure... AND 0