Announcement

Collapse
No announcement yet.

Some General PB/DOS ASM Questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some General PB/DOS ASM Questions

    (1) is this safe (or functional)? Having a SUB thus in my
    include-in-everything-INC file:

    Code:
    SUB GetDS ()
        ! push ss
        ! pop ds
    END SUB
     
    SUB GetES ()
        ! push ss
        ! pop es
    END SUB
    ...or would such tactics only work if the ASM code were physically
    located in each UNIT's proceures?

    (2) is there a way, I presume it would be with a DOS interrupt service,
    to allocate memory to an EXE (from within a UNIT procedure), and
    have the procedure directly access it? What I mean is, to duplicate
    the functionality of the Win32 "HeapAlloc()" API? If there is a DOS
    service that does this, then do not go to the trouble of spelling it
    out for me, as I can do the research, myself. A simple "yes" or "no"
    will be sufficient.

    Thank you for any replies.


    ------------------

  • #2
    1. No. Registers must be preserved across SUB or FUNCTION boundaries.
    The state needs to be the same when you exit a SUB as when you entered it.

    2. Yes.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment

    Working...
    X