This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem writing to dest address (Assembly)

I created a table, where I have various data.
I need to take out data from this table, alter it, then write it back to the same position, however, for some reason, data is not written to the position

Here is my code

CSEG AT 3h
table: DB 100, 200, 150, 170

Lookup: MOV DPTR, #precos ; DPTR points to the start of the lookup table MOV A, #0 ; A is the offset from the start of the lookup table MOVC A, @A + DPTR ; Moves the (A+1)th item into the Accumulator ADD A, #20 MOV R1, #3 MOV @R1, A JMP Lookup

When I loop through the code, A goes from 0 to 100 to 120, then it's supposed to write it at position 3, get it back again, add 20 more, etc...

What I actually need, is a way to access a memory position, alter it, then update it.

Parents Reply Children
No data