Now, the situation is I have two program, one is bootloader, it run
in
a floppy disk at 0x7c00, it works greak, it function is load the fd's
second and third sector into memory(2nd sector at 0x8000, 3rd sector
at 0x9000), the code at 0x8000 is used for enable the protect mode,
after that, GD-CODE segment in GDT is from 0 to 4GB, GD-DATA is same,
too. Then jump to 0x9000 and execute my program was loaded from fd's
3rd sector. I want to run a C-compiled program, is it's format must
be
'32bit plain binary file', and I'm using gcc, ld, objcopy to make it.
gcc -c test.c
ld test -o test.o -e my -Ttext 0x9000 -i
objcopy test.o test.bin -R .note -R .comment -S -O binary
the complete C code is here:
---------------------------------------------------------------------------*-------------------------------------------
void my()
{
unsigned char *vm=(unsigned char *)0xb8000;
*(vm++)='a';
*(vm++)=0xc;
*(vm++)=0xc;
*(vm++)='d';
while(1);
}
---------------------------------------------------------------------------*--------------------------------------------
it doesn't work~~!
and my assemble file works fine.
code is here:
(nasm)
---------------------------------------------------------------------------*----------------------------------------------
bits 32
org 09000h
;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; *;;;;;;;;
mov edi, (80 * 0 + 0) * 2 + 0b8000h
mov ah, 0Ch
mov al, 'a'
mov [ds:edi], ax
mov edi, (80 * 0 + 1) * 2 + 0b8000h
mov ah, 0Ch
mov al, 'b'
mov [ds:edi], ax
mov edi, (80 * 0 + 2) * 2 + 0b8000h
mov ah, 0Ch
mov al, 'c'
mov [ds:edi], ax
mov edi, (80 * 0 + 3) * 2 + 0b8000h
mov ah, 0Ch
mov al, 'd'
mov [ds:edi], ax
mov edi, (80 * 0 + 4) * 2 + 0b8000h
mov ah, 0Ch
mov al, 'e'
mov [ds:edi], ax
mov edi, (80 * 0 + 5) * 2 + 0b8000h
mov ah, 0Ch
mov al, 'f'
mov [ds:edi], ax
;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; *;;;;;;;;;;;
jmp $
---------------------------------------------------------------------------*--------------------------------------------------------------- 2 1728
sorry to everyone, it works well.
i made some serious mistakes. Yi********@gmai l.com wrote:
sorry to everyone, it works well.
i made some serious mistakes.
Free standing, platform specific code is perhaps more topical for
alt.os.developm ent or comp.arch and perhaps alt.lang.asm. This group is
primarily for Standard C which is usually inadequate for such purposes. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: shoo |
last post by:
Any one know how to do this? thank
Write a simple text-formatting program that produces neatly printed
output from input text containing embedded command lines that
determine how to format the output; all lines begin with a period are
command lines. The task of the program is to collect words from input
lines, fill output lines with...
|
by: shoo |
last post by:
Any one know how to do this? thank
Write a simple text-formatting program that produces neatly printed
output from input text containing embedded command lines that
determine how to format the output; all lines begin with a period are
command lines. The task of the program is to collect words from input
lines, fill output lines with...
|
by: G Patel |
last post by:
I wrote the following program to remove C89 type comments from stdin
and send it to stdout (as per exercise in K&R2) and it works but I was
hoping more experienced programmer would critique the layout/style/etc.
Any comments will be helpful. Thank you.
/*
****************************************************
C89/90 COMMENT REMOVER
|
by: sunniyeow |
last post by:
Hi, My question is regarding password protecting 2 different folders
inside a single virtual directory using forms authentication method.
Easier if I illustrate things out...
- <authentication mode="Forms">
- Virtual Directory aka Top Level Root = /mysite
- Inside /mysite I have 2 sub-folders which I want to password protect
= /adminonly...
|
by: Alan Silver |
last post by:
Hello,
Sorry this is a bit wordy, but it's a pretty simple question...
I have a web site, http://domain/ which is a public site, part of which
(http://domain/a/) is protected by forms authentication.
I would like to configure it so that anyone not logged in, trying to
access the protected part will not be redirected to the login page,...
| |
by: Flavio |
last post by:
Hi, I try to write here because maybe my problem is a common one.
I have a rather complicated multithreaded program, which uses the POSIX
pthread standard.
A master routine calls a series of slave routines.
My problems is about output. If I use the standard syntax:
.....
cout << "Hi, I am thread number" << i << endl;
|
by: Mario |
last post by:
Hello,
I need a program what generates me a blue screen in Windows XP with .net!
This should be simple, but how?
Please help me.
Mario
|
by: r_spaargaren |
last post by:
Hello,
for a school project i need to program the Motorola 68HC11 to use the
HD44780 LCD controller, and this must be done in C lang plus maybe a
bit of assembly.
The 68HC11 uC is embedded in a HandyBoard (www.handyboard.com).
The Handyboard gives the following problem:
The Handyboard has different modes, Expanded mode and Singe chip...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |