r3d4 icon indicating copy to clipboard operation
r3d4 copied to clipboard

Confusion with test snippet results (cell width vs variables?)

Open raydeejay opened this issue 3 years ago • 1 comments

the following code

^r3/lib/gui.r3

#mystr "hello you" "ahoy" "excuse" 0

#cellA #cellB
#cellC $12345678   #cellD $87654321
#cellE $1234567890abcdef

| #anon  [ 0 7 gotoxy  "anon here" print ; ]

:>>str  | a -- a'
  ( c@+ 1? drop ) drop
  dup c@ 0? ( 2drop 'mystr ; ) drop ;

:main
    cls home
    0 0 gotoxy  xypen "X: %d Y: %d" print
    0 1 gotoxy  'cellB 'cellA - "default variable size: %d" print
    0 3 gotoxy  "3 4 +  " print   3 4 + .b emits

    0 5 gotoxy  cellC "cellC: %x" print
    0 6 gotoxy  cellD "cellD: %x  (what?)" print
    [ 0 7 gotoxy  "anon here" print ; ] ex   | how to store elsewhere?
    0 8 gotoxy  cellE "cellE: %x  (what?)" print
    0 10 gotoxy  $1234567890abcdee 1 + "cell width %x" print

    15 15 gotoxy  'mystr >>str >>str >>str print
    xypen atxy  "Hello Human!" print
    key
      >esc< =? ( exit )
      >n<   =? ( exit )
    drop ;


: 'main onshow ;

produces the result in the attached image... which has me slightly confused :-D can you shed some light on it?

image

raydeejay avatar Apr 06 '21 19:04 raydeejay

the size of var are 32 bits by default

#cellE $890abcdef $1234567

    0 8 gotoxy  'cellE q@ "cellE: %x  (what?)" print

get the value from memory preverse sign, but traslate to 64bits!! if you use only the 32bits unsigned you can add "$ffffffff and"

Ray, write me a email !!

phreda4 avatar Apr 06 '21 20:04 phreda4