More about procedures and Video Processing
Lesson plan <ul><li>Review existing concepts </li></ul><ul><li>More about procedures and boolean expression </li></ul><ul>...
Review <ul><li>Procedure: </li></ul><ul><li>name PROC ; the code of the procedure ... RET name ENDP  </li></ul><ul><li>Cal...
More about procedures <ul><li>Passing parameters: </li></ul><ul><ul><li>Are very similar to the concept of passing paramet...
Passing parameters by value: <ul><ul><li>Parameters are the actual data item. </li></ul></ul><ul><ul><ul><li>Passing value...
Passing parameters by value: <ul><li>Passing value in STACK </li></ul><ul><li>Push values being passed in STACK </li></ul>...
Passing parameters by value: <ul><li>Passing value in STACK: </li></ul><ul><li>Address the limitations in terms of number ...
Passing parameters by value: <ul><ul><ul><li>Operand1 DW 10  ; (0AH) </li></ul></ul></ul><ul><ul><ul><li>Operand2 DW 2  ; ...
Passing parameters by Reference <ul><li>Instead of passing values, we pass the address using register or stack </li></ul><...
Passing parameters by Reference <ul><li>Instead of passing values, we pass the address using register or stack </li></ul><...
Video processing <ul><li>Use INT instruction to handle inputs and outputs </li></ul><ul><li>INT 10H: screen handling </li>...
Screen features <ul><li>25 rows (0-24) and 80 columns (0-79) </li></ul>(0,79) (0,0) (24,0) (24,79)
Screen features <ul><li>Cursor location: </li></ul><ul><li>Upper left corner: Row: 0, Column 0 </li></ul><ul><li>Upper rig...
Screen features <ul><li>Video Display Area: </li></ul><ul><li>Text mode: 4KB in BIOS (2K for characters and 2K for attribu...
Screen features <ul><li>Setting cursor: </li></ul><ul><li>INT 10H function 02H tells BIOS to set the cursor </li></ul><ul>...
Screen features <ul><li>Example: Set cursor at (12,40) </li></ul><ul><li>MOV AH, 02H </li></ul><ul><li>MOV BH, 0  ; page# ...
Screen features <ul><li>Clear & Scrolling screen  </li></ul><ul><li>INT 10H function 06H tells BIOS to clear or scroll scr...
Screen features <ul><li>Example: </li></ul><ul><ul><li>MOV AH,06H  ; clear and scroll </li></ul></ul><ul><ul><li>MOV AL,00...
Screen features <ul><ul><li>Attribute byte in text mode determines the characteristics of each displayed character </li></...
Screen features <ul><li>INT 21H: </li></ul><ul><ul><li>Display ASCII characters (02H) </li></ul></ul><ul><ul><li>Display s...
Screen features <ul><li>Display a character </li></ul><ul><ul><li>Step 1: Set AH =02H </li></ul></ul><ul><ul><li>Step 2: L...
Screen features <ul><li>Example: </li></ul><ul><ul><li>MOV AH, 02H </li></ul></ul><ul><ul><li>MOV DL, ‘C’ </li></ul></ul><...
Practice/Lab 1 <ul><li>Open your browser and open this page: </li></ul><ul><li>C:emu8086documentation8086_instruction_set....
Practice/Lab 1 <ul><li>page  60,132 </li></ul><ul><li>TITLE VideoPractice ClearScreen and Output </li></ul><ul><li>; -----...
Practice/Lab 1 <ul><li>4.   Modify your code so that it performs the following tasks: </li></ul><ul><li>Clear screen </li>...
Answer to Fibonaci practice <ul><li>FIBONACI  PROC NEAR </li></ul><ul><li>MOV AX,00 </li></ul><ul><li>MOV BX,01 </li></ul>...
INT 21H displaying screen <ul><li>INT 21H, function 09H: display a string which is followed by the dollar($) sign </li></u...
INT 21H displaying screen <ul><li>Example: </li></ul><ul><li>message db &quot;Hello everybody! I am learning assembly lang...
INT 21H displaying screen <ul><li>INT 21H, function 40H </li></ul><ul><ul><li>Use  file handles  to process display operat...
INT 21H displaying screen <ul><ul><li>File handle: is a number used to refer to a specific device </li></ul></ul><ul><ul><...
INT 21H displaying screen <ul><ul><li>Example: </li></ul></ul><ul><li>message db ‘Hello’, 0DH, 0AH </li></ul><ul><li>MOV A...
INT 21H for keyboards <ul><li>INT 21H function: </li></ul><ul><ul><li>0AH: input from keyboard </li></ul></ul><ul><ul><li>...
INT 21H for keyboards <ul><li>INT 21H function 0AH </li></ul><ul><ul><li>Step 1:Set AH = 0AH </li></ul></ul><ul><ul><li>St...
INT 21H for keyboards <ul><li>Parameter list is a structure which consists of: </li></ul><ul><li><Name of parameter list> ...
INT 21H for keyboards <ul><li>Example: </li></ul><ul><ul><li>Para_list label byte </li></ul></ul><ul><ul><li>max_len  DB 1...
INT 21H for keyboards <ul><li>Example: </li></ul><ul><li>Assume the input string is ‘CS271’ </li></ul><ul><li>act_len = 5 ...
<ul><li>This uses file handles to request keyboard input </li></ul><ul><ul><li>Step 1: Set AH = 3FH </li></ul></ul><ul><ul...
<ul><li>Example: </li></ul><ul><ul><li>input  DB  100 DUP(‘ ‘) </li></ul></ul><ul><ul><li>MOV AH, 3FH </li></ul></ul><ul><...
<ul><li>Example: (not available in EMU8086) </li></ul><ul><ul><li>input  DB 100 DUP(‘ ‘) </li></ul></ul><ul><ul><li>MOV AH...
Practice/Lab 2 <ul><li>Open your browser and open this page: </li></ul><ul><li>C:emu8086documentation8086_instruction_set....
Practice/Lab <ul><li>page  60,132 </li></ul><ul><li>TITLE InputPRactice Input </li></ul><ul><li>; ------------------------...
Practice/Lab <ul><li>4.   Modify your code so that it performs the following tasks: </li></ul><ul><li>- R ead a string (le...
Project 2
Adavanced Screen Processing <ul><li>Explore INT 10H to: </li></ul><ul><ul><li>Set video mode </li></ul></ul><ul><ul><li>Di...
Upcoming SlideShare
Loading in …5
×

More about procedures and Video Processing

557
-1

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
557
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

More about procedures and Video Processing

  1. 1. More about procedures and Video Processing
  2. 2. Lesson plan <ul><li>Review existing concepts </li></ul><ul><li>More about procedures and boolean expression </li></ul><ul><li>Video processing </li></ul>
  3. 3. Review <ul><li>Procedure: </li></ul><ul><li>name PROC ; the code of the procedure ... RET name ENDP </li></ul><ul><li>Calling a procedure: </li></ul><ul><ul><li>CALL <name of the procedure> </li></ul></ul><ul><ul><li>Address of the next instruction will be pushed onto STACK </li></ul></ul>
  4. 4. More about procedures <ul><li>Passing parameters: </li></ul><ul><ul><li>Are very similar to the concept of passing parameters in C/C++ and Java </li></ul></ul><ul><ul><li>A program may pass parameters by: </li></ul></ul><ul><ul><ul><li>Value </li></ul></ul></ul><ul><ul><ul><li>Reference </li></ul></ul></ul>
  5. 5. Passing parameters by value: <ul><ul><li>Parameters are the actual data item. </li></ul></ul><ul><ul><ul><li>Passing value in register: </li></ul></ul></ul><ul><ul><ul><li>Store values being passed in registers </li></ul></ul></ul><ul><ul><ul><li>Call the procedure </li></ul></ul></ul><ul><ul><ul><li>Example: </li></ul></ul></ul><ul><ul><ul><li>MOV AX, operand1 </li></ul></ul></ul><ul><ul><ul><li>MOV BX, operand2 </li></ul></ul></ul><ul><ul><ul><li>CALL MULTIPROC </li></ul></ul></ul><ul><ul><ul><li>… </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC PROC </li></ul></ul></ul><ul><ul><ul><li>MUL BX </li></ul></ul></ul><ul><ul><ul><li>RET </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC ENDP </li></ul></ul></ul>MULTIPROC(operand1,operand2
  6. 6. Passing parameters by value: <ul><li>Passing value in STACK </li></ul><ul><li>Push values being passed in STACK </li></ul><ul><li>Call the procedure </li></ul><ul><li>Pop values from STACK </li></ul><ul><li>Example: </li></ul><ul><ul><ul><li>PUSH operand1 </li></ul></ul></ul><ul><ul><ul><li>PUSH operand2 </li></ul></ul></ul><ul><ul><ul><li>CALL MULTIPROC </li></ul></ul></ul><ul><ul><ul><li>… </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC PROC </li></ul></ul></ul><ul><ul><ul><li>PUSH BP </li></ul></ul></ul><ul><ul><ul><li>MOV BP, SP </li></ul></ul></ul><ul><ul><ul><li>MOV AX, [BP+8] </li></ul></ul></ul><ul><ul><ul><li>MUL WORD PTR [BP+4] </li></ul></ul></ul><ul><ul><ul><li>POP BP </li></ul></ul></ul><ul><ul><ul><li>RET </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC ENDP </li></ul></ul></ul>MULTIPROC(operand1,operand)
  7. 7. Passing parameters by value: <ul><li>Passing value in STACK: </li></ul><ul><li>Address the limitations in terms of number of registers </li></ul><ul><li>More complicated because we need indirect addressing to access the stack (use of BP) </li></ul>
  8. 8. Passing parameters by value: <ul><ul><ul><li>Operand1 DW 10 ; (0AH) </li></ul></ul></ul><ul><ul><ul><li>Operand2 DW 2 ; (02H) </li></ul></ul></ul><ul><ul><ul><li>PUSH BP ;to save its content </li></ul></ul></ul>
  9. 9. Passing parameters by Reference <ul><li>Instead of passing values, we pass the address using register or stack </li></ul><ul><ul><ul><li>LEA SI, operand1 </li></ul></ul></ul><ul><ul><ul><li>LEA DI, operand2 </li></ul></ul></ul><ul><ul><ul><li>CALL MULTIPROC </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC PROC </li></ul></ul></ul><ul><ul><ul><li>MOV AX, [SI] </li></ul></ul></ul><ul><ul><ul><li>MUL [DI] </li></ul></ul></ul><ul><ul><ul><li>RET </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC ENDP </li></ul></ul></ul>MULTIPROC(&operand1, &operand2)
  10. 10. Passing parameters by Reference <ul><li>Instead of passing values, we pass the address using register or stack </li></ul><ul><ul><ul><li> PUSH OFFSET operand1 </li></ul></ul></ul><ul><ul><ul><li> PUSH OFFSET operand2 </li></ul></ul></ul><ul><ul><ul><li>CALL MULTIPROC </li></ul></ul></ul><ul><ul><ul><li>…… </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC PROC </li></ul></ul></ul><ul><ul><ul><li>PUSH BP </li></ul></ul></ul><ul><ul><ul><li>MOV BP, SP </li></ul></ul></ul><ul><ul><ul><li>MOV BX, [BP+6] </li></ul></ul></ul><ul><ul><ul><li>MOV DI,[BP+4] </li></ul></ul></ul><ul><ul><ul><li>MOV AX, [BX] </li></ul></ul></ul><ul><ul><ul><li>MUL WORD PTR [DI] </li></ul></ul></ul><ul><ul><ul><li>POP BP </li></ul></ul></ul><ul><ul><ul><li>RET 4 </li></ul></ul></ul><ul><ul><ul><li>MULTIPROC ENDP </li></ul></ul></ul>MULTIPROC(&operand1, &operand2)
  11. 11. Video processing <ul><li>Use INT instruction to handle inputs and outputs </li></ul><ul><li>INT 10H: screen handling </li></ul><ul><li>INT 21H: for displaying screen output </li></ul><ul><li>Main idea: </li></ul><ul><ul><li>Insert a value in AH register which is used to identify the type of service the interrupt needs to perform </li></ul></ul>
  12. 12. Screen features <ul><li>25 rows (0-24) and 80 columns (0-79) </li></ul>(0,79) (0,0) (24,0) (24,79)
  13. 13. Screen features <ul><li>Cursor location: </li></ul><ul><li>Upper left corner: Row: 0, Column 0 </li></ul><ul><li>Upper right corner: Row: 0, Column 79 </li></ul><ul><li>Lower left corner: Row: 24, Column 0 </li></ul><ul><li>Lower right corner: Row: 24, Column 79 </li></ul><ul><li>Center: Row 12, Column 39 </li></ul>
  14. 14. Screen features <ul><li>Video Display Area: </li></ul><ul><li>Text mode: 4KB in BIOS (2K for characters and 2K for attributes) </li></ul><ul><li>Pages: 0 to 7 </li></ul><ul><li>INT 10H: Set cursor (AH= 02H) </li></ul><ul><li>INT 10H: Clear & Scroll screen (AH = 06H) </li></ul>
  15. 15. Screen features <ul><li>Setting cursor: </li></ul><ul><li>INT 10H function 02H tells BIOS to set the cursor </li></ul><ul><li>Step 1: Determine the row and column that we want to set our cursor at. E.g row = 12, column = 40) </li></ul><ul><li>Step 2: Load 02H to AH. Load page# to BH, Row# to DH, and Column# to DL </li></ul><ul><li>Step 3: Call INT 10H function </li></ul>
  16. 16. Screen features <ul><li>Example: Set cursor at (12,40) </li></ul><ul><li>MOV AH, 02H </li></ul><ul><li>MOV BH, 0 ; page# to BH </li></ul><ul><li>MOV DH, 12 ; row# to DH </li></ul><ul><li>MOV DL, 40 ; column# to DL </li></ul><ul><li>INT 10H </li></ul>
  17. 17. Screen features <ul><li>Clear & Scrolling screen </li></ul><ul><li>INT 10H function 06H tells BIOS to clear or scroll screen </li></ul><ul><ul><li>Step 1: Load 06H to AH </li></ul></ul><ul><ul><li>Step 2:Determine number of lines to scroll </li></ul></ul><ul><ul><li>Step 3:Determine the attributes of the screen (background and foreground colors). Load them into BH </li></ul></ul><ul><ul><li>Step 4: Load the starting row:column to CX </li></ul></ul><ul><ul><li>Step 5: Load the ending row:column to DX </li></ul></ul><ul><ul><li>Step 6: Call INT 10H </li></ul></ul>
  18. 18. Screen features <ul><li>Example: </li></ul><ul><ul><li>MOV AH,06H ; clear and scroll </li></ul></ul><ul><ul><li>MOV AL,00H </li></ul></ul><ul><ul><li>MOV BH,0F1H ; white background, blue foreground </li></ul></ul><ul><ul><li>MOV CX,0000H ; starting row:column </li></ul></ul><ul><ul><li>MOV DX,184FH ; ending row:column </li></ul></ul><ul><ul><li>INT 10H </li></ul></ul>
  19. 19. Screen features <ul><ul><li>Attribute byte in text mode determines the characteristics of each displayed character </li></ul></ul>71=0111 0001 (White background and Blue foreground)
  20. 20. Screen features <ul><li>INT 21H: </li></ul><ul><ul><li>Display ASCII characters (02H) </li></ul></ul><ul><ul><li>Display string (09H or 40H) </li></ul></ul><ul><ul><li>Get input from keyboard (0AH or 3FH) </li></ul></ul>
  21. 21. Screen features <ul><li>Display a character </li></ul><ul><ul><li>Step 1: Set AH =02H </li></ul></ul><ul><ul><li>Step 2: Load the character to DL </li></ul></ul><ul><ul><li>Step 3: Call INT 21H to display the character </li></ul></ul>
  22. 22. Screen features <ul><li>Example: </li></ul><ul><ul><li>MOV AH, 02H </li></ul></ul><ul><ul><li>MOV DL, ‘C’ </li></ul></ul><ul><ul><li>INT 21H </li></ul></ul>
  23. 23. Practice/Lab 1 <ul><li>Open your browser and open this page: </li></ul><ul><li>C:emu8086documentation8086_instruction_set.html </li></ul><ul><li>And </li></ul><ul><li>C:emu8086documentation8086_and_dos_interrupts.html </li></ul><ul><li>2. Open your emu8086 software </li></ul><ul><li>3. Cut and paste (or type) the following code (as shown in the next page) and save as output.asm </li></ul>
  24. 24. Practice/Lab 1 <ul><li>page 60,132 </li></ul><ul><li>TITLE VideoPractice ClearScreen and Output </li></ul><ul><li>; --------------------------------------------- </li></ul><ul><li>STACK SEGMENT PARA STACK 'Stack' </li></ul><ul><li>DW 32 DUP(0) </li></ul><ul><li>STACK ENDS </li></ul><ul><li>; ---------------------------------------------- </li></ul><ul><li>DATASEG SEGMENT PARA 'Data' </li></ul><ul><li>; Please insert your data declaration here </li></ul><ul><li>DATASEG ENDS </li></ul><ul><li>CODESEG SEGMENT PARA 'Code' </li></ul><ul><li>MAIN PROC FAR </li></ul><ul><li>MOV AX, dataseg </li></ul><ul><li>MOV DS, AX </li></ul><ul><li>; Please enter your code here </li></ul><ul><li>MOV AX,4C00H ;exit procedure </li></ul><ul><li>INT 21H </li></ul><ul><li>MAIN ENDP </li></ul><ul><li>CODESEG ENDS </li></ul><ul><li>END MAIN ;End of program </li></ul>
  25. 25. Practice/Lab 1 <ul><li>4. Modify your code so that it performs the following tasks: </li></ul><ul><li>Clear screen </li></ul><ul><li>Set cursor to the middle of screen </li></ul><ul><li>Display the characters (5) in: </li></ul><ul><li>CHAR_TBL DB ‘A’ ,’B’, ’C’, ’D’, ’E’ </li></ul><ul><li>on the middle of the screen </li></ul><ul><li>5. Compile and run your code </li></ul>
  26. 26. Answer to Fibonaci practice <ul><li>FIBONACI PROC NEAR </li></ul><ul><li>MOV AX,00 </li></ul><ul><li>MOV BX,01 </li></ul><ul><li>MOV CX,7 ;7 repetitions </li></ul><ul><li>MOV DX,00 </li></ul><ul><li>L10: </li></ul><ul><li>ADD AX,BX ;Number is in AX </li></ul><ul><li>MOV BX,DX </li></ul><ul><li>MOV DX,AX </li></ul><ul><li>LOOP L10 </li></ul><ul><li>RET </li></ul><ul><li>FIBONACI ENDP </li></ul>
  27. 27. INT 21H displaying screen <ul><li>INT 21H, function 09H: display a string which is followed by the dollar($) sign </li></ul><ul><ul><li>Step 1: Declare a string, which is followed by dollar sign </li></ul></ul><ul><ul><li>Step 2: Set DS to the beginning address of data segment. And set AH =09H </li></ul></ul><ul><ul><li>Step 3: Load offset of the string to DX </li></ul></ul><ul><ul><li>Step 4: Call INT 21H </li></ul></ul>
  28. 28. INT 21H displaying screen <ul><li>Example: </li></ul><ul><li>message db &quot;Hello everybody! I am learning assembly language!&quot;,&quot;$“ </li></ul><ul><li>mov ah,09 ; move 9 to AH </li></ul><ul><li>lea dx,message </li></ul><ul><li>int 21h </li></ul>
  29. 29. INT 21H displaying screen <ul><li>INT 21H, function 40H </li></ul><ul><ul><li>Use file handles to process display operations </li></ul></ul><ul><ul><li>Procedure: </li></ul></ul><ul><ul><ul><li>Step 1: Set AH=40H </li></ul></ul></ul><ul><ul><ul><li>Step 2: Set BX= file handle (of screen) </li></ul></ul></ul><ul><ul><ul><li>Step 3: Set CX = number of characters to display </li></ul></ul></ul><ul><ul><ul><li>Step 4: Set DX = Offset Address of display area </li></ul></ul></ul><ul><ul><ul><li>Step 5: Call INT 21H </li></ul></ul></ul>
  30. 30. INT 21H displaying screen <ul><ul><li>File handle: is a number used to refer to a specific device </li></ul></ul><ul><ul><li>Handle Device </li></ul></ul><ul><ul><li>00 Input (keyboard) </li></ul></ul><ul><ul><li>01 Output (screen) </li></ul></ul><ul><ul><li>04 Printer </li></ul></ul>
  31. 31. INT 21H displaying screen <ul><ul><li>Example: </li></ul></ul><ul><li>message db ‘Hello’, 0DH, 0AH </li></ul><ul><li>MOV AH,40H ; move 40H to AH </li></ul><ul><li>MOV BX, 01 </li></ul><ul><li>MOV CX, 7 </li></ul><ul><li>lea dx,message </li></ul><ul><li>int 21h </li></ul>
  32. 32. INT 21H for keyboards <ul><li>INT 21H function: </li></ul><ul><ul><li>0AH: input from keyboard </li></ul></ul><ul><ul><li>3FH: input from keyboard </li></ul></ul>
  33. 33. INT 21H for keyboards <ul><li>INT 21H function 0AH </li></ul><ul><ul><li>Step 1:Set AH = 0AH </li></ul></ul><ul><ul><li>Step 2: Load offset address of the parameter list into DX </li></ul></ul><ul><ul><li>Step 3: Call INT 21H </li></ul></ul>
  34. 34. INT 21H for keyboards <ul><li>Parameter list is a structure which consists of: </li></ul><ul><li><Name of parameter list> LABEL BYTE </li></ul><ul><li><Variable represents maximum number of input characters> DB <value> </li></ul><ul><li><Variable represents actual number of input characters> DB <value> </li></ul><ul><li><Variable to contain typed characters> </li></ul>
  35. 35. INT 21H for keyboards <ul><li>Example: </li></ul><ul><ul><li>Para_list label byte </li></ul></ul><ul><ul><li>max_len DB 100 </li></ul></ul><ul><ul><li>act_len DB ? </li></ul></ul><ul><ul><li>input DB 100 DUP(‘ ‘) </li></ul></ul><ul><ul><li>MOV AH, 0AH </li></ul></ul><ul><ul><li>LEA DX, Para_list </li></ul></ul><ul><ul><li>INT 21H </li></ul></ul>
  36. 36. INT 21H for keyboards <ul><li>Example: </li></ul><ul><li>Assume the input string is ‘CS271’ </li></ul><ul><li>act_len = 5 </li></ul><ul><li>input: CS271$ ‘ ‘ ‘ ‘ ‘ ‘ ‘ ‘ </li></ul><ul><ul><li>MOV BH, 00 </li></ul></ul><ul><ul><li>MOV BL, ACT_LEN </li></ul></ul><ul><ul><li>MOV INPUT[BX],’$’ </li></ul></ul>CS271$
  37. 37. <ul><li>This uses file handles to request keyboard input </li></ul><ul><ul><li>Step 1: Set AH = 3FH </li></ul></ul><ul><ul><li>Step 2: Set BX=00H (file handle 00 represents keyboard) </li></ul></ul><ul><ul><li>Step 3: Set CX = maximum number of character to accept </li></ul></ul><ul><ul><li>Step 4: Load offset address of area for entering characters to DX </li></ul></ul>INT 21H function 3F
  38. 38. <ul><li>Example: </li></ul><ul><ul><li>input DB 100 DUP(‘ ‘) </li></ul></ul><ul><ul><li>MOV AH, 3FH </li></ul></ul><ul><ul><li>MOV BX, 00H </li></ul></ul><ul><ul><li>MOV CX, 100 </li></ul></ul><ul><ul><li>LEA DX, input </li></ul></ul><ul><ul><li>INT 21H </li></ul></ul>INT 21H function 3F
  39. 39. <ul><li>Example: (not available in EMU8086) </li></ul><ul><ul><li>input DB 100 DUP(‘ ‘) </li></ul></ul><ul><ul><li>MOV AH, 3FH </li></ul></ul><ul><ul><li>MOV BX, 00H </li></ul></ul><ul><ul><li>MOV CX, 100 </li></ul></ul><ul><ul><li>LEA DX, input </li></ul></ul><ul><ul><li>INT 21H </li></ul></ul>INT 21H function 3F
  40. 40. Practice/Lab 2 <ul><li>Open your browser and open this page: </li></ul><ul><li>C:emu8086documentation8086_instruction_set.html </li></ul><ul><li>And </li></ul><ul><li>C:emu8086documentation8086_and_dos_interrupts.html </li></ul><ul><li>2. Open your emu8086 software </li></ul><ul><li>3. Cut and paste (or type) the following code (as shown in the next page) and save as input.asm </li></ul>
  41. 41. Practice/Lab <ul><li>page 60,132 </li></ul><ul><li>TITLE InputPRactice Input </li></ul><ul><li>; --------------------------------------------- </li></ul><ul><li>STACK SEGMENT PARA STACK 'Stack' </li></ul><ul><li>DW 32 DUP(0) </li></ul><ul><li>STACK ENDS </li></ul><ul><li>; ---------------------------------------------- </li></ul><ul><li>DATASEG SEGMENT PARA 'Data' </li></ul><ul><li>; Please insert your data declaration here </li></ul><ul><li>DATASEG ENDS </li></ul><ul><li>CODESEG SEGMENT PARA 'Code' </li></ul><ul><li>MAIN PROC FAR </li></ul><ul><li>MOV AX, dataseg </li></ul><ul><li>MOV DS, AX </li></ul><ul><li>; Please enter your code here </li></ul><ul><li>MOV AX,4C00H ;exit procedure </li></ul><ul><li>INT 21H </li></ul><ul><li>MAIN ENDP </li></ul><ul><li>CODESEG ENDS </li></ul><ul><li>END MAIN ;End of program </li></ul>
  42. 42. Practice/Lab <ul><li>4. Modify your code so that it performs the following tasks: </li></ul><ul><li>- R ead a string (length <= 50) from keyboard. You need to insert the following into your data declaration </li></ul><ul><li>Para_list label byte </li></ul><ul><ul><li>max_len DB <put the maxlen for this exercise> </li></ul></ul><ul><ul><li>act_len DB ? </li></ul></ul><ul><ul><li>input DB <replace with the maxlen for this exercise> DUP(‘ ‘) </li></ul></ul><ul><ul><li>- Display the string on the screen at (12,40) </li></ul></ul><ul><li>5. Compile and run your code </li></ul>
  43. 43. Project 2
  44. 44. Adavanced Screen Processing <ul><li>Explore INT 10H to: </li></ul><ul><ul><li>Set video mode </li></ul></ul><ul><ul><li>Display attribute or character at cursor position </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×