Assembly Code Share

Moderators: None (Apply to moderate this forum)
Number of threads: 375
Number of posts: 685

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
OOP and TASM Posted by angelusMortis on 23 Oct 2002 at 4:43 AM
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.

ideal
locals @@
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

proc get_pixel USES es di ax bx dx, STRUCOFS,@@x,@@y : word
        push    0a000h
        pop     es
        mov     di,[STRUCOFS]
        mov     ax,320
        mul     [@@y]
        add     ax,[@@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

Thread Tree
angelusMortis OOP and TASM on 23 Oct 2002 at 4:43 AM
emu8086 Re: OOP and TASM on 24 Oct 2002 at 12:19 PM
angelusMortis Re: OOP and TASM on 24 Oct 2002 at 11:41 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.