Assembly newbie question

This is a discussion on Assembly newbie question within the Tech Board forums, part of the Community Boards category; Code: .... mov dx,OFFSET FNAME mov ax,3D02H int 21H jc FOK_NZEND mov bx,ax push bx mov cx,5 mov dx,OFFSET START_IMAGE ...

  1. #1
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    375

    Assembly newbie question

    Code:
    ....
           mov     dx,OFFSET FNAME 
           mov     ax,3D02H            
           int     21H
           jc      FOK_NZEND           
    
           mov     bx,ax               
           push    bx                  
           mov     cx,5               
           mov     dx,OFFSET START_IMAGE       
           mov     ah,3FH              
           int     21H
    
           pop     bx                  
           mov     ah,3EH
           int     21H                 
    
           mov     ax,WORD PTR [FSIZE] 
           add     ax,OFFSET ENDPROG - OFFSET PROG   
           jc      FOK_NZEND           
           cmp     BYTE PTR [START_IMAGE],0E9H   
           jnz     FOK_ZEND            
           cmp     WORD PTR [START_IMAGE+3],4956H   
           jnz     FOK_ZEND            
    ....
    Hi im trying to learn assembly.
    Above lines are intended to assembled with TASM. but im using NASM and when i assemble them with nasm, i get errors for lines with OFFSET, WORD PTR and BYTE PTR. How can fix the code to assemble it with nasm. (when i just delete above statements (eg. mov dx, FNAME) thoes errors dont show up, but is it right to do that?)

    thanx.
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    OFFSET means "the address of within the current segment". I think you can just remove that all together - it will be obvious if it works or not.

    WORD PTR, etc, you need to put the size without ptr inside the [], e.g. [word: blah] will access blah as a word.

    See the NASM manual: http://nasm.sourceforge.net/doc/nasmdoc0.html

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    375
    worked. thanks.
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. Newbie with Very Newbie Question
    By Jedi_Mediator in forum C++ Programming
    Replies: 18
    Last Post: 07-01-2008, 08:00 AM
  3. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  4. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 05:45 PM
  5. Question about conversions between assembly, binary, and c
    By Waldo2k2 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 07-18-2002, 05:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21