Re: db and dw commands

Ed Casas (edc@ece.ubc.ca) Sun, 10 Dec 2000 19:40:54 -0800


Date: Sun, 10 Dec 2000 19:40:54 -0800
From: Ed Casas <edc@ece.ubc.ca>
Subject: Re: db and dw commands

> But, in the Assembly Language lecture, there is an example of > creating a buffer. > buf db 128 dup (?) > This isn't as clear for me. Does "dup" duplicate whatever is in > the parenthesis 128 times? In this case, we'll just have 128 > uninitialized bytes? Yes. > Also, how do we properly access these referenced locations? > mov ax,buf > mov ax, [buf] > Would these both do the same thing? The first instruction loads the contents of the first word in the buffer. The syntax of the second on implies indirect addressing, using the first element of buf (but I'm not sure if it would work). You probably want to look at the assembly-language handout: http://casas.ece.ubc.ca/379/lectures/asm1.pdf which describes how to access the elements of an array: mov bx,offset x ... mov ax,[bx] ... -- Ed Casas edc@ece.ubc.ca http://casas.ece.ubc.ca +1 604 822-2592