Entry condition: Formatted floating-point operand in [R0].
Exit information: OV=1 overflow, OV=0 conversion success: The absolute value of the fixed-point number is in [R0] (double byte), the sign
is in bit 1FH, F0=1 is an integer, CY=1 is a one-byte integer and a one-byte decimal, otherwise it is a pure decimal.
Affected resources: PSW, A, B, R2, R3, R4, bit 1FH Stack requirements: 6 bytes
FTOD: LCALL MVR0; transfer [R0] to the first work area
MOV A, R2
JZ FTD4; the exponent is zero, pure decimal
JB ACC.7, FTD4; the exponent is negative, pure decimal
SETB C
SUBB A, #10H
JC FTD1
SETB OV; the exponent is greater than 16, overflow
RET
FTD1: SETB C
MOV A, R2
SUBB A, #8; is the exponent greater than 8?
JC FTD3
FTD2: MOV B,#10H ; if the exponent is greater than 8, convert it as a double-byte integer
LCALL FTD8
SETB F0 ; set up a double-byte integer flag
CLR C
CLR OV
RET
FTD3: MOV B,#8 ; convert it as a one-byte integer to a one-byte decimal
LCALL FTD8
SETB C ; set up a one-byte integer to a one-byte decimal flag
CLR F0
CLR OV
RET
FTD4: MOV B,#0 ; convert it as a pure decimal
LCALL FTD8
CLR OV ; set up a pure decimal flag
CLR F0
CLR C
RET
FTD8: MOV A,R2 ; right-normalize according to the specified number of integer digits
CJNE A,B,FTD9
MOV A,R3 ; transfer the double-byte result to [R0]
MOV @R0,A
INC R0
MOV A,R4
MOV @R0,A
DEC R0
RET
FTD9: CLR C
LCALL RR1 ; right-normalize once
SJMP FTD8
Previous article:Convert floating point BCD code into formatted floating point number
Next article:Convert a double-byte hexadecimal fixed-point number into a formatted floating-point number
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- How can a car's keyless entry system be hacked?
- What is a battery monitoring system (BMS)? What are its main functions? What is the BMS architecture? This article explains
- I want to learn quantum mechanics by myself. What kind of mathematics books should I read first? Thank you.
- What books are there on the desk for reading? [Show it]
- Actual development and experience of the second phase
- Problems with using modelsim
- Open source tutorial: Smart rainforest tank based on ESP8266 and Gizwits Cloud, low cost and high intelligence
- Grasp the future of smart cars, Dadatong will help you unlock the new generation of ADAS technology. The live broadcast with prizes is waiting for you on June 19th!
- EEWORLD University Hall----Live Replay: Fujitsu talks about automotive-grade FRAM and German-quality naked-eye 3D video technology
- Python is terrible? Developers summarize 8 reasons