Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

assembly language questions.

Status
Not open for further replies.

sagar474

Full Member level 5
Joined
Oct 18, 2009
Messages
285
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,318
Location
India,kakinada
Activity points
3,122
I found this in an article and I cant understand. why?
"If a valid boot sector is found, it is loaded into memory at location 0:07C0h. "

and I'm trying to understand the code.
Code:
mov ax, 07C0h		; Set up 4K stack space after this bootloader
	add ax, 288		; (4096 + 512) / 16 bytes per paragraph
	mov ss, ax
	mov sp, 4096

	mov ax, 07C0h		; Set data segment to where we're loaded
	mov ds, ax
but i cant understand why 07C0h , why 288 ,why 4096

please anyone explain me this.
 

$07c0 is the memory location where the BIOS puts the bootloader.

288 = (4096 + 512) / 16 bytes per paragraph = 4k stack + 512 bytes for bootloader divided into 16-bit words.
 

288 = (4096 + 512) / 16 bytes per paragraph = 4k stack + 512 bytes for bootloader divided into 16-bit words.
The explanation doesn't fit. The stack space is above SS, so the stack size doesn't matter for the register offset. May be an additional 4k data space is provided between code and stack. Or the author was simply confused.
 

Yes, I noticed that too.. I don't pretend to understand the code, but that is certainly how the author came up with the figure 288.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top