Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;TESTS: ACCESS AND BANKED MEMORY
- MOVLB 01 ; set BSR to select Bank 1
- MOVLW 0x01; Move the value of 1 to W
- MOVWF 0x01, ACCESS; ;Move the value in W to the 1 register in ACCESS
- MOVWF 0x01, BANKED; ;Move the value in W to the 1 register in BANKED
- ADDWF 0x01, f, ACCESS ;Add W to the file register at location 1 in ACCESS
- ADDWF 0x01, f, BANKED ;Add W to the file register at location 1 in ACCESS
- UDATA_ACS
- VAR1 res 1
- VAR2 res 1
- VAR3 res 1
- VAR4 res 1
- VAR5 res 1
- VAR6 res 1
- ; Declare a code section at 0x0 named 'RST'. This instruction sends the
- ; program to the actual start of the program.
- RST code 0x0000
- GOTO Setup
- ; Declare a code section at 0x0030. This is where the actual program logic will start
- SRT code 0x0030
- Setup:
- ;TESTS: W AND F USAGE
- MOVLW 0xA3 ;Move A3 to W
- MOVWF VAR1, ACCESS ;Move W to VAR1
- MOVLW 0xA2 ;Move A2 to W
- MOVWF VAR2, ACCESS ;Move W to VAR2
- MOVFF VAR1, VAR3 ;Move Var1 to Var3
- MOVF VAR2, W, ACCESS ;Move Var2 to W
- MOVWF VAR4, ACCESS ;Move W to Var 4
- UDATA_ACS
- VAR1 res 1
- VAR2 res 1
- VAR3 res 1
- VAR4 res 1
- VAR5 res 1
- VAR6 res 1
- ; Declare a code section at 0x0 named 'RST'. This instruction sends the
- ; program to the actual start of the program.
- RST code 0x0000
- GOTO Setup
- ; Declare a code section at 0x0030. This is where the actual program logic will start
- SRT code 0x0030
- Setup:
- ;Load addresses with numbers
- MOVLW 0x1
- MOVWF VAR4
- MOVLW 0x5
- MOVWF VAR5
- MOVLW 0x10
- MOVWF VAR6
- ;Load the FSR with these addresses
- LFSR 0, VAR4
- LFSR 1, VAR6
- LFSR 2, VAR6
- ;Reference the addresses and do stuff
- movf PREINC0, W ;Increment the address which is 0 is at
- MOVWF VAR2 ;The next number after VAR4 is VAR5
- movf PREINC1, W ;....... which 1 is at
- MOVWF VAR3 ;There is no variable stored after VAR6, hence 0
- MOVLW 0x4
- MOVFF INDF2, PLUSW2 ;Move forward 4 spots and then put VAR6 there
- TABLES YEZYUS
- ; MOVLW 0x30
- ; MOVWF TBLPTRL
- ; TBLRD*
- ; MOVF TABLAT, W
- ; MOVWF VAR2, ACCESS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement