+ All Categories
Home > Documents > Web viewStep7: Wait for some time. Step8: Specify parameters for string2 dispay, ie.AH=09H, DX=...

Web viewStep7: Wait for some time. Step8: Specify parameters for string2 dispay, ie.AH=09H, DX=...

Date post: 04-Feb-2018
Category:
Upload: phamngoc
View: 220 times
Download: 1 times
Share this document with a friend
23
DOS/BIOS PROGARMING READING CHARACTER FROM KEYBOARD AND DISPLAY ABSTRACT: Assembly language program to read the character from keyboard and display using DOS function. APPARATUS: Personal computer with TASM software ALGORITHM: Step1: Start Step2: Initialize data segment & code segment Step3: Specify parameters for string1 dispay, ie.AH=09H, DX= String address. Step4: Display string (INT 21H) Step5: Specify parameters for string dispay, ie.AH=09H, Step6: Read character (INT 21H) into AL. Step7: Wait for some time. Step8: Specify parameters for string2 dispay, ie.AH=09H, DX= String address Step9: Display string (INT 21H) Step10: Specify parameters for character display, ie.AH=02H, DL=character Step11: Display Character (INT 21H) Step12: Stop PROGRAM: ASSUME CS:CODE,DS:DATA CODE SEGMENT START:MOV AX,DATA MOV DS,AX MOV AH,09H MOV DX,OFFSET MSG1 INT 21H MOV AH,01H INT 21H MOV CHAR,AL MOV AH,09H MOV DX,OFFSET MSG2
Transcript

DOS/BIOS PROGARMING

READING CHARACTER FROM KEYBOARD AND DISPLAY

ABSTRACT: Assembly language program to read the character from keyboard and display using

DOS function.

APPARATUS: Personal computer with TASM software

ALGORITHM:

Step1: StartStep2: Initialize data segment & code segmentStep3: Specify parameters for string1 dispay, ie.AH=09H, DX= String address.Step4: Display string (INT 21H)Step5: Specify parameters for string dispay, ie.AH=09H,Step6: Read character (INT 21H) into AL.Step7: Wait for some time.Step8: Specify parameters for string2 dispay, ie.AH=09H, DX= String addressStep9: Display string (INT 21H)Step10: Specify parameters for character display, ie.AH=02H, DL=characterStep11: Display Character (INT 21H)Step12: Stop

PROGRAM:

ASSUME CS:CODE,DS:DATA

CODE SEGMENT

START:MOV AX,DATA

MOV DS,AX

MOV AH,09H

MOV DX,OFFSET MSG1

INT 21H

MOV AH,01H

INT 21H

MOV CHAR,AL

MOV AH,09H

MOV DX,OFFSET MSG2

INT 21H

MOV AH,02H

MOV DL,CHAR

INT 21H

MOV AH,4CH

INT 21H

CODE ENDS

DATA SEGMENT

MSG1 DB 'PRESS ANY KEY:$'

MSG2 DB 'THE KEY PRESSED IS:$'

CHAR DB ?

DATA ENDS

END START

THEORY:

INT Interrupt Numberwhere Interrupt Number ranges from 00H to 0FFH (i.e., from 0 to 255). The execution of an INT instruction causes an Interrupt Service Routine (ISR) associated with the Interrupt Number to be executed. Many of the ISRs have multiple sub functions. To specify which sub function is to be executed under a particular Interrupt Number, the AH register is assigned a sub function number before the execution of the INT instruction.

AH = 01h - READ CHARACTER FROM STANDARD INPUT, WITH ECHO

Return: AL = character read

Notes:

^C/^Break are checked ^P toggles the DOS-internal echo-to-printer flag ^Z is not interpreted, thus not causing an EOF if input is redirected character is

echoed to standard output

See Also: AH=06h,AH=07h,AH=08h,AH=0Ah

AH = 02h -WRITE CHARACTER TO STANDARD OUTPUT

Entry: DL = character to write

Return: AL = last character output

Notes:

