Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/02/03 10:57
Read: times


 
#53861 - RE: array in asm51
Responding to: ???'s previous message
In ASM51 an array is not an intrinsic element of the language. Thus it is necessary for you to manage the data yourself. In the case of making an array of 1 byte values the following example may help you understand how to do this.
   ...
   ...
DSEG  AT     030H     ;setup data area
IDX   DS     1        ;index for array 
ARY   Ds     10       ;array of 10 bytes
   ...
   ...
   ...
CSEG  AT     040H     ;part of code area for the sample
;
INIT:                 ;loop to initialize the array 
      MOV    IDX, #0  ;initialize the array index
;
      MOV    R2,#10   ;setup loop counter for array
ILOOP:
      MOV    A, IDX   ;make pointer to next element
      ADD    A, #ARY
      MOV    R0, A    ;put pointer into R0
      MOV    @R0, IDX ;set element equal to index value
                      ;(just as an example)
      INC    IDX      ;increment the index
      DEC    R2       ;decrement the loop counter
      JNZ    ILOOP    ;loop through size of array
;
    ...
    ...


Hope this helps
Michael Karas


List of 7 messages in thread
TopicAuthorDate
array in asm51            01/01/70 00:00      
   RE: array in asm51            01/01/70 00:00      
   RE: array in asm51            01/01/70 00:00      
      RE: array in asm51            01/01/70 00:00      
         RE: array in asm51            01/01/70 00:00      
   RE: array in asm51            01/01/70 00:00      
   RE: array in asm51            01/01/70 00:00      

Back to Subject List