delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/04/21:30:16

From: "lewi9908" <lewi9908 AT ghc DOT ctc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: AT&T inline asm in DJGPP...
Date: Wed, 4 Dec 2002 18:17:10 -0800
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <uutdpmblukkhbc@corp.supernews.com>
References: <200212020026 DOT gB20QDV26749 AT speedy DOT ludd DOT luth DOT se> <uulf7s7lb5c55b AT corp DOT supernews DOT com> <asf91n$kv1$1 AT antares DOT lu DOT erisoft DOT se> <uunnttaavscea0 AT corp DOT supernews DOT com> <ashpbs$848$1 AT antares DOT lu DOT erisoft DOT se> <uuqqog9hkv5k96 AT corp DOT supernews DOT com> <askhpa$56$1 AT antares DOT lu DOT erisoft DOT se>
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Complaints-To: abuse AT supernews DOT com
Lines: 72
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019