flat assembler
Message board for the users of flat assembler.

Index > DOS > MOVing register into RAM, DOS

Author
Thread Post new topic Reply to topic
jatos



Joined: 04 Nov 2006
Posts: 20
jatos 15 Mar 2007, 14:38
I know this may well have been asked before, but I have searched on the forums.

I know I can use MOV to move the contents of a register directly into the memory with anything PUSH or POP. However, how I do know in DOS which memory address to give to MOV?

_________________
Jamie
Post 15 Mar 2007, 14:38
View user's profile Send private message Reply with quote
eek



Joined: 21 Oct 2006
Posts: 24
eek 15 Mar 2007, 21:36
use the ketman interpreter to get a picture for what you're doing.

http://www.btinternet.com/~btketman/tutpage.html

While it isn't FASM and is only 16bit it WILL save you asking a few thousand questions.

A push puts the value onto the stack.
Other areas of memory can be reserved for values of different size or even dynamic values.
Post 15 Mar 2007, 21:36
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 16 Mar 2007, 03:38
Try using GRDB (DOS debugger, but works under Win XP) to view registers before and after instructions. It also allows immediate execution of instructions directly (/and ax,127) without having to assemble and run. It supports at least up through MMX, if not more by now (I forget).
Post 16 Mar 2007, 03:38
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 17 Mar 2007, 05:09
Quote:
but works under Win XP


Sad


Quote:
how I do know in DOS which memory address to give to MOV?


Code:
--------D-2148-------------------------------
INT 21 - DOS 2+ - ALLOCATE MEMORY
        AH = 48h
        BX = number of paragraphs to allocate
Return: CF clear if successful
            AX = segment of allocated block
        CF set on error
            AX = error code (07h,08h) (see #01680 at AH=59h/BX=0000h)
            BX = size of largest available block
Notes:  DOS 2.1-6.0 coalesces free blocks while scanning for a block to
          allocate
        .COM programs are initially allocated the largest available memory
          block, and should free some memory with AH=49h before attempting any
          allocations
        under the FlashTek X-32 DOS extender, EBX contains a protected-mode
          near pointer to the allocated block on a successful return
SeeAlso: AH=49h,AH=4Ah,AH=58h,AH=83h
--------D-2149-------------------------------
INT 21 - DOS 2+ - FREE MEMORY
        AH = 49h
        ES = segment of block to free
Return: CF clear if successful
        CF set on error
            AX = error code (07h,09h) (see #01680 at AH=59h/BX=0000h)
Notes:  apparently never returns an error 07h, despite official docs; DOS 2.1+
          code contains only an error 09h exit
        DOS 2.1-6.0 does not coalesce adjacent free blocks when a block is
          freed, only when a block is allocated or resized
        the code for this function is identical in DOS 2.1-6.0 except for
          calls to start/end a critical section in DOS 3.0+
SeeAlso: AH=48h,AH=4Ah
--------D-214A-------------------------------
INT 21 - DOS 2+ - RESIZE MEMORY BLOCK
        AH = 4Ah
        BX = new size in paragraphs
        ES = segment of block to resize
Return: CF clear if successful
        CF set on error
            AX = error code (07h,08h,09h) (see #01680 at AH=59h/BX=0000h)
            BX = maximum paragraphs available for specified memory block
Notes:  under DOS 2.1-6.0, if there is insufficient memory to expand the block
          as much as requested, the block will be made as large as possible
        DOS 2.1-6.0 coalesces any free blocks immediately following the block
          to be resized
SeeAlso: AH=48h,AH=49h,AH=83h
    


You can also reserve memory just above your executable, see:

http://board.flatassembler.net/topic.php?t=6735 (In Main, MZ examples)

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 17 Mar 2007, 05:09
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 29 Mar 2007, 00:33
Quote:

but works under Win XP Sad


It works under DOS and Win XP (unlike 386SWAT, loaded as a device driver, which needs DOS or QEMU or whatever ...).
Post 29 Mar 2007, 00:33
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.