And rough notes. You can check the function of interrupt 21 on the Internet. I hope it can help you.
; Function: hello world! Output of the string
;Register association: code segment code is associated with code segment register CS,
;data segment data is associated with data segment register DS.
assume CS:code,DS:data
;data segment definition
data segment
data ends
; Code segment definition
code segment
;Program starts
:
code ends
end start
Disassembly analysis of hello world:
The disassembly results are as follows:
-u
0C32:0000 B8310C
0C32:0003 8ED8
0C32:0005 BA0000
0C32:0008 B409
0C32:000A CD21
0C32:000C B44 C
0C32: 000E CD21
0C32:0010 0426
0C32:0012 807F0403
0C32:0016 7507
0C32:0018 26
0C32:0019 807F0A00
0C32:001D 7437
0C32:001F A15827
The single step is as follows:
-t
AX=0C31
DS=0C21
0C32:0003 8ED8
From the disassembled code, we can know that the segment address of the data segment is assigned by the OS to 0C31 and sent to AX
The code end segment address is 0C32 and is latched by CS.
The stack segment address is the same as the data segment address, but SP and IP have the same starting value, so it may cause some problems.
Continue single-stepping:
-t
AX=0C31
DS=0C31
0C32:0005 BA0000
The value of AX has been sent to DS. It can be seen that the starting value of the address in the general segment is 0.
Single step:
0C32:0005 BA0000
-t
AX=0C31
DS=0C31
0C32:0008 B409
The value of DX is reset to 0.
Single step:
AX=0931
DS=0C31
0C32:000A CD21
09 is sent to the high eight bits of AX
Single step:
AX=0931
DS=0C31
00A7:107C 90NOP
Trigger interrupt 21, program jump
The following are some interrupt functions. Since the students have not learned them yet, the disassembly analysis will stop here for the time being.
Finally, take a look at the memory storage:
-d 0c31:0
0C31:0000
0C31:0010
0C31:0020
0C31:0030
It can be seen that our procedure was successful.
Previous article:Calculation of delay time in single chip microcomputer C language
Next article:MSP430 clock setting and application summary
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- I would like to ask you how to use timequest to analyze the delay time of the delay chain in FPGA.
- [Qinheng Trial] Experience of CH549 capacitive touch function
- RS485 communication issues in MSP430F169
- Raspberry Pi PICO low-resolution thermal imager
- Reversible USB port
- Why does the power consumption of stm32L0 increase after it enters STOP mode again after being woken up by an external interrupt in STOP mode?
- [TI millimeter wave radar evaluation]_4_boost board evaluation encountered problems 2
- Using registers to do STM8 UART1 error request help
- BearPi-HM Nano Development Board Review 0 Unboxing and Development Environment Setup
- I found another DK IOT STUDIO online IDE that runs RAPID IOT. I guess they are the same but distributed on different websites.