^C/^Break are checked the last character output will be the character in DL unless DL=09h on entry, in which

case AL=20h as tabs are expanded to blanks if standard output is redirected to a file, no error checks (write- protected, full media,

etc.) are performed

See Also: AH=06h,AH=09h

AH = 05h - WRITE CHARACTER TO PRINTER

Entry: DL = character to print

Notes:

keyboard checked for ^C/^Break STDPRN is usually the first parallel port, but may be redirected under DOS 2+ if the printer is busy, this function will wait

See Also: INT 17/AH=00h

AH = 06h - DIRECT CONSOLE OUTPUT

Entry: DL = character (except FFh)

Return: AL = character output

Notes: does not check ^C/^Break

See Also: AH=02h,AH=09h

AH = 06h - DIRECT CONSOLE INPUT

Entry: AH = 06h DL = FFh

Return:

ZF set if no character available and AL = 00h ZF clear if character available AL = character read

Notes:

^C/^Break are NOT checked if the returned character is 00h, the user pressed a key with an extended keycode,

which will be returned by the next call of this function although the return of AL=00h when no characters are available is not documented,

some programs rely on this behavior

See Also: AH=0Bh

AH=07h - DIRECT CHARACTER INPUT, WITHOUT ECHO

Return: AL = character read from standard input

Notes: does not check ^C/^Break

See Also: AH=01h,AH=06h,AH=08h,AH=0Ah

AH = 08h - CHARACTER INPUT WITHOUT ECHO

Return: AL = character read from standard input

Notes: ^C/^Break are checked

See Also: AH=01h,AH=06h,AH=07h,AH=0Ah,AH=64h

AH = 09h - WRITE STRING TO STANDARD OUTPUT

Entry: DS:DX -> '$'-terminated string

Return: AL = 24h

Notes: ^C/^Break are checked

See Also: AH=02h,AH=06h"OUTPUT"

AH = 0Ah - BUFFERED INPUT

Entry: DS:DX -> buffer (see below)

Return: buffer filled with user input

Notes:

^C/^Break are checked reads from standard input

See Also: AH=0Ch

Format of DOS input buffer:

Offset Size Description00 1 maximum characters buffer can hold

01 1 number of chars from last input which may be recalled OR number of characters actually read, excluding CR

02 n actual characters read, including the final carriage return

AH=0Bh - GET STDIN STATUS

Return:

AL = 00h if no character available AL = FFh if character is available

Notes: ^C/^Break are checked

See Also: AH=06h"INPUT"

AH = 0Ch - FLUSH BUFFER AND READ STANDARD INPUT

Entry:

AL = STDIN input function to execute after flushing buffer other registers as appropriate for the input function Return: as appropriate for the specified input function

Note: if AL is not one of 01h,06h,07h,08h, or 0Ah, the buffer is flushed but no input is attempted

See Also: AH=01h,AH=06h"INPUT",AH=07h,AH=08h,AH=0Ah

AH = 0Dh - DISK RESET

Notes: This function writes all modified disk buffers to disk, but does not update the directory information

See Also: AX=5D01h

AH = 0Eh - SELECT DEFAULT DRIVE

Entry: DL = new default drive (0=A:, 1=B:, etc)

Return: AL = number of potentially valid drive letters

Notes: the return value is the highest drive present

See Also: AH=19h,AH=3Bh,AH=DBh

AH = 19h - GET CURRENT DEFAULT DRIVE

Return: AL = drive (0=A:, 1=B:, etc)

See Also: AH=0Eh,AH=47h,AH=BBh

AH = 25h - SET INTERRUPT VECTOR

Entry:

AL = interrupt number DS:DX -> new interrupt handler

Notes: this function is preferred over direct modification of the interrupt vector table

See Also: AX=2501h,AH=35h

AH = 2Ah - GET SYSTEM DATE

Return: CX = year (1980-2099) DH = month DL = day AL = day of week (00h=Sunday)

See Also: AH=2Bh"DOS",AH=2Ch,AH=E7h

AH = 2Bh - SET SYSTEM DATE

