home *** CD-ROM | disk | FTP | other *** search
- rcsid: .asciz "$Header: /ful/chris/ctex/lib/RCS/machint.s,v 1.1 84/05/26 01:53:01 chris Exp $"
-
- # machint (addr, count)
- # char *addr; int count;
- #
- # Convert "count" 4-byte PXL-style integers at address "addr"
- # to and from machine integers. (Note that calling machint
- # twice is effectively a no-op.)
-
- .align 2
- .globl _machint
- _machint:
- .word 0
-
- movl 4(ap),r1 # r1 = addr
- ashl $2,8(ap),r2
- addl2 r1,r2 # r2 = &addr[count]
- 1: cmpl r1,r2 # is addr >= end?
- blss 2f
- ret # return if r1 >= r2
- 2: movl (r1)+,r0 # r0 = *r1++
- movb r0,-1(r1) # byte 0 to byte 3
- ashl $-8,r0,r0 # r0 >>= 8
- movb r0,-2(r1) # byte 1 to byte 2
- ashl $-8,r0,r0 # etc
- movb r0,-3(r1)
- ashl $-8,r0,r0
- movb r0,-4(r1)
- brb 1b # and repeat
-