8086 Debug commands for assembly language

Source: Internet
Author: User
Tags first row

The code below, write the data section of the value, first saved to the stack, and then bounce out from the stack, put back the data section, after the execution, data section of the data, in turn.

Assume cs:code,ds:data,ss:stack
data segment
	DW 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
data Ends
Stack segment
	DW 0,0,0,0,0,0,0,0
stack ends
code segment
start:
	mov ax,stack
	mov ss , Ax
	mov sp,16
	
	mov ax,data
	mov ds,ax
	mov bx,0
	mov cx,8
s:
	push [BX]
	add bx,2
	loop s
	mov bx,0
	mov cx,8
s0:
	pop [bx]
	add bx,2
	loop s0
	mov ax,4c00h
	int 21h
code ends
end Start


Generate EXE with MASM and link, then debug

Input u, display assembly instructions

Enter R to display the contents of the register and the next assembly instructions

Enter T, step through, and display the register contents and next assembly instructions

Enter G 0010 to display the contents of the register that executes to the 18d3:0010 at the cx,0008 before MOV

Enter d ds:0, display data segment + offset 0 and its subsequent data

As shown in the figure, the first row of data is the data in the data section of the program

Enter d ss:0 to display the data at the stack segment + offset 0 and back

Enter G 001a so that the first loop is executed and then enter D ss:0 to display the data in the stack

Looking at the first line, the data in the data segment has been pressed into the stack, then the result after the second loop has been executed.

Enter G 0027, then D ds:0, then D ss:0

See, the data in the data segment has been reversed.

Input T, single step to 21H interrupt

Enter P, run interrupt, and end the program

Enter Q to exit debug

Some of the above debug commands are often used by me at this time. University has learned assembly language, but has forgotten a lot, now review, by the way, to record, for later memories.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.