Entry: CX = year (1980-2099) DH = month DL = day

Return:

AL = 00 successful FFh invalid date, system date unchanged

Note: DOS 3.3+ also sets CMOS clock

See Also: AH=2Ah,AH=2Dh

AH = 2Ch - GET SYSTEM TIME

Return: CH = hour CL = minute DH = second DL = 1/100 seconds

Note: on most systems, the resolution of the system clock is about 5/100sec, so returned times generally do not increment by 1 on some systems, DL may always return 00h

See Also: AH=2Ah,AH=2Dh,AH=E7h

AH = 2Dh - SET SYSTEM TIME

Entry: CH = hour CL = minute DH = second DL = 1/100 seconds

Return:

AL = 00h successful FFh if invalid time, system time unchanged

Note: DOS 3.3+ also sets CMOS clock

See Also: AH=2Bh"DOS",AH=2Ch

AH = 2Eh - SET VERIFY FLAG

Entry: AL = new state of verify flag (00 off, 01h o)

Notes:

default state at system boot is OFF when ON, all disk writes are verified provided the device driver supports read-after-

write verification

See Also: AH=54h

AH=30h - GET DOS VERSION

Entry: AL = what to return in BH (00h OEM number, 01h version flag)

Return:

AL = major version number (00h if DOS 1.x) AH = minor version number BL:CX = 24-bit user serial number (most versions do not use this) if DOS <5 or

AL=00h BH = MS-DOS OEM number if DOS 5+ and AL=01h BH = version flag bit 3: DOS is in ROM other: reserved (0)

Notes:

DOS 4.01 and 4.02 identify themselves as version 4.00 MS-DOS 6.21 reports its version as 6.20; version 6.22 returns the correct value Windows95 returns version 7.00 (the underlying MS-DOS)

See Also: AX=3000h/BX=3000h,AX=3306h,AX=4452h

AH=35h - GET INTERRUPT VECTOR

Entry: AL = interrupt number

Return: ES:BX -> current interrupt handler

SeeAlso: AH=25h,AX=2503h

AH = 36h - GET FREE DISK SPACE

Entry: DL = drive number (0=default, 1=A:, etc)

Return:

AX = FFFFh if invalid drive AX = sectors per cluster BX = number of free clusters CX = bytes per sector DX =

total clusters on drive

Notes:

free space on drive in bytes is AX * BX * CX total space on drive in bytes is AX * CX * DX "lost clusters" are considered to be in use this function does not return proper results on CD-ROMs; use AX=4402h"CD-ROM"

instead

SeeAlso: AH=1Bh,AH=1Ch,AX=4402h"CD-ROM"

AH = 39h - "MKDIR" - CREATE SUBDIRECTORY

Entry: DS:DX -> ASCIZ pathname

Return:

CF clear if successful AX destroyed CF set on error AX = error code (03h,05h)

Notes:

all directories in the given path except the last must exist fails if the parent directory is the root and is full DOS 2.x-3.3 allow the creation of a directory sufficiently deep that it is not possible

to make that directory the current directory because the path would exceed 64 characters

SeeAlso: AH=3Ah,AH=3Bh,AH=6Dh

AH = 3Ah - "RMDIR" - REMOVE SUBDIRECTORY

Entry: DS:DX -> ASCIZ pathname of directory to be removed

Return:

CF clear if successful, AX destroyed CF set on error AX = error code (03h,05h,06h,10h)

Notes: directory must be empty (contain only '.' and '..' entries)

SeeAlso: AH=39h,AH=3Bh

AH = 3Bh - "CHDIR" - SET CURRENT DIRECTORY

Entry: DS:DX -> ASCIZ pathname to become current directory (max 64 bytes)

Return:

CF clear if successful, AX destroyed CF set on error AX = error code (03h)

Notes: if new directory name includes a drive letter, the default drive is not changed, only the current directory on that drive

SeeAlso: AH=47h,AH=71h,INT 2F/AX=1105h

AH = 3Ch - "CREAT" - CREATE OR TRUNCATE FILE

