2 ; Ullrich von Bassewitz, 2003-08-12
4 ; This module contains a utility function for the machine dependent parts
5 ; of uname (__sysuname): It copies a packed struct utsname (just the strings
6 ; without padding) into a struct utsname. The source of the data is an
7 ; external symbol named "utsdata", the target is passed in a/x.
8 ; The function is written so that it is a direct replacement for __sysuname
9 ; for systems where utsdata is fixed. It may also be called via jump or
10 ; subroutine on systems where utsdata must be changed at runtime.
18 .include "utsname.inc"
22 ;--------------------------------------------------------------------------
27 ; Table with offsets into struct utsname
29 .byte utsname::sysname
30 .byte utsname::nodename
31 .byte utsname::release
32 .byte utsname::version
33 .byte utsname::machine
35 fieldcount = * - fieldoffs
37 ;--------------------------------------------------------------------------
47 stx tmp1 ; Field number
52 inc tmp1 ; Bump field counter
53 lda fieldoffs,y ; Get next field offset
54 tay ; Field offset -> y
58 inx ; Next char in utsdata
59 cmp #$00 ; Check for end of string
60 beq next ; Jump for next field
61 iny ; Next char in utsname struct
62 bne loop ; Copy string
64 done: lda #$00 ; Always successful