1 / 13

Computer Organization & Assembly Language

Computer Organization & Assembly Language. University of Sargodha, Lahore Campus Prepared by Ali Saeed. Interrupts. Interrupts can be seen as a number of functions. These functions make the programming much easier

quinta
Télécharger la présentation

Computer Organization & Assembly Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed

  2. Interrupts • Interrupts can be seen as a number of functions. • These functions make the programming much easier • Instead of writing a code to print a character you can simply call the interrupt and it will do everything for you. • There are also interrupt functions that work with disk drive and other hardware. • We call such functions software interrupts.

  3. Interrupts • where value can be a number between 0 to 255 (or 0 to 0FFh), generally we will use hexadecimal numbers. • You may think that there are only 256 functions, but that is not correct. Each interrupt may have sub-functions. • To specify a sub-function AH register should be set before calling interrupt. • Each interrupt may have up to 256 sub-functions (so we get 256 * 256 = 65536 functions). • In general AH register is used, but sometimes other registers maybe in use.

  4. Interrupts • Interrupts are also triggered by different hardware, these are called hardware interrupts. • Currently we are interested in software interrupts only. • To make a software interrupt there is an INT instruction • it has very simple syntax: • INT value

  5. INT 21H • INT 21H may be used to invoke a large number of DOS functions • A particular number of interrupt in AH register

  6. INT 21H • INT 21H function expect input value in a certain register and return output in a certain register e.g. • MOV Ah,1 • INT 21H • Take a character as input and put the ASCII in AL register • It will put 0 in AL if non character key is pressed

  7. INT 21H • display the character ’a’ on the screen: • mov dl, ‘a‘ ; dl = ‘a‘ • mov ah, 2h ; character output subprogram • int 21h ; call ms-dos output character • Student Exercise: Write a code that takes one character input from user, and display 2 times on screen.

  8. INT 21H • String Function • AH contain 9 • Inputs: DX= offset address of string • The String must end with $ character • E.g • Msg DB ‘Hello!$’ • LEA DX, Msg • Mov AH,9 • INT 21H • Output: Hello!

  9. LEA Instruction • Load Effective Address • LEA Destination, Source • It get offset address of source and put it into destination register • E.g • LEA DX, Msg • Put offset of Msg in DX register

  10. Control Function • DL contain ASCII code of control character • INT 21H cause control function to be performed

  11. Student Assignment • Multiplication of 3x3 Matrics • Dead Line Next Week 1st Class

  12. Programming Steps

  13. Thanks

More Related