Jump to content
  • Advertisement
Sign in to follow this  
VanillaSnake21

assembly question

This topic is 4078 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Im having problems with my code, I'm trying to get the argument string from the PSP at offset 81h, and a part of my code is
	mov ah, 62h
	int 21h     ;// get PSP addrs

	push es
		mov es, bx                ;// bx contains the PSP addrs after the last 62h - 21h call
	        lea ax, byte ptr es:[81h] ;// loads absolute addr of a byte
	pop es

this is not all the code, but i just wanted to clarify something for myself, what is the point of byte ptr infront of es:[81h]? When I run the code through a debugger (CodeView) it disassembles the lea instruction to lea ax, word ptr es:[81h], which is the same as if I had ommited the byte ptr in the first place. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Labeling a pointer with a size only matters when you're moving data. When you're doing address calculations(as 'lea' does), it doesn't matter at all.

Share this post


Link to post
Share on other sites
Quote:
Original post by Extrarius
Labeling a pointer with a size only matters when you're moving data. When you're doing address calculations(as 'lea' does), it doesn't matter at all.


Thanks, thats what I wantd to know

Share this post


Link to post
Share on other sites
This might be a little off from my OP question, but i didnt wanna start a new thread.
When I display a string, with function 09h, int 21h, I have to put the string I want to display into DS:DX format. So what I do is

mov ax, seg line_str ;move the segment address into ax
mov ds, ax ;point ds at address in ax
lea dx, line_str ; compute (offset?) global address of line_str
mov ah, 09h ;specify subfunction to use in int21h
int 21h ;call DOS interrupt




So my question is - if lea loads the effective address, which is an absolute address of a mem location, how come this works? Isn't DX supposed to contain the offset to the line_str, but instead here it contains a whole global address. Thanks

EDIT: added comments

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!