×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Memory Management

Memory Management

Memory Management

(OP)
Hi!!!

I´m searching for some help on Mem in Asm...
Could someone of you please post some code on how to
save something in Mem (like an string in basic)

Thanx
Doc DooM

RE: Memory Management

I'm not sure I understand what you mean. In ASM strings are just chunks of memory. You can declare a block of memory with a DS command (Declare Storage)or a DC (Declare Constant). I am assuming you are using x86 ASM. Different platforms use different commands.

RE: Memory Management

First declare how much memory you want to set
aside for a given field. Either a DC or a DS will
do this. The difference is a DS merely reserves
the memory but doesn't change the contents of the
memory, while a DC reserves the memory and stores
a constant in it.
FIELD-1 DS CL80 Reserves 80 bytes
FIELD-2 DC CL80'ABCE' Reserves 80 bytes, and
puts ABCD in the leftmost
4 bytes, and fills the
remaining 76 with blanks.
The compiler automatically
fills unused positions to the right with blanks,.
for C (character) fields.
Notice the DS has nothing in apostrophes after it.
The DC has to have something in apostrohes, because
that's the nature of the definition.
To move something to the fields:
MVC FIELD-1,=CL8'THORFOUR'
MVC FIELD-2,FIELD-1
Assembler moves the b-field (=CL8'THORFOUR) to the
a-field (FIELD-1). The b-field is another way to
set up a constant, except it won't have a label.
Assembler will then move FIELD-1(which now contains
THORFOUR followed by 76 bytes containing anything,
to FIELD-2, wiping out the ABCD that was there.
Hope this helps.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close