28 October 2018, 21:48 | #1 |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Why does this work?
Code:
Rem AMOS Pro 2,00 Rem WHY DOES THIS WORK? Rem AS DEEKS & DOKES are to odd addresses??? Reserve As Data 5,1000 ST=Start(5)+1 N=1 For I=ST To ST+31 Step 2 Doke I,N Print I;",";Deek(I) N=N*2 Next I |
28 October 2018, 21:50 | #2 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
|
it works because amos can read byte per byte and rebuild the 16 bit word... My Oric already had DEEK & DOKE and was 8 bit.
|
28 October 2018, 22:01 | #3 | |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Quote:
DEEK function: read two bytes from an even address word=Deek(address) DEEK reads a two-byte "word" at a specified address. This address must be even, or an address error will be generated. DOKE instruction: change a two-byte word at an even address Doke address,number Use the DOKE command to copy a two-byte number between 0 and 65535 into the memory location at a specified even address. Only DOKE into places where you are certain of safety, because indiscriminate use of this command will almost certainly crash your Amiga! (My Underlines) It does not throw up an "address error" and it seems to work ok in this case. |
|
28 October 2018, 22:39 | #4 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
|
oh then it works because you're using a 68020+. 68020 and higher are able to read words on odd addresses.
|
28 October 2018, 22:58 | #5 | |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Quote:
I didn't know that. I am indeed using an A1200 environment and AMOS 2.00 But even so (leading on to my next question)........... Sometimes this seems very flaky. Is there a way of writing/reading a mixture of 8/16 bit integers to consecutive memory locations reliably (odd or even) on all 68X? for instance I may have sequence $F0 $00 $E710 to be saved (& retrieved) from arbitory addresses as 8 or 16 bit numbers (obviously $E710 is 16 bit & the others are 8 bit) How would I deal with this without wasting the odd addresses? I'll never need a number above $FFFF but I could waste a LOT of space by aligning and losing the odd bytes |
|
28 October 2018, 23:02 | #6 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
|
use custom DOKE (resp DEEK):
Code:
POKE(address,(value / 256) & 0xFF); POKE(address+1,value & 0xFF); |
01 November 2018, 21:12 | #7 |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Thanks, that has solved my problem nicely
for reference...... I did Poke address,value and $FF Poke address+1,(value / 256) and $FF to enter the values and value =Peek(address)+256*Peek(address+1) to retrieve the value. |
01 November 2018, 21:16 | #8 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
|
With that, you'll get the same value when writing & reading but you're actually writing your data with the wrong endianness.
address must have MSB, so (value / 256), and address+1 must have LSB, so value and $FF. Your 2 errors make up, but the data is written in the wrong endian direction. Try a double POKE on an even address, then a real DEEK you'll see what I mean |
01 November 2018, 23:14 | #9 | |
Registered User
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
|
Quote:
It works here just now and it's only for some location data which i'm trialing. (Unless you can see any problems down the line)....... |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting More to work | methodman | support.Apps | 2 | 15 April 2018 13:09 |
does it work everywhere or not | meynaf | Coders. Asm / Hardware | 1 | 28 June 2016 23:32 |
How do I get F4 to work? | mrvp | support.FS-UAE | 3 | 30 August 2015 20:31 |
Why no more work on OS 3.9? | mfletcher | Amiga scene | 7 | 10 May 2009 11:47 |
Does this work? | BarrySWE | support.Apps | 1 | 05 October 2005 18:39 |
|
|