Created
April 9, 2012 06:13
-
-
Save CCodeWarrior/2341909 to your computer and use it in GitHub Desktop.
A very short demonstration for mul and timer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Probano unidad de multiplicacion de JPU16 | |
; Autor: Jonathan Castro | |
; JPU16ASM | |
; | |
; | |
TMRCTRL equ 0xA000 | |
TMRPR equ 0x6000 | |
TMRCNT equ 0x2000 | |
DDRA equ 0x0001 | |
PORTA equ 0x0002 | |
data | |
operando1: word 1 | |
operando2: word 1 | |
resultado: word 1 | |
code | |
move r0, 0 | |
move [operando1], r0 | |
move [operando2], r0 | |
move r1, 48828 | |
out TMRPR, r1 | |
move r1, 0x003B | |
out TMRCTRL, r1 | |
move r1, 0xFFFF | |
out DDRA, r1 | |
out PORTA, r0 | |
lazo: | |
nop | |
nop | |
jmp lazo | |
ISR: | |
move r4, [operando2] | |
add r4, 1 | |
cmp r4, 10 | |
jl operar | |
move r4, 0 | |
move r5, [operando1] | |
add r5, 1 | |
cmp r5, 10 | |
jl operar | |
move r5, 0 | |
operar: | |
move r6, r4 | |
mul r6, r5 | |
move [resultado], r6 | |
out PORTA, r6 | |
move [operando2], r4 | |
move [operando1], r5 | |
ieret | |
code 0x1FF | |
jmp ISR | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment