zzip Posted October 13, 2021 Share Posted October 13, 2021 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 Quote Link to comment Share on other sites More sharing options...
mono Posted October 13, 2021 Share Posted October 13, 2021 125 GRAPHICS 0 126 OPEN #1,4,0,"D:MYFONT.FNT" 130 FOR I=0 TO 1023 165 CLOSE #1 Quote Link to comment Share on other sites More sharing options...
zzip Posted October 13, 2021 Author Share Posted October 13, 2021 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? Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted October 13, 2021 Share Posted October 13, 2021 Line 150 would need to multiply GRTOP by 256 first as it's the page # Quote Link to comment Share on other sites More sharing options...
zzip Posted October 13, 2021 Author Share Posted October 13, 2021 27 minutes ago, Wrathchild said: Line 150 would need to multiply GRTOP by 256 first as it's the page # Wow, yeah that makes sense and that could easily explain why things were crashing! Quote Link to comment Share on other sites More sharing options...
mono Posted October 13, 2021 Share Posted October 13, 2021 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. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted October 13, 2021 Share Posted October 13, 2021 1 hour ago, mono said: you need to read 1024 bytes Presumably not if you only intend to use half the charset ? Quote Link to comment Share on other sites More sharing options...
zzip Posted October 14, 2021 Author Share Posted October 14, 2021 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 Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted February 20, 2022 Share Posted February 20, 2022 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? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted February 20, 2022 Share Posted February 20, 2022 2 hours ago, Justin Payne said: I wanted to save it to my hard drive so when I went into options, I selected N, .M65, 10, 10, OK. What are you using, what options ? Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted February 20, 2022 Share Posted February 20, 2022 24 minutes ago, TGB1718 said: What are you using, what options ? After hitting OK, I go to SAVE and put in the file name. Quote Link to comment Share on other sites More sharing options...
matosimi Posted February 20, 2022 Share Posted February 20, 2022 @zzip you can use BGET in Turbo Basic XL and load whole charset much faster using single command without FOR loop. Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted February 20, 2022 Share Posted February 20, 2022 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. Quote Link to comment Share on other sites More sharing options...
zzip Posted February 22, 2022 Author Share Posted February 22, 2022 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. Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted February 22, 2022 Share Posted February 22, 2022 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) 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.