Re: poke2 (2)

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message ----- 
From: <r.schr at t-online.de>
To: "EUforum" <EUforum at topica.com>
Subject: poke2 (2)

> Hi hardware freaks,
> 
> what i really want to know: a piece of Euphoria code which has the same
> impact on the hardware as the following piece of C code:
> 
> /***** Begin of C-Code   *****/
> 
>   int *ip;  /* address of 16-bit word */
>   
>    ip = 0x200000; /* starting address of hardware memory */
>   *ip = 0xABCD; /* writing 16-bit word at address 0x200000 */
> 
> /***** End of C-Code   *****/
> 
> Thanks, Rolf

You could try this...

  integer INTEL
  atom  a
  atom ip

  -- See what sort of "endian" chip this is
  a = allocate(4)
  poke4(a, 1)
  INTEL = peek(a)
  free(a)


  ip = #200000
  if INTEL then
      poke(ip, {#CD, #AB})
  else
      poke(ip, {#AB, #CD})
  end if

----
Derek

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu