GroovyBee Posted February 15, 2016 Share Posted February 15, 2016 I thought this would be more useful in a thread on its own. The example shows how to copy the upper case letter cards "A" to "Z" and digits "0" to "9" from the font in GROM into GRAM and then make use of them. Screenshot :- Source code :- Gram2GromFont.bas Any problems or questions let me know. 4 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 16, 2016 Share Posted February 16, 2016 Cool! And in case you want a bit of italics, I just made this variation. It takes a little longer to run, thus I needed to split up the calls. REM ------------------------------------------------------------------------- REM PrepareTheFont - Copy the GROM cards of interest into position in GRAM. REM ------------------------------------------------------------------------- REM REM Notes: REM - In IntyBASIC 1.2.4 this function generates 6 warnings due to forward REM references at the assembly language phase. *These are safe*, but always REM check the project's *.lst file (just in case). REM - Takes 3 VBLANK ticks to execute. REM REM Input: REM Nothing! REM REM Trashes: REM #junk REM REM ------------------------------------------------------------------------- PrepareTheFont: procedure ' Copy "A" to "L" into GRAM at index DEF00. #junk=usr COPYFONT("A",DEF00,12) ' Copy "M" to "Y" into GRAM at index DEF12. #junk=usr COPYFONT("M",DEF12,12) REM The ML routine takes more time, so the calls need to be split further ' Copy "Y" to "Z" into GRAM at index DEF24 #junk=usr COPYFONT("Y",DEF24,2) ' Copy "0" to "9" into GRAM at index DEF26. #junk=usr COPYFONT("0",DEF26,10) end REM ------------------------------------------------------------------------- REM PrepareTheFont - END REM ------------------------------------------------------------------------- REM ------------------------------------------------------------------------- REM COPYFONT - Copy GROM cards to GRAM. REM ------------------------------------------------------------------------- REM REM Notes: REM - Takes 1 VBLANK tick to execute. REM REM Usage: REM USR COPYFONT(A,B,C) REM REM Input: REM A - Starting card in GROM to copy data from (source). REM B - Starting index card in GRAM to copy data to (destination). REM C - Number of consecutive cards to copy. REM REM Returns: REM Nothing! REM REM Trashes: REM r0, r1, r2, r4, r5 REM REM ------------------------------------------------------------------------- asm COPYFONT: PROC asm pshr r5 asm ; Convert 1st parameter into an offset in GROM. asm sll r0, 2 asm sll r0, 1 ; A=A*8 asm addi #$3000, r0 ; A=$3000+(A* asm pshr r0 ; Stack it! asm ; Convert 2nd parameter into an offset in GRAM. asm sll r1, 2 asm sll r1, 1 ; B=B*8 asm addi #$3800, r1 ; B=$3800+(B* asm pshr r1 ; Stack it! asm ; Save the 3rd parameter (length) for later. asm pshr r2 ; Stack it! asm ; Wait for VBLANK to occur. asm call _wait asm ; Get the card's GROM/GRAM start addresses and the number of cards asm ; to copy from the stack. asm pulr r1 ; No of cards to copy. asm pulr r5 ; Destination data pointer in GRAM. asm pulr r4 ; Source data pointer in GROM. asm ; Copy the data from GROM to GRAM (a cards worth at a time). asm @@CopyLoop: asm repeat 3 ; Modified (*) asm mvi@ r4, r0 asm slr r0,1 ; Shift right (*) asm mvo@ r0, r5 asm endr asm repeat 2 ; (*) asm mvi@ r4, r0 asm mvo@ r0, r5 asm endr asm repeat 3 ; (*) asm mvi@ r4, r0 asm sll r0,1 ; Shift left (*) asm mvo@ r0, r5 asm endr asm decr r1 asm bne @@CopyLoop asm ; Work completed! asm pulr pc asm ENDP REM ------------------------------------------------------------------------- REM COPYFONT - END REM ------------------------------------------------------------------------- 2 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 16, 2016 Share Posted February 16, 2016 (edited) Or if your Intellivision is on a diet (adjust calls accordingly): asm @@CopyLoop: asm repeat 8 asm mvi@ r4, r0 asm movr r0,r2 asm slr r0,1 asm andr r2,r0 asm mvo@ r0, r5 asm endr asm decr r1 asm bne @@CopyLoop You can even combine my two variations for a funky, slender, slated font that only remotely looks like the GROM font. Edited February 16, 2016 by carlsson 1 Quote Link to comment Share on other sites More sharing options...
fsuinnc Posted February 16, 2016 Share Posted February 16, 2016 All of this is very cool. Thanks. 1 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 16, 2016 Author Share Posted February 16, 2016 If its OK with you carlsson, I'll add your changes into the next version and allow the programmer to select the font style too. Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 16, 2016 Share Posted February 16, 2016 Absolutely! I was just dabbling with whatever CP1600 instructions are available to see what kind of result I could obtain. 1 Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted February 16, 2016 Share Posted February 16, 2016 I have to ask, what is the reason you copy fonts from GROM into GRAM? If you're making your own fonts for your game, wouldn't it be more effective and practical to define your own character set in ROM to your specifications? -dZ. 1 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 16, 2016 Author Share Posted February 16, 2016 I have to ask, what is the reason you copy fonts from GROM into GRAM? If you're making your own fonts for your game, wouldn't it be more effective and practical to define your own character set in ROM to your specifications? Its just so that you can use more than the first 8 colours. Some people like the Inty font ya know . Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 16, 2016 Author Share Posted February 16, 2016 Thanks to carlsson's code you can now select between one of three fonts styles :- Source code :- Gram2GromFont.bas @nanochess: Feel free to include this in the IntyBASIC distribution. 4 Quote Link to comment Share on other sites More sharing options...
+nanochess Posted February 16, 2016 Share Posted February 16, 2016 Almost I had forget my experiments with fonts years ago based on Texas Instruments datasheet default 8x8 font. I could not resist the temptation to add a 3D effect and use the new CALL syntax of IntyBASIC v1.2.5 Gram2GromFont.bas Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 17, 2016 Author Share Posted February 17, 2016 I took nanochess's version and added a simple GRAM font string printer :- Gram2GromFont.bas 1 Quote Link to comment Share on other sites More sharing options...
First Spear Posted February 17, 2016 Share Posted February 17, 2016 (edited) (redacted) Edited February 17, 2016 by First Spear Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 17, 2016 Author Share Posted February 17, 2016 It also uses commands that are only available with the latest IntyBASIC compiler. You can get IntyBASIC 1.2.5 from a link in the 1st post here. 1 Quote Link to comment Share on other sites More sharing options...
catsfolly Posted February 17, 2016 Share Posted February 17, 2016 This is a cool hack, but... Shouldn't the file be called "Grom2GramFont.bas"? That what it is called in the source code: REM Module: Grom2GramFont.bas REM REM Description: An example of using the GROM font when its been copied to GRAM. REM Author(s): Mark Ball, carlsson and nanochess (both from AtariAge) REM Date: 16/02/16 REM Version: 1.02F A Gram to Grom Font converter would be a pretty nice trick... Catsfolly 2 Quote Link to comment Share on other sites More sharing options...
Kiwi Posted February 17, 2016 Share Posted February 17, 2016 (edited) I woke up with an idea how to do this in IntyBASIC. No assembly requires. mode 0,15 include "constants.bas" for c=0 to 239 #BACKTAB(c)=GRAM+CS_LIGHTBLUE+(c* next c wait for #pointer=0 to ((64*-1) wait #junk=peek($3000+#pointer) poke($3800+#pointer,#junk) next #pointer loop: goto loop It works. I could make it faster to handle wait when a variable = to the other variable. Then reset that variable. EDIT changed the 64*8 to ((64* -1) to stop it from writing into the space graphic Edited February 17, 2016 by Kiwi 3 Quote Link to comment Share on other sites More sharing options...
catsfolly Posted February 17, 2016 Share Posted February 17, 2016 Here is a version that supports a vertically flipped font, which could be used to provide a "mirror reflection" of the regular font (maybe for a title screen for example). Not sure how generally useful such a thing would be, but i might use it... Perhaps it would look better combined with the italics effect... Grom2GramFont.bas Catsfolly 3 Quote Link to comment Share on other sites More sharing options...
Kiwi Posted February 17, 2016 Share Posted February 17, 2016 It could be use as the lettering is over a lake. You could place a blank tile advance colorstack at 200 if the 2nd colorstack is one of the three blue. 2 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 17, 2016 Author Share Posted February 17, 2016 I woke up with an idea how to do this in IntyBASIC. No assembly requires. mode 0,15 include "constants.bas" for c=0 to 239 #BACKTAB(c)=GRAM+CS_LIGHTBLUE+(c* next c wait for #pointer=0 to 64*8 wait #junk=peek($3000+#pointer) poke($3800+#pointer,#junk) next #pointer loop: goto loop It works. I could make it faster to handle wait when a variable = to the other variable. Then reset that variable. With some unrolling you can do more work per loop (not tested) :- #src=$3000 #dest=$3800 for #c=0 to (64* step 8 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 next #c 1 Quote Link to comment Share on other sites More sharing options...
Kiwi Posted February 17, 2016 Share Posted February 17, 2016 With some unrolling you can do more work per loop (not tested) :- #src=$3000 #dest=$3800 for #c=0 to (64* step 8 wait poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 poke(#dest,peek(#src)) #dest=#dest+1: #src=#src+1 next #c It needed a wait in the loop, otherwise it'll partially write the data to the dest before being denied write access. However, with the wait is faster and can write 8 lines of data a frame. 1 Quote Link to comment Share on other sites More sharing options...
+nanochess Posted February 17, 2016 Share Posted February 17, 2016 Ok, I could not resist the temptation to add a digital font using half of the thinning from Carlsson Grom2GramFont.bas 4 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 17, 2016 Author Share Posted February 17, 2016 I took catsfolly's version and added a reflected font, as well as adding a title to each of the font styles :- Source code :- Grom2GramFont.bas 2 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 17, 2016 Author Share Posted February 17, 2016 Ok, I could not resist the temptation to add a digital font using half of the thinning from Carlsson I'll add this to the next release (which might drop out later). 1 Quote Link to comment Share on other sites More sharing options...
+nanochess Posted February 17, 2016 Share Posted February 17, 2016 I'll add this to the next release (which might drop out later). Damn! cross-post! now I will have to wait for adding it to IntyBASIC 1 Quote Link to comment Share on other sites More sharing options...
pimpmaul69 Posted February 17, 2016 Share Posted February 17, 2016 (edited) Nm. I was wrong. Edited February 17, 2016 by pimpmaul69 1 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted February 17, 2016 Author Share Posted February 17, 2016 Damn! cross-post! now I will have to wait for adding it to IntyBASIC I'll leave the update for a couple of hours just in case anybody else comes up with a new font mangling algorithm. Who knew so much mileage could be had from the built in font . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.