-
February 5th, 2004, 01:55 AM
#1
Member
very basic assembly question
I've been reading a lot of assembly tutorials(though it wont probably sound like it), but the only question i have is how do you write to variables? I understand registers, and creating variables, but how can you change a variable's value?????
You laugh because im different, i laugh because your all the same.
-
February 5th, 2004, 04:20 AM
#2
Junior Member
When you want to change a viriables value:
a)if you have a variable on a register you just change the registers value
b)if your variable is in memory then you store your value in the position of memory that your variable is.
-
February 5th, 2004, 03:31 PM
#3
I don't know all the ways to do it, but the simplest
is the db (define byte) statement:
Code:
org 100h
section .data
string ;put any string here
db "hello, world!"
string_length equ $ -string ;calculates the length
section .text
BEGIN:
mov bx,0001h ;write to stdout
mov ah,40h ;write to file or device
mov dx,string ;address of buffer
mov cx,string_length ;length
int 21h ;dos call
mov ah,4ch ;terminate
int 21h ;dos call
see also
I came in to the world with nothing. I still have most of it.
-
February 6th, 2004, 12:14 AM
#4
Member
How do you find the position of a variable?
You laugh because im different, i laugh because your all the same.
-
February 6th, 2004, 12:30 AM
#5
You refer to it by name. mov dx,string puts its address into
the dx register.
I came in to the world with nothing. I still have most of it.
-
February 10th, 2004, 02:50 AM
#6
Member
so if i say:
integer equ 1
mov dx, integer
mov dx, 7
integer will then equal 7? If this is true, how do i remove the integer from the dx register?
You laugh because im different, i laugh because your all the same.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|