Jump to content

Photo

Large Capital Letters in BASIC


35 replies to this topic

#26 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,848 posts
  • HarmlessLion
  • Location:BUR

Posted Thu Aug 10, 2017 6:09 PM

The jump tables are fixed in all known revisions -- for the older bank switched copy cartridges I wrote a generic loader to load the character set from assembly, and it worked on 99/4, 99/4A, and 99/4A v2.2.

Code is attached here. Also includes the subroutines used for setting address, copying bytes, etc.

The main trick is in the "GPLVDP" function which parses the jump table and the first instruction of the GPL subroutine to determine the address in GROM of the character set. It does both uppercase and lowercase (small capitals) sets.

Spoiler


(Edit: new almost-universal code. I couldn't come up with a way to autodetect the lowercase set's size, but everything else is now automatically determined through inspection instead of assumed. ;) Sample app included).

Edited by Tursi, Thu Aug 10, 2017 9:34 PM.


#27 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,848 posts
  • HarmlessLion
  • Location:BUR

Posted Thu Aug 10, 2017 6:19 PM

Well, the GPL jump table starts at >0010 in GROM 0. The “Load Standard Character Set” routine vector is at >0016. All of these vectors are “BR @address” GPL instructions, which will be >4000 + GROM address.  If you extract that address and add 5 to it, the next 2 bytes will be the address of the Standard Character Set table. From Heiner Martin’s book:


After reading that and reading my code, I was curious why it's different... my loader only works if the first instruction is a DEST, as the small capitals and lowercase functions both are. I didn't realize that the /large/ capitals would have a different codeset...

So I'll go back and patch my code to support the first instruction being a MOVE too, cause now I want it to be complete. ;)

#28 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 399 posts
  • Location:The Great White North

Posted Thu Aug 10, 2017 7:59 PM

Thanks Lee

How did I ever work with the 99 before I met you?

B

#29 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 399 posts
  • Location:The Great White North

Posted Thu Aug 10, 2017 8:34 PM

The jump tables are fixed in all known revisions -- for the older bank switched copy cartridges I wrote a generic loader to load the character set from assembly, and it worked on 99/4, 99/4A, and 99/4A v2.2.

Code is attached here. Also includes the subroutines used for setting address, copying bytes, etc.

The main trick is in the "GPLVDP" function which parses the jump table and the first instruction of the GPL subroutine to determine the address in GROM of the character set. It does both uppercase and lowercase (small capitals) sets.

Spoiler

 

 

Thanks Tursi.  

 

I will borrow these ideas for  finding the character table ... one day.  :)

 

I did make the CHARSET word in high level Forth using the GVMOVE function.

It is not as fast as the BIG chars but not a noticeable delay for most purposes.

HEX
: ]GFONT ( ascii -- grom_adr) BL -  7 * 6B4 + ;  \ GROM array of TI Font data

: CHARSET ( -- )
        [CHAR] ~ 1+ BL                    \ all ASCII chars
        DO  
           I ]GFONT                       \ get GROM address for char I
           I ]PDT                         \ get PDT address for char I
           0 OVER VC!                     \ store 1st zero in VDP
             1+                           \ inc PDT address
             7 GVMOVE                     \ write 7 bytes GROM->VDP
        LOOP ;
        


Edited by TheBF, Thu Aug 10, 2017 8:35 PM.


#30 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 399 posts
  • Location:The Great White North

Posted Thu Aug 10, 2017 8:48 PM

Timings:

 

: BIGCAPS  ( -- ) 4B4 900  200 GVMOVE  ;    \  18.4 mS

 

CHARSET  143 mS                ( approx. 72 mS for upper case only)

 

So not too shabby.  Less than 4 times slower than ALC.

 

B



#31 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 3,988 posts
  • Location:Denmark

Posted Fri Aug 18, 2017 11:46 PM

Here's the standard capital character made just a little bigger.
 
100 call clear::call screen(14)::print "ABCDEFGHIJKLMNOPQRSTUVWXYZ"::for c=65 to 90
110 call charpat(c,c$)::c$=seg$(c$,3,4)&seg$(c$,5,12)::call char(c,c$)::next c
120 input c$::goto 120
 
                       
bigletters3.anim.gif

