Add ES/Lab/LAB4/HEXtoBCD.asm
This commit is contained in:
parent
f13066ce58
commit
e7a49b6432
1 changed files with 39 additions and 0 deletions
39
ES/Lab/LAB4/HEXtoBCD.asm
Normal file
39
ES/Lab/LAB4/HEXtoBCD.asm
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
AREA RESET, DATA, READONLY
|
||||||
|
EXPORT __Vectors
|
||||||
|
__Vectors
|
||||||
|
DCD 0x10001000
|
||||||
|
DCD Reset_Handler
|
||||||
|
ALIGN
|
||||||
|
|
||||||
|
AREA MYCODE, CODE, READONLY
|
||||||
|
ENTRY
|
||||||
|
EXPORT Reset_Handler
|
||||||
|
|
||||||
|
Reset_Handler
|
||||||
|
LDR R0, =SRR
|
||||||
|
LDR R1, [R0]
|
||||||
|
MOV R4, #0
|
||||||
|
MOV R11, #1
|
||||||
|
MOV R10, #3
|
||||||
|
|
||||||
|
LOOP
|
||||||
|
MOV R5, #10
|
||||||
|
UDIV R3, R1, R5
|
||||||
|
MUL R6, R3, R5
|
||||||
|
SUB R7, R1, R6
|
||||||
|
MUL R8, R7, R11
|
||||||
|
ADD R4, R4, R8
|
||||||
|
LSL R11, R11, #4
|
||||||
|
MOV R1, R3
|
||||||
|
SUBS R10, #1
|
||||||
|
BNE LOOP
|
||||||
|
|
||||||
|
STOP
|
||||||
|
B STOP
|
||||||
|
|
||||||
|
SRR DCD 0x45
|
||||||
|
|
||||||
|
AREA mydata, DATA, READWRITE
|
||||||
|
SRC DCD 0x45
|
||||||
|
|
||||||
|
END
|
Loading…
Add table
Add a link
Reference in a new issue