Mail Archives: djgpp/1999/06/25/22:03:16
DaXy_II wrote:
>
> > C:\mark\code>more<greeting.cpp
> > #include <iostream.h>
> >
> > int main() {
> > cout << "Hello World." << endl;
> >
> > return 0;
> > }
>
> This will be a huge exe! Try this
>
> int cur;
>
> void putc(char* vid, char ch) {
> vid[cur++] =
>
> int main() {
> char* video;
> cur = 0 // You could get the cursor pos ...
>
> video = (char*)0xB8000; // 0xB0000 for monocrome monitors.
> while (*message++) {
> putc(video,*message);
> }
> }
>
> And link without the stdlib, almost as small as an asm
Hmm... did you try this? It won't work in DJGPP; you can't poke
physical memory addresses directly.
And yes, we know that DJGPP generates large executables. Hello World
doesn't show its best side... but try compiling Emacs with a compiler
that accepts your code above.
Oh, if you want a small Hello World, here you go:
.org 0x100
mov ah, 0x9
mov dx, msg
int 0x21
mov ax, 0x4c00
int 0x21
msg:
.db "Hello, world$"
Run djasm on it.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -