Jump to content
GDMike

Looking for inverted charset

Recommended Posts

I'm looking for a TEXT mode inverted character set.

because I'm lazy..nah not really, but if it's out there I'd rather not go through the pain to create. If there's an algorithm then even sweeter, but a set would work just fine. In the meantime I'll start making em... Thanks in advance!!

Share this post


Link to post
Share on other sites
1 hour ago, GDMike said:

I'm looking for a TEXT mode inverted character set.

because I'm lazy..nah not really, but if it's out there I'd rather not go through the pain to create. If there's an algorithm then even sweeter, but a set would work just fine. In the meantime I'll start making em... Thanks in advance!!

 

Do you mean upside down or color inversion?

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, GDMike said:

Color inverted..

 

I believe there is a console routine accessible by GPLLNK that does that. I will look it up.

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, Lee Stewart said:

I believe there is a console routine accessible by GPLLNK that does that. I will look it up.

 

Nope. GPLLNK routine >003B provides mirror-image characters by swapping bits.

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

You can write a simple routine to produce the inverse of each byte in the font. The relevant TMS9900 instruction to do this on a word (2-byte) basis via an address pointer in R1 would be

       INV  *R1

 

I think I will write a Forth word in fbForth 2.0 that will, at the very least, invert a character of your choice from ASCII 0 – 255. You could then use that in another word that would operate on an ASCII range. Stay tuned.

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

Slick. I'm gonna try this

Blwp @Vsbr

Inv *r1

Blwp @vsbw

I wish it were that easy... 

Update, I didn't see any change, so I did a inv R1 and a blwp @vsbw..

I'll wait and see what you come up with..I'm just guessing now..lol

 

Edited by GDMike

Share this post


Link to post
Share on other sites
27 minutes ago, GDMike said:

Slick. I'm gonna try this

Blwp @Vsbr

Inv *r1

Blwp @vsbw

I wish it were that easy... 

Update, I didn't see any change

 

In this case, R1 doe not point to the byte you want to INVert, it contains it. Just remove the ‘*’:

       INV  R1

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

Yup I tried that and see the video of the output from post #8

Edited by GDMike

Share this post


Link to post
Share on other sites

Was i capturing my cursor instead of the character I was sitting on?..hmm..I'm going to make a change..brb

No, things got worse

It's no biggy to make all my new fonts..

I tried this but I got a big nothing

Kybuf has a copy of keyboard character last pressed

IMG_20200203_193800788.jpg

Edited by GDMike

Share this post


Link to post
Share on other sites

You need to change 8 bytes in the PDT (Pattern Descriptor Table), so you need a loop. Here is the Forth I promised:

\ Invert char pattern asc
: INVCHR    ( asc -- )  
   255 AND              \ force to 0 - 255
   3 SLA PDT + DUP      \ dup character pattern location
   8 + SWAP DO          \ loop through character pattern
      I VSBR            \ get next byte of character pattern
      -1 XOR            \ flip bits
      I VSBW            \ write byte back to PDT
   LOOP  ;

\ Invert char patterns asc1 - ascn
: INVRNG  ( asc1 ascn -- )  
   1+ SWAP DO           \ loop through char patterns
      I INVCHR          \ invert next char pattern
   LOOP  ;

 

If you need Forth Assembler for it, I can do that as well.

 

...lee

  • Thanks 1

Share this post


Link to post
Share on other sites

Thx Lee, it's gorgeous! 

Show me the forth assy version..I'll try to see what I need to do in plain assy..

Share this post


Link to post
Share on other sites

Just fyi for anyone else, reverse color characters are already defined in Turboforth. Wilsy included them..

BUT I'm still doing stuff in assy. Not forth assy. So I have to manipulate the pattern table..that's the ticket! Thx Lee as always.

Edited by GDMike

Share this post


Link to post
Share on other sites

Here is some ALC to do it, but it looks like you already have some that works:

 

 

 

* BL @ICHAR to get here.
* R0 must have ASCII character value to change.
* 
ICHAR  LI   R2,8        load counter
       SLA  R0,3        calculate PDT offset
       AI   R0,>0800    add PDT location
ICLOOP BLWP @VSBR       get next pattern byte to R1
       INV  R1          INVert it
       BLWP @VSBW       put it back
       INC  R0          address of next byte
       DEC  R2          decrement counter
       JNE  ICLOOP      jump if not done
       RT

 

 

...lee

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Yes, exactly Lee. This is it. I just didn't know how to manipulate the pattern descr table like this. But this is cool..

I can see how this would be useful in a game too, but I'm not making a game, yet anyway. Lol I'm mad at myself for not knowing how to do this.. but I'm still green real green.

Thank you!

 

Share this post


Link to post
Share on other sites

When I get back to my editor this is on my list as well.  I was thinking that I just needed to replicated the entire font in the upper part of the pattern table and invert that copy. Then whenever I need high-lighting I use ASCII+128   and I get the reversed version on the screen.  Is that what Willsy does in Turbo Forth?

  • Like 1

