poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Non-ASCII systems and poke


From: Jose E. Marchesi
Subject: Non-ASCII systems and poke
Date: Sat, 18 Jul 2020 13:41:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi John, people.
I just found these remarks among my notes:

12:21 <jmd> The manual talks a lot about ASCII.
12:21 <jmd> But does poke use ASCII even on machines whose normal
            character encodind, is (for example) EBCDIC?
13:02 <jemarch> I don't know, never tried
13:02 <jemarch> thats a good point
13:06 <jmd> Need to have a .set character-encoding cmd ?
13:12 <jmd> It would also be necesary to adjust the %c directive in
            printf

First, Poke's "characters" are defined to be unsigned integers in the
range 0..255.  So we are limited to character encodings using that
range.

When characters are converted to strings, for example in:

  (poke) 'o' as string
  "o"

it uses the ctos PVM instruction:

   push    0x6fUB
   ctos    
   nip

which eventually uses a C string like this:

   str[0] = c;

On the other hand, in order to display string values we print the C
string corresponding to the string value.

So yes, if the system used a different encoding for characters than
ASCII, then these remarks in the manual are wrong.

It would be nice to have the .set character-encoding setting, to allow
poking data in which the characters are encoded differently, but I am
not sure if the involved effort would be worth it...

Thoughts?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]