OOP and TASM

i'm just posting this because some people still didnt realize that
OOP is also possible with TASM.
if u like to find out more about it, search for OOP TASM (or something
like that) on google.

[code]
ideal

model tiny, pascal
p386

STRUC pixel GLOBAL METHOD {

set : word = set_pixel
get : word = get_pixel

}
x dw ?
y dw ?
col db ?
ends pixel

STRUC pixel2 GLOBAL METHOD {
}
x dw ?
y dw ?
z dw ?
ends pixel2


CODESEG
org 100h
main:
push cs
pop ds

mov ax,13h
int 10h

CALL p METHOD pixel:set, offset p
CALL p1 METHOD pixel:set, offset p1
CALL p METHOD pixel:get, offset p,170,110
CALL p METHOD pixel:set, offset p

mov ah,08h
int 21h

mov ax,03h
int 10h

ret


proc set_pixel USES es di ax bx dx, STRUCOFS : word
push 0a000h
pop es
mov di,[STRUCOFS]
mov ax,320
mul [(pixel ptr di).y]
add ax,[(pixel ptr di).x]
mov bx,ax
mov al,[(pixel ptr di).col]
mov [es:bx],al
ret
endp

@y : word
push 0a000h
pop es
mov di,[STRUCOFS]
mov ax,320
@y]
@x]
mov bx,ax
mov al,[es:bx]
mov [(pixel ptr di).col],al
ret
endp

p : pixel { x = 160, y = 100, col = 15 }
p1 : pixel { x = 170, y = 110, col = 2 }

end main[/code]

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories