flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Review my loader...

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 25 Nov 2009, 19:54
You mean to set SP as 0 and let it wrap around?
Code:
xor sp,sp ; SP = 0x0000
push xxx  ; SP = 0xFFFF    
Post 25 Nov 2009, 19:54
View user's profile Send private message Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 295
Alphonso 26 Nov 2009, 02:43
Almost like that. When pushing/popping it's done in either words, dwords or qwords.

For instance the default of 'push 1' in real mode will decrement SP by 2 (SP = 0000 - 2 = FFFE) then place word 0001 at SS:FFFE (byte FFFE=01, byte FFFF=00).

I suppose you could use FFFF as a way of checking you haven't popped more than you've pushed since if SP is set to 1 the next push should produce a double fault, never tried it though. Twisted Evil
Post 26 Nov 2009, 02:43
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.