8088 Macro Assembly Quick Reference Manual
━━━━━━━━━━━━
1. Data transfer instructions
───────────────────────────────────────
They transfer data between memory and registers, and between registers and input/output ports.
1. General data transfer instructions.
MOV Transfer a word or byte.
PUSH Push a word onto the stack.
POP Pop a word from the stack.
XCHG Exchange a word or byte.
XLAT Byte table lookup translation.
── BX points to the start of a 256-byte table, and AL is the table index value (0-255, that is,
0-FFH); on return AL contains the lookup result. ( ->AL )
2. Input/output port transfer instructions.
IN I/O port input. ( syntax: IN accumulator, {port number│DX} )
OUT I/O port output. ( syntax: OUT {port number│DX},accumulator )
When the I/O port is specified by immediate mode, its range is 0-255; when specified by register DX,
its range is 0-65535.
3. Destination address transfer instructions.
LEA Load effective address.
Example: LEA DX,string ;store the offset address in DX.
LDS Transfer destination pointer, loading the pointer contents into DS.
Example: LDS SI,string ;store segment address
ffset address into DS:SI.
LES Transfer destination pointer, loading the pointer contents into ES.
Example: LES DI,string ;store segment address
ffset address into ES
I.
4. Flag transfer instructions.
LAHF Flag register transfer, load flags into AH.
SAHF Flag register transfer, load the contents of AH into the flag register.
PUSHF Push flags onto the stack.
POPF Pop flags from the stack.
2. Arithmetic instructions
───────────────────────────────────────
ADD Addition.
ADC Addition with carry.
INC Add 1.
AAA ASCII adjust for addition.
DAA Decimal adjust for addition.
SUB Subtraction.
SBB Subtraction with borrow.
DEC Subtract 1.
NEC Negate (subtract it from 0).
CMP Compare.(Subtract the two operands, only modify the flags, do not store the result.)
AAS ASCII adjust for subtraction.
DAS Decimal adjust for subtraction.
MUL Unsigned multiplication.
IMUL Integer multiplication.
For the above two instructions, the result is returned in AH and AL (byte operation), or DX and AX (word operation),
AAM ASCII adjust for multiplication.
DIV Unsigned division.
IDIV Integer division.
For the above two instructions, the result is returned as follows:
Quotient in AL, remainder in AH, (byte operation);
or quotient in AX, remainder in DX, (word operation).
AAD ASCII adjust for division.
CBW Convert byte to word. (sign-extend the byte in AL into AH)
CWD Convert word to doubleword. (sign-extend the word in AX into DX)
3. Logical instructions
───────────────────────────────────────
AND AND operation.
OR OR operation.
XOR XOR operation.
NOT Invert.
TEST Test.(AND the two operands, only modify the flags, do not store the result.)
SHL Logical shift left.
SAL Arithmetic shift left.(=SHL)
SHR Logical shift right.
SAR Arithmetic shift right.(=SHR)
ROL Rotate left.
ROR Rotate right.
RCL Rotate left through carry.
RCR Rotate right through carry.
For the above eight shift instructions, the shift count can be as many as 255 times.
When shifting once, the opcode can be used directly. Such as SHL AX,1.
When shifting >1 time, the shift count is given by register CL.
Such as MOV CL,04
SHL AX,CL
4. String instructions
───────────────────────────────────────
DS:SI Source string segment register :source string index.
ES
I Destination string segment register:destination string index.
CX Repeat count counter.
AL/AX Scan value.
D flag 0 means SI and DI should auto-increment during repeated operations; 1 means they should auto-decrement.
Z flag Used to control the end of scan or compare operations.
MOVS String transfer.
( MOVSB Transfer character. MOVSW Transfer word. )
CMPS String compare.
( CMPSB Compare character. CMPSW Compare word. )
SCAS String scan.
Compare the contents of AL or AX with the destination string, and the compare result is reflected in the flags.
LODS Load string.
Load the elements (word or byte) from the source string one by one into AL or AX.
STOS Store string.
The reverse process of LODS.
REP/REPE/REPNE/REPZ/REPNZ Repeat
5. Program transfer instructions
───────────────────────────────────────
1>Unconditional transfer instructions (far transfer)
JMP Unconditional transfer instruction
CALL Procedure call
RET/RETFProcedure return.
2>Conditional transfer instructions (short transfer, within a distance of -128 to +127)
JA/JNBE Transfer when not below or not equal.
JAE/JNB Transfer when greater than or equal.
JB/JNAE Transfer when below.
JBE/JNA Transfer when below or equal.
The above four test the result of unsigned integer operations (flags C and Z).
JG/JNLE Transfer when greater.
JGE/JNL Transfer when greater than or equal.
JL/JNGE Transfer when less than.
JLE/JNG Transfer when less than or equal.
The above four test the result of signed integer operations (flags S, O and Z).
JE/JZ Transfer when equal.
JNE/JNZ Transfer when not equal.
JC Transfer when carry.
JNC Transfer when no carry.
JNO Transfer when no overflow.
JNP/JPO Transfer when parity is odd.
JNS Transfer when sign bit is "0".
JO Overflow transfer.
JP/JPE Transfer when parity is even.
JS Transfer when sign bit is "1".
3>Loop control instructions (short transfer)
LOOP Loop when CX is not zero.
LOOPE/LOOPZ Loop when CX is not zero and flag Z=1.
LOOPNE/LOOPNZ Loop when CX is not zero and flag Z=0.
JCXZ Transfer when CX is zero.
4>Interrupt instructions
INT Interrupt instruction
INTO Overflow interrupt
IRET Interrupt return
5>Processor control instructions
HLT Processor pause, continuing only when an interrupt or reset signal occurs.
WAIT Make the CPU enter wait state when chip pin TEST is high level.
ESC Transfer to external processor.
LOCK Lock the bus.
NOP No operation.
STC Set carry flag.
CLC Clear carry flag.
CMC Complement carry flag.
STD Set direction flag.
CLD Clear direction flag.
STI Set interrupt enable flag.
CLI Clear interrupt enable flag.
6. Pseudo-instructions
───────────────────────────────────────
DB Define byte.
DW Define word (2 bytes).
PROC Define procedure.
ENDP End of procedure.
SEGMENT Define segment.
ASSUME Establish segment-register addressing.
ENDS End of segment.
END End of program.
7. Interrupt vectors used by the system and BIOS, DOS
───────────────────────────────────────
.Interrupt 0: Divide by zero error .Interrupt 19: Bootstrap loader
.Interrupt 1: Single-step interrupt .Interrupt 1A: Date/time call
.Interrupt 2: Non-maskable interrupt NMI .Interrupt 1B: Gets control when keyboard break occurs
.Interrupt 3: Power-fail interrupt (CCH) .Interrupt 1C: Gets control on clock interrupt
.Interrupt 4: Overflow interrupt .Interrupt 1D: Points to CRT initial parameter table
.Interrupt 5: Screen print interrupt .Interrupt 1E: Points to cassette parameter table
.Interrupt 6-7: Reserved .Interrupt 1F: Characters 128 to 256 for 1KB graphics mode CRT
.Interrupt 8: Timer interrupt(18.2/sec) .Interrupt 20: End DOS program
.Interrupt 9: Keyboard interrupt .Interrupt 21: DOS function call
.Interrupt A-D: Reserved .Interrupt 22: Termination address (recommended to use EXEC function call)
.Interrupt E: Floppy drive interrupt .Interrupt 23: DOS Ctrl-Break exit address
.Interrupt F: Reserved .Interrupt 24: DOS fatal error vector
.Interrupt 10: Screen I/O call .Interrupt 25: DOS absolute disk read
.Interrupt 11: Equipment check call .Interrupt 26: DOS absolute disk write
.Interrupt 12: Memory check call .Interrupt 27: End-and-stay-resident (recommended to use function 31H)
.Interrupt 13: Floppy drive I/O call .Interrupt 28-3F: DOS reserved
.Interrupt 14: RS-232 I/O call .Interrupt 40-7F: Unused
.Interrupt 15: Cassette I/O call .Interrupt 80-85: BASIC reserved
.Interrupt 16: Keyboard I/O call .Interrupt 86-F0: Used by BASIC interpreter
.Interrupt 17: Printer I/O call .Interrupt F1-FF: Unused
.Interrupt 18: ROM-BASIC entry
8. IBM PC interrupt INT 10:
───────────────────────────────────────
.00H Set screen mode.
Entry: AH=0, AL=display mode code.(0-6)
0: 40x25 monochrome 1: 40x25 color 2: 80x25 monochrome 3: 80x25 color text mode
4: 320x200 color 5: 320x200 monochrome 6: 640x200 monochrome graphics mode
7: 80x25 monochrome character (monochrome monitor)
.01H Set cursor size
Entry: AH=1, CH=cursor start scan line (00-0C), CL=cursor end scan line (00-0C), and CH<CL.
.02H Set cursor position
Entry: AH=2, BH=page number, DH
L=start row:column.
.03H Read cursor position
Entry: AH=3, BH=page number. Return: DH
L=start row:column.
.06H Scroll window up
Entry: AH=6, AL=number of lines to scroll up in window (AL=0 scroll entire window);
CH:CL -DH
L Window coordinates
.07H Scroll window down
Entry: AH=7, AL=number of lines to scroll down in window
CH:CL -DH
L Window coordinates
.08H Read character and attribute at current cursor position
Entry: AH=8, BH=page number. Return: AH:AL=character color:character ASCII code
The color definitions for displayed characters are as follows:
1 2 3 4 5 6 7 8
┌─┬─┬─┬─┬─┬─┬─┬─┐
│BL│R│G│B│I│R│G│B│
└─┴─┴─┴─┴─┴─┴─┴─┘ B-blue G-green R-red
Blink └───┘ High └───┘
Character background Character display color
.09H Write character and attribute at current cursor position (cursor does not move down).
Entry: AH=9, BH=page number, BL:AL=character color:character ASCII code, CX=repeat count.
.0AH Write character at current cursor position (keep original attribute)
Entry: AH=0A, BH=page number, AL=character ASCII code, CX=repeat count.
.0BH Color setting
Entry: AH=0B, BL=0 Set background color, BH=0-15
BL=1 Set palette code, BH=0-1
.0CH Write graphics dot
Entry: AH=0C, CX
X=column number:row number, AL=color.
.0DH Read graphics dot
Entry: AH=0D, CX
X=column number:row number. Return: AL=color,
.0EH Write character at current page and current cursor position
Entry: AH=0E, AL=character ASCII code, BL=foreground color.
.0FH Display status
Entry: AH=0F. Return: AL=current display mode, AH=screen columns, BH=current page number
9. IBM PC keyboard interrupt INT 16:
───────────────────────────────────────
.00H Read one character entered from keyboard.
Entry: AH=0. Return: AL=character ASCII code, AH=scan code.
.01H Check whether a character has been entered from keyboard.
Entry: AH=1. Return: ZF=1 (Z) no character entered;
ZF=0 (NZ) character entered, AL=character ASCII code, AH=scan code.
The entered character remains in the keyboard buffer at the same time.
.02H Read current shift-key status.
Entry: AH=2.
Return: AL=status.
7 6 5 4 3 2 1 0
┌─┬─┬─┬─┬─┬─┬─┬─┐
AL: │ │ │ │ │ │ │ │ │
└─┴─┴─┴─┴─┴─┴─┴─┘
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ └─Right Shift
│ │ │ │ │ │ └─Left Shift
│ │ │ │ │ └─Ctrl
│ │ │ │ └─Alt
│ │ │ └─Scroll Lock
│ │ └─Num Lock
│ └─Capa Lock
└─Ins
10. ROM interrupt INT 13:
───────────────────────────────────────
A.Floppy drive I/O call(360K)
.00H Reset disk system
Entry: AH =0
Return: AH =disk status
0-bad command, 1-address not found on disk, 3-write protect, 4-sector not found, ...
.01H Read disk status
Entry: AH =1
Return: AH =disk status
.02H Disk read
Entry: AH =2, DL =drive number(0-3), 0=A, 1=B, 2=C
DH =head number(0 or 1), CH =track number(0-39H), CL =starting sector number(1-9)
AL =number of sectors to read(1-9), ES:BX =start address of memory buffer.
Return: AL =actual number of sectors read,AH =disk status; carry flag CF =0,error; =1,success.
.03H Disk write
Entry: AH =3, DL =drive number(0-3), 0=A, 1=B, 2=C
DH =head number(0 or 1), CH =track number(0-39H), CL =starting sector number(1-9)
AL =number of sectors to write(1-9), ES:BX =start address of memory buffer.
Return: AL =actual number of sectors written,AH =disk status; carry flag CF =0,error; =1,success.
B.Hard disk I/O call
Entry: AH =0-3, DL =drive number(hard disk 80H,81H), 80=C, 81=D
DH =head number(hard disk 0-15), CH =track number(0-1023), CL =starting sector number(1-17)
AL =number of sectors to read/write, ES:BX =start address of memory buffer.
Return: AL =actual number of sectors read,AH =disk status; carry flag CF =0,error; =1,success.
11. Absolute disk read/write (interrupt 25, interrupt 26)
───────────────────────────────────────
A. INT 25 absolute disk read
B. INT 26 absolute disk write
Entry: AL =drive number(0-2), 0=A, 1=B, 2=C
DX =logical sector number of the starting sector
CX =number of sectors to read/write(1-80H),
DS:BX =start address of memory buffer.
12. IBM PC function calls (interrupt INT 21)
───────────────────────────────────────
.00H End program.
.01H Input one character from keyboard.(echo)
Entry: AH=01. Return: DL=input character.
For extended keys, two function calls are required.
.02H Display one character.
Entry: AH=02, DL=character.(07 bell,08 backspace,0D carriage return,0A line feed)
.05H Print one character.
Entry: AH=05, DL=character.(0D carriage return,0A line feed)
.08H Input one character from keyboard.(no echo)
Entry: AH=08. Return: DL=input character.
For extended keys, two function calls are required.
.09H Display a string of characters.
Entry: AH=09, DS
X=start address of string.(The string must end with character '$'.)
.0AH Input a string of characters from keyboard.
Entry: AH=0A, DS
X=start address of string. Byte DS:=buffer length (maximum number of characters it can hold)
(The input string must end with carriage return.)
Return: start address of string at DS
X+2, number of characters=DS:.
.0CH Clear keyboard buffer, and call keyboard function(.01H,06H,07H,08H or 0AH).
Entry: AH=0C, AL=number of keyboard function to call(.01H,06H,07H,08H or 0AH).
.30H Get DOS version number.
Return: AL-major version number, AH-minor version number
.42H Move file read/write pointer
AL=0 Move pointer CX
X bytes from the beginning of the file
AL=1 Move pointer CX
X bytes from the current position
AL=2 Move pointer backward CX
X bytes from the end of the file
.43H Change file attributes
.4CH End DOS program, and preserve the code for possible use in batch processing.
━━━━━━━━━━━━
1. Data transfer instructions
───────────────────────────────────────
They transfer data between memory and registers, and between registers and input/output ports.
1. General data transfer instructions.
MOV Transfer a word or byte.
PUSH Push a word onto the stack.
POP Pop a word from the stack.
XCHG Exchange a word or byte.
XLAT Byte table lookup translation.
── BX points to the start of a 256-byte table, and AL is the table index value (0-255, that is,
0-FFH); on return AL contains the lookup result. ( ->AL )
2. Input/output port transfer instructions.
IN I/O port input. ( syntax: IN accumulator, {port number│DX} )
OUT I/O port output. ( syntax: OUT {port number│DX},accumulator )
When the I/O port is specified by immediate mode, its range is 0-255; when specified by register DX,
its range is 0-65535.
3. Destination address transfer instructions.
LEA Load effective address.
Example: LEA DX,string ;store the offset address in DX.
LDS Transfer destination pointer, loading the pointer contents into DS.
Example: LDS SI,string ;store segment address
ffset address into DS:SI.LES Transfer destination pointer, loading the pointer contents into ES.
Example: LES DI,string ;store segment address
ffset address into ES
I.4. Flag transfer instructions.
LAHF Flag register transfer, load flags into AH.
SAHF Flag register transfer, load the contents of AH into the flag register.
PUSHF Push flags onto the stack.
POPF Pop flags from the stack.
2. Arithmetic instructions
───────────────────────────────────────
ADD Addition.
ADC Addition with carry.
INC Add 1.
AAA ASCII adjust for addition.
DAA Decimal adjust for addition.
SUB Subtraction.
SBB Subtraction with borrow.
DEC Subtract 1.
NEC Negate (subtract it from 0).
CMP Compare.(Subtract the two operands, only modify the flags, do not store the result.)
AAS ASCII adjust for subtraction.
DAS Decimal adjust for subtraction.
MUL Unsigned multiplication.
IMUL Integer multiplication.
For the above two instructions, the result is returned in AH and AL (byte operation), or DX and AX (word operation),
AAM ASCII adjust for multiplication.
DIV Unsigned division.
IDIV Integer division.
For the above two instructions, the result is returned as follows:
Quotient in AL, remainder in AH, (byte operation);
or quotient in AX, remainder in DX, (word operation).
AAD ASCII adjust for division.
CBW Convert byte to word. (sign-extend the byte in AL into AH)
CWD Convert word to doubleword. (sign-extend the word in AX into DX)
3. Logical instructions
───────────────────────────────────────
AND AND operation.
OR OR operation.
XOR XOR operation.
NOT Invert.
TEST Test.(AND the two operands, only modify the flags, do not store the result.)
SHL Logical shift left.
SAL Arithmetic shift left.(=SHL)
SHR Logical shift right.
SAR Arithmetic shift right.(=SHR)
ROL Rotate left.
ROR Rotate right.
RCL Rotate left through carry.
RCR Rotate right through carry.
For the above eight shift instructions, the shift count can be as many as 255 times.
When shifting once, the opcode can be used directly. Such as SHL AX,1.
When shifting >1 time, the shift count is given by register CL.
Such as MOV CL,04
SHL AX,CL
4. String instructions
───────────────────────────────────────
DS:SI Source string segment register :source string index.
ES
I Destination string segment register:destination string index.CX Repeat count counter.
AL/AX Scan value.
D flag 0 means SI and DI should auto-increment during repeated operations; 1 means they should auto-decrement.
Z flag Used to control the end of scan or compare operations.
MOVS String transfer.
( MOVSB Transfer character. MOVSW Transfer word. )
CMPS String compare.
( CMPSB Compare character. CMPSW Compare word. )
SCAS String scan.
Compare the contents of AL or AX with the destination string, and the compare result is reflected in the flags.
LODS Load string.
Load the elements (word or byte) from the source string one by one into AL or AX.
STOS Store string.
The reverse process of LODS.
REP/REPE/REPNE/REPZ/REPNZ Repeat
5. Program transfer instructions
───────────────────────────────────────
1>Unconditional transfer instructions (far transfer)
JMP Unconditional transfer instruction
CALL Procedure call
RET/RETFProcedure return.
2>Conditional transfer instructions (short transfer, within a distance of -128 to +127)
JA/JNBE Transfer when not below or not equal.
JAE/JNB Transfer when greater than or equal.
JB/JNAE Transfer when below.
JBE/JNA Transfer when below or equal.
The above four test the result of unsigned integer operations (flags C and Z).
JG/JNLE Transfer when greater.
JGE/JNL Transfer when greater than or equal.
JL/JNGE Transfer when less than.
JLE/JNG Transfer when less than or equal.
The above four test the result of signed integer operations (flags S, O and Z).
JE/JZ Transfer when equal.
JNE/JNZ Transfer when not equal.
JC Transfer when carry.
JNC Transfer when no carry.
JNO Transfer when no overflow.
JNP/JPO Transfer when parity is odd.
JNS Transfer when sign bit is "0".
JO Overflow transfer.
JP/JPE Transfer when parity is even.
JS Transfer when sign bit is "1".
3>Loop control instructions (short transfer)
LOOP Loop when CX is not zero.
LOOPE/LOOPZ Loop when CX is not zero and flag Z=1.
LOOPNE/LOOPNZ Loop when CX is not zero and flag Z=0.
JCXZ Transfer when CX is zero.
4>Interrupt instructions
INT Interrupt instruction
INTO Overflow interrupt
IRET Interrupt return
5>Processor control instructions
HLT Processor pause, continuing only when an interrupt or reset signal occurs.
WAIT Make the CPU enter wait state when chip pin TEST is high level.
ESC Transfer to external processor.
LOCK Lock the bus.
NOP No operation.
STC Set carry flag.
CLC Clear carry flag.
CMC Complement carry flag.
STD Set direction flag.
CLD Clear direction flag.
STI Set interrupt enable flag.
CLI Clear interrupt enable flag.
6. Pseudo-instructions
───────────────────────────────────────
DB Define byte.
DW Define word (2 bytes).
PROC Define procedure.
ENDP End of procedure.
SEGMENT Define segment.
ASSUME Establish segment-register addressing.
ENDS End of segment.
END End of program.
7. Interrupt vectors used by the system and BIOS, DOS
───────────────────────────────────────
.Interrupt 0: Divide by zero error .Interrupt 19: Bootstrap loader
.Interrupt 1: Single-step interrupt .Interrupt 1A: Date/time call
.Interrupt 2: Non-maskable interrupt NMI .Interrupt 1B: Gets control when keyboard break occurs
.Interrupt 3: Power-fail interrupt (CCH) .Interrupt 1C: Gets control on clock interrupt
.Interrupt 4: Overflow interrupt .Interrupt 1D: Points to CRT initial parameter table
.Interrupt 5: Screen print interrupt .Interrupt 1E: Points to cassette parameter table
.Interrupt 6-7: Reserved .Interrupt 1F: Characters 128 to 256 for 1KB graphics mode CRT
.Interrupt 8: Timer interrupt(18.2/sec) .Interrupt 20: End DOS program
.Interrupt 9: Keyboard interrupt .Interrupt 21: DOS function call
.Interrupt A-D: Reserved .Interrupt 22: Termination address (recommended to use EXEC function call)
.Interrupt E: Floppy drive interrupt .Interrupt 23: DOS Ctrl-Break exit address
.Interrupt F: Reserved .Interrupt 24: DOS fatal error vector
.Interrupt 10: Screen I/O call .Interrupt 25: DOS absolute disk read
.Interrupt 11: Equipment check call .Interrupt 26: DOS absolute disk write
.Interrupt 12: Memory check call .Interrupt 27: End-and-stay-resident (recommended to use function 31H)
.Interrupt 13: Floppy drive I/O call .Interrupt 28-3F: DOS reserved
.Interrupt 14: RS-232 I/O call .Interrupt 40-7F: Unused
.Interrupt 15: Cassette I/O call .Interrupt 80-85: BASIC reserved
.Interrupt 16: Keyboard I/O call .Interrupt 86-F0: Used by BASIC interpreter
.Interrupt 17: Printer I/O call .Interrupt F1-FF: Unused
.Interrupt 18: ROM-BASIC entry
8. IBM PC interrupt INT 10:
───────────────────────────────────────
.00H Set screen mode.
Entry: AH=0, AL=display mode code.(0-6)
0: 40x25 monochrome 1: 40x25 color 2: 80x25 monochrome 3: 80x25 color text mode
4: 320x200 color 5: 320x200 monochrome 6: 640x200 monochrome graphics mode
7: 80x25 monochrome character (monochrome monitor)
.01H Set cursor size
Entry: AH=1, CH=cursor start scan line (00-0C), CL=cursor end scan line (00-0C), and CH<CL.
.02H Set cursor position
Entry: AH=2, BH=page number, DH
L=start row:column..03H Read cursor position
Entry: AH=3, BH=page number. Return: DH
L=start row:column..06H Scroll window up
Entry: AH=6, AL=number of lines to scroll up in window (AL=0 scroll entire window);
CH:CL -DH
L Window coordinates.07H Scroll window down
Entry: AH=7, AL=number of lines to scroll down in window
CH:CL -DH
L Window coordinates.08H Read character and attribute at current cursor position
Entry: AH=8, BH=page number. Return: AH:AL=character color:character ASCII code
The color definitions for displayed characters are as follows:
1 2 3 4 5 6 7 8
┌─┬─┬─┬─┬─┬─┬─┬─┐
│BL│R│G│B│I│R│G│B│
└─┴─┴─┴─┴─┴─┴─┴─┘ B-blue G-green R-red
Blink └───┘ High └───┘
Character background Character display color
.09H Write character and attribute at current cursor position (cursor does not move down).
Entry: AH=9, BH=page number, BL:AL=character color:character ASCII code, CX=repeat count.
.0AH Write character at current cursor position (keep original attribute)
Entry: AH=0A, BH=page number, AL=character ASCII code, CX=repeat count.
.0BH Color setting
Entry: AH=0B, BL=0 Set background color, BH=0-15
BL=1 Set palette code, BH=0-1
.0CH Write graphics dot
Entry: AH=0C, CX
X=column number:row number, AL=color..0DH Read graphics dot
Entry: AH=0D, CX
X=column number:row number. Return: AL=color,.0EH Write character at current page and current cursor position
Entry: AH=0E, AL=character ASCII code, BL=foreground color.
.0FH Display status
Entry: AH=0F. Return: AL=current display mode, AH=screen columns, BH=current page number
9. IBM PC keyboard interrupt INT 16:
───────────────────────────────────────
.00H Read one character entered from keyboard.
Entry: AH=0. Return: AL=character ASCII code, AH=scan code.
.01H Check whether a character has been entered from keyboard.
Entry: AH=1. Return: ZF=1 (Z) no character entered;
ZF=0 (NZ) character entered, AL=character ASCII code, AH=scan code.
The entered character remains in the keyboard buffer at the same time.
.02H Read current shift-key status.
Entry: AH=2.
Return: AL=status.
7 6 5 4 3 2 1 0
┌─┬─┬─┬─┬─┬─┬─┬─┐
AL: │ │ │ │ │ │ │ │ │
└─┴─┴─┴─┴─┴─┴─┴─┘
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ └─Right Shift
│ │ │ │ │ │ └─Left Shift
│ │ │ │ │ └─Ctrl
│ │ │ │ └─Alt
│ │ │ └─Scroll Lock
│ │ └─Num Lock
│ └─Capa Lock
└─Ins
10. ROM interrupt INT 13:
───────────────────────────────────────
A.Floppy drive I/O call(360K)
.00H Reset disk system
Entry: AH =0
Return: AH =disk status
0-bad command, 1-address not found on disk, 3-write protect, 4-sector not found, ...
.01H Read disk status
Entry: AH =1
Return: AH =disk status
.02H Disk read
Entry: AH =2, DL =drive number(0-3), 0=A, 1=B, 2=C
DH =head number(0 or 1), CH =track number(0-39H), CL =starting sector number(1-9)
AL =number of sectors to read(1-9), ES:BX =start address of memory buffer.
Return: AL =actual number of sectors read,AH =disk status; carry flag CF =0,error; =1,success.
.03H Disk write
Entry: AH =3, DL =drive number(0-3), 0=A, 1=B, 2=C
DH =head number(0 or 1), CH =track number(0-39H), CL =starting sector number(1-9)
AL =number of sectors to write(1-9), ES:BX =start address of memory buffer.
Return: AL =actual number of sectors written,AH =disk status; carry flag CF =0,error; =1,success.
B.Hard disk I/O call
Entry: AH =0-3, DL =drive number(hard disk 80H,81H), 80=C, 81=D
DH =head number(hard disk 0-15), CH =track number(0-1023), CL =starting sector number(1-17)
AL =number of sectors to read/write, ES:BX =start address of memory buffer.
Return: AL =actual number of sectors read,AH =disk status; carry flag CF =0,error; =1,success.
11. Absolute disk read/write (interrupt 25, interrupt 26)
───────────────────────────────────────
A. INT 25 absolute disk read
B. INT 26 absolute disk write
Entry: AL =drive number(0-2), 0=A, 1=B, 2=C
DX =logical sector number of the starting sector
CX =number of sectors to read/write(1-80H),
DS:BX =start address of memory buffer.
12. IBM PC function calls (interrupt INT 21)
───────────────────────────────────────
.00H End program.
.01H Input one character from keyboard.(echo)
Entry: AH=01. Return: DL=input character.
For extended keys, two function calls are required.
.02H Display one character.
Entry: AH=02, DL=character.(07 bell,08 backspace,0D carriage return,0A line feed)
.05H Print one character.
Entry: AH=05, DL=character.(0D carriage return,0A line feed)
.08H Input one character from keyboard.(no echo)
Entry: AH=08. Return: DL=input character.
For extended keys, two function calls are required.
.09H Display a string of characters.
Entry: AH=09, DS
X=start address of string.(The string must end with character '$'.).0AH Input a string of characters from keyboard.
Entry: AH=0A, DS
X=start address of string. Byte DS:=buffer length (maximum number of characters it can hold)(The input string must end with carriage return.)
Return: start address of string at DS
X+2, number of characters=DS:..0CH Clear keyboard buffer, and call keyboard function(.01H,06H,07H,08H or 0AH).
Entry: AH=0C, AL=number of keyboard function to call(.01H,06H,07H,08H or 0AH).
.30H Get DOS version number.
Return: AL-major version number, AH-minor version number
.42H Move file read/write pointer
AL=0 Move pointer CX
X bytes from the beginning of the fileAL=1 Move pointer CX
X bytes from the current positionAL=2 Move pointer backward CX
X bytes from the end of the file.43H Change file attributes
.4CH End DOS program, and preserve the code for possible use in batch processing.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui

