www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/24/03:31:24

From: "Charles Sandmann" <sandmann AT clio DOT rice DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: hello.s, anyone?
Date: Tue, 23 Sep 1997 23:48:00
Organization: Aspen Technology, Inc.
Lines: 30
Message-ID: <34285530.sandmann@clio.rice.edu>
References: <607m3p$805$3 AT vnetnews DOT value DOT net>
Reply-To: sandmann AT clio DOT rice DOT edu
NNTP-Posting-Host: nboal2.dmccorp.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> This message concerns a quest that some may find challenging, some
> humorous, and some rather dubious: the road to a standalone hello.s

gcc -c hello.s
ld -s hello.o -o hello
stubify hello

On the file below (hello.s) will produce a 2560 byte executable, the 
smallest valid DJGPP image.  Pretty silly exercise, but good for testing
DPMI provider hacking, stub hacking, etc ...  (Warning, tested only on V2.00).
Look at crt0.s for the interface definition.

/* Clip hello.s below */
	.text
	.globl	start
start:
	movl	$L1, %ebx
1:
	movb	$2, %ah
	movb	(%ebx), %dl
	cmpb	$0,%dl
	je	2f
	int	$0x21
	incl	%ebx
	jmp	1b
2:	
	movb	$0x4c,%ah
	int	$0x21

L1:	.ascii "Hello, World!\15\12\0"
 and maybe you just need to insure
the string gets terminated. Then again, I've been incorrect before.  Br5an

>strncpy(Personal_info.name,buff,20); //copy 20 chars
Personal_info.name[20] = '\0';  //since 0 thru 20 == 21

- Raw text -


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