Search code examples
arraysassembly68hc11

How to create an array in assembly for 68hc11?


I need to write a program that will execute from $100, allocate a 200-byte array at $800, and initialize that array with the values 200, 199, … 1.

I need to know how to create a loop that will decrement an array while decrementing the value to be stored in an array.

Any ideas or suggestions? I cannot find alot of example code for this processor.

ORG  $100

      LDAA #200
      STAA #$800
      DECA
      BNE  

Solution

  • Vreset              equ       $FFFE
    RAM                 equ       $800
    ROM                 equ       $100
    
    ARRAY_SIZE          equ       200
    
                        org       RAM
    
    array               rmb       ARRAY_SIZE
    
                        org       ROM
    
    Start               ldx       #array
                        ldaa      #ARRAY_SIZE
    Loop                staa      ,x
                        inx
                        deca
                        bne       Loop
    
                        bra       *
    
                        org       Vreset
                        dw        Start