On Tue, Jul 14, 1998 at 10:33:11PM +0200, Harald Koerfgen wrote:
Ok, the departement of nitpicking is out on the road again:
> .text
> .globl __start
> .set noreorder
>
> __start:
> lui $4, %hi(device) # /dev/ttyS0
> ori $4, %lo(device)
%lo returns a signed offset, so this will only work if the address of
device happens to be something with bit 15 cleared, which will probably
be the case when you assemble your code. It won't do it for the general
case. Aside, why not just using the la instruction ...
> li $5, 2
> li $6, 0
> li $2, 4005 # open
> syscall
> nop
This is not a jump or branch instruction, no need for a nop.
> bltz $2, 1f # error?
This won't work. We use the same syscall conventions as IRIX. The
result or the _positive_ error number are in $2 on return; an error
flag is in $7. So that line should read:
bnez $7, 1f # error?
> string: .ascii "Hello World!"
> .byte 0x0a
The assembler knows about the usual C escape sequences like \n. Makes
live easier.
> I'll do my very best to clean up the code and upload it to Michael before
> going
> into vacation next week :-).
Congratulations, nice piece of work. You don't happen to take your
DEC with you on holiday, don't you ;-)
Ralf
|