Jump to content
OxC0FFEE

redefine charset using string instead of data; thwarted by special chars

Recommended Posts

Hi,

 

New/old A8 basic coder here (haven't touched it in ~30y). Trying to remember how to use ML strings to redefine character sets...

 

My most immediate problem is that I can't get certain characters on the screen. CHR$(127) does not output the right-facing triangle character. I need to get that in a string to redefine my character set but I'm forgetting how. The screenshot attached shows another person's program that contains said character in a string, but I don't know how it was done.

 

I have access to Atari800MacX, Envision on a windows XP VM, and I'm open to other mac/win/a8 tools if there's an easy-peasy character set generator that outputs what I need. I also don't mind converting the values by hand into ATASCII but I figure there's easier ways :)

 

My requirements are that the code be self-contained in the basic file and that it be as compact as possible, so I can't use external files to load the charset data, and I figure strings are better than data statements.

post-50996-0-06327300-1486046909_thumb.png

Edited by OxC0FFEE

Share this post


Link to post
Share on other sites

Funny how my memory works. I often can't remember what I had for dinner one or two nights ago, but I remembered this, and verified on my real machine.

 

Type ESC (escape key), then hit the tab key.

Share this post


Link to post
Share on other sites

! thank you! :) And I know what you mean about long-disused latent memories.

 

Does anyone know if there's a general-purpose escaping method for all non-printing characters into strings, not just 127?

Share this post


Link to post
Share on other sites

Yeah - any character you want to print (such as the arrow for clear-screen), just hit ESC before typing the character.

Share this post


Link to post
Share on other sites

Carriage returns would still have to be handled with STRING$(X,X)=CHR$(155), tho. BTW if the data or ML routine is short enough, you don't need to DIM a string variable for it. Just USR(ADR("{ml routine}")).

  • Like 4

Share this post


Link to post
Share on other sites

Carriage returns would still have to be handled with STRING$(X,X)=CHR$(155), tho.

 

Also, the double quote character. CHR$(34) ?

  • Like 1

Share this post


Link to post
Share on other sites

Carriage returns would still have to be handled with STRING$(X,X)=CHR$(155), tho. BTW if the data or ML routine is short enough, you don't need to DIM a string variable for it. Just USR(ADR("{ml routine}")).

 

I seem to recall making a variable to point to the string (ROUTINE=ADR("ML_ROUTINE")) and then poking in quotes and carriage returns (POKE ROUTINE+n,155) before calling the subroutine. Best of both worlds. :)

Share this post


Link to post
Share on other sites

With implied assignment, e.g. A$="abcdef" the trouble is with embedding quotes and Return code.

With DATA statements the trouble is with embedding commas and Return code.

 

IMO the best method is a mix of reading and concatenating from DATA then use the method FJC suggested. Maintain extra data elsewhere of indexes into the string where characters need to be changed to those codes.

Or in the case where there aren't many occurrences to be fixed just include the program code to do the change, e.g. A$(400,400)="," : POKE ADR(A$)+600,155

Actually that second example would probably be better due to less memory use. Also note with the Poke method, use <string index - 1>

Share this post


Link to post
Share on other sites

I have a utility called convert.bas which does all this for you and even messes with the variable name table so that you can use string assignments to write directly to memory

 

Http://atariage.com/forums/topic/147473-basic-program-fonts-wanted-in-string-format/?p=1813361&fromsearch=1#entry1813361

Edited by Synthpopalooza
  • Like 2

Share this post


Link to post
Share on other sites

I always seemed to be running out of space in BASIC and data statements eat RAM. :)

 

Yup. Even if data is worked down to strings in data statements or assignments there is still redundant data.

 

The most efficient use of memory is having no string data staged as DATA or assignments. Instead, put it in a file (or files) and read it at startup.

 

Unfortunately, Atari BASIC is brain damaged when using CIO to put/get arbitrary lengths of binary data, so a program has to do it the slow way and GET one character at a time. (OSS BASIC XL and others have working Bget commands that fix this.)

 

I posted a bit of blather about this in the blog including a new version of XIO that does what it should, here:

 

http://atariage.com/forums/blog/576/entry-13185-part-10-of-11-simple-assembly-for-atari-basic/

Edited by kenjennings
  • Like 1

Share this post


Link to post
Share on other sites

Poke 766,1 I seem to recall there were more then a few problems with this like you have to get to a clean line and enter poke 766,0 before you could move the cursor back up to hit enter on the line. Worked great for cls character anyway. IIRC the technique was something like hit BREAK key repeatedly to move down screen.

  • Like 2

Share this post


Link to post
Share on other sites

 

Yup. Even if data is worked down to strings in data statements or assignments there is still redundant data.

not necessarily for strings - if your routine is relocatable you can keep and run it directly from string, so no overhead here.

 

On quotes and return char -- few times I have avoided them by redesigning the data/code. It's just another constraint ; )

Share this post


Link to post
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.

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