Jump to content

Photo

Large Capital Letters in BASIC


29 replies to this topic

#26 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,710 posts
  • 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,710 posts
  • 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

  • 280 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

  • 280 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

  • 280 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






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users