Re: Assembler

From: Bernd Walter <ticso(at)cicely8.cicely.de>
Date: Sun, 25 Jun 2000 22:23:49 +0200

On Sun, Jun 25, 2000 at 06:28:27PM +0200, Bernd Walter wrote:
> On Sat, Jun 24, 2000 at 08:03:04PM +0200, Christian Weisgerber wrote:
> > J Wunsch <joerg_wunsch(at)uriah.heep.sax.de> wrote:
> >
> > > Hier nochmal das Testprogramm aus dem Beispiel in as-Syntax.
> >
> > Das hätte ich jetzt gerne nochmal für Alpha.
>
> Oje - da will sich einer ins Unglueck stuerzen...

Zur Vervollstaendigung die Portierung fuer Alpha:

cc -c -g -x assembler-with-cpp -ffixed-8 hello-world2.s
ld -o hello-world2 hello-world2.o

#include <machine/asm.h>
        .text
        .globl _start /* must be declared for linker (ld) */

textseq:
msg: .ascii "Hello, world!\n" /* our dear string */
        .equ t12diff, _start-textseq
        .equ len, . - msg /* length of our dear string */

_start: /* tell linker entry point */
        subq t12,t12diff,gp /* get address of .text */
        addq zero,1,a0 /* file descriptor (stdout) */
        addq gp,textseq-msg,a1 /* message to write */
        addq zero,len,a2 /* message length */
        addq zero,0x4,v0 /* system call number (sys_write) */
        call_pal PAL_OSF1_callsys /* call kernel - errors returned in a3 */
        addq zero,0x0,v0 /* system call number (sys_exit) */
        call_pal PAL_OSF1_callsys /* exit */

Ich war etwas Faul und habe es mit Hilfe vom cpp gemacht, weil asm.h
die Registervariablen setzt und es an anderen Stellen auch was einfacher
ist.

-- 
B.Walter              COSMO-Project         http://www.cosmo-project.de
ticso(at)cicely.de         Usergroup           info(at)cosmo-project.de
To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Sun 25 Jun 2000 - 22:23:42 CEST

search this site