Jump to content
IGNORED

Changing Fonts in BASIC help


zzip

Recommended Posts

I'm returning to Atari 8-bit programming for the first time in probably 35 years.    I created some map/font in EnvisionPC for use in a possible game.   But when I load and set the font I'm having issues.

 

The following code just freezes or hangs the emulator I'm using.    (It's Turbo Basic XL if that matters).    Assume the file is open at this point.   In line 130 if I load say 256 bytes it won't crash, but if I go higher it does.   If it hits an end of file, it should give me an error, right?   Not hang/crash?   Also no matter how many bytes I successfully load in, line 170 doesn't seem to change the font.   Am I doing something wrong here?

100 MEMTOP=PEEK(106)
110 GRTOP=MEMTOP-4
120 POKE 106, GRTOP
130 FOR I=0 TO 511
140 GET #1,A
150 POKE GRTOP+I,A
160 NEXT I
170 POKE 756,GRTOP

 

Link to comment
Share on other sites

26 minutes ago, mono said:

125 GRAPHICS 0

126 OPEN #1,4,0,"D:MYFONT.FNT"

130 FOR I=0 TO 1023

165 CLOSE #1

I didn't include the open and close command because it's loading more data before this from the same file.    Assuming the file opened and closed successfully, is there anything else wrong with the code I posted?

Link to comment
Share on other sites

5 hours ago, zzip said:

I didn't include the open and close command because it's loading more data before this from the same file.    Assuming the file opened and closed successfully, is there anything else wrong with the code I posted?

You need to "relocate" screen by reopening it after POKE 106,n if you need to reserve and protect memory over the screen - it's done in my code by GRAPHICS instruction.

Additionally you need to read 1024 bytes from file, because character set contains 128 characters (128*8=1024) - I've changed end range from 511 to 1023 in FOR instruction in my snippet of code.

Link to comment
Share on other sites

16 hours ago, mono said:

Additionally you need to read 1024 bytes from file, because character set contains 128 characters (128*8=1024) - I've changed end range from 511 to 1023 in FOR instruction in my snippet of code.

Yeah I know, but originally it was crashing if I read 1024 bytes, so I lowered it to try to debug it

Link to comment
Share on other sites

  • 4 months later...

Slightly off topic question but since you've been able to save your modified character set, I'm wondering if you can tell me what I might be missing. I wanted to save it to my hard drive so when I went into options, I selected N, .M65, 10, 10, OK. Then, back at the edit screen I hit Save, put in a file name,  and hit enter. Figuring this would be saved to the same directory as EnvisionPC, I went there and nothing. Is there something I'm missing?

Link to comment
Share on other sites

I think I might have figured out the problem. I looked at the file timestamps and 2006 was quite a long time ago. I just downloaded version 0.9 and will try to duplicate each character by placing them side by side. Kind of a pain but I guess I should have checked to make sure what I saved actually saved.

Link to comment
Share on other sites

On 2/20/2022 at 4:51 PM, matosimi said:

@zzip you can use BGET in Turbo Basic XL and load whole charset much faster using single command without FOR loop.

I know, my goal was to eventually use Turbo Basic commands to speed anything up that I could.

 

But this was a refresher for 8-bit programming for me.   I created a character set and map, and all I wanted to do is display it onscreen in BASIC.   Once that worked I could proceed to turn it into a game.

 

But I spent too much time struggling with that simple task.   Either it crashed, the character set would appear corrupted and the colors where always wrong.  I checked through Mapping the the Atari and other docs to try to figure out what I was doing wrong, and couldn't find it.    I just gave up working on it.

Link to comment
Share on other sites

15 minutes ago, zzip said:

Either it crashed, the character set would appear corrupted and the colors where always wrong. 

If it's crashing I think it would point to the char set being loaded somewhere that's corrupting

BASIC, I think character sets have to be on a 1K boundary, usual way is lower RAMTOP then

POKE 106,PEEK(106)-4

open your graphics screen afterwards, your reserved memory area is then safe (until reset pressed)

 

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...
  • Recently Browsing   0 members

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