![]() |
Forum Index : Microcontroller and PC projects : OPTION DISPLAY VALUES
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
Mark Regular Member ![]() Joined: 26/11/2022 Location: United StatesPosts: 85 |
Is it possible for a MMBASIC program on the PicoMite to read the rows and columns values set with OPTION DISPLAY when using a USB console? I've already checked MM.HRES and MM.VRES and they are the resolution of screens. Mark |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
mm.hres/mm.fontwidth, mm.vres/mm.fontheight |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
this will be down to whatever "terminal" is attached to your serial console output. if your terminal is emulating, say, VT100, then the code to get the cursor position would appear to be ESC[6n and the positional data will come back as if it had been typed at the keyboard I tried it here and from the command prompt I get: ![]() Note: I did not type that last line, the console did. HTH oh, forgot to say... here is a comprehensive list of VT100 escape codes. https://espterm.github.io/docs/VT100%20escape%20codes.html Edited 2023-03-07 03:53 by CaptainBoing |
||||
Mark Regular Member ![]() Joined: 26/11/2022 Location: United StatesPosts: 85 |
Thanks for the replies. matherp: mm.hres and mm.vres return 0. This is the non-VGA version of PicoMite Basic and I am running minicom on my Mac (I get the same results with TerraTerm on a PC) with the Pico connected to a USB port. Captain: Thanks for the link to the VT100 codes. the command you show gives the position of the cursor. What I am looking for is the values set by OPTION DISPLAY command in MMBASIC. for example: OPTION LIST ... OPTION DISPLAY 48, 160 I want to be able to read the values 48 (rows) and 160 (columns) in my MMBASIC program. I want to have the program adjust its display to match the display window. fwiw: Both the LIST and EDIT commands adjust their displays based on the settings of OPTION DISPLAY. Thanks, Mark |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
I think they shouldn't be 0 if you have a display configured. John |
||||
Mark Regular Member ![]() Joined: 26/11/2022 Location: United StatesPosts: 85 |
I don't have a LCD display configured. I am using the console over the virtual (USB) serial port. Mark |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
If you don't have a display set, you are asking for the settings of the terminal program on the PC. Some standards do have a means of querying the terminal to get the size but it will be easier to set the terminal size to a suitable size for your program. Most terminal program will respond to the size command. ' DIM chrX = 80 DIM chrY = 36 PRINT CHR$(27)+"[4;"+STR$(chrY)+";"+STR$(chrX)+"t" PRINT "terminal set " This sets the terminal to 80 x 36 characters. VK7JH MMedit |
||||
Mark Regular Member ![]() Joined: 26/11/2022 Location: United StatesPosts: 85 |
I think I understand what you are saying about the terminal size, but what I am trying to do is determine the values set by the OPTION DISPLAY setting. Both the LIST and EDIT commands seem to respect those values. BTW, when doing a LIST, is there a way to abort the list before you have seen all the pages? |
||||
paceman Guru ![]() Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
Just type a "CtrlC" when it asks for "Input any character.." this drops back to the prompt. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
I understand *what* you are trying to do, Mark, but *why* is something else. The PicoMite has two displays, console and graphic. Normally console mode is *only* used for system configuration and error messages. The dimensions of it are irrelevant. The only reason that OPTION DISPLAY is there, AFAIK, is so that the user can get a readable display on their screen. There should be no need to read this back. Console mode shouldn't really be used inside the user's program as it is fairly restricted in what it can do. It's good for status and error messages while debugging. You *can* use it in your programs - there's nothing to stop you - but you have to work within its limitations. The graphic mode(s) is/are much more flexible and should be the normal choice for the user's program. You can read these back, enabling you to find the centre of the screen, number of text lines in the current font etc. OPTION DISPLAY sets what the PicoMite is going to do, it has nothing to do with the connected terminal. Because of this you already know those settings - just include a note in the program that that's what you expect the user to set their terminal to for best results. Alternatively, send commands to the terminal to set it up or simply set everything to 40 lines of 80 characters, set a font that works and keep to those settings. They are more or less universal. Remember that in the real world (of real terminals, not emulators) the terminal is always the slave device, it's not up to you to write your program to suit a terminal. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Then I think that it's up to you to decide the values or ask/set the remote device. MMBasic doesn't do that for you. John |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
I will include MM.INFO(OPTION WIDTH) and MM.INFO(OPTION HEIGHT) in the next release Edited 2023-03-07 19:17 by matherp |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
Do not dismiss the console too lightly. It provides the same interface as we had on console-reliant machines since whenever (your NASCOM?). I am working with the tiny MicroMite mostly, but I have applications that use and drive the console just as a CP/M prog would have done back in the 80s. It is perfectly passable and a good option where a LCD panel isn't justified/required/feasible. With cursor positioning, simple windowing, colour control etc... you can make some very acceptable displays. A sprinkling of Subs to generate the right escape sequences and you are good to go Depending on your emulation you could even get mice in on the gig. Edited 2023-03-07 20:15 by CaptainBoing |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
Agreed, but the PicoMite has a far better alternative to the console if you want a display for user programs. I'd have killed for Mode 2 on a Nascom. Even in mono. :) I've used the console myself (and wrote an ESC code library that was designed for both the Micromite [in library space] and the PicoMite [as a SUB]). As I said, you *can* use it, but that doesn't make it the best tool for the job. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Mark Regular Member ![]() Joined: 26/11/2022 Location: United StatesPosts: 85 |
paceman: Thanks for the answer. I could have sworn that I tried Ctrl-C to interrupt a list and it didn't work, but I just tried it and it does work. Mixtel: The Picomite only has a graphics mode when connected to external display hardware, such as an LCD screen or the VGA display. I am working on programs for a Picomite that has neither. Peter: Thanks for the implied answer (currently not possible) and for adding the capability to the next release. Captain: Thanks for the "sprinkling of Subs" I have my own ANSI library, but I like the way your's is written. BTW, your library shows the need for the functions that Peter is going to add. In your code to clear the whole screen, there is a hardcoded '25' for the number of rows on the screen. If the program is running with different values for OPTION DISPLAY, that 25 is not appropriate. General Answer to All: I am writing some "utility" type programs (I won't say what until they are working, I want to keep my options open if things don't pan out ![]() On the other hand, when using my Windows eBook laptop and TeraTerm, I need to use fewer rows and columns for the smaller display, so I set OPTION DISPLAY 24,80. Edit perfectly adjusts to the different screen sizes. By being able to read the values of OPTION DISPLAY in my programs, I can have them adjust their displays automatically. Tassy: Thanks for the ANSI command to set the screen size. Do you know if there is a corresponding command to get the current screen size? I don't see one in the link from Captain. I'm guessing that since the ANSI escape sequences pre-date TerraTerm and minicom with adjustable screen sizes, the program "knew" the display size options of the terminals based on the terminal's IDENT response, so there was no need to query the display size. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
The VT52 and VT100 terminals may not do it. Later terminals may support additional options. Some handled line graphics, for example. There were quite a few variations. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I don't know if this mechanism would work: https://stackoverflow.com/questions/35688348/how-do-i-determine-size-of-ansi-terminal Best wishes, Tom Edited 2023-03-08 00:51 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
hah! it does! ... and I never really thought about it but yes it would benefit from it. Sadly there are a number of things that make it extremely unlikely I'll be able to avail myself... one because of the platform and the other self-inflicted because I use an older version (by "choice") good call tho' |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Here's an example of MMBasic using serial output to a terminal (TeraTerm) and doing old-style text windowing with VT100 commands: ![]() I didn't use the console because I wanted to leave it free for debugging. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Mark Regular Member ![]() Joined: 26/11/2022 Location: United StatesPosts: 85 |
thwill: Thanks for the tip. The code does work. I send an escape sequence to position the cursor to row 999 and column 999. I then send an ESC [6n to get the cursor position (thanks Captain), it then prints "[48;160R" on the screen matches my terminal set up. The question now is how do I read that "[48;160R" into my program and not have it display on the screen? lizby: That screen demonstrates exactly what I want to do with my program. I'm currently using the USB console, but I like the idea of using a serial terminal Mark |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |