An alternative way to output (single) inverted characters

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
Mike
Herr VC
Posts: 4832
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

An alternative way to output (single) inverted characters

Post by Mike »

I found this out yesterday, that one can include quote-mode even in PRINT statements...

PRINT CHR$(128+20)CHR$(4) will print an inverse 'D'. The best thing however is, you can write this with control-characters alone, as follows:

PRINT{2 QUOTE}{DEL}{RVS ON}{SHIFT T}D{RVS OFF}{2 QUOTE}{DEL}

so that the screen reads (in lower case): print"Td", with 'T' and 'd' in inverse video. For single inverted chars this needs one byte less than the embedding in {RVS ON} and {RVS OFF}.

Michael
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

That's pretty cool. I wonder why it only works with the first character?

Later,
Rob
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Shift+T (INS) will put the computer in insert mode, even if executing a PRINT statement. Try this:

PRINT"{SHIFT+DEL}{CRSR UP}"
PRINT"{SHIFT+DEL}{SHIFT+DEL}{CTRL-2}{CRSR DOWN}"

However, this trick only works for characters and shifted characters. If you want to print inverse numbers, most symbols or C= graphics, you have to use proper RVS ON.
Anders Carlsson

Image Image Image Image Image
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

Playing around with this idea and looking at the memory map, I noticed there was a location to tell the computer how many inserts outstanding. Location 216 does this for the Vic. Try this:

10 POKE216,11:PRINT""{DEL}{RVS ON}HELLO{SPACE}THERE{RVS OFF}"

As noted above, this idea only works with certain characters. Also, If you try to edit the line, It will mess it up(The "t" & the space disappears of course). This doesn't save memory or run any quicker, just a different way to do it.

Another thing, Don't expect to use any control chars {blk}{wht} ect... They will only come out as characters in quote(or insert) mode. You could use location 646 to tell the computer what color its cursor is. BTW, You can use location 646 to PRINT in multicolor mode using values 8-15 and using location 36878 to change auxilury color.
Later,
Rob
Post Reply