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

DCR instruction doesn't work properly after 80h #46

Open
torishabhmehta opened this issue Apr 14, 2020 · 1 comment
Open

DCR instruction doesn't work properly after 80h #46

torishabhmehta opened this issue Apr 14, 2020 · 1 comment
Assignees
Labels
core Issues about core logic

Comments

@torishabhmehta
Copy link

torishabhmehta commented Apr 14, 2020

I was working with a pretty basic multiplication code when I encountoured that my code is failing for higher values of a particular operand. After investigating, I found that the dcr operation sets the S flag to 1 for values in register higher than 80h. This is obviously a bug, since S flag should be set only if dcr is operating on 00h register entry. Please look into this. Here's my code for error reproduction:

;<Multiplication Program>

jmp load

;data
num: db 0ffh, 81h
res: db 00h, 00h

;code
load: nop
lhld num
xchg
mov c, d
mvi d, 0h
lxi h, 0000h


main: nop
dcr c
jm end
dad d
jmp main

end: nop
shld res
hlt
@torishabhmehta torishabhmehta changed the title DCR instruction doesn'y work properly after 80h DCR instruction doesn't work properly after 80h Apr 14, 2020
@torishabhmehta
Copy link
Author

The code works perfectly for values in num+1 less than/equal to 80h. The dcr operation acting on higher values than that simply sets the S flag, which triggers the jm command

@onkarshinde onkarshinde added the core Issues about core logic label May 5, 2020
@srid srid removed their assignment Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues about core logic
Projects
None yet
Development

No branches or pull requests

4 participants