1. poke2 question

Hi,

I have a (maybe stupid) question concerning 16-bit-ISA addressing. The
hardware of an special ISA card in question is controlled via writing
16-bit-words from a base address on above 1 MB. I do know two
possibilities using Euphoria:

1.  	poke(address,{byte1,byte2})

and

2.  	poke(address  ,byte1)
	poke(address+1,byte2) .

Is the effect on the hardware the same or is it different? And what
would be the EU-code which should be equivalent with the C-function for
writing a (16 bit-) Word?

Any idea or advice?
 Thanks, Rolf

new topic     » topic index » view message » categorize

2. Re: poke2 question

> Hi,
>
> I have a (maybe stupid) question concerning 16-bit-ISA addressing. The
> hardware of an special ISA card in question is controlled via writing
> 16-bit-words from a base address on above 1 MB. I do know two
> possibilities using Euphoria:
>
> 1.  poke(address,{byte1,byte2})
>
> and
>
> 2.  poke(address  ,byte1)
> poke(address+1,byte2) .
>
> Is the effect on the hardware the same or is it different? And what
> would be the EU-code which should be equivalent with the C-function for
> writing a (16 bit-) Word?

Both are equivalent, although preference would be given to the first method,
as it should be faster. In this case it's trivial though.
There is no specific method for poking words to memory.
To poke bytes, use the methods above.
To poke a 16bit number, use this..
      poke(address,{remainder(num,256),floor(num/256)})

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: poke2 question

>To poke a 16bit number, use this..
>       poke(address,{remainder(num,256),floor(num/256)})


Though this would be faster:

  poke(address,{and_bits(num,255),floor(num/256)})

or (probably) even:

  poke(address,{num, floor(num/256)})

since poke() only will store the lower 8 bits of the first value anyway.

new topic     » goto parent     » topic index » view message » categorize

4. Re: poke2 question

> Hi,

> I have a (maybe stupid) question concerning 16-bit-ISA addressing. The
> hardware of an special ISA card in question is controlled via writing
> 16-bit-words from a base address on above 1 MB. I do know two
> possibilities using Euphoria:

> 1.      poke(address,{byte1,byte2})

> and

> 2.      poke(address  ,byte1)
>         poke(address+1,byte2) .

They should be pretty much the same, except the second will be a
little slower...

> Is the effect on the hardware the same or is it different? And what
> would be the EU-code which should be equivalent with the C-function for
> writing a (16 bit-) Word?

Untested, but this should write a 16-bit value contained in "Word" to
"Address"

include machine.e
sequence bytes
bytes = int_to_bytes(Word)
poke(Address,Word[1..2])

> Any idea or advice?
>  Thanks, Rolf

Thomas Parslow (PatRat) ICQ #:26359483
Rat Software
http://www.rat-software.com/
Please leave quoted text in place when replying

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu