Assembly Language Technical indicators

Source: Internet
Author: User

I. Program STATUS Registers
PSW (Program status Word) is a procedure state register, which is a 16-bit register, consisting of conditional code flags (flag) and control flags:
Bit0:cf
Bit2:pf
Bit4:af
Bit6:zf
Bit7:sf
Bit8:tf
Bit9:if
Bit10:df
Bit11:of
Where a conditional code flag is used to record the status information of a running result in a program. Because these state information is often used as a transfer control condition for subsequent conditional transfer instructions, it is called a conditional code. This includes the following 6 digits:
Of the (Overflow Flag) overflow flag, which is called an overflow when the operand exceeds the range that the machine can represent at this point, at position 1, or 0.
SF (Sign Flag) symbol mark, recording the result of the symbol, the result is negative time 1, otherwise set 0.
ZF (Zero Flag) 0 flag, operation result is 0 o'clock ZF position 1, otherwise 0.
The CF (Carry Flag) carry flag that records the value from the highest significant bit when the operation is performed. For example, when performing an addition instruction, the highest effective bit has a carrying time of 1, otherwise 0.
The AF (auxiliary carry Flag) auxiliary carry flag that records the rounding value of 3rd bit (half byte) at the time of the operation. For example, when the addition instruction is executed, the 3rd position is 1, or 0 is placed.
PF (Parity Flag) parity flag, which is used to provide test conditions for code errors that may result when information is transmitted in the machine. When the number of 1 in the resulting operand is even 1, it is placed 0
The control flag has three digits:
DF (Direction Flag) directional flag, in the string processing instructions to control the direction of processing information. When DF bit is 1 o'clock, each operation causes the change address register Si and di decrement, thus causes the string processing from the high address to the low address direction processing. When DF is 0 o'clock, the SI and di increments are made so that string processing is processed from a low address to a high address.
if (Interrupt Flag) interrupt flag, when if is 1 o'clock, allow interrupt, otherwise shutdown interrupt
TF (Trap Flaga) trap flag for single-step operation. When the TF bit is 1 o'clock, each instruction is executed to create a trap, the system controls the computer, and when the TF bit is 0 o'clock, the CPU does not create traps.

Interrupt Shielding Registers
The Interrupt screen Register's I/O port address is 21H, and its 8 bits correspond to 8 peripherals.
Bit0: Timer (IR0)
Bit1: Keyboard (IR1)
Bit2: Reserved (IR2)
BIT3: Serial communication Port (2) (IR3)
BIT4: Serial communication port (1) (IR4)
BIT5: Hard Drive (IR5)
BIT6: Floppy disk (IR6)
BIT7: Printer (IR7)
Allow or disallow the interruption of certain peripherals by setting a bit of this register to 1 or 1. A bit of 0 indicates that a certain peripheral interrupt request is allowed, and a bit of 1 indicates that an interrupt request for a peripheral is blocked (forbidden).
For example, to allow only keyboard interrupts, you can set the following interrupt screen Word:
MOV al,11111101b
Out 21h,al
If you want to add a keyboard interrupt to your system, you can do so with the following directives:
In al,21h
and al,11111101b
Out 21h,al
Third, interrupt command register
Bit0:l0
Bit1:l1
Bit2:l2
bit3,bit4:0
Bit5:eoi
Bit6:sl
Bit7:r
The Interrupt command Register's I/O port address is 20H, and its individual control bits dynamically control the interrupt handling process, where the l2-l0 three-bit specified IR0-IR7 has the lowest priority interrupt request. Bit 6 (Set level) and bit 7 (Rotate) The order in which the interrupt priority of the IR0-IR7 is controlled. Bit 5 (EOI) is the interrupt end bit. When EOI is 1 o'clock, the interrupt request that is currently being processed is cleared, so after the interrupt processing is complete, the end position must be interrupted at 1, otherwise the processing of the sibling interrupt or low-level interrupt will be masked. Of course, when necessary, In an interrupt handler, you can also use the EOI command to clear the current interrupt request, making it possible to respond to a sibling or low-level interrupt during interrupt processing.
End interruption with the following instructions:
MOV al,20h
Out 20h,al
When a EOI command is issued, BITS 7 and 6 have four combinations, meaning the following:
R SL
0 0 Normal Priority mode
0 1 Clears the interrupt request specified by L2-L1
1 0 Interrupt Priority order left loop one position
1 1 Interrupt priorities are then cycled to the lowest priority position by the interrupt request specified by L2-l0.
Four, keyboard status bytes
Bit0=1: Press the right SHIFT key.
Bit1=1: Press LEFT ARROW shift
Bit2=1: Press the CONTROL key CTRL
Bit3=1: Press the alternate key alt
Bit4=1:scroll Lock state has been transformed
Bit5=1:num Lock state has been transformed
Bit6=1:caps Lock state has been transformed
Bit7=1:insert state has been transformed
Five, keyboard buffer structure
0040:001a buff_head DW?; The first address of the keyboard buffer
0040:001c buff_tail DW?; The end address of the keyboard buffer
0040:001e kb_buffer DW DUP (?); 16 input amount of space
0040:003e kb_buffer_end LABEL WORD
This buffer is an advanced first-out loop queue, and Buff_head and Buff_tail are two address pointers to the buffer. When the head refers to equal to the tail pointer, the buffer is empty.
Six, color attribute bytes
BIT0-BIT3: The Future (BIT0:B,BIT1:G,BIT2:R,BIT3:I)
BIT4-BIT6: Background (BIT4:B,BIT5:G,BIT6:R)
BIT7: Flashing (BL)
RGB for red, green, blue, bl for flashing, I for brightness, flicker and brightness only apply to the foreground.
Vii. dos predefined file codes
0= Standard input Equipment
1= Standard output Equipment
2= standard Error Output device
3= Standard Auxiliary Equipment
4= Standard Printing Equipment
Viii. file code type file operation error return code
01 Illegal function number
02 File not Found
03 Path Not Found
04 Too many files open at the same time
05 denial of Access
06 Illegal document code
07 Memory control block is corrupted
08 Not enough memory
09 Illegal Storage block Address
10 Illegal environment
11 Illegal formats
12 Illegal access Code
13 Illegal data
14 (not used)
15 Illegal designation Equipment
16 attempt to delete the current directory
17 Device inconsistency
18 No files
Nine, file attribute bytes
Bit0: Read Only
Bit1: Hidden file
Bit2: System files
Bit3: Volume file
BIT4: Sub-Directory
BIT5: Archive bit (This bit is 1: A file that has been written and closed (hard disk))
X. Access code
0--open files for reading
1--Open File for write
2--open files for read and write
Xi. Track Address Area
Using the BIOS function to format a track requires that the ES:BX register specify a set of track address areas, and that for each sector on the track, you must have a four-byte data item formatted as t/h/s/b,
t= Track number
H= Magnetic Number One
s= Sector Area code
b= number of bytes per sector (00=128,01=256,02=512,03=1024)
12, disk status bytes
With BIOS disk operation (AH=02,03,04,05) If the operation succeeds, CF and AH are set to 0, and if the operation fails, CF is placed in 1,ah to return the status code indicating the cause of the error.
01 sending illegal commands to disk I/O
02 No address marks found on disk
03 trying to write the protection disk
04 The specified sector was not found
DMA overload operation
Maximum DMA exceeds 64K limit
10 Read disk data error (CRC)
20 Floppy Controller Error
40 Random Move failure
80 answer failed

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.