Finding bytes of memory in Pep9 assembly code

517 Views Asked by At

This assembly code takes an input, multiplies it by 35,and leaves result in the register. It's 17 bytes of memory, but how do I calculate that?

deci M,d

ldwa M,d

asla ;2m

asla ;4m

asla ;8m

asla ; 16m

adda M,d ; 17m

asla ; 34m

adda M,d ; 35m

2

There are 2 best solutions below

0
user3344003 On

Every assembler I have ever seen has the ability to generate a listing that shows the how it allocates memory.

3
Շի րակ On

Your question is not clear. You are probably have started learning assembly language and it can be confusing. Don't worry just go through couple of examples and you will learn it. You first declare a variable, perform all needed function and then store the variable, and you clearly are not doing it. btw you are using the accumulator and not x register.

asla, adda, etc. the a in adda stands for accumulator. if it were addx it would have been xregister.

anyway if you are asking how to know how much memory you gonna need just search and see how much memory decimals etc need and declare your variables accordingly or you can use the stack and heaps.