![]() |
Forum Index : Microcontroller and PC projects : OPTION DISPLAY VALUES
![]() ![]() |
|||||
Author | Message | ||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
I started with the framework by shed user "flip" (who I think has not posted in a long time) here: MMBasic Multi-window Framework PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I've never done it in MMBasic, only C, but my guess is that if it is possible then you do it using the INPUT$() function to read from file #0. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mark Regular Member ![]() Joined: 26/11/2022 Location: United StatesPosts: 85 |
Print Chr$(27) "[999;999H" Chr$(27) "[6n" Dim rows% = 0 Dim cols% = 0 Dim ic$ Dim v% Dim rc% = 0 Do ic$ = Inkey$ Loop Until Len(ic$) > 0 Do ic$ = Inkey$ If Len(ic$) = 0 Then Exit EndIf If ic$ = ";" Then rc% = 1 Else v% = Asc(ic$) - 48 If v% < 10 Then If rc% Then cols% = cols% * 10 + v% Else rows% = rows% * 10 + v% EndIf EndIf EndIf Loop Here's a snippet that I found works to get the terminal rows and columns. Mark |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7938 |
It would be interesting to know if that will work generally. It wouldn't surprise me if some terminals didn't work with 999,999. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
It doesn't look very robust timing-wise! I'd want to delay a bit to give a chance for the whole response string to come in. John |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
tried it here with '170, and puTTY with VT100 emulation - following code: Dim Integer rows,cols Dim a$,l$ Print Chr$(27)"[999;999H"Chr$(27)"[6n" 'response looks something like ESC[28;1R - rows;cols and no CRLF Do While a$<>"R"' grab the response up to the "R" a$=Inkey$ If a$<>"" Then l$=l$+a$ Loop If Left$(l$,2)=Chr$(27)+"[" Then rows=Val(mid$(l$,3)) cols=Val(Mid$(l$,Instr(l$,";")+1)) Print rows,cols End if works just fine (nice work Mark, good find Thwill) but then it has to if the VT100 emulation is good. Edited 2023-03-08 08:12 by CaptainBoing |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
My version There seems to be a large number of chr$(0) sent before the data is returned. This is with TeraTerm (and MMCC) under Windows 11. How many depends on the response time. You also have to be prepared for very slow responses now that some end-users are playing with TCPIP. ' PRINT "we are here" PRINT CHR$(27)+"[6n"; DIM locate$ = "" DIM n DO k$ = INKEY$ INC n 'print asc(k$);" "; IF k$<>CHR$(0) AND k$<>CHR$(27) AND k$ <>"" THEN locate$ = locate$ + k$ LOOP UNTIL k$ = "R" OR LEN(locate$) > 10 OR n > 1000000 IF LEFT$(locate$,1) = "[" THEN col = VAL(MID$(locate$,2)) row = VAL(FIELD$(locate$,2,";")) ENDIF PRINT "Terminal says "+locate$, row,col, n Jim VK7JH MMedit |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |