home *** CD-ROM | disk | FTP | other *** search
- ; MOUSEASM.S
- ; copyright 1989, MicroWay, Inc.
- ; ------------------------------------- ;
- name t2 ;
- .387 ;
- assume cs:codeseg ;
- assume ds:dataseg ;
- codeseg segment dword er use32 public ;
- ;
- extrn _init_mouse:near ;
- extrn _show_mouse_cursor:near ;
- extrn _hide_mouse_cursor:near ;
- extrn _get_mouse:near ;
- extrn _set_mouse:near ;
- extrn _get_press:near ;
- extrn _get_release:near ;
- extrn _mouse_viewport:near ;
- extrn _read_motion:near ;
- extrn _set_mp_ratio:near ;
- extrn _set_mouse_cursor:near ;
- extrn _set_subroutine:near ;
- ;
- dataseg segment dword rw use32 public ;
- ;
- intno dw 33h ; This is a data area to
- rds dw (?) ; hold the values of registers
- res dw (?) ; for the Phar Lap service,
- rfs dw (?) ; int 21, number 2511, issue
- rgs dw (?) ; real mode interrupt with
- reax dd (?) ; specified register values
- redx dd (?) ;
- ;
- dataseg ends ;
- align 4 ;
- ;
- _mouse proc near ;
- public _mouse ; C & Pascal entry
- _mouse_: ;
- public _mouse_ ; FORTRAN entry
- push ebp ;
- mov ebp,esp ; save all registers -
- push eax ; we don't know what kind
- push ebx ; of trouble the mouse
- push ecx ; interrupt may produce
- push edx ;
- push edi ;
- push esi ;
- pushf ;
- ;
- ; int 21 service function 2511 requires that an area in memory be
- ; used to specify the contents of the eax, ds, es, fs, gs, and edx
- ; registers, as these cannot be loaded at the time the function is
- ; invoked. edx points at the location.
- ;
- ; For most functions, we only need to save the contents of eax and
- ; edx in this place, but for functions 9, 12, 18, and 'R', es will
- ; also have to be specified. ds is loaded with a copy of es in these
- ; cases as a matter of safety.
- ;
- ; In the case of graphics cursor, we assume it is at an offset of 0
- ; into its segment (each such cursor will require, for that reason,
- ; its own segment). We cannot do this in the case of a routine, so
- ; the programmer will have to pass the entry point as an argument.
- ;
- mov esi,[ebp+08h] ;
- mov eax,[esi] ; first parameter
- mov reax,eax ; into memory
- mov esi,[ebp+0ch] ;
- mov ebx,[esi] ; second parameter
- mov esi,[ebp+10h] ;
- mov ecx,[esi] ; third parameter
- mov esi,[ebp+14h] ;
- mov eax,[esi] ; fourth paramter
- cmp reax,9 ; if the first parameter is
- je short m1 ; 9, 12, 18 or 'R', then
- cmp reax,12 ; load es
- je short m2 ;
- cmp reax,18 ;
- je short m1 ;
- cmp reax,'R' ;
- je short m1 ;
- mov redx,eax ;
- jmp short m4 ;
- m1: ;
- mov redx,0 ; array of data - offset 0
- jmp short m3 ;
- m2: ;
- mov redx,ebx ; entry into routine
- m3: ;
- mov rds,ax ;
- mov res,ax ;
- m4: ;
- mov edx,offset intno ; offset of memory area
- mov ax,2511h ;
- int 21h ; do the interrupt
- mov eax,redx ; now, replace parameters with
- mov edi,[ebp+14h] ; return values
- mov [edi],eax ; last parameter
- mov edi,[ebp+10h] ;
- mov [edi],ecx ; third
- mov edi,[ebp+0ch] ;
- mov [edi],ebx ; second
- mov eax,reax ;
- mov edi,[ebp+08h] ;
- mov [edi],eax ; first
- popf ; restore registers
- pop esi ;
- pop edi ;
- pop edx ;
- pop ecx ;
- pop ebx ;
- pop eax ;
- pop ebp ;
- ret ; return
- _mouse endp ;
- ;
- ;
- _realbuf_ proc near ;
- public _realbuf_ ; FORTRAN entry
- _realbuf: ;
- public _realbuf ; C & Pascal entry
- push ebx ;
- push edi ;
- push esi ;
- mov edx,[esp+10h] ; address of parameter
- mov ebx,[edx] ; parameter
- shr ebx,4 ; we want to request paragraphs
- inc ebx ; round up
- mov ax,25c0h ; request rm memory function
- int 21h ;
- jnc short rb1 ; carry indicates failure
- mov eax,-1 ; for failure, return -1
- jmp short rb2 ;
- rb1: ;
- movzx eax,ax ;
- rb2: ;
- mov [edx],ax ; the parameter value has been
- pop esi ; replaced with the segment value
- pop edi ;
- pop ebx ;
- ret ; return
- _realbuf_ endp ;
- align 4 ;
- ;
- ; The following are FORTRAN entry points - it would have been
- ; a tiny bit faster to doctor the output of the Pascal compilation
- ; (the Assembly file) to insert labels, but it would also be more
- ; likely that errors would result in the release product.
- ;
- ;
- _init_mouse_ proc near ;
- public _init_mouse_ ;
- jmp _init_mouse ;
- _init_mouse_ endp ;
- ;
- _show_mouse_cursor_ proc near ;
- public _show_mouse_cursor_ ;
- jmp _show_mouse_cursor ;
- _show_mouse_cursor_ endp ;
- ;
- _hide_mouse_cursor_ proc near ;
- public _hide_mouse_cursor_ ;
- jmp _hide_mouse_cursor ;
- _hide_mouse_cursor_ endp ;
- ;
- _get_mouse_ proc near ;
- public _get_mouse_ ;
- jmp _get_mouse ;
- _get_mouse_ endp ;
- ;
- _set_mouse_ proc near ;
- public _set_mouse_ ;
- jmp _set_mouse ;
- _set_mouse_ endp ;
- ;
- _get_press_ proc near ;
- public _get_press_ ;
- jmp _get_press ;
- _get_press_ endp ;
- ;
- _get_release_ proc near ;
- public _get_release_ ;
- jmp _get_release ;
- _get_release_ endp ;
- ;
- _mouse_viewport_ proc near ;
- public _mouse_viewport_ ;
- jmp _mouse_viewport ;
- _mouse_viewport_ endp ;
- ;
- _read_motion_ proc near ;
- public _read_motion_ ;
- jmp _read_motion ;
- _read_motion_ endp ;
- ;
- _set_mp_ratio_ proc near ;
- public _set_mp_ratio_ ;
- jmp _set_mp_ratio ;
- _set_mp_ratio_ endp ;
- ;
- _set_mouse_cursor_ proc near ;
- public _set_mouse_cursor_ ;
- jmp _set_mouse_cursor ;
- _set_mouse_cursor_ endp ;
- ;
- _set_subroutine_ proc near ;
- public _set_subroutine_ ;
- jmp _set_subroutine ;
- _set_subroutine_ endp ;
- ;
- codeseg ends ;
- end ;