CopyProgramToSDRAM.asm 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ; Test program to verify the copy to SDRAM and jump functionality of the ROM bootloader
  2. Main:
  3. CopyCode:
  4. addr2reg CodeToCopy r1 ; r1 = (src) address of the code to copy, stored in ROM
  5. load 0 r2 ; r2 = (dst) address 0 of SDRAM: 0x00, and loop var
  6. load 16 r4 ; r4 = number of words to copy
  7. CopyStartLoop:
  8. ; copy ROM to SDRAM
  9. read 0 r1 r15
  10. write 0 r2 r15
  11. add r1 1 r1 ; incr ROM address
  12. add r2 1 r2 ; incr SDRAM address
  13. beq r2 r4 2 ; copy is done when SDRAM address == number of words to copy at the start
  14. jump CopyStartLoop ; copy is not done yet, copy next address
  15. jump 0 ; jump to sdram
  16. CodeToCopy:
  17. .dw 0b00011100000001000000000000010001 ; Set r1 to 1024
  18. .dw 0b00011100000000000001000001010101 ; Set r5 to 16
  19. .dw 0b11010000000000000000010100010000 ; Write value in r1 to address in r5 with offset 0
  20. .dw 0b11100000000000000000010100000010 ; Read from address in r5 to r2
  21. .dw 0b11111111111111111111111111111111 ; Halt
  22. .dw 6 7 8 9 10 11 12 13 14 15 16
  23. Int:
  24. readintid r1
  25. reti