结构问题 [英] struc problems
问题描述
我正在使用GCC(和NASM)通过asm表发送...
BootDrv db 0
BIOS_Mem_Map_Entries dd 0
APM_Status db 0
APM_Major_Version db 0
APM_Minor_Version db 0
APM_Code_Base dd 0
APM_Data_Base dd 0
APM_Data_Length dd 0
APM_Code_Length dd 0
VESA_Struct_Start:
; VESA
VESASignature db''VESA''
VESAVersion dw 0
OemStringPtr dd 0
功能dd 0
VideoModePtr dd 0
TotalMemory dw 0
; VBE2
OemSoftwareRev dw 0
OemVendorNamePtr dd 0
OemProductNamePtr dd 0
OemProductRevPtr dd 0
VBE2_reserved次数222 db 0
VBE_OemData乘以256 db 0
VESA_ModeInfo dd 0
VESA_Mode_Counter dw 0
VGA_Mode_Counter dw 0
VGA_ModeInfo dd 0
Graphics_Mode_Choosen db 1
Graphics_SubM ode_Choosen db 0
TimerLoop dd 0
Current_X dw 0
Current_Y dw 0
.. ..到一个C结构...
typedef struct BIOSInfo
{
BYTE BootDrv;
ULONG BIOS_Mem_Entries;
BYTE APM_Status;
BYTE APM_Major_Version;
BYTE APM_Minor_Version;
ULONG APM_Code_Base; < br $>
ULONG APM_Data_Base;
ULONG APM_Data_Length;
ULONG APM_Code_Length;
// VESA Struct Start
BYTE VESA_Signature [4];
USHORT VESAVersion;
ULONG OemStringPtr;
ULONG功能;
ULONG VideoModePtr;
USHORT TotalMemory;
// VBE2直到?gg
USHORT OemSoftwareRev;
ULONG OemVendorNamePtr;
ULONG OemProductNamePtr;
ULONG OemProductRevPtr;
BYTE VBE2_reserved [222];
BYTE VBE_OemData [256];
ULONG VESA_ModeInfo;
USHORT VESA_Mode_Count呃;
USHORT VGA_Mode_Counter;
ULONG VGA_ModeInfo;
BYTE Graphics_Mode_Choosen;
BYTE Graphics_SubMode_Choosen;
ULONG TimerLoop;
USHORT Current_X;
USHORT Current_Y;
} BIOSInfo;
....但出于某种原因:
BIOSInfo * BIOS_Info_Pointer = Get_ASM_Params();
ScreenMode [0] = BIOS_Info_Pointer-> Graphics_Mode_Choosen;
ScreenMode [1] = BIOS_Info_Pointer-> Graphics_SubMode_Choosen;
ScreenMode [0]不等于1(Graphics_Mode_Choosen)和ScreenMode [1]
不等于0(Graphics_SubMode_Choosen)。
有人能给我一个关于错误的提示吗?
btw:
_Get_ASM_Params:
lea eax,[BootDrv]
ret
TIA!
Hi I''m using GCC (and NASM) to send over a asm table...
BootDrv db 0
BIOS_Mem_Map_Entries dd 0
APM_Status db 0
APM_Major_Version db 0
APM_Minor_Version db 0
APM_Code_Base dd 0
APM_Data_Base dd 0
APM_Data_Length dd 0
APM_Code_Length dd 0
VESA_Struct_Start:
;VESA
VESASignature db ''VESA''
VESAVersion dw 0
OemStringPtr dd 0
Capabilities dd 0
VideoModePtr dd 0
TotalMemory dw 0
;VBE2
OemSoftwareRev dw 0
OemVendorNamePtr dd 0
OemProductNamePtr dd 0
OemProductRevPtr dd 0
VBE2_reserved times 222 db 0
VBE_OemData times 256 db 0
VESA_ModeInfo dd 0
VESA_Mode_Counter dw 0
VGA_Mode_Counter dw 0
VGA_ModeInfo dd 0
Graphics_Mode_Choosen db 1
Graphics_SubMode_Choosen db 0
TimerLoop dd 0
Current_X dw 0
Current_Y dw 0
....to a C struc...
typedef struct BIOSInfo
{
BYTE BootDrv;
ULONG BIOS_Mem_Entries;
BYTE APM_Status;
BYTE APM_Major_Version;
BYTE APM_Minor_Version;
ULONG APM_Code_Base;
ULONG APM_Data_Base;
ULONG APM_Data_Length;
ULONG APM_Code_Length;
//VESA Struct Start
BYTE VESA_Signature[4];
USHORT VESAVersion;
ULONG OemStringPtr;
ULONG Capabilities;
ULONG VideoModePtr;
USHORT TotalMemory;
//VBE2 till?gg
USHORT OemSoftwareRev;
ULONG OemVendorNamePtr;
ULONG OemProductNamePtr;
ULONG OemProductRevPtr;
BYTE VBE2_reserved[222];
BYTE VBE_OemData[256];
ULONG VESA_ModeInfo;
USHORT VESA_Mode_Counter;
USHORT VGA_Mode_Counter;
ULONG VGA_ModeInfo;
BYTE Graphics_Mode_Choosen;
BYTE Graphics_SubMode_Choosen;
ULONG TimerLoop;
USHORT Current_X;
USHORT Current_Y;
}BIOSInfo;
.... but for some reason:
BIOSInfo *BIOS_Info_Pointer = Get_ASM_Params();
ScreenMode[0] = BIOS_Info_Pointer->Graphics_Mode_Choosen;
ScreenMode[1] = BIOS_Info_Pointer->Graphics_SubMode_Choosen;
ScreenMode[0] isn''t equal to 1 (Graphics_Mode_Choosen) and ScreenMode[1]
isn''t equal to 0 (Graphics_SubMode_Choosen).
Can anybody give me a hint on what''s wrong?
btw:
_Get_ASM_Params:
lea eax,[BootDrv]
ret
TIA!
推荐答案
" Spike" < me.hates:SP ** @ me.net>写在
新闻:9w ********************* @ newsc.telia.net:
"Spike" <me.hates:sp**@me.net> wrote in
news:9w*********************@newsc.telia.net:
我正在使用GCC(和NASM)通过asm表发送...
Hi I''m using GCC (and NASM) to send over a asm table...
您是否读过有关打包结构的编译器文档? C $ / $
编译器可以在结构的第一个元素之后添加填充字节。
-
- Mark - >
-
Have you read you compiler documentation about packing structs? C
compilers can add padding bytes after the first element of a struct.
--
- Mark ->
--
不,我没有...我在哪里可以找到有关GCC padds结构的信息:s?
// SPike
" Mark A. Odell" < OD ******* @ hotmail.com> skrev i meddelandet
新闻:Xn ******************************** @ 130.133.1 。 4 ...
no I haven''t... where can I find information about if GCC padds struc:s?
//SPike
"Mark A. Odell" <od*******@hotmail.com> skrev i meddelandet
news:Xn********************************@130.133.1. 4...
" Spike" < me.hates:SP ** @ me.net>在
新闻中写道:9w ********************* @ newsc.telia.net:
"Spike" <me.hates:sp**@me.net> wrote in
news:9w*********************@newsc.telia.net:
你好我正在使用GCC(和NASM)通过asm表发送...
Hi I''m using GCC (and NASM) to send over a asm table...
您是否读过有关打包结构的编译器文档? C
编译器可以在结构的第一个元素之后添加填充字节。
-
- 标记 - >
-
Have you read you compiler documentation about packing structs? C
compilers can add padding bytes after the first element of a struct.
--
- Mark ->
--
>
" Mark A. Odell" < OD ******* @ hotmail.com>在消息中写道
news:Xn ******************************** @ 130.133.1 。 4 ...
"Mark A. Odell" <od*******@hotmail.com> wrote in message
news:Xn********************************@130.133.1. 4...
" Spike" < me.hates:SP ** @ me.net>在
新闻中写道:9w ********************* @ newsc.telia.net:
"Spike" <me.hates:sp**@me.net> wrote in
news:9w*********************@newsc.telia.net:
嗨我是使用GCC(和NASM)通过asm表发送...
Hi I''m using GCC (and NASM) to send over a asm table...
您是否读过有关打包结构的编译器文档? C
编译器可以在结构的第一个元素之后添加填充字节。
Have you read you compiler documentation about packing structs? C
compilers can add padding bytes after the first element of a struct.
第一个之后?任何成员之后都可以填充(出于某种原因,我不知道,大多数人说成员之间和最后一个成员之后)。
Alex
After the first? There can be padding after any member (for some reason I
don''t understand, most people say "between members and after the last
member").
Alex
这篇关于结构问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!