#387 M68K/BCPL: Metacomco linker Alink uses packlw and unpacklw

m68k-amiga
closed-fixed
nobody
Shell/DOS (109)
5
2012-03-01
2012-02-29
Mark K
No

The Metacomco linker Alink uses the BCPL routines gbytes and pbytes (a.k.a. packlw and unpacklw in AROS source). Alink is available on at least the Amiga Assembler and Amiga Pascal 1.0 disks.

gbytes/packlw and pbytes/unpacklw are not currently implemented in AROS. Here's some information about them.

gbytes: GV offset $20, in Kick 1.3 ROM at $FF4AFC

Called with source address (normal pointer, not BPTR) in D1, count in D2.B. Count should be between 1 and 4. Bytes are read starting at source into D1. E.g. if bytes at the source address are $12 34 56 78 and gbytes is called with count 3, result in D1 is $00123456.

In the Kickstart implementation, if D2.B doesn't contain 1 to 4, a total of D2.B bytes (or 256 if D2.B = 0) are read starting at source and rotated into the low byte of D1. So if you call gbytes with D2.B = 0, D1 will end up containing the four bytes at address (source+252). That behaviour is probably not required.

pbytes: GV offset $24, in Kick1.3 ROM at $FF4B0A

Called with dest address (normal pointer) in D1, value in D3.L, count in D2.B. Count should be between 1 and 4. Writes count bytes from D3 to destination. So if value is $12345678 and count=3, write $34 $56 $78 to destination.

In the Kickstart implementation, bytes are written in reverse order from address (dest+count-1) to (dest). So if the count is not between 1 and 4, bytes in D3 are repeatedly written to fill the region from dest to dest+count-1. That feature could be used to fill memory with an arbitrary 4-byte pattern; but probably no software does that.

Discussion

  • Toni Wilen
    Toni Wilen
    2012-03-01

    • status: open --> closed-fixed