Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: What could cause an instruction to be skipped? #9

Closed
fschutt opened this issue Oct 27, 2017 · 2 comments
Closed

Question: What could cause an instruction to be skipped? #9

fschutt opened this issue Oct 27, 2017 · 2 comments

Comments

@fschutt
Copy link

fschutt commented Oct 27, 2017

I'm sorry if this isn't the right place to ask, but it's hard getting someone with assembly experience.

I'm going through the tutorials (thanks a lot!) and I have this code:

org 100h
mov ax, 0800h
mov ds, ax
mov si, c[3]
ret

c DW 5 DUP(09h)

When I'm stepping through the code, the instruction mov si, c[3] doesn't do anything (I'd expect it to set SI to 0009). If I write it like this, however:

org 100h
mov si, c[3]
ret

c DW 5 DUP(09h)

... then it works. Is this intended somehow or is this a bug in the emulator? Does SI depend on other things to be set to certain values? If I use ax instead of si, it only changes ah for some reason. Could you replicate this or is this intentional? Thanks in advance.

@gurugio
Copy link
Owner

gurugio commented Oct 30, 2017

mov ax, 0800h
mov ds, ax
Those commands set ds=0800h.
So, "mov si, c[3]" command is "mov si, ds:c[3]", and it means "mov si, 0800:c[3]".
What is the address of c array?
Is the segment address of c array 0800h?

The second source does not change the segment address.
So it can read the c array.

@fschutt
Copy link
Author

fschutt commented Oct 30, 2017

Thanks a lot for the answer!

@fschutt fschutt closed this as completed Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants