EASy68K  
It is currently Sat Aug 24, 2019 7:47 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Apr 07, 2019 8:21 pm 
Offline

Joined: Sun Apr 07, 2019 8:11 pm
Posts: 1
So i have this array which i intialiazed using ds.l
Code:
 array1 ds.l 10
. I know i can access a the array by loading it and using it like:
Code:
lea array1, a0
move.l (a0)+,d1

but is there a way to access a specific number without looping through it? i tried do
Code:
move.l (a0,d1),d1
but that doesn't work. Is there a way to do that?


Top
 Profile  
 
PostPosted: Mon Apr 08, 2019 12:58 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1101
Code:
*-----------------------------------------------------------
* Program    : Array programming
* Written by : Charles Kelly
* Date       : April, 2019
* Description:
*-----------------------------------------------------------
    ORG $1000

START:              ; first instruction of program

    lea array1,A0       ; pointer to array
    clr.l   D2          ; index = 0
    move.l  #$42,(A0,D2)  ; store $42 to array at index D2
   
    *OR
   
    lea array2,A0       ; pointer to array
    move.l  #$65,(4,A0)  ; store $65 to array at array2 + 4
       
    MOVE.B  #9,D0
    TRAP    #15     ; halt simulator

* Variables and Strings
array1  ds.l    10  ; 10 long word array
array2  ds.l    10  ; 10 long word array

    END START       ; last line of source

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 151 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group