home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Name : ScreenOrigin
- ;
- ; Function: Set screen origin on EGA an VGA
- ;
- ; Caller: TURBO PASCAL
- ;
- ;
- ; void ScreenOrigin(x,y);
- ; int x,y /*pixel x,y coordinates*/
- ;
- .model tpascal
- .data
- crt_mode equ 49h
- addr_6845 equ 63h
- points equ 85h
- bios_flags equ 89h
- extrn bytesperrow:word
- .code
- public screenorigin
-
- screenorigin proc far argx:word, argy:word
-
- mov ax,40h
- mov es,ax ;ES->Video Bios data area
- mov cl,es:[crt_mode]
- mov ax,argx
- mov bx,argy
- cmp cl,7
- ja l01
- je l02
- test byte ptr es:[bios_flags],1
- jnz l02
- jmp short l03
-
- ; setup for graphics modes (8 pixels per byte)
-
- l01: mov cx,8
- div cl
- mov cl,ah
- xor ah,ah
- xchg ax,bx
- mul word ptr bytesperrow
- jmp short l05
-
- ;setup for vga alpha and ega mono alpha mode
- ; (9 pixels per byte)
-
- l02: mov cx,9
- div cl
- dec ah
- jns l04
- mov ah,8
- jmp short l04
-
- ;setup for ega color alpha modes (8 pixels per byte)
-
- l03: mov cx,8
- div cl
- l04: mov cl,ah
- xor ah,ah
- xchg ax,bx
- div byte ptr es:[points]
- xchg ah,ch
- mul word ptr bytesperrow
- shr ax,1
- l05: call setorigin
- ret
- screenorigin endp
-
- setorigin proc near
- add bx,ax
- mov dx,es:[addr_6845]
- add dl,6
-
- ; update Start Address High and Low registers
-
- l20: in al,dx
- test al,8
- jz l20
- l21: in al,dx
- test al,1
- jnz l21
- cli
- sub dl,6
- mov ah,bh
- mov al,0ch
- out dx,ax
- mov ah,bl
- inc al
- out dx,ax
- sti
- add dl,6
- l22: in al,dx
- test al,8
- jz l22
- cli
- sub dl,6
- mov ah,ch
- mov al,8
- out dx,ax
- mov dl,0c0h
- mov al,13h or 20h
- out dx,al
- mov al,cl
- out dx,al
- sti
- ret
- setorigin endp
- end
-
-