Add ES/Lab/LAB4/HEXtoBCD2.asm
This commit is contained in:
parent
b75a878a7f
commit
0afb3ab4bd
1 changed files with 43 additions and 0 deletions
43
ES/Lab/LAB4/HEXtoBCD2.asm
Normal file
43
ES/Lab/LAB4/HEXtoBCD2.asm
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
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 R2, R1
|
||||||
|
MOV R3, #0
|
||||||
|
|
||||||
|
DIV_LOOP
|
||||||
|
CMP R2, #10
|
||||||
|
BLT DIV_DONE
|
||||||
|
SUB R2, R2, #10
|
||||||
|
ADD R3, R3, #1
|
||||||
|
B DIV_LOOP
|
||||||
|
|
||||||
|
DIV_DONE
|
||||||
|
MUL R8, R2, R11
|
||||||
|
ADD R4, R4, R8
|
||||||
|
LSL R11, R11, #4
|
||||||
|
MOV R1, R3
|
||||||
|
SUBS R10, R10, #1
|
||||||
|
BNE LOOP
|
||||||
|
|
||||||
|
STOP
|
||||||
|
B STOP
|
||||||
|
|
||||||
|
SRR DCD 0x45
|
||||||
|
|
||||||
|
END
|
Loading…
Add table
Add a link
Reference in a new issue