Share this post


Link to post
Share on other sites
8 minutes ago, TheBF said:

When I get back to my editor this is on my list as well.  I was thinking that I just needed to replicated the entire font in the upper part of the pattern table and invert that copy. Then whenever I need high-lighting I use ASCII+128   and I get the reversed version on the screen.  Is that what Willsy does in Turbo Forth?

 

I think that is so. I will check in a little while.

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

Mike Riccio did a similar trick with the INV command.  He inverted the character patterns for characters 0 through 127 buffering the inverted pattern, and then with a VMBW wrote it back out for character patterns 128 to 255.

 

Thus, for "drop down" menus, as he dropped down one row at a time, he would read the characters for the next row and add 128 to each position, write it back out, to give the effect of highlighting.  Then, the row above or below he had just scrolled off, he would subtract 128 to return to the normal characters.

 

I hope that makes sense.  With a 9938, you also have the option of the blinking which you can set to ON with no time off to get the same effect.

 

If you look for the MyTerm source code, more the original and not telnet capable version, it has the code.  You would just need to change the VDP ports for the TI-99/4A instead of the Geneve ports.  It has code for drop down menus, etc.

 

Beery

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, TheBF said:

When I get back to my editor this is on my list as well.  I was thinking that I just needed to replicated the entire font in the upper part of the pattern table and invert that copy. Then whenever I need high-lighting I use ASCII+128   and I get the reversed version on the screen.  Is that what Willsy does in Turbo Forth?

 

55 minutes ago, Lee Stewart said:

I think that is so. I will check in a little while.

 

Indeed, that is what @Willsy does—except that his offset into the inverse table is 96 instead of 128. And, here is his code (converted to work with the E/A assembler)—

* initialise inverse characters
* ascii codes 144 to 218 are inverse of 48 to 122
DOINV  LI   R5,>900                 ; vdp source
       LI   R6,>C00                 ; vdp destination
       LI   R4,728                  ; count
INVLOP MOV  R5,R0                   ; get source address in r0 for VDP ops
       BL   @_VSBR                  ; go read the vdp data (result in R1)
       INV  R1                      ; invert it
       MOV  R6,R0                   ; load destination address
       BL   @_VSBW0                 ; write r1 to destination address
       INC  R5                      ; advance source address
       INC  R6                      ; advance destination address
       DEC  R4                      ; decrement counter
       JNE  INVLOP                  ; loop until finished

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, GDMike said:

I'm looking for a TEXT mode inverted character set.

because I'm lazy..nah not really, but if it's out there I'd rather not go through the pain to create. If there's an algorithm then even sweeter, but a set would work just fine. In the meantime I'll start making em... Thanks in advance!!

Hmm easy load that CHARACTER SET into RXB 2015

and type:

CALL INVERSE(ALL)

If you want the definition type CALL CHARPAT(charvalue,$tringvariable)

Edited by RXB
  • Like 2

Share this post


Link to post
Share on other sites

Thanks Rich.

This has made me realize something obvious. I can invert the patterns OR I can simply reverse the colours of the alternate charset at ASCII 128, which would be much faster to do.  I gotta write some code.

 

  • Like 2

Share this post


Link to post
Share on other sites

As it turns out I am accumulating enough tools in the CAMEL99 library that I could write this as a little script that does the following:

  1. Allocates a buffer in low memory
  2. copies the font patterns into the buffer
  3. copies the buffer back to patterns for chars >80 and up
  4. compiles a little program to invert the high ascii chars
  5. compiles a program to see the characters
  6. inverts the characters
  7. shows the characters
  8. releases the memory
  9. removes itself from Forth

I am pretty happy with it. :)

\ HIGHFONT script copy font into the 8bit range & INVERT

NEEDS MARKER FROM DSK1.MARKER

MARKER REMOVE  ( erases everything in Forth to here)

NEEDS MALLOC FROM DSK1.MALLOC

HEX
800 CONSTANT PDT   ( Pattern table address)
800 CONSTANT 2K
400 CONSTANT 1K

2K MALLOC CONSTANT MYBUFFER

PDT MYBUFFER      1K VREAD  ( read low chars to buffer)
MYBUFFER PDT 1K + 1K VWRITE ( write them back to 8bit chars)

: INVERTCHARS ( -- )
     PDT 1K +   \ start VDP address
     1K         \ number of bytes
     BOUNDS ( -- VDPend VDPstart )
     DO
       I [email protected] INVERT I VC!
     LOOP ;

: .CHARSET  CR 101 0 DO I EMIT LOOP ; ( show 256 chars)

INVERTCHARS
.CHARSET

2K MFREE  ( release the memory)
REMOVE    ( remove all this from Forth)

The video is running Normal speed.

Edit: Replaced video clip with clean version

 

 

Edited by TheBF
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...