home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
games
/
egagraph.zip
/
PLOT.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-07-23
|
3KB
|
99 lines
; PLOT.ASM EGA point plotting routine (mode 2)
; PROCEDURE Plot(x,y,Color : INTEGER);
; This routine is designed to be called from Turbo Pascal.
; It has been tested on both EGA and 640x480 modes on the
; Video 7 graphics board. This routine draws at about 84,000
; pixels per second on a 10 mhz, 1 wait state, 286 machine.
; If you find a way to make it faster, let me know.
; James Billmeyer
; Soft-Touch Computer Systems
; 7716 Balboa Blvd., Unit D
; Van Nuys, Ca. 91406
; (818) 781-4400
; LINE.ASM EGA line drawing routine
; This routine is designed to be called from Turbo Pascal.
; It has been tested on both EGA and 640x480 modes on the
; Video 7 graphics board. If you find a way to make it faster,
; let me know.
; James Billmeyer
; Soft-Touch Computer Systems
; 7716 Balboa Blvd., Unit D
; Van Nuys, Ca. 91406
; (818) 781-4400
cseg segment byte ; start of code segment
assume cs:cseg
Plot proc near
int 1
push bp ; save bp register
mov bp,sp ; get top of stack
mov dx,0A000h ; ds := EGA buffer segment address
mov es,dx
mov ax,[bp+6] ; address := (y * 80) + (x / 8)
mov dx,80
mul dx
mov cx,3
mov di,[bp+8]
shr di,cl
add di,ax
mov cx,[bp+8] ; mask := 1 shl (7 - x mod 8)
and cl,7
xor cl,7
mov ch,1
shl ch,cl
mov bl,ch
; Select Write Mode 2
mov dx,3CEh ; select mode register
mov ax,5
out dx,al
mov dx,3CFh ; set to write mode 2
mov ax,2
out dx,al
; Set Bit Mask Register
mov dx,3CEh ; select register 8
mov ax,8
out dx,al
mov dx,3CFh ; output bit mask to register 8
mov al,bl
out dx,al
; Latch all four bit planes
mov al,es:[di] ; latches all four bit planes
; Write Pixel
mov ax,[bp+4] ; get color
mov es:[di],al
; Restore defualt EGA graphics status
mov dx,3CEh
mov ax,5
out dx,al
mov dx,3CFh
mov ax,0
out dx,al
mov dx,3CEh
mov ax,8
out dx,al
mov dx,3CFh
mov ax,0FFh
out dx,al
pop bp
ret 6
plot endp
cseg ends
end