Entry:

CX = file attributes DS:DX -> ASCIZ filename

Return:

CF clear if successful, AX = file handle CF set on error AX = error code (03h,04h,05h)

Notes: if a file with the given name exists, it is truncated to zero length

SeeAlso: AH=16h,AH=3Dh,AH=5Ah,AH=5Bh

AH = 3Dh - "OPEN" - OPEN EXISTING FILE

Entry:

AL = access and sharing modes DS:DX -> ASCIZ filename

Return:

CF clear if successful, AX = file handle CF set on error AX = error code (01h,02h,03h,04h,05h,0Ch,56h)

Notes:

file pointer is set to start of file file handles which are inherited from a parent also inherit sharing and access

restrictions files may be opened even if given the hidden or system attributes

SeeAlso: AH=0Fh,AH=3Ch,AX=4301h,AX=5D00h

AH = 3Eh - "CLOSE" - CLOSE FILE

Entry: BX = file handle

Return:

CF clear if successful, AX destroyed CF set on error, AX = error code (06h)

Note: if the file was written to, any pending disk writes are performed, the time and date stamps are set to the current time, and the directory entry is updated

SeeAlso: AH=10h,AH=3Ch,AH=3Dh

AH = 3Fh - "READ" - READ FROM FILE OR DEVICE

Entry:

BX = file handle CX = number of bytes to read DS:DX -> buffer for data

Return:

CF clear if successful - AX = number of bytes actually read (0 if at EOF before call) CF set on error AX = error code (05h,06h)

Notes:

data is read beginning at current file position, and the file position is updated after a successful read

the returned AX may be smaller than the request in CX if a partial read occurred if reading from CON, read stops at first CR

SeeAlso: AH=27h,AH=40h,AH=93h

AH=40h - "WRITE" - WRITE TO FILE OR DEVICE

Entry:

BX = file handle CX = number of bytes to write DS:DX -> data to write

Return:

CF clear if successful -AX = number of bytes actually written CF set on error - AX = error code (05h,06h)

Notes:

if CX is zero, no data is written, and the file is truncated or extended to the current position

data is written beginning at the current file position, and the file position is updated after a successful write

the usual cause for AX < CX on return is a full disk

SeeAlso: AH=28h,AH=3Fh

AH = 41H - "UNLINK" - DELETE FILE

Entry:

DS:DX -> ASCIZ filename (no wildcards, but see notes) CL = attribute mask for deletion (server call only, see notes)

Return:

CF clear if successful, AX destroyed (DOS 3.3) AL seems to be drive of deleted file CF set on error AX = error code (02h,03h,05h)

Notes:

(DOS 3.1+) wildcards are allowed if invoked via AX=5D00h, in which case the filespec must be canonical (as returned by AH=60h), and only files matching the attribute mask in CL are deleted

DOS does not erase the file's data; it merely becomes inaccessible because the FAT chain for the file is cleared

deleting a file which is currently open may lead to filesystem corruption.

SeeAlso: AH=13h,AX=4301h,AX=4380h,AX=5D00h,AH=60h,AH=71h

AH=42h - "LSEEK" - SET CURRENT FILE POSITION

Entry:

AL = origin of move 00h start of file 01h current file position 02h end of file BX = file handle CX:DX = offset from origin of new file position

Return:

CF clear if successful, DX:AX = new file position in bytes from start of file CF set on error, AX = error code (01h,06h)

Notes:

for origins 01h and 02h, the pointer may be positioned before the start of the file; no error is returned in that case, but subsequent attempts at I/O will produce errors

if the new position is beyond the current end of file, the file will be extended by the next write (see AH=40h)

SeeAlso: AH=24h

AH=43 - GET FILE ATTRIBUTES

Entry:

AL = 00h DS:DX -> ASCIZ filename

Return:

CF clear if successful CX = file attributes CF set on error, AX = error code (01h,02h,03h,05h)

BUG: Windows for Workgroups returns error code 05h (access denied) instead of error code 02h (file not found) when attempting to get the attributes of a nonexistent file.

