English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 26 November 2019, 20:30   #1
Fireball
Registered User

 
Join Date: Jan 2019
Location: Werne
Posts: 8
Problem with AsmOne Adress Register Indirect

Hello Amiga Coders,

currently I try to understand the ARI with AsmOne.

In my test case I would like to store the last element (6) in the d1 register but when I run my code I got a value like 00030000 in d1 and I have no idea why? When I use a word (2 Byte) instead of a long word (4 Byte) my example works fine.

Here comes my testing code.
Code:
main: 
    clr.l d0
    clr.l d1
    move.l #llist,a0
    move.l (a0),d0
    move.l 12(a0,d0),d1 ; 003000 as result :-(
   
fini:
    rts

llist: dc.l 2
       dc.l 1,2,3
       even
Code:
main: 
    move.l #wlist,a0
    move (a0),d0	
    move 4(a0,d0),d1 ; 00000003 as result in d1 :-)		

fini:
    rts

wlist: dc 2 
       dc 1,2,3
       even
I hope someone can help me with my problem.

Best regards

Fb :-)
Fireball is offline  
Old 26 November 2019, 20:45   #2
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 178
Use
llist: dc.l 4
instead because you are using longwords, which are 4 bytes each. And 8(a0,d0.l), otherwise you'll be out of bounds.
a/b is offline  
Old 27 November 2019, 00:18   #3
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 51
Posts: 1,195
Quote:
Originally Posted by Fireball View Post
Hello Amiga Coders,

currently I try to understand the ARI with AsmOne.

In my test case I would like to store the last element (6) in the d1 register but when I run my code I got a value like 00030000 in d1 and I have no idea why? When I use a word (2 Byte) instead of a long word (4 Byte) my example works fine.

Here comes my testing code.
Code:
main:  
    clr.l d0 ;d0=0
    clr.l d1 ;d1=0
    move.l #llist,a0
    move.l (a0),d0 ;d0=2
    move.l 12(a0,d0),d1 ; 12+2+A0, d1=$0003xxxx
   
fini:
    rts


llist: dc.l 2
       dc.l 1,2,3
       even
Code:
main: 
    move.l #wlist,a0
    move (a0),d0	
    move 4(a0,d0),d1 ; 00000003 as result in d1 :-)		

fini:
    rts

wlist: dc 2 
       dc 1,2,3
       even
I hope someone can help me with my problem.

Best regards

Fb :-)
Your code reads longword from llist+14 offset.
Better always set size for instructions move.w, dont use only "move", same for "dc".
Don_Adan is offline  
Old 27 November 2019, 12:55   #4
Fireball
Registered User

 
Join Date: Jan 2019
Location: Werne
Posts: 8
Thank you I'll try this tonight. :-)
Fireball is offline  
Old 27 November 2019, 21:54   #5
Fireball
Registered User

 
Join Date: Jan 2019
Location: Werne
Posts: 8
OK thank you! Now it works. My mistake was that I have to change dc 2 in dc 4 when I use long word. You safe my day. :-)
Fireball is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AsmOne and IncBin Nightshft Coders. Asm / Hardware 2 26 November 2019 16:36
Address register indirect, word vs long deimos Coders. Asm / Hardware 4 15 November 2019 16:58
Strange indirect addressing with index Soundy support.WinUAE 3 23 July 2019 09:05
indirect Filesystem autoconfig Leandro Jardim support.WinUAE 5 09 September 2015 12:54
AsmOne even directive...? pmc Coders. General 30 04 December 2009 09:33

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:28.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06335 seconds with 13 queries