vela025 wrote: ↑Mon Jan 15, 2024 7:49 am
Thanks so much for taking the time to do that, I really appreciate it. What does the last line of code do?
That's the wrong way around. Consider what will happen if USR &FFF1 returns a negative number. You need to mask first, divide after.
Code: Select all
=(USR&FFF1 AND &1000000) DIV &1000000
or, even simpler:
Bits 24-31 of the returned value from USR when calling 6502 code is the 6502 flags register. Bit 24 is thereby the Carry flag. See
link.
Code: Select all
DEFFNu(capslock,length):LOCALA,A$:A$="":REPEAT:A=GETAND127:IF A=13 THENPRINT:UNTILTRUE:=A$
IFA=21ORA=24PRINTSTRING$(LENA$,CHR$8);:A$="":UNTILFALSE
IF(A=8ORA=127)ANDLENA$>1A$=LEFT$(A$,LENA$-1):VDU8:UNTILFALSE
IF(A=8ORA=127)ANDLENA$=1A$="":VDU8:UNTILFALSE
IFA=127ORA<32UNTILFALSE
IFcapslockANDA>96ANDA<123A=A-32
IFLENA$+1>ABSlengthVDU7:UNTILFALSE
A$=A$+CHR$A:IFlength<0VDU42:UNTILFALSE:ELSEVDUA:UNTILFALSE
The 3rd and 4th lines are redundant there. Just replace both of them with:
Code: Select all
IF(A=8 OR A=127) AND LENA$>0:A$=LEFT$(A$,LENA$-1):VDU 8:UNTIL FALSE
Code: Select all
1150 .escape
1160 LDA#&79:LDX#0:LDY#0:JSR&FFF4
1170 CPX#&70:BNE return2
1180 LDA#125:LDX#0:LDY#0:JSR&FFF4
1190 LDA#0:STAFLAG:JMPreturn2
For the user who is connecting Escape is disabled, but for the machine running Obbs pressing escape allows you to "drop in to chat" with the connected user.
That's testing to see if the physical Escape key is being pressed by calling the low-level keyboard scan code. If it is, then the Escape state is set and FLAG is set to 0. Both OSBYTE calls redundently set Y, all OSBYTE calls <128 ignore Y and it is implicitly set to 0, so it's pointless setting Y before calling, it gets ignored/set to zero /anyway/, and OSBYTE 125 does no take any parameters at all, so it's redundant setting X and it is ignored. Also, the OSBYTE &79 call won't see the Escape key if a lower-numbered key is being pressed at the same time. Escape being key &70 there are 59 other keys that will be spotted first that will stop the scan findng the Escape key!