Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cprint and cfprint text mode routines
#11
(09-23-2023, 08:22 PM)bplus Wrote: Interesting how you did checking on/off with subs!

But you left out comparing to standard way with Color + Locate + Print

I am weighing the cost of extra lines of code for subs and ease of typing one line instead of 3 with standard 3 maybe try good ole CLP sub:

Sub CLP(fg, bg, row, col, text$)
color fg, bg
locate row, col
print text$;
end sub

Remember though, part of the idea here is: "without altering global color values or background colors".

For the "not alter global colors", you could:
OFG = _DEFAULTCOLOR
OBG = _BACKGROUNDCOLOR
....stuff
COLOR OFG, OBG
END SUB

But to maintain background colors, you'd need to get POINT (x, y)....

Which ends up with what's going on in these routines, but with _Mem commands.
Reply
#12
Well darn. I watch a movie with my wife, take a nap and take a look at the forum before working on making the routines a little faster...and the work has been done while I slept!  Thank you.

There a few other routines related to this I'm also working on that I can see how to speed up.
Reply
#13
Ha! best way to do "work". But is it work?
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#14
(09-23-2023, 10:01 PM)James D Jarvis Wrote: Well darn. I watch a movie with my wife, take a nap and take a look at the forum before working on making the routines a little faster...and the work has been done while I slept!  Thank you.

There a few other routines related to this I'm also working on that I can see how to speed up.

The best way to speed something up is to remove as much of it as possible from your loops.  Look at the math in your loops with those MEMPUT statements, and then look at mine.  See the difference in number of calculations we end up doing?
Reply
#15
Quote:Remember though, part of the idea here is: "without altering global color values or background colors".

Oops yes OK but honestly I don't see why. If I had a color, locate and print text line why would I do it the long way ever again ;-)) In screen 0 that's all you can do is print Text or _PutImages with hardware?
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Text-centring subs PhilOfPerth 3 771 12-20-2024, 02:50 AM
Last Post: Pete
  A scrolling SUB for text in SCREEN 0 TempodiBasic 1 645 12-10-2024, 01:04 AM
Last Post: TempodiBasic
  Reverse search and case-insernsitive search routines TDarcos 6 1,331 04-15-2024, 04:21 AM
Last Post: eoredson
  Text encryption AtomicSlaughter 8 1,658 11-17-2022, 10:58 PM
Last Post: Jack
  Text Mode Drawing Routines James D Jarvis 0 558 10-16-2022, 06:27 PM
Last Post: James D Jarvis

Forum Jump:


Users browsing this thread: 1 Guest(s)