Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global asm_main
- .align 4
- Zmemory: .space 2000000
- .align 4
- asm_main:
- LDR R12, =# 0xE000102C
- LDR R0, =# 0xE0001004
- LDR R9, =# 0x020
- STR R9, [R0]
- LDR R1, =# 0xE0001018
- LDR R9, =# 62
- STR R9, [R1]
- LDR R2, =# 0xE0001034
- LDR R9, =# 6
- STR R9, [R2]
- LDR R3, =# 0xE0001000
- LDR R9, =# 0x117
- STR R9, [R3]
- LDR R5, =# 0xE0001030
- MOV R0, #0
- MOV R1, #0
- MOV R2, #0
- MOV R3, #0
- LDR R9, = Zmemory
- LDR R4,=#0x41220000
- initialdelete:
- MOV R0, #0
- MOV R1, #0
- MOV R6, #0
- MOV R7, #0
- MOV R10, #0
- BL deleteMem
- B switch7On
- switch7On:
- LDR R1, [R4] ;@ loads switch values
- BL debouncer
- TST R1, #128 ;@ tests if SW7 on on
- BNE check ;@ if SW7 on, check UART status
- ;@MOV R1, #0
- ;@STR R1, [R5]
- BEQ ResetRegisters ;@ if SW7 off, reset registers and go to switch off mode
- check:
- LDR R7, [R12] ;@ Loads Status Reg. into R7
- LSR R7, #1 ;@ LSR to get bit that matters
- TST R7, #1 ;@ if bit is 0, there is mem to be read, if 1, it is empty
- BNE switch7On ;@ If UART empty, recheck switch value
- BEQ read ;@ If not empty, store byte into Zmem
- read:
- LDRB R6, [R5] ;@ Load value from UART into R6
- STRB R6, [R9, R10] ;@ Store byte into offset of Zmem
- ADD R10, R10, #1 ;@ R10 will be amount of bytes stored
- B switch7On ;@ Check Switches
- ResetRegisters:
- MOV R7, #0
- MOV R6, #0
- B Switch7Off
- Switch7Off:
- LDR R1, [R4] ;@ Load Switch value
- BL debouncer
- TST R1, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ executeZmem ;@ If switch still zero, execute code
- executeZmem:
- LDRB R11, [R9,R7] ;@ Execute values in Zmem
- BL CheckUART
- STRB R11, [R5] ;@ Push stored value onto UART
- CMP R7, R10 ;@ Compares new counter to total bytes, if equal, Zmem done executing
- BEQ DoneExecuting
- ADD R7, R7, #1
- BNE Switch7Off
- CheckUART:
- LDR R6, [R12] ;@ Checks if UART
- LSR R6, #13
- TST R6, #1
- BNE CheckUART
- MOV R15, R14
- DoneExecuting:
- LDR R1, [R4] ;@ Load Switch value
- BL debouncer
- TST R1, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ DoneExecuting ;@ If switch still zero, execute code
- debouncer:
- LDR R0, =#2 ;@ CHANGE
- B debounce
- debounce:
- SUBS R0, R0, #1
- BNE debounce
- MOV R0, #0
- MOV R15, R14
- zeroZmem:
- MOV R0, #0
- MOV R1, #0
- MOV R6, #0
- MOV R7, #0
- MOV R10, #0
- BL deleteMem
- B switch7On
- deleteMem:
- LDRB R0, =#0
- STRB R0, [R9, R1]
- ADD R1, #1
- LDR R2, =#1 ;@ CHANGE TO 2MILLION
- CMP R1, R2
- BNE deleteMem
- MOV R15, R14
- -------------------------------------------------------------------------------------------------------------------------------
- .global asm_main
- .align 4
- Zmemory: .space 2000000
- .align 4
- asm_main:
- LDR R12, =# 0xE000102C
- LDR R0, =# 0xE0001004
- LDR R9, =# 0x020
- STR R9, [R0]
- LDR R1, =# 0xE0001018
- LDR R9, =# 62
- STR R9, [R1]
- LDR R2, =# 0xE0001034
- LDR R9, =# 6
- STR R9, [R2]
- LDR R3, =# 0xE0001000
- LDR R9, =# 0x117
- STR R9, [R3]
- LDR R5, =# 0xE0001030
- MOV R0, #0
- MOV R1, #0
- MOV R2, #0
- MOV R3, #0
- LDR R7, = Zmemory
- LDR R9,=#0x41220000
- initialdelete:
- MOV R0, #0
- MOV R1, #0
- MOV R6, #0
- MOV R10, #0
- BL deleteMem
- B switch7On
- switch7On:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ loads switch values
- BL debouncer
- TST R8, #128 ;@ tests if SW7 on on
- BNE check ;@ if SW7 on, check UART status
- ;@MOV R1, #0
- ;@STR R1, [R5]
- BEQ ResetRegisters ;@ if SW7 off, reset registers and go to switch off mode
- check:
- LDR R8, [R12] ;@ Loads Status Reg. into R7
- LSR R8, #1 ;@ LSR to get bit that matters
- TST R8, #1 ;@ if bit is 0, there is mem to be read, if 1, it is empty
- BNE switch7On ;@ If UART empty, recheck switch value
- BEQ read ;@ If not empty, store byte into Zmem
- read:
- LDRB R8, [R5] ;@ Load value from UART into R6
- STRB R8, [R7, R10] ;@ Store byte into offset of Zmem
- ADD R10, R10, #1 ;@ R10 will be amount of bytes stored
- B switch7On ;@ Check Switches
- ResetRegisters:
- MOV R7, #0
- MOV R6, #0
- B Switch7Off
- Switch7Off:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ executeZmem ;@ If switch still zero, execute code
- executeZmem:
- LDRB R8, [R7,R11] ;@ Execute values in Zmem
- BL CheckUART
- STRB R11, [R5] ;@ Push stored value onto UART
- CMP R7, R10 ;@ Compares new counter to total bytes, if equal, Zmem done executing
- BEQ DoneExecuting
- ADD R11, R11, #1
- BNE Switch7Off
- CheckUART:
- PUSH{R8, R9}
- LDR R8, [R12] ;@ Checks if UART
- LSR R8, #13
- TST R8, #1
- BNE CheckUART
- POP{R8, R9}
- MOV R15, R14
- DoneExecuting:
- LDR R1, [R4] ;@ Load Switch value
- BL debouncer
- TST R1, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ DoneExecuting ;@ If switch still zero, execute code
- debouncer:
- PUSH {R8}
- LDR R8, =#2 ;@ CHANGE
- B debounce
- debounce:
- SUBS R8, R8, #1
- BNE debounce
- MOV R8, #0
- POP {R8}
- MOV R15, R14
- zeroZmem:
- MOV R10, #0
- BL deleteMem
- B switch7On
- deleteMem:
- LDRB R0, =#0
- STRB R0, [R9, R1]
- ADD R1, #1
- LDR R2, =#1 ;@ CHANGE TO 2MILLION
- CMP R1, R2
- BNE deleteMem
- MOV R15, R14
- ------------------------------------------------------------------------------------------------------------------------------------
- .global asm_main
- .align 4
- Zmemory: .space 2000000
- .align 4
- asm_main:
- LDR R0, =# 0xE0001004
- LDR R9, =# 0x020
- STR R9, [R0]
- LDR R1, =# 0xE0001018
- LDR R9, =# 62
- STR R9, [R1]
- LDR R2, =# 0xE0001034
- LDR R9, =# 6
- STR R9, [R2]
- LDR R3, =# 0xE0001000
- LDR R9, =# 0x117
- STR R9, [R3]
- LDR R5, =# 0xE0001030
- MOV R0, #0
- MOV R1, #0
- MOV R2, #0
- MOV R3, #0
- MOV R11, #0
- LDR R7, = Zmemory
- LDR R9,=#0x41220000
- initialdelete:
- BL deleteMem
- B switch7On
- switch7On:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ loads switch values
- BL debouncer
- TST R8, #128 ;@ tests if SW7 on on
- BNE check ;@ if SW7 on, check UART status
- ;@MOV R1, #0
- ;@STR R1, [R5]
- BEQ ResetRegisters ;@ if SW7 off, reset registers and go to switch off mode
- check:
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Loads Status Reg. into R7
- LSR R8, #1 ;@ LSR to get bit that matters
- TST R8, #1 ;@ if bit is 0, there is mem to be read, if 1, it is empty
- BNE switch7On ;@ If UART empty, recheck switch value
- BEQ read ;@ If not empty, store byte into Zmem
- read:
- LDRB R8, [R5] ;@ Load value from UART into R6
- STRB R8, [R7, R10] ;@ Store byte into offset of Zmem
- ADD R10, R10, #1 ;@ R10 will be amount of bytes stored
- B switch7On ;@ Check Switches
- ResetRegisters:
- MOV R7, #0
- MOV R8, #0
- B Switch7Off
- Switch7Off:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ executeZmem ;@ If switch still zero, execute code
- executeZmem:
- LDR R7, = Zmemory
- LDRB R8, [R7,R11] ;@ Execute values in Zmem
- BL CheckUART
- STRB R8, [R5] ;@ Push stored value onto UART
- CMP R10, R11 ;@ Compares new counter to total bytes, if equal, Zmem done executing
- BEQ DoneExecuting
- ADD R11, R11, #1
- BNE Switch7Off
- CheckUART:
- PUSH {R8, R9}
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Checks if UART
- LSR R8, #13
- TST R8, #1
- BNE CheckUART
- POP {R8, R9}
- MOV R15, R14
- DoneExecuting:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ DoneExecuting ;@ If switch still zero, execute code
- debouncer:
- PUSH {R8}
- LDR R8, =#2 ;@ CHANGE
- B debounce
- debounce:
- SUBS R8, R8, #1
- BNE debounce
- MOV R8, #0
- POP {R8}
- MOV R15, R14
- zeroZmem:
- BL deleteMem
- B switch7On
- deleteMem:
- PUSH {R8, R10, R11}
- LDR R7, = Zmemory
- LDRB R8, =0
- STRB R8, [R7, R11]
- ADD R11, R11, #1
- LDR R10, =#1 ;@ CHANGE to 2mill
- CMP R10, R11
- BNE deleteMem
- POP {R8, R10, R11}
- MOV R15, R14
- --------------------------------------------------------------------------------------------------------------------------------
- .global asm_main
- .align 4
- Zmemory: .space 2000000
- .align 4
- asm_main:
- LDR R0, =# 0xE0001004
- LDR R9, =# 0x020
- STR R9, [R0]
- LDR R1, =# 0xE0001018
- LDR R9, =# 62
- STR R9, [R1]
- LDR R2, =# 0xE0001034
- LDR R9, =# 6
- STR R9, [R2]
- LDR R3, =# 0xE0001000
- LDR R9, =# 0x117
- STR R9, [R3]
- LDR R5, =# 0xE0001030
- MOV R0, #0
- MOV R1, #0
- MOV R2, #0
- MOV R3, #0
- MOV R11, #0
- LDR R7, = Zmemory
- LDR R9,=#0x41220000
- /*initialdelete:
- BL deleteMem
- B switch7On*/
- switch7On:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ loads switch values
- BL debouncer
- TST R8, #128 ;@ tests if SW7 on on
- BNE check ;@ if SW7 on, check UART status
- ;@MOV R1, #0
- ;@STR R1, [R5]
- BEQ ResetRegisters ;@ if SW7 off, reset registers and go to switch off mode
- check:
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Loads Status Reg. into R7
- LSR R8, #1 ;@ LSR to get bit that matters
- TST R8, #1 ;@ if bit is 0, there is mem to be read, if 1, it is empty
- BNE switch7On ;@ If UART empty, recheck switch value
- BEQ read ;@ If not empty, store byte into Zmem
- read:
- LDRB R8, [R5] ;@ Load value from UART into R6
- STRB R8, [R7, R10] ;@ Store byte into offset of Zmem
- ADD R10, R10, #1 ;@ R10 will be amount of bytes stored
- B switch7On ;@ Check Switches
- ResetRegisters:
- MOV R7, #0
- MOV R8, #0
- MOV R11,#0
- B Switch7Off
- Switch7Off:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ executeZmem ;@ If switch still zero, execute code
- executeZmem:
- LDR R7, = Zmemory
- LDRB R8, [R7,R11] ;@ Execute values in Zmem
- BL CheckUART
- STRB R8, [R5] ;@ Push stored value onto UART
- CMP R10, R11 ;@ Compares new counter to total bytes, if equal, Zmem done executing
- BEQ DoneExecuting
- ADD R11, R11, #1
- BNE Switch7Off
- CheckUART:
- PUSH {R8, R9}
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Checks if UART
- LSR R8, #13
- TST R8, #1
- BNE CheckUART
- POP {R8, R9}
- MOV R15, R14
- DoneExecuting:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ DoneExecuting ;@ If switch still zero, execute code
- debouncer:
- PUSH {R8}
- LDR R8, =#10 ;@ CHANGE
- B debounce
- debounce:
- SUBS R8, R8, #1
- BNE debounce
- MOV R8, #0
- POP {R8}
- MOV R15, R14
- zeroZmem:
- MOV R11, #0
- LDR R10, =#4 ;@ CHANGE to 2mill
- BL deleteMem
- MOV R11, #0
- MOV R10, #0
- MOV R8, #0
- B switch7On
- deleteMem:
- PUSH {R8, R10, R11}
- LDR R7, = Zmemory
- LDRB R8, =0
- STRB R8, [R7, R11]
- ADD R11, R11, #1
- CMP R10, R11
- BNE deleteMem
- POP {R8, R10, R11}
- MOV R15, R14
- ---------------------------------------------------------------------------------------------------------------------------------------
- .global asm_main
- .align 4
- Zmemory: .space 2000000
- .align 4
- asm_main:
- LDR R0, =# 0xE0001004
- LDR R9, =# 0x020
- STR R9, [R0]
- LDR R1, =# 0xE0001018
- LDR R9, =# 62
- STR R9, [R1]
- LDR R2, =# 0xE0001034
- LDR R9, =# 6
- STR R9, [R2]
- LDR R3, =# 0xE0001000
- LDR R9, =# 0x117
- STR R9, [R3]
- LDR R5, =# 0xE0001030
- MOV R0, #0
- MOV R1, #0
- MOV R2, #0
- MOV R3, #0
- MOV R11, #0
- LDR R7, = Zmemory
- LDR R9,=#0x41220000
- /*initialdelete:
- BL deleteMem
- B switch7On*/
- switch7On:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ loads switch values
- BL debouncer
- TST R8, #128 ;@ tests if SW7 on on
- BNE check ;@ if SW7 on, check UART status
- ;@MOV R1, #0
- ;@STR R1, [R5]
- BEQ ResetRegisters ;@ if SW7 off, reset registers and go to switch off mode
- check:
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Loads Status Reg. into R7
- LSR R8, #1 ;@ LSR to get bit that matters
- TST R8, #1 ;@ if bit is 0, there is mem to be read, if 1, it is empty
- BNE switch7On ;@ If UART empty, recheck switch value
- BEQ read ;@ If not empty, store byte into Zmem
- read:
- LDRB R8, [R5] ;@ Load value from UART into R6
- STRB R8, [R7, R4] ;@ Store byte into offset of Zmem
- ADD R4, R4, #1 ;@ R10 will be amount of bytes stored
- B switch7On ;@ Check Switches
- ResetRegisters:
- MOV R7, #0
- MOV R8, #0
- MOV R11,#0
- B Switch7Off
- Switch7Off:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ executeZmem ;@ If switch still zero, execute code
- executeZmem:
- LDR R7, = Zmemory
- LDRB R8, [R7,R11] ;@ Execute values in Zmem
- BL CheckUART
- STRB R8, [R5] ;@ Push stored value onto UART
- CMP R4, R11 ;@ Compares new counter to total bytes, if equal, Zmem done executing
- BEQ DoneExecuting
- ADD R11, R11, #1
- BNE Switch7Off
- CheckUART:
- PUSH {R8, R9}
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Checks if UART is able to take bits of memory, or if its full
- LSR R8, #13
- TST R8, #1
- BNE CheckUART
- POP {R8, R9}
- MOV R15, R14
- DoneExecuting:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ DoneExecuting ;@ If switch still zero, execute code
- debouncer:
- PUSH {R8}
- LDR R8, =#300 ;@ CHANGE
- B debounce
- debounce:
- SUBS R8, R8, #1
- BNE debounce
- MOV R8, #0
- POP {R8}
- MOV R15, R14
- zeroZmem:
- MOV R11, #0
- LDR R10, =#2000 ;@ CHANGE to 2mill
- BL deleteMem
- MOV R11, #0
- MOV R10, #0
- MOV R8, #0
- B switch7On
- deleteMem:
- PUSH {R8, R10, R11}
- LDR R7, = Zmemory
- LDRB R8, =0
- STRB R8, [R7, R11]
- ADD R11, R11, #1
- CMP R10, R11
- BNE deleteMem
- POP {R8, R10, R11}
- MOV R15, R14
- ----------------------------------------------------------------------------------------------------------------------------
- .global asm_main
- .align 4
- Zmemory: .space 2000000
- .align 4
- asm_main:
- LDR R0, =# 0xE0001004
- LDR R9, =# 0x020
- STR R9, [R0]
- LDR R1, =# 0xE0001018
- LDR R9, =# 62
- STR R9, [R1]
- LDR R2, =# 0xE0001034
- LDR R9, =# 6
- STR R9, [R2]
- LDR R3, =# 0xE0001000
- LDR R9, =# 0x117
- STR R9, [R3]
- LDR R5, =# 0xE0001030
- MOV R0, #0
- MOV R1, #0
- MOV R2, #0
- MOV R3, #0
- MOV R11, #0
- LDR R7, = Zmemory
- LDR R9,=#0x41220000
- /*initialdelete:
- BL deleteMem
- B switch7On*/
- switch7On:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ loads switch values
- BL debouncer
- TST R8, #128 ;@ tests if SW7 on on
- BNE check ;@ if SW7 on, check UART status
- ;@MOV R1, #0
- ;@STR R1, [R5]
- BEQ ResetRegisters ;@ if SW7 off, reset registers and go to switch off mode
- check:
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Loads Status Reg. into R7
- LSR R8, #1 ;@ LSR to get bit that matters
- TST R8, #1 ;@ if bit is 0, there is mem to be read, if 1, it is empty
- BNE switch7On ;@ If UART empty, recheck switch value
- BEQ read ;@ If not empty, store byte into Zmem
- read:
- LDRB R8, [R5] ;@ Load value from UART into R6
- STRB R8, [R7, R4] ;@ Store byte into offset of Zmem
- ADD R4, R4, #1 ;@ R10 will be amount of bytes stored
- B switch7On ;@ Check Switches
- ResetRegisters:
- MOV R7, #0
- MOV R8, #0
- MOV R11,#0
- B Switch7Off
- Switch7Off:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ executeZmem ;@ If switch still zero, execute code
- executeZmem:
- LDR R7, = Zmemory
- LDRB R8, [R7,R11] ;@ Execute values in Zmem
- BL CheckUART
- ;@ this is where we decide what to output
- STRB R8, [R5] ;@ Push stored value onto UART
- CMP R4, R11 ;@ Compares new counter to total bytes, if equal, Zmem done executing
- BEQ DoneExecuting
- ADD R11, R11, #1
- BNE Switch7Off
- CheckUART:
- PUSH {R8, R9}
- LDR R9, =# 0xE000102C
- LDR R8, [R9] ;@ Checks if UART is able to take bits of memory, or if its full
- LSR R8, #13
- TST R8, #1
- BNE CheckUART
- POP {R8, R9}
- MOV R15, R14
- DoneExecuting:
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- BL debouncer
- TST R8, #128
- BNE zeroZmem ;@ If switch goes back on, zero out mem, restart
- BEQ DoneExecuting ;@ If switch still zero, execute code
- debouncer:
- PUSH {R8}
- LDR R8, =#25000 ;@ CHANGE
- B debounce
- debounce:
- SUBS R8, R8, #1
- BNE debounce
- MOV R8, #0
- POP {R8}
- LDR R9,=#0x41220000
- LDR R8, [R9] ;@ Load Switch value
- MOV R15, R14
- zeroZmem:
- MOV R11, #0
- LDR R10, =#2000 ;@ CHANGE to 2mill
- BL deleteMem
- MOV R11, #0
- MOV R10, #0
- MOV R8, #0
- MOV R4, #0
- B switch7On
- deleteMem:
- PUSH {R8, R10, R11}
- LDR R7, = Zmemory
- LDRB R8, =0
- STRB R8, [R7, R11]
- ADD R11, R11, #1
- CMP R10, R11
- BNE deleteMem
- POP {R8, R10, R11}
- MOV R15, R14
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement