Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Java core programming, Lecture notes of Java Programming

Java programming fundamental with advance threading topic

Typology: Lecture notes

2019/2020

Uploaded on 03/08/2023

brouabame
brouabame 🇧🇩

9 documents

1 / 22

Toggle sidebar

Partial preview of the text

Download Java core programming and more Lecture notes Java Programming in PDF only on Docsity! KEYBOARD INTERRUPTs 8086 03/08/2023 1 The Purpose of Interrupts Interrupts are particularly useful when interfacing I/O devices that provide or require data at relatively low data transfer rates . If the person using the keyboard typed one character per second. The software of the Processors waited an entire second between each key stroke for the person to type another key . This process was such a tremendous waste of time that designers developed another process, Interrupt processing to handle this situation. Interrupt processing allows the microprocessor to execute other software while the keyboard operator is thinking about what key to type next. 03/08/2023 2 INT Instruction The term type in the instruction format refers to a number between 0 and 255 which identifies the interrupt. When an 8086 executes an INT instruction. It will: 1. Decrement the stack pointer by 2 and push the flags onto the stack. 2. Decrement the stack pointer by 2 and push the contents of CS onto the stack. 3. Decrement the stack pointer by 2 and push the offset of the next instruction after the INT number instruction on the stack. 4. Get a new value for IP from an absolute memory address of 4 times the type specified in the instruction. For an INT 8 instruction. For example, the new IP will be read from address 00020H. 5. Get a new value for CS from an absolute memory address of 4 times the type specified in the instruction plus 2. For an INT 8 instruction, for example, the new value of CS will be read from address 00022H. 6. Reset both IF and TF. Other flags are not affected. 03/08/2023 5 INT 21h Instruction Hence in this section we are going to see about INT instructions used for Keyboard.(INT 21 h-DOS Interrupt) The int 21 h instructions are used to interrupt through the Keyboard, Files, Directives. Depending on the value that is moved to the ‘ah’ the operations will be done. The following slides will explain the different operations performed. 03/08/2023 6 INT 21h Instruction INT 21h / AH=1 - read character from standard input, with echo, result is stored in AL. if there is no character in the keyboard buffer, the function waits until any key is pressed. example: mov ah, 1 int 21h INT 21h / AH=2 - write character to standard output. entry: DL = character to write, after execution AL = DL. example: mov ah, 2 mov dl, 'a' int 21h 03/08/2023 7 Other INT 21h Instruction INT 21h / 6h;direct console input or output. INT 21h/0Bh; Get input Status INT 21h/0Ch; Flush keyboard buffer and read standard input INT 21h/0Eh; Select default drive INT 21h/19h; Get current default drive INT 21h/25h; Set interrupt vector INT 21h/35h; Get interrupt Vector INT 21h/39h; Make directory INT 21h/3Ah; Remove directory INT 21h/3Bh; Set current directory 03/08/2023 10 Other INT 21h instruction INT 21h/3Ch;create or truncate file INT 21h/3Dh;Open Existing file INT 21h/3Eh;Close file INT 21h/3Fh;Read from File INT 21h/40h;Write to file INT 21h/41h;Delete File INT 21h/42h;Set current File Position INT 21h/47h;Get current Directory INT 21h/4Ch;return control to the operating system(STOP PROGRAM) INT 21h/56h; rename file/move file   03/08/2023 11 Example Programs INPUT A CHARACTER AND PRINT THE CHARACTER IN THE OUTPUT .model small .stack 100h .code mov ax, @data mov ds, ax mov ah, 1h ; keyboard input subprogram int 21h ; read character into al mov dl, al ; copy character to dl mov ah, 2h ; character output subprogram int 21h ; display character in dl end 03/08/2023 12 INT 16h INSTRUCTION 03/08/2023 15 INT 16h is the basic BIOS keyboard operation used extensively by software developers and provides the following services according to a function code that you load in AH. INT 16h/03h: set typematic Repeat rate INT 16h/05h: Keyboard write.  INT 16h/10h: Read keyboard Character INT 16h/11h: Determine whether character is present or not INT 16h/12h: Return Keyboard Status. INT 10h Instructions INT 10h instruction is used for the video mode. Even this INT instruction has many operations that works according to the value moved onto the ‘ah’. Option 0H – Sets video mode. Registers used:  AH = 0H  AL = Video Mode. 03/08/2023 16 INT 10h Instructions 03/08/2023 17 The following are some of the services offered by INT 10 H. INT 10H/00H; set video mode INT 10H/01H; set cursor size INT 10H/02H; set cursor position INT 10H/03H; return cursor status INT 10H/05H; select active page INT 10H/06H; scroll up screen INT 10H/07H; scroll down screen INT 10H/0Ah; display character INT 10H/0CH; Write pixel dot INT 10H/13H; Return video information INT 10h Instructions 03/08/2023 20 INT 10h / AH = 13h - write string. input: AL = write mode:     bit 0: update cursor after writing;     bit 1: string contains attributes. BH = page number. BL = attribute if string contains only characters (bit 1 of AL is zero). CX = number of characters in string (attributes are not counted). DL,DH = column, row at which to start writing. ES:BP points to string to be printed. INT 10h Instructions 03/08/2023 21 example: mov al, 1 mov bh, 0 mov bl, 0011_1011b mov cx, msg1end - offset msg1 ; calculate message size. mov dl, 10 Mov dh, 7 push cs pop es mov bp, offset msg1 mov ah, 13h int 10h jmp msg1end msg1 db " hello, world! “ msg1end:   THANK YOU 03/08/2023 22
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved