Results 1 to 2 of 2

Thread: Convert this...

  1. #1

    Thread Starter
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    Can someone please convert this to inline assembler or C code? It's needed quite urgently.

    public _setbxdx
    .MODEL SMALL ;whatever
    .CODE
    set_struc struc
    dw ? ;old bp
    dd ? ;return addr (always far call)
    p_bx dw ? ;reg bx value
    p_dx dw ? ;reg dx value
    set_struc ends
    _setbxdx proc far ; must be FAR
    push bp
    mov bp,sp
    mov bx,[bp]+p_bx
    mov dx,[bp]+p_dx
    pop bp
    ret
    _setbxdx endp
    END
    Designer/Programmer of the Comtech Operating System(CTOS)

  2. #2
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Sorry it took so long...

    This is a first draft, but if you want if revised to a cleaner solution, reply back.
    Code:
    // Beginning of program
    struct set_struc 
    {
    short int OldBP;
    long int ReturnAddr;
    // I do not recognize this syntax.
    p_bx dw ? ;reg bx value
    p_dx dw ? ;reg dx value
    /////////////////////////////////////////
    }
    
    // In function
    _asm
    {
    push bp
    mov bp,sp
    mov bx,[bp]+p_bx
    mov dx,[bp]+p_dx
    pop bp
    }
    I hope this helps.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width