Mail Archives: djgpp/2002/12/04/21:30:16
Ok got the text to show up however I ran in to a problem moving the text
round the consol screen...
But first here is the current code(I got asm code by compling the C version
the screen writting code and the looked at the .s file and change the AT&T
asm to Intel)...
The ASM code
[BITS 32]
GLOBAL _OutputText
SECTION .text
_OutputText:
push ebp
mov ebp,esp
mov edx, 0xb8000
add edx, 0x4;[ebp+0x12]
mov ecx, [ebp+0x8]
cmp byte [ebp+0x8], 0x00
je L4
L5:
mov al, byte [ecx]
mov byte [edx], al
inc ecx
inc edx
mov byte [edx], 0x4f
inc edx
cmp byte [ecx], 0x00
jne L5
L4:
mov esp,ebp
pop ebp
retn
The C code...
extern "C" void OutputText(char* pOutStr, int iVideoMemIndex);
int main()
{
OutputText("Hello, world!", 4); //Start writting on the third
char in vid mem...
return 0;
}
Now the problem is at...
_OutputText:
push ebp
mov ebp,esp
mov edx, 0xb8000
---> add edx, 0x4;[ebp+0x12] ;Should get 0xb8004 using the
[ebp+0x12]...
...
I can add 0x4 as a constant but I try to add the value of the 2nd funtion
param [ebp+0x12] and the text only starts at 0xb8000 the 1st char in the
consol screen...
Can you explain what value is at [ebp+0x12]? Is it a pointer or 0x4 because
of in this case "OutputText("Hello, world!", 4);". I think it is 0x4...
A lot closer now...
Any more help...
- Raw text -