Title: Mouse
1Mouse
Invent by Douglas C. Engelbart in 1964, Stanford
Research Institute in Menlo Park, CA, USA
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
2Mouse
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
3Mouse
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
4Mouse
INT 33H Reset driver and read status Input AX
0000 Return AX -1 if mouse
hardware/driver installed 0 if
mouse hardware/driver not installed BX Number
of buttons -1 Two buttons
0 Other than two 3 Mouse system
mouse
Note Install mouse driver before use
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
5Mouse
INT 33H Show mouse cursor Input AX
0001 Hide mouse cursor Input AX 0002 Note
Multiple calls to hide mouse cursor will
require multiple calls to function 01h to un hide
it.
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
6Mouse
INT 33H Return position and Button status Input
AX 0003 Return BX Button status
Bit 0 left button pressed if 1
Bit 1 right button pressed if 1 Bit
2 middle button pressed if 1 ( Mouse system
mouse ) CX Column DX Row
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
7Mouse
INT 33H Position mouse cursor Input AX
0004 CX Column DX Row
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
8TSR ( Terminate and Stay Resident )
Outline ISR proc near . ISR endp Ini
t proc near Init endp
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
9TSR
ISR proc near . call
routine1 iret ISR endp Routine1
proc near .. Routine1 endp
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
10TSR
Init proc near Install ISR to some
INT Terminated but stay resident Init endp
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
11TSR
Install ISR to some INT Init proc near
assume cscode,dscode
model tiny Point ISR to some interrupt
mov ax,25xxh xx INT No. mov
dx,offset ISR int 21h
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
12TSR
INT 21H Set interrupt vector Input AH 25h
( 37 ) AL Interrupt number DS DX
Address of interrupt handler Return None
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
13TSR
Terminated but stay resident point
to last address 1 mov dx, offset
Init int 27h Init enp
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
14TSR
INT 27H Terminate and Stay Resident Input CS
Segment of PSP DX Address of which next
program may be loaded ( highest
address to stay resident 1 ) Note this
interrupt limit portion of stay resident to 64KB
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
15TSR
ISR proc near .. iret ISR endp Init proc
near assume cscode,dscode
model tiny mov ax,25xxh xx INT
No. mov dx,offset ISR int
21h mov dx, offset Init int 27h Init enp
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
16TSR
INT 21H Terminate and Stay Resident Input AH
31h ( 49 ) AL Return code DX Size of
resident portion, in paragraphs ( 16
Bytes ) Note this function allow portion of
stay resident more than 64KB and can send return
code to parent process
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
17TSR
Init proc near assume
cscode,dscode model tiny mov
ah,25h mov al,xxh xx INT No. mov
dx,offset ISR int
21h mov ah,31h mov dx, offset
Init shr dx,4 size in paragraph inc dx ro
und up to next paragraph int 21h Init enp
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
18TSR
INT 21H Get interrupt vector Input AH 35h
( 53 ) AL Interrupt number Return ES BX
Point to the interrupt handling routine
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
19TSR
mov ax, 35xxh xx INT No. int
21h mov word ptr OldInt, bx save Old
ISR mov word ptr OldInt 2, es mov ax,
25xxh xx INT No. mov dx, offset
ISR int 21h mov ah, 31h mov dx, offset
Init shr dx, 4 size in paragraph inc dx rou
nd up to next paragraph int 21h Note code
segment must have PARA directive
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
20.COM
- .COM and .EXE
- No defined stack or data segment
- All code data stack can not exceed 64KB
- ASSUME directive use to point all segment
register to same address - ORG directive must be use to start at 100H, 00
FFh is PSP - JMP instruction use to jump to main code at
start
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
21.COM
CodeSeg Segment Para Code Assume
CSCodeSeg, DSCodeSeg, SSCodeSeg,
ESCodeSeg ORG 100H Begin JMP Main ------
--------------------------------------------------
----- Str__ DB Hello world!, data
area --------------------------------------------
----------------- Main Proc near Main endp
CodeSeg ends END Begin
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
22.COM
.MODEL SMALL .CODE ORG 100H Begin JMP Main --
--------------------------------------------------
--------- Str__ DB Hello world!, data
area --------------------------------------------
----------------- Main Proc near Main endp
END Begin
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
23.COM
TASM Test TLINK /T Test EXE2BIN Test
Test.com
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
24A bit more on Text mode
INT 10H Set active display page Input AH
05h AL Display page number Return None
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
25A bit more on Text mode
INT 10H Scroll window up and down Input AH
06h ( Up ) , AH 07h ( Down ) AL Number of
lines to scroll ( if 0, clear screen ) BH
Display attribute of blank line CH Row number
of upper left corner CL Column number of
upper left corner DH Row number of upper left
corner DL Column number of upper left
corner Note This service effect only currently
active display page
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
26A bit more on Text mode
Direct Video Display In mode 3, Text mode with
80 X 25, 16 color, 4 pages 2 bytes for 1 char
1 for ASCII and 1 for attribute 1 screen use 80 X
25 X 2 4,000 Bytes Page 0 start at B800h
0000h
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
27Graphic Mode
Graphic mode list Mode Type Resolution Colors Sta
rting Address 04H Color 320 X 200 4 B8000H 05H M
ono 320 X 200 B8000H 06H Mono 640 X
200 B8000H 0DH Color 320 X 200 16 A0000H 0EH
Color 640 X 200 16 A0000H 0FH Mono 640 X
350 A0000H 10H Color 640 X 350 16
A0000H 11H Color 640 X 480 2 of 262,144
A0000H 12H Color 640 X 480 16 of 262,144
A0000H 13H Color 320 X 200 256 of
262,144 A0000H 6AH Color 800 X 600 16 A0000H
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
28Graphic Mode
Standard SVGA modes
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
29Graphic Mode
INT 10H Set video mode Input AH 00h AL
Video mode Return None Note When the mode
is change, the screen is cleared.
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
30Graphic Mode
INT 10H Get current video mode Input AH 0Fh
( 15 ) Return AL Video mode AH Number of
character columns per line BH Active display
page number
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
31Graphic Mode
mov ah,0Fh int 10h get current video
mode mov OldMode, al mov ah,
00 mov al, 12h 640 X 480 int
10h change to graphic mode mov
ah, 00 mov al, OldMode int 10h Back
to Text mode
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
32Graphic Mode
INT 10H Write Pixel Input AH 0Ch ( 12
) AL Pixel color CX X Coordinate of pixel
( Horizontal ) DX Y Coordinate of pixel (
Vertical ) BH Display page number ( if more
than 1 page ) Return None
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5
33Graphic Mode
INT 10H Read Pixel Input AH 0Dh ( 13 ) CX
X Coordinate of pixel ( Horizontal ) DX Y
Coordinate of pixel ( Vertical ) BH Display
page number ( if more than 1 page ) Return AL
Pixel color
C. Vongchumyen 1 / 2004
Computer Organization and Assembly Language 5