The second lesson of assembly language Assignment-Experiment 1

Source: Internet
Author: User
Tags printable characters

Debug command-excerpt from Baidu EncyclopediaA Assembly CommandFunction: Assemble the instruction directly into the machine code input into memory. Description: For the assembly of the small program and modify the target program, all the input numbers are 16-based, the user loaded into the memory of the assembly statement is continuous storage, if no address is specified, and the assembly command is not used, the statement is compiled into the cs:0100 area. Example a:>debug-a 010008f1:0100 mov ah,0908f1:0102 mov dx,10908f1:0105 int 21h;08f1:0107 int 21H; <-xp run cmd debug, it should be int 20h,21h will encounter invalid instruction error08f1:0109 db ' May I help you $ ' 08f1:0115← Leave a status-g← run may I help you run the results program terminated normally indicates normal operationC Comparison CommandFunction: Compare the contents of the two memory areas, and display their addresses and contents if they are different. For example: c4000:0 3F 100 is used to compare the content between 4000:0000-4000:003f and ds:0100-ds:013f: Its display format is as follows: Memory address 1 contains 1 embedded value 2 memory address 2 Example: Compare 4000:0 3F 100 Differences in content-c4000:0 3F 1004000:0000 08f1:01004000:0001 3E 08f1:0101 Display the difference between the content 4000:0002 the FF 08f1:0102 ... ... ..... ..... ....... such as a....... such as a. A. To compare the range within the DS, the segment address does not have to be noted: C 0 4 100; compare ds:0---ds:4 and ds:100---another format for the DS:104C command is as follows: C address 1 L length address 2 such as:-c000:0 L4 0; by 0000:0 with ds:0 starting compared it with-c0000:0 3 0 the command equals, which shows the result as follows: 0000:0000 8A C0 08f1:00000000:0001 08f1:0001 They compare 4 bytes 0000:0002 1C 00 0 8f1:00020000:0003 7F 08f1:0003dump Command* d[Address] or d[start address [destination address] dump command function: Displays the memory information in memory image mode. Description: The dump uses the left and right parts to display the memory image content, the left side is 16 binary, and the Ascⅱ character is displayed on the on-side, all non-printable characters with a period (. Said Each row displays 16 bytes of content, with a   hyphen between the eighth and Nineth bytes  -This command implies that the   segment address is a value of DS. If no start address is specified, the D command is displayed starting from the next cell in the last cell that is displayed, and if it was not previously used to the D command, the contents of the initial   segment register, plus the address   offset  0100h, begin to appear. Example:-d10,4f is to display the contents of the ds:4f in the D command if the segment address is not indicated, it is implicitly considered a DS segment. If a segment address is specified, the specified range is listed from the specified segment address such as:-dfff:00:0f we can also specify the length to list the required memory content such as:-D L20 is displayed by ds:100-ds:11f content, a total of 20H bytes: * e[address] [byte string] Modify Memory Command function: Modify the memory value starting from the specified address. Format: E start address [data row]⑴ the cell content of the specified range with a given content-e address Contents Table Example:-e100-45-d 100,l0808f1:0100-- ⑵ per Memory Content example:-e 100:08f1:0100 76 42:42 is the operator type this command is to change the original 100th memory content 76 to 42, with the D command to see. * f[address Range] [byte or byte string] Fill command function: The byte or byte string to fill in the memory specified by the address range. Example:-f100-64-d100 11f08f1:0100-A-64-61-up-to-be-13-67 98 E3 C8 2E B3 b6-03 AC 3121 4E g ... 1 ... If the data row exceeds the specified range, the values that are not filled are ignored. Example:-F-107, 4 a 4 b 4C 4d-d 100,lof08f1:0100------64-61GDABCDABCD from the above example, the out-of-range data is ignored in addition, the F and E commands can be filled in a string: such as:-F, "MSDOS"-D l0f08f1:0100 4D, 4F, 64-61 DOS FGABCD ABCDG Execute CommandFunction: Executes the program being debugged, stops execution when a breakpoint is reached, and displays the register flag and the next command to execute. Note: If the start address is not specified, the current instruction address is determined by the contents of the CS,IP register, if the user specifies the starting address from the specified start address. If a breakpoint is specified, stop execution when the instruction arrives at the instruction address and display the contents of each register flag bit and the next command to execute, allowing the user to set a maximum of 10 breakpoints. Example: A:\>debug tan.exe-u: Anti-compilation into assembly language process code ..... -G 100 Specifies the breakpoint program terminated normally: In addition: We can run a file under Debug. exe such as: A:\>debug Tan.exe-g can start to run this procedure, and in DOS exactly the same: * h[value [ Numeric] Hexadecimal arithmetic command function: Shows the sum of two hexadecimal numbers plus the difference of the first number minus the second. Description: Perform a simple hexadecimal number operation for the user. Example:-h4538 56239b5b EF15I commandFunction: Enter and display (in hexadecimal) one byte from the specified port. Example:-i70f9; display Port 70 for the f9i command to fetch data from a 80x86 64K portl CommandFunction: The absolute sector of a file or disk is loaded into the memory. Note: The maximum number of sectors a single L command can mount is 80H, where the disk number 0,1,2,3 ... Represent A,b,c, respectively, ... A read wreathes its appears, displaying an error message. ⑴ format 1. L Mount address drive name Start sector/Sector number This method loads the contents of the specified sector range on the disk into the area where the storage starts from the specified address, in addition to how the sector number refers to the logical/sector. Example:-L 100 0 01, the 0 sector of a drive is loaded to cs:100-D 10f08f1:0100 EB 3C 3C, 4F, 53-36 2E, 6.22. ⑵ format 2:l Mount address this way the specified file can be loaded into memory, the loaded file can be entered in the DEBUG with the N command can be established, in the format of the-N file name: Example 1 DEBUG tan.pas-l 100 cases 2 Debug-n tan.pas-l 100 Note: The L command can only read logical sectors, cannot read the disk code used in the Disk partition Table L command a=00,b=01,c=02 ...m Data CommandFunction: Move the contents of the memory unit in the address range to the specified address of the starting address description: During transmission, the source and target areas can be partially overlapped; The source area data remains intact after the transfer. Example:-e100 45-d100 10f08f1:0100------------11 0-d110 l1f08f1:0100 0A 19-20, 9F abcde......* n[disk number:] [path] [filename] [extension] function: Defines the action file name. Description: Can define two operation files at the same time, and will form the file control block corresponding set in memory cs:5c and CS:6C, for later L and W command operation. When we run the program debugging, we add the file program name and the program's parameters or run the file after we start debug, but when we debug a section, we may load other files to test, then we can use the N command to set up without exiting Debug. Example: A:\>debug tan.exe-n Youg.pas When the program is debugging for a certain period of time, to load the Tan.exe into Tan1.pas-ntanl.paso output CommandFunction: Sends bytes to the specified output port. Example: When we encounter the power-on request to enter a password, you can use the following methods to cancel-O 10_o 71 00P Process CommandFunction: A subroutine call instruction, loop instruction, interrupt instruction or a repeating string instruction, stop the next instruction. Note: When executing a strip program call instruction, loop instruction, interrupt instruction, or a repeating string instruction, issue the P command to execute the instruction and return to the next instruction to be executed. The P command, like T, is used to keep track of the commands that the program runs, and we can specify the starting address of the program to run in the P command, the number of instructions, or cs:ip the address of the specified program, if unspecified. The difference between P and T commands is that the P command takes call/int as an instruction, simplifies the tracing process, and the P command runs only the RAM memory command, while the T command runs the RAM and ROM programs.Q Exit Commandr Register CommandFunctions: One, displays the contents of a single register, and provides modification functions. Two, display all register contents, plus the letter flag status and the next instruction to be executed. Three, display 8 flag bit status, and provide modification function. If you do not want to change then enter. Example:-R bxbx 0050:51-rax=0000 bx=0051 cx=0000 sp=ffee bp=0000 si=0000 di=0000ds=0003 es=0cd3 SS=0CD3 IP=0100 NV up EI PL NZ N A PO nc0cd3:0100 0F DB of If you want to change the flag register, use-RF to enter, then debug will display the flag content, if you want to change any flag, just enter the name of the flag. Flag name setting not set flag name setting not set out OV (overflow) NV (not overflow) 0-bit ZR NZ (not equal to zero) direction DN (decrease) up (increase) auxiliary carry AC NA (no carry) interrupt EI (license) DI (forbidden) parity sign PE (even) PO (odd) symbol NG (negative) PL (positive) Carry CY NC (Clear Carry) Example:-RFNV up EI pl NZ NA PO NC:-O v di← input values CommandFunction: Finds the given string within the specified address range. Description: Used to specify the address range to find a string, if found to display its address, or directly display the debug prompt. The implied address is the DS segment value. This memory can be represented by (start address) (terminating address) or (start address) L (length), while strings and rows of data can be mixed: for example: 02.76 "BC". Example:-d100 lof08f1:0100 of 2A 0B 96-ff F0 B9 8A F3 xx B1. Ac,1b...-s lof "AC" 08f1:0102← means found, starting from 0102,T Trace CommandFunction: Each tracking program executes, each instruction will display the contents of each register. Note: Usually follow a command, but the user can also set the number of instructions to track multiple instructions, after each execution of an instruction, display the contents and flag status of all registers. Each instruction trace-t[= start address] stops after executing an instruction from the specified address, displays all register contents and the value of the flag bit, and the Tathagata-specified address is executed starting from the current CS:IP. A:\&GT;DEBUG-A08F1:0100 mov dl,03h08f1:0102 mov ah,02h08f1:0104 int 21h08f1:0106 int 20h08f1:0108-tax=0000 BX=0000 CX= 0000 dx=0000 sp=ffee bp=0000 si=0000 di=0000ds=08f1 es=08f1 ss=08f1 cs=08f1 1p=0105 NV up EI PL NZ PO cy09f1:0102 B402 MOV Ah,02 If the start address is specified, the T command starts tracking from the specified address, and we can also specify the number of instructions to be tracked once, pausing the display of the screen with Ctrl+s for observation. -t=100 10; Start tracking 10 instructions from cs:100u address CommandFunction: Converts the contents of memory into assembly statements. Description: The number of disassembled bytes depends on the user's system display, as well as the options that are used in the U command. ⑴ start compiling from the specified address, disassemble the 32 byte-u[address]← starting from cs:100, and its disassembly 32 bytes if the address is omitted, the 32 bytes are compiled starting from the next unit of the last instruction of a U command. ⑵ disassembly of the specified storage range-U start address termination address (L length) Example:-u 10908f1:0100 CD20 INT 2008f1:0102 ff9f009a call fa12[bx+9a00]08f1:0106 F0 lock08f1 : 0107 fe1d Call far [di]08f1:0109 F0 Lock Description: If a range is specified, the entire range will be deserializedw Write disk command* w[address] [disk symbol:] [start sector] [sector number] Write command function: Writes the modified data to disk. Description: You can write data that begins with the specified memory address on disk, and you can write the debug file on disk without specifying a parameter or specifying an address parameter. Set the size of the file when running W CX or BX register ⑴ writes data to the specified sector of the disk-W start address drive name start sector number of sectors ⑵ writes the data to the specified file, the-W start address example a:\>debug-a08f1:0100 ..... Writes the program segment 08f1:012a....-r Cxcx:0000:2a← writes the number of bytes, that is, the program end address minus the start address-n tan.com← Set the file name, the suffix is com-wwring 002A bytes-qa:\> Tan← can execute this program * "XD" command: Release EMS memory Example:-XD 0001handle 0001 deallocatel← released after the use of XD release can be reassigned * "XM" command; the memory page extents in the expanded memory are mapped to the main memory area format: XM RAM long page Main memory Page Handle example:-XM3 2 0001← map the 3rd logical page area of the No. 0001 handle to the 2nd Real page Area Logical page mapped to physical page 02* "XS" command: Displays the current EMS usage. Format-xs

The second lesson of assembly language Assignment-Experiment 1

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.