Hello,
I was working on my little OS project and this is something I wanted to know:
// if this is defined ...
typedef struct
{
unsigned short a;
unsigned char s1;
} my_struct;
What is the placement of the object above in memory?
Because I've seen many people's pmode tutorial in
assembly written like: (from above example)
; some kind of struct keyword here
s1 db 0x0
a dw 0x0
; end of struct keyword
Are the two codes equivilent or different? And what does
the Intel's manual meant by drawing the descriptors like:
31 15 0
+----------------------------------+
| bla-bla-bla1.................. |
------------------------------------
| bla-bla-bla2.................. |
+----------------------------------+
mean? It certainly did not specify whether bla-1 comes
first or bla-2 comes first...pretty confusing...
---- that's one question ----
also, I'm using gcc+nasm to write my pmode-initializer,
and i'm encountering some situation...
whenever I use a gcc to write a function with 'in' and 'out',
my BOCHS will return to me some weird I/O output error.
I've resolved this problem my writing my own 16-bit functions with
NASM and compile and link together...
but whenever it comes time that i need to implement a function
for main() to use, only the first level functions are working...vagued...
this is what i meant:
#include "sysio.h" // stuff i wrote using NASM amongst other useful macros
void foo();
void boo();
int main()
{
foo(); /* this one will work */
// bla-bla-bla
// bla-bla-bla
here:
goto here; // debug use
}
void foo()
{
boo();
return;
}
void boo()
{
// will not even enter here sometimes
// and even if it gets through...
/* here are some calls to functions produced by NASM */
/* these functions works if they're at main() or foo() */
puts("test...\r\n");
return;
}
---- oh, and a 3rd question ----
also, i've tried to write to 0xb8000 after asserted i've got color
emulation, and i've tried to do this:
char *video_buffer=(unsigned char*)0xb8000;
video_buffer='A';
video_buffer++;
video_buffer=0x07;
video_buffer++;
but it didn't work, sometimes the progress stops right at this statement,
other times, it loops the same code (before this line) twice and skip this part,
or other times, nothing happened in correspondence to the statement
and whatever supposed to happen just happened...
sounds very weird...
thanks very much!