Mail Archives: djgpp/1997/09/27/01:30:23
From: | "M. Schulter" <mschulter AT value DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | GAS, 42, and all that
|
Date: | 26 Sep 1997 22:54:20 GMT
|
Organization: | Value Net Internetwork Services Inc.
|
Lines: | 77
|
Message-ID: | <60hees$8og$1@vnetnews.value.net>
|
NNTP-Posting-Host: | value.net
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi, there.
Here's a program to suggest that indeed "\42\x42\42" might be a rather
profound answer to the universe, since the verb to be in English has the
same pronunciation as the name of the second letter of the alphabet.
Of course, the answer could also refer to a certain language developed by
Ken Thompson and not directly supported by DJGPP, although one could argue
that DJGPP certainly supports the "++" version (and also +=2 versions).
Maybe one of the implications here is that the evolution of the universe
was directed toward the first language to support an implementation of
UNIX, leading in turn to DJGPP.
BTW, anyone care to venture an opinion on how the efficiency of this
approach for showing a string (borrowed in good part from a program by
CWS) might compare with using _printf or explicitly using a DPMI call to
show a whole string at once?
/*************************************************************************
*
* djgpp42.s -- version 0.42
*
* This file should be compiled in djgpp 2.x with:
*
* gcc -c djgpp42.s
* ld -s djgpp42.o -o djgpp42
* stubify djgpp42
*
* Margo Schulter, mschulter AT value DOT net September 26, 1997
*
**************************************************************************
*/
.file "djgpp42.s"
.text
.align 2
.global show
.align 2
.global start
start:
movl $L0, %ebx
call show
movl $L1, %ebx
call show
movl $L2, %ebx
call show
movl $L3, %ebx
call show
movl $L4, %ebx
call show
movw $0x4c00, %ax
int $0x21
show:
movb $0x02, %ah
movb (%ebx), %dl
cmpb $0, %dl
je 0f
int $0x21
incl %ebx
jmp show
0:
ret
L0:
.ascii "\n\nOne reported answer to the universe is \0"
L1:
.ascii "\42\x42\42\n\n\r\0"
L2:
.ascii "\050\124\150\151\163\040\167\141\163\040\156\157\164\0"
L3:
.ascii "\040\151\156\040\104\112\107\120\120\040\0"
L4:
.ascii "\106\101\121\040\062\056\061\060\051\n\n\r\0"
- Raw text -