Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. ;TESTS: ACCESS AND BANKED MEMORY
  2.  
  3. MOVLB 01 ; set BSR to select Bank 1
  4. MOVLW 0x01; Move the value of 1 to W
  5. MOVWF 0x01, ACCESS; ;Move the value in W to the 1 register in ACCESS
  6. MOVWF 0x01, BANKED; ;Move the value in W to the 1 register in BANKED
  7.  
  8. ADDWF 0x01, f, ACCESS ;Add W to the file register at location 1 in ACCESS
  9. ADDWF 0x01, f, BANKED ;Add W to the file register at location 1 in ACCESS
  10.  
  11.  
  12. UDATA_ACS
  13. VAR1 res 1
  14. VAR2 res 1
  15. VAR3 res 1
  16. VAR4 res 1
  17. VAR5 res 1
  18. VAR6 res 1
  19.  
  20. ; Declare a code section at 0x0 named 'RST'. This instruction sends the
  21. ; program to the actual start of the program.
  22. RST code 0x0000
  23. GOTO Setup
  24.  
  25. ; Declare a code section at 0x0030. This is where the actual program logic will start
  26. SRT code 0x0030
  27. Setup:
  28. ;TESTS: W AND F USAGE
  29. MOVLW 0xA3 ;Move A3 to W
  30. MOVWF VAR1, ACCESS ;Move W to VAR1
  31. MOVLW 0xA2 ;Move A2 to W
  32. MOVWF VAR2, ACCESS ;Move W to VAR2
  33. MOVFF VAR1, VAR3 ;Move Var1 to Var3
  34. MOVF VAR2, W, ACCESS ;Move Var2 to W
  35. MOVWF VAR4, ACCESS ;Move W to Var 4
  36.  
  37.  
  38.  
  39.  
  40.  
  41. UDATA_ACS
  42. VAR1 res 1
  43. VAR2 res 1
  44. VAR3 res 1
  45. VAR4 res 1
  46. VAR5 res 1
  47. VAR6 res 1
  48.  
  49. ; Declare a code section at 0x0 named 'RST'. This instruction sends the
  50. ; program to the actual start of the program.
  51. RST code 0x0000
  52. GOTO Setup
  53.  
  54. ; Declare a code section at 0x0030. This is where the actual program logic will start
  55. SRT code 0x0030
  56. Setup:
  57. ;Load addresses with numbers
  58. MOVLW 0x1
  59. MOVWF VAR4
  60. MOVLW 0x5
  61. MOVWF VAR5
  62. MOVLW 0x10
  63. MOVWF VAR6
  64.  
  65. ;Load the FSR with these addresses
  66. LFSR 0, VAR4
  67. LFSR 1, VAR6
  68. LFSR 2, VAR6
  69.  
  70. ;Reference the addresses and do stuff
  71. movf PREINC0, W ;Increment the address which is 0 is at
  72. MOVWF VAR2 ;The next number after VAR4 is VAR5
  73. movf PREINC1, W ;....... which 1 is at
  74. MOVWF VAR3 ;There is no variable stored after VAR6, hence 0
  75.  
  76. MOVLW 0x4
  77. MOVFF INDF2, PLUSW2 ;Move forward 4 spots and then put VAR6 there
  78.  
  79.  
  80.  
  81.  
  82. TABLES YEZYUS
  83. ; MOVLW 0x30
  84. ; MOVWF TBLPTRL
  85. ; TBLRD*
  86. ; MOVF TABLAT, W
  87. ; MOVWF VAR2, ACCESS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement