Jump to content

Photo

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

atari 8-bit development character set ml tools ATASCII

12 replies to this topic

#1 OxC0FFEE OFFLINE  

OxC0FFEE

    Space Invader

  • 15 posts

Posted Thu Feb 2, 2017 8:53 AM

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.

Attached Thumbnails

  • Screen Shot 2017-01-31 at 13.09.45.png

Edited by OxC0FFEE, Thu Feb 2, 2017 8:54 AM.


#2 Stephen OFFLINE  

Stephen

    Quadrunner

  • 7,463 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Thu Feb 2, 2017 10:00 AM

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.



#3 OxC0FFEE OFFLINE  

OxC0FFEE

    Space Invader

  • Topic Starter
  • 15 posts

Posted Thu Feb 2, 2017 10:14 AM

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



#4 Stephen OFFLINE  

Stephen

    Quadrunner

  • 7,463 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Thu Feb 2, 2017 12:18 PM

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



#5 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,857 posts
  • Location:The land of Gorch

Posted Thu Feb 2, 2017 12:46 PM

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}")).

#6 kenjennings OFFLINE  

kenjennings

    Dragonstomper

  • 789 posts
  • Me + sio2pc-usb + 70 old floppies
  • Location:Florida, USA

Posted Thu Feb 2, 2017 9:16 PM

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

 

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



#7 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 14,326 posts
  • Location:United Kingdom

Posted Fri Feb 3, 2017 7:08 AM

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



#8 Rybags OFFLINE  

Rybags

    Gridrunner

  • 15,993 posts
  • Location:Australia

Posted Fri Feb 3, 2017 6:46 PM

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>



#9 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 14,326 posts
  • Location:United Kingdom

Posted Sat Feb 4, 2017 6:32 AM

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

#10 Synthpopalooza OFFLINE  

Synthpopalooza

    Stargunner

  • 1,472 posts
  • Location:knoxville, TN

Posted Sat Feb 4, 2017 8:14 AM

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, Sat Feb 4, 2017 8:22 AM.


#11 kenjennings OFFLINE  

kenjennings

    Dragonstomper

  • 789 posts
  • Me + sio2pc-usb + 70 old floppies
  • Location:Florida, USA

Posted Sat Feb 4, 2017 12:10 PM

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/...or-atari-basic/


Edited by kenjennings, Sat Feb 4, 2017 12:11 PM.


#12 ricortes OFFLINE  

ricortes

    Dragonstomper

  • 632 posts

Posted Sat Feb 4, 2017 12:13 PM

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.



#13 pirx OFFLINE  

pirx

    Moonsweeper

  • 447 posts
  • Location:Poland

Posted Sat Feb 18, 2017 1:47 PM

 

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







Also tagged with one or more of these keywords: atari 8-bit, development, character set, ml, tools, ATASCII

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users