SeeAlso: AX=4301h,AX=4310h,AX=7143h,AH=B6h

AH=43 - "CHMOD" - SET FILE ATTRIBUTES

Entry:

AL = 01h CX = new file attributes DS:DX -> ASCIZ filename

Return:

CF clear if successful, AX destroyed CF set on error, AX = error code (01h,02h,03h,05h)

Notes:

will not change volume label or directory attribute bits, but will change the other attribute bits of a directory

MS-DOS 4.01 reportedly closes the file if it is currently open

SeeAlso: AX=4300h,AX=4311h,AX=7143h,INT 2F/AX=110Eh

Bitfields for file attributes:

Bits 7 6 5 4 3 2 1 0Description shareable - archive directory vol. label system hidden read-only

AH = 47h - "CWD" - GET CURRENT DIRECTORY

Entry:

DL = drive number (00h = default, 01h = A:, etc) DS:SI -> 64-byte buffer for ASCIZ pathname

Return:

CF clear if successful CF set on error, AX = error code (0Fh)

Notes:

the returned path does not include a drive or the initial backslash many Microsoft products for Windows rely on AX being 0100h on success

SeeAlso: AH=19h,AH=3Bh,AH=71h

AH = 4Ch - "EXIT" - TERMINATE WITH RETURN CODE

Entry: AL = return code

Return: never returns

Notes: unless the process is its own parent, all open files are closed and all memory belonging to the process is freed

SeeAlso: AH=00h,AH=26h,AH=4Bh,AH=4Dh

AH = 4Dh - GET RETURN CODE (ERRORLEVEL)

Return:

AH = termination type (00=normal, 01h control-C abort, 02h=critical error abort, 03h terminate and stay resident)

AL = return code

Notes:

the word in which DOS stores the return code is cleared after being read by this function, so the return code can only be retrieved once

COMMAND.COM stores the return code of the last external command it executed as ERRORLEVEL

SeeAlso: AH=4Bh,AH=4Ch,AH=8Ah

AH = 54h - GET VERIFY FLAG

Return: AL = verify flag (00h=off, 01h=on, i.e. all disk writes verified after writing)

SeeAlso: AH=2Eh

AH = 56h - "RENAME" - RENAME FILE

Entry:

DS:DX -> ASCIZ filename of existing file (no wildcards, but see below) ES:DI -> ASCIZ new filename (no wildcards) CL = attribute mask (server call only, see below)

Return:

CF clear if successful CF set on error, AX= error code (02h,03h,05h,11h)

Notes:

allows move between directories on same logical volume this function does not set the archive attribute open files should not be renamed (DOS 3.0+) allows renaming of directories

AH = 57h - GET FILE'S LAST-WRITTEN DATE AND TIME

Entry:AL = 00h (Get attribute)

BX = file handle

Return:

CF clear if successful, CX = file's time DX = file's date CF set on error, AX = error code (01h,06h)

SeeAlso: AX=5701h

Bitfields for file time:

Bits 15-11 10-5 4-0Description hours minutes seconds

Bitfields for file date:

Bits 15-9 8-5 4-0Description year (1980-) month day

AH = 57h - SET FILE'S LAST-WRITTEN DATE AND TIME

Entry:AL =01h (Set attributes)

BX = file handle CX = new time DX = new date

Return:CF clear if successful

CF set on error AX = error code (01h,06h)

SeeAlso: AX=5700h

PROCEDURE:

1. Open command prompt.

2. Change into TASM software Directory.

3. Type the program using DOS editor.

4. Save the program as ASM file.

5. Convert the ASM file into OBJ file using TASM.

6. Convert OBJ file into EXE file using TLINK.

7. Debug the EXE file using DOS Debugger or TD.

8. Run the program using F7(single step) or F9(at a time).

9. Observe the results in the appropriate segment.

10. Compare the result with theoretical calculations

CODE TABLE:Physical Address

Hex Code Label Mnemonic operand CommentsSegment OffsetAddress Address

