How many temp registers are needed for 'pop segment index'?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How many temp registers are needed for 'pop segment index'?

linuxford
Hello,
I'm using 20 assembly commands and two temp registers to code the 'pop segment index'

I know I have extra assembly commands than what is actually needed. Could you please specify roughly how many commands and temp registers one actually 'needs' for a more optimum translation of the 'pop segment index'?

I don't know if this is out of line, but wondering if perhaps you could post some psuedo code or rough flow? If not, totally okay. Thanks for any help :)
Reply | Threaded
Open this post in threaded view
|

Re: How many temp registers are needed for 'pop segment index'?

Bobber
Most of them are really similar but pointer and static are a little different.  For the others I only needed 1 temp register and i think they only differed by 1 command each. I know I was more than 10 but less than 20 on my machine commands:

Store segment[index] in a temp variable
Set D to sp-1
Goto address in temp
Set this location to D
Reply | Threaded
Open this post in threaded view
|

Re: How many temp registers are needed for 'pop segment index'?

linuxford
Great feedback! Thanks for the information. Psuedo code was helpful.

I used one temp register and total of 14 assembly commands.
Reply | Threaded
Open this post in threaded view
|

Re: How many temp registers are needed for 'pop segment index'?

linuxford
I was able to shave one less assembly command from the 'pop segment index' vm code translation.
'push segment index'   took 10 assembly commands and no temp register.

Thanks again for feedback, getting better at this.