home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 24
/
CD_ASCQ_24_0995.iso
/
dos
/
prg
/
dsik205
/
dsik.dat
/
EXAMPLES
/
EXAMP10B.ASM
< prev
next >
Wrap
Assembly Source File
|
1995-04-10
|
4KB
|
164 lines
;/***************************************************************************
;*
;* Digital Sound Interface Kit (DSIK)
;* Version 2.00
;*
;* by Carlos Hasan
;*
;* Filename: example10b.asm
;* Version: Revision 1.0
;*
;* Language: Turbo Assembler 4.0 (Ideal Mode)
;* Environment: IBM PC (DOS/4GW)
;*
;* Description: Assembly routines for the examp10.c source file.
;*
;***************************************************************************/
ideal
p386
model flat,c
; equates & structures
XDOTS = 256 ; window width and height in pixels
YDOTS = 160
struc point ; (x,y) 2-d point structure
x dd ?
y dd ?
ends point
; data segment
dataseg
x1 dd ? ; temp variables
y1 dd ?
x2 dd ?
y2 dd ?
dx1 dd ?
dy1 dd ?
dx2 dd ?
dy2 dd ?
; code segment
codeseg
global drawimage:proc
;============================================================================
; void drawimage(char *imageptr, point *pnts)
; In:
; EAX = 256x256 image address
; EDX = vertex points
;============================================================================
proc drawimage
pushad
mov esi,eax ; esi = imageptr
mov ebx,edx ; ebx = pnts
mov edi,0a0000h+((320-XDOTS)/2)+320*((200-YDOTS)/2)
mov eax,[ebx+8*0+point.x] ; (x1,y1) = pnts[0]
mov edx,[ebx+8*0+point.y]
shl eax,8
shl edx,8
mov [x1],eax
mov [y1],edx
mov eax,[ebx+8*1+point.x] ; (x2,y2) = pnts[1]
mov edx,[ebx+8*1+point.y]
shl eax,8
shl edx,8
mov [x2],eax
mov [y2],edx
mov eax,[ebx+8*3+point.x] ; (dx1,dy1) = (pnts[3]-pnts[0])/YDOTS
sub eax,[ebx+8*0+point.x]
cdq
shld edx,eax,8
shl eax,8
mov ecx,YDOTS
idiv ecx
mov [dx1],eax
mov eax,[ebx+8*3+point.y]
sub eax,[ebx+8*0+point.y]
cdq
shld edx,eax,8
shl eax,8
idiv ecx
mov [dy1],eax
mov eax,[ebx+8*2+point.x] ; (dx2,dy2) = (pnts[2]-pnts[1])/YDOTS
sub eax,[ebx+8*1+point.x]
cdq
shld edx,eax,8
shl eax,8
mov ecx,YDOTS
idiv ecx
mov [dx2],eax
mov eax,[ebx+8*2+point.y]
sub eax,[ebx+8*1+point.y]
cdq
shld edx,eax,8
shl eax,8
idiv ecx
mov [dy2],eax
mov ecx,YDOTS ; for y=1 to YDOTS do
drawimagel0:
push ecx
mov eax,[y2] ; stepy = (y2-y1)/XDOTS
sub eax,[y1]
cdq
mov ecx,XDOTS
idiv ecx
mov ebp,eax
mov eax,[x2] ; stepx = (x2-x1)/XDOTS
sub eax,[x1]
cdq
idiv ecx
mov ecx,eax
mov ebx,[x1] ; (ebx,edx) = (x1,y1)
mov edx,[y1]
xor eax,eax
I=0 ; for x=1 to XDOTS do
REPT XDOTS
mov al,bh ; (ebx,edx) = (posx,posy)
mov ah,dh ; (ecx,ebp) = (stepx,stepy)
add ebx,ecx
mov al,[eax+esi]
add edx,ebp
mov [edi+I],al
I=I+1
ENDM ; next x
mov eax,[dx1] ; (x1,y1) += (dx1,dy1)
mov edx,[dy1]
add [x1],eax
add [y1],edx
mov eax,[dx2] ; (x2,y2) += (dx2,dy2)
mov edx,[dy2]
add [x2],eax
add [y2],edx
add edi,320 ; screenptr += 320
pop ecx
dec ecx
jg drawimagel0 ; next y
popad
ret
endp
end