ASSUME CS:CODE,DS:DATA

CODE SEGMENT

START:MOV AX,DATA

MOV DS,AX

MOV AH,09H

MOV DX,OFFSET MSG1

INT 21H

MOV AH,01H

INT 21H

MOV CHAR,AL

MOV AH,09H

MOV DX,OFFSET MSG2

INT 21H

MOV AH,02H

MOV DL,CHAR

INT 21H

MOV AH,4CH

INT 21H

CODE ENDS

DATA SEGMENT

MSG1 DB 'PRESS ANY KEY:$'

MSG2 DB 'THE KEY PRESSED IS:$'

CHAR DB ?

DATA ENDS

END START

RESULT:

READING KEYBOARD BUFFERED WITH ECHO

ABSTRACT: To Read the Keyboard Buffered with Echo using BIOS.

APPARATUS: Personal computer with TASM software.

ALGORITHM:Step1: Start.

Step2: Load the number 13h into AL register.

Step3: Initialize the AH register with 00h

Step4: Display interrupt

Step5: Initialize the AH register with 00h

Step6: Key board Interrupt

Step7: Compare the data in AL register with character ‘q’.

Step8: If equal to zero go to step 12.

Step9: Move the number 0Fh into BL register.

Step10: Move the number 14 into AH register.

Step11: Keyboard Interrupt.

Step12: Load the number 4C in AH register.

Step13: Stop.

PROGRAM:

ASSUME CS: CODECODE SEGMENTSTART: MOV AH, 00H

MOV Al, 13HINT 10H

BACK: MOV AH, 00hINT 16HCMP AL, ‘q’JE EXITMOV BL, 0FHMOV AH, 14INT 10HJMP BACK

EXIT: MOV AH, 4CHINT 21H

CODE ENDSEND START

THEORY:

BIOS interrupt calls are a facility that operating systems and application programs use to invoke the facilities of the Basic Input/ Output System on IBM PC compatible computers. Traditionally, BIOS calls are mainly used by MS-DOS programs and some other software such as boot loaders (including, mostly historically, relatively simple application software that boots directly and runs without an operating system—especially game software.) BIOS only runs in the real address mode (Real Mode) of the x86 CPU, so programs that call BIOS either must also run in real mode or must switch from protected mode to real mode before calling BIOS and then switch back again. For this reason, modern operating systems that use the CPU in Protected Mode generally do not use the BIOS to support system functions, although some of them use the BIOS to probe and initialize hardware resources during their early stages of booting.

In all computers, software instructions control the physical hardware (screen, disk, keyboard, etc.) from the moment the power is switched on. In a PC, the BIOS, pre-loaded in ROM on the main board, takes control immediately after the processor is reset, including during power-up or when a hardware reset button is pressed. The BIOS initializes the hardware, finds, loads and runs the boot program (usually, but not necessarily, an OS loader), and provides basic hardware control to the operating system running on the machine, which is usually an operating system but may be a directly booting single software application.

The following are list of BIOS function calls: INT10.0 - Set video mode INT10.1- Set cursor type INT 10.2 - Set cursor position INT 10.3 - Read cursor position INT 10.4 - Read light pen INT 10.5 - Select active display page INT10.6 - Scroll active page up INT10.7 - Scroll active page down INT 10.8 - Read character and attribute at cursor INT10.9 - Write character and attribute at cursor INT10.A - Write character at current cursor INT 10.B - Set color palette INT10.C - Write graphics pixel at coordinate INT 10.D - Read graphics pixel at coordinate INT 10.E - Write text in teletype mode INT 10.F - Get current video state INT 10.10 - Set/get palette registers (EGA/VGA) INT10.11 - Character generator routine (EGA/VGA) INT10.12 - Video subsystem configuration (EGA/VGA) INT10.13 - Write string (BIOS after 1/10/86) INT10.14 - Load LCD char font (convertible) INT10.15 - Return physical display parms (convertible) INT10.1A - Video Display Combination (VGA) INT10.1B - Video BIOS Functionality/State Information (MCGA/VGA) INT10.1C - Save/Restore Video State (VGA only) INT10.FE - Get DESQView/TopView Virtual Screen Regen Buffer INT10.FF - Update DESQView/TopView Virtual Screen Regen Buffer

