Jump to content
IGNORED

[IntyBASIC] - A more colourful font


GroovyBee
 Share

Recommended Posts

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 :-

post-21935-0-98382800-1455578814_thumb.gif

 

Source code :-

Gram2GromFont.bas

 

Any problems or questions let me know.

  • Like 4
Link to comment
Share on other sites

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

  • Like 2
Link to comment
Share on other sites

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 by carlsson
  • Like 1
Link to comment
Share on other sites

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 :P.

Link to comment
Share on other sites

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

  • Like 2
Link to comment
Share on other sites

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* 8)-1) to stop it from writing into the space graphic

Edited by Kiwi
  • Like 3
Link to comment
Share on other sites

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...

 

post-14916-0-32600800-1455728449_thumb.gif

 

Grom2GramFont.bas

 

 

Catsfolly

 

 

  • Like 3
Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

 

 

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.

  • Like 1
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...