CopyProgramToSDRAM.asm 1.3 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 0b00011100000000000000010100010001 ;Set r1 to 5 //27
  18. .dw 0b00011100000000000000001000100010 ;Set r2 to 2 //28 [Done, -> int]
  19. .dw 0b00000011000000000000000100100011 ;Compute r1 + r2 and write result to r3 //29
  20. .dw 0b00000011000000000000001100100011 ;Compute r3 + r2 and write result to r3 //2A
  21. .dw 0b11111111111111111111111111111111 ; Halt
  22. .dw 6 7 8 9 10 11 12 13 14 15 16
  23. Int:
  24. readintid r1
  25. reti