Warning: Some BIOS implementations have a bug that causes registerBP to be destroyed. It is advisable to save BP before a call toVideo BIOS routines on these systems.

- registers CS, DS, ES, SS, BX, CX, DX are preserved unless explicitly changed

INT 10.13 - Write String (BIOS)

AH = 13hAL = write mode (see bit settings below) = 0 string is chars only, attribute in BL, cursor not moved = 1 string is chard only, attribute in BL, cursor moved = 2 string contains chars and attributes, cursor not moved = 3 string contains chars and attributes, cursor movedBH = video page numberBL = attribute if mode 0 or 1 (AL bit 1=0)CX = length of string (ignoring attributes)DH = row coordinateDL = column coordinateES:BP = pointer to string

Bit settings for write mode (register AL):

|7|6|5|4|3|2|1|0| AL | | | | | | | `---- 0=don't move cursor, 1=move cursor | | | | | | `----- 0=BL has attributes, 1=string has attributes `---------------- unused

returns nothing

- BEL, BS, CR, LF are treated as ASCII control codes- wraps data and scrolls if unable to fit data on one line

INT 10,14 - Load LCD Character Font (convertible only)

AH = 14h

AL = 0 - load user specified font ES:DI = pointer to character font CX = number of characters to store DX = char offset into ram font area BH = number of bytes per character BL = 0 load main font (block 0) = 1 load alternate font (block 1)

AL = 1 - load system ROM default font BL = 0 load main font (block 0) = 1 load alternate font (block 1)

AL = 2 - set mapping of LCD high intensity attribute BL = 0 ignore high intensity attribute = 1 map high intensity to underscore = 2 map high intensity to reverse video = 3 map high intensity to select alternate font

INT 16H:

This interruption is responsible for obtaining basic keyboard functionality, i.e. is responsible for collecting the keystrokes, obtain the status of the buffer of keyboard, etc. The standard encoding of the keyboard that offers the INT 16 h is a US keyboard. To adapt the coding of the INT 16h to another type of keyboard (for example, a Hebrew keyboard) must attend the scan-code of the key pressed, and perform suitable for interpreting the key that you want to.

101 letters or more keyboards, there are some keys to the INT 16h interprets them as expanded keys, which have a scan-code different to the normal keys

List of services of INT16H.

Function Function code Device

Read key press 00h KeyboardGet the State of the keyboard buffer 01h KeyboardGet the State of the keyboard 02h KeyboardEstablish repetition factor 03h KeyboardSimulate a keystroke 05h KeyboardGet the ID of the keyboard 0Ah KeyboardRead expanded keyboard character 10h Expanded keyboardObtain status of the expanded keyboard buffer 11h Expanded keyboardGet expanded keyboard status 12h Expanded keyboard

PROCEDURE:1. Open command prompt.

2. Change into TASM software Directory.

3. Type the program using DOS editor.

4. Save the program as ASM file.

5. Convert the ASM file into OBJ file using TASM.

6. Convert OBJ file into EXE file using TLINK.

7. Debug the EXE file using DOS Debugger or TD.

8. Run the program using F7(single step) or F9(at a time).

9. Observe the results in the appropriate segment.

10. Compare the result with theoretical calculations

CODE TABLE:Physical Address

Hex Code Label Mnemonic operand CommentsSegment OffsetAddress Address

ASSUME CS: CODE

CODE SEGMENT

START: MOV AH, 00H

MOV Al, 13H

INT 10H

BACK: MOV AH, 00h

INT 16H

CMP AL, ‘q’

JE EXIT

MOV BL, 0FH

MOV AH, 14

INT 10H

JMP BACK

EXIT: MOV AH, 4CH

INT 21H

CODE ENDS

END START

RESULT:


Recommended