LOCATE bug?

DOS specific questions.
atrocity
Posts: 11
Joined: Jul 25, 2007 22:24

LOCATE bug?

Post by atrocity »

I'm writing a FreeBASIC-specific code editor with syntax highlighting and stuff for DOS with online help and stuff (just started today), but I'm running into either a) I'm an bright, or b) I've found a bug.

Here's where things are going weird:
1. I redraw the code window.
2. I do a LOCATE 3, 2 to put it at that position and I realize the cursor is at 1,1 flashing (undescore flashing, not mouse-cursor).

Locate DOES update the text as I print to the screen randomly, but actually moving the cursor, it doesn't happen. The only reason I care is because it's kind of hard to know where the cursor is when you're editing code if it's stuck in the upper corner.

I've tried Locate , , 0 then ,,1 to turn it back on to see if it will move it, still didn't work. Any ideas?
atrocity
Posts: 11
Joined: Jul 25, 2007 22:24

Re: LOCATE bug?

Post by atrocity »

Actually, the one thing I was thinking of as I was talking about this in #freebasic is that maybe it's page-specific? Meaning does each graphical page (well, console page) have it's own cursor location? I have 0 set as the visual, and 1 set as the current. Then I'm just using PCopy to move from 1 to 0 so you can't see the screen being redrawn.
atrocity
Posts: 11
Joined: Jul 25, 2007 22:24

Re: LOCATE bug?

Post by atrocity »

Okay, I'm all out of ideas on this. You can't do page-switching like you could in the old QBasic days (as far as I can tell). I'm using PCopy to move the write page to the active page. The only time it WILL accept all the arguments for switching pages is if I pass it "Screen 0,,,0" instead of "Screen ,,, 0" or it gives me an error. I tried ScreenLock/Unlock, but that does nothing since I'm not in a graphic mode.
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Re: LOCATE bug?

Post by vdecampo »

FB automatically does double buffering so you can just lock the screen, modify it, then unlock it to have the updates appear,,,

ie:

Code: Select all

ScreenLock
'do stuff
'do stuff
ScreenUnlock
Does that help?

PS: You should still be able to use separate pages but I find it to be clunky.

PPS: Try to not lock the screen for a long time.

-Vince
atrocity
Posts: 11
Joined: Jul 25, 2007 22:24

Re: LOCATE bug?

Post by atrocity »

I thought I wrote about ScreenLock'ing. It doesn't seem to work in console mode (Screen 0), just graphical.

I did end up figuring out the issue, though. LOCATE seems to only update the physical cursor location on page 0, no other pages. So even if you set your active page to page 1 and use LOCATE, it won't move it after a PCopy unless you set the active to page 0, then use LOCATE. Then I was able to set my page back to page 1.

I did all that after I did the PCopy, btw. This should probably be documented in the documentation, but I'm not sure if we're allowed to update the wiki or not. :)
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: LOCATE bug?

Post by counting_pine »

It's a wiki, so assuming you can log in, feel free to make changes as you see fit. We can always revert it if it's wrong :)
This might also be a bug, so you might want to consider filing a report. Also if you are able to check on Windows that would help too.
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: LOCATE bug?

Post by fxm »

I thought that 'Locate' acted on the current working page only (which can be different of the current visible page)!
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: LOCATE bug?

Post by counting_pine »

Ok, so perhaps the problem (or "problem") is that pcopy isn't copying the cursor position?
The behaviour of Locate should affect the active page (whether 0 or something else), otherwise your control over the active page would be significantly limited. I gather that part is working OK?
atrocity
Posts: 11
Joined: Jul 25, 2007 22:24

Re: LOCATE bug?

Post by atrocity »

Yeah, actually, that sounds about right. Like I said, it might be working as intended. But if so, should be documented, then. I just through doing a PCopy would pull the active cursor location, too.
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: LOCATE bug?

Post by fxm »

'Pcopy' copies also the text cursor position and the graphic cursor position.
atrocity
Posts: 11
Joined: Jul 25, 2007 22:24

Re: LOCATE bug?

Post by atrocity »

That's odd, because it didn't do that for me.
codeFoil
Posts: 256
Joined: Dec 22, 2011 4:45
Location: United States
Contact:

Re: LOCATE bug?

Post by codeFoil »

fxm wrote:'Pcopy' copies also the text cursor position and the graphic cursor position.
I think atrocity is referring to the visible blinking cursor displayed by the graphics card on a DOS system.

After a quick look at the code for Locate and Screen for the DOS runtime, I can see that both make BIOS calls.
I haven't looked the BIOS services up yet.
The code for Pcopy for the DOS runtime makes no BIOS calls.
atrocity
Posts: 11
Joined: Jul 25, 2007 22:24

Re: LOCATE bug?

Post by atrocity »

Sorry, yes. It does correctly move the cursor from the actual "Locate" perspective, it just doesn't move the actual graphical cursor.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: LOCATE bug?

Post by counting_pine »

So basically the problem is that PCopy isn't updating the flashing cursor position in DOS, is that right?
Does 'Screen , a, v' update it as expected? And are Win32 programs similarly afflicted?
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: LOCATE bug?

Post by fxm »

KeyPgScreengraphics
Updated documentation:
Screen , [, [ active_page ] [, [ visible_page ]]]
There seems to be a comma too!

[Edit]
Thank you for the quick correction!
Last edited by fxm on Jun 27, 2012 17:05, edited 3 times in total.
Post Reply