#32 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 399 posts
  • Location:The Great White North

Posted Sat Aug 19, 2017 4:03 AM

That's a pretty cool trick. You are the font master.

 

I added these simply routines to my system to access GROM without the Assembly language

: GROM  ( addr -- ) SPLIT 9C02 C! 9C02 C! ;

: GC@+   ( -- char)  9800 C@ ;  \ read & auto-increment address

: GVMOVE  ( grom_addr vdp_addr cnt -- ) \ GROM->VDP move
          ROT GROM
          BOUNDS DO  GC@+  I VC!  LOOP ;

: BIGCAPS  ( -- ) 4B4  20 ]PDT  200 GVMOVE  ;

Which let me write this demo


: TEST  GRAPHICS 
        8 9 AT-XY     ." TEXAS INSTRUMENTS"
       10 11 AT-XY       ." HOME COMPUTER"
        2 16 AT-XY     ." READY-PRESS ANY KEY TO BEGIN"
        4 22 AT-XY (c) ." 1981  TEXAS INSTRUMENTS"

        0 0 AT-XY 0 4 DO I . 1000 MS   -1 +LOOP
        
        0 0 BL 10 HCHAR

        BIGCAPS

        BEGIN KEY? UNTIL
        BYE  ;

Attached Files


Edited by TheBF, Sat Aug 19, 2017 4:03 AM.


#33 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 399 posts
  • Location:The Great White North

Posted Thu Sep 7, 2017 10:13 AM

As I am testing out my system I am trying to run other peoples Forth Code.

This BANNER routine uses a data matrix to define big fonts. All I had to do was add my version of the UPPER routine to convert chars

and my BYTES word to compile the data matrix and it worked.

 

Spoiler

Attached Files



#34 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 399 posts
  • Location:The Great White North

Posted Thu Sep 7, 2017 10:43 PM

As I looked at this code I realized that the TI-99 already has a bit pattern for all the characters in the VDP RAM.

In CAMEL99 I call the pattern table PDT and you can access the pattern address of any character with ]PDT.

 

So I removed the UPPER case filter and  the offset used to start all characters at >20 (space character) and substituted ]PDT.

With this I can get the bit pattern for any ASCII character in the TI-charset.

 

Then I replaced the memory character fetch ( C@ ) with the VDP version ( VC@ ) so that I read the pattern from VDP RAM.

 

After those changes I can print out any TI-99 character in this banner form without using another table of patterns.

 

That saves a lot of space since I only need this code and it works. 

: BANNER ( str len -- )
    8 0 DO  CR                       
           2DUP BOUNDS       \ convert str,len to end/start addresses
​           ?DO               \ I is address of each char in string
              I C@ ]PDT J +  VC@    \ read VDP byte PDT[ascii,j]              
​              2 7 DO
                    DUP 1 I LSHIFT AND
                    IF  ." #"  ELSE  ."  "  THEN
              -1 +LOOP  
​              DROP  
           LOOP                       
    LOOP  
​    2DROP ;

Attached Files


Edited by TheBF, Thu Sep 7, 2017 10:59 PM.


#35 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,432 posts
  • Location:Silver Run, Maryland

Posted Fri Sep 8, 2017 5:11 AM

As I looked at this code I realized that the TI-99 already has a bit pattern for all the characters in the VDP RAM.

In CAMEL99 I call the pattern table PDT and you can access the pattern address of any character with ]PDT.

 

I just assumed speed was the reason you did not use the PDT. Of course, we all know what “assume” does.

 

...lee



#36 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 399 posts
  • Location:The Great White North

Posted Fri Sep 8, 2017 7:25 AM

 

I just assumed speed was the reason you did not use the PDT. Of course, we all know what “assume” does.

 

...lee

 

 

The think you assumed perhaps,  that I am as smart as you are.  :)

It takes me a little longer to connect the dots or bits as in this case.

 

I was out of this arena for over 20 years doing product marketing and then general management. (be kind)  

There are lots of rusty parts in this old head about software and Forth, but I am applying a little oil every day.

 

B


Edited by TheBF, Fri Sep 8, 2017 7:27 AM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users