screen again
Posted: Wed Feb 13, 2002 9:05 am
Help!!
This problem is similar to previous screen one, but the offsets and data seem correct.
The kernel has a simple putchar function that prints a character to the screen,
-this works when "video.putchar('G',0x0900)"
-but now when "char mystring[]="GK";
video.putchar(mystring[0],0x0900)"
I'm using VC++ 6 sp5 to compile and link,
bochs with bfe visual debugger to run and debug.
It gets the right value from memory(47 for 'G') and puts it in the right place for the function, but then f**ks it up from there.
The kernel is loaded at 0x0010000 in memory and kernel data to 0x0011000.
The c++ kernel contains a class called video with a function putchar(char c, short color);
it increments the video memory ptr each time a char is printed
the class main creates video and calls putchar with an item of the string array.
below is the asm for the dissasembled kernel - not much;
note:(nop's used to split up code into sections)
PUSH EBP
MOV EBP,ESP
SUB ESP,0C
LEA ECX,DWORD PTR[EBP-08]
CALL 0000002E
NOP
MOV AX,[2000]
ADD DWORD PTR [EAX],EAX
MOV WORD PTR [EBP-0C],AX
MOV CL,BYTE PTR [00012002]
MOV BYTE PTR [EBP-0A],CL
MOV DL,BYTE PTR [EBP-0C]
MOV BYTE PTR [EBP-01],DL
PUSH 00000900
MOV AL,BYTE PTR [EBP-01]
PUSH EAX
LEA ECX,DWORD PTR [EBP-08] ;right value in right
;place entering function
CALL 0000000D
NOP
JMP 0000003A
MOV EAX,ECX
MOV ECX,DWORD PTR [EAX]
MOV WORD PTR [ECX],8002
RET
MOVSX AX,WORD PTR [ESP+24]
ADD AL,0B
INC ESP
AND AL,08
MOV EDX,DWORD PTR [ECX]
MOV WORD PTR [EDX],AX
ADD DWORD PTR [ECX],02
RET 0008
apologies for the complicated example, if anyone would like more info shout.
This problem is similar to previous screen one, but the offsets and data seem correct.
The kernel has a simple putchar function that prints a character to the screen,
-this works when "video.putchar('G',0x0900)"
-but now when "char mystring[]="GK";
video.putchar(mystring[0],0x0900)"
I'm using VC++ 6 sp5 to compile and link,
bochs with bfe visual debugger to run and debug.
It gets the right value from memory(47 for 'G') and puts it in the right place for the function, but then f**ks it up from there.
The kernel is loaded at 0x0010000 in memory and kernel data to 0x0011000.
The c++ kernel contains a class called video with a function putchar(char c, short color);
it increments the video memory ptr each time a char is printed
the class main creates video and calls putchar with an item of the string array.
below is the asm for the dissasembled kernel - not much;
note:(nop's used to split up code into sections)
PUSH EBP
MOV EBP,ESP
SUB ESP,0C
LEA ECX,DWORD PTR[EBP-08]
CALL 0000002E
NOP
MOV AX,[2000]
ADD DWORD PTR [EAX],EAX
MOV WORD PTR [EBP-0C],AX
MOV CL,BYTE PTR [00012002]
MOV BYTE PTR [EBP-0A],CL
MOV DL,BYTE PTR [EBP-0C]
MOV BYTE PTR [EBP-01],DL
PUSH 00000900
MOV AL,BYTE PTR [EBP-01]
PUSH EAX
LEA ECX,DWORD PTR [EBP-08] ;right value in right
;place entering function
CALL 0000000D
NOP
JMP 0000003A
MOV EAX,ECX
MOV ECX,DWORD PTR [EAX]
MOV WORD PTR [ECX],8002
RET
MOVSX AX,WORD PTR [ESP+24]
ADD AL,0B
INC ESP
AND AL,08
MOV EDX,DWORD PTR [ECX]
MOV WORD PTR [EDX],AX
ADD DWORD PTR [ECX],02
RET 0008
apologies for the complicated example, if anyone would like more info shout.