From: cuz Date: Tue, 12 Aug 2003 17:24:02 +0000 (+0000) Subject: New uname function X-Git-Tag: V2.12.0~1440 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4e76d0155d2a286bbd2c766790eb4f55964ca5fc;p=cc65 New uname function git-svn-id: svn://svn.cc65.org/cc65/trunk@2286 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile index 51d05f67d..ccbe19f15 100644 --- a/libsrc/apple2/Makefile +++ b/libsrc/apple2/Makefile @@ -45,6 +45,7 @@ OBJS= _scrsize.o \ read.o \ revers.o \ systime.o \ + sysuname.o \ where.o \ write.o diff --git a/libsrc/apple2/sysuname.s b/libsrc/apple2/sysuname.s new file mode 100644 index 000000000..cd41eac29 --- /dev/null +++ b/libsrc/apple2/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Apple ][" + + + diff --git a/libsrc/atari/Makefile b/libsrc/atari/Makefile index dc9524321..1b8647825 100644 --- a/libsrc/atari/Makefile +++ b/libsrc/atari/Makefile @@ -30,59 +30,60 @@ ATARIDEFS = -DNUMDRVS=4 -DUCASE_FILENAME=1 #-------------------------------------------------------------------------- # Object files -OBJS = _scrsize.o \ - break.o \ - cclear.o \ - cgetc.o \ - chline.o \ - clock.o \ - close.o \ - clrscr.o \ - color.o \ - cputc.o \ - crt0.o \ - ctype.o \ - cvline.o \ - dio_cts.o \ - dio_stc.o \ - diopncls.o \ - dioread.o \ - diowrite.o \ - diowritev.o \ - fdtable.o \ - getargs.o \ - getfd.o \ - gotox.o \ - gotoy.o \ - gotoxy.o \ - graphics.o \ - graphuse.o \ - joy_stddrv.o \ - kbhit.o \ - lseek.o \ - mouse.o \ - mul40.o \ - open.o \ - oserrlist.o \ - oserror.o \ - ostype.o \ - randomize.o \ - read.o \ - readjoy.o \ - remove.o \ - revers.o \ - rs232.o \ - rwcommon.o \ - savevec.o \ - scroll.o \ - setcolor.o \ - siocall.o \ - systime.o \ - tvtype.o \ - ucase_fn.o \ - wherex.o \ - wherey.o \ - write.o +OBJS = _scrsize.o \ + break.o \ + cclear.o \ + cgetc.o \ + chline.o \ + clock.o \ + close.o \ + clrscr.o \ + color.o \ + cputc.o \ + crt0.o \ + ctype.o \ + cvline.o \ + dio_cts.o \ + dio_stc.o \ + diopncls.o \ + dioread.o \ + diowrite.o \ + diowritev.o \ + fdtable.o \ + getargs.o \ + getfd.o \ + gotox.o \ + gotoy.o \ + gotoxy.o \ + graphics.o \ + graphuse.o \ + joy_stddrv.o \ + kbhit.o \ + lseek.o \ + mouse.o \ + mul40.o \ + open.o \ + oserrlist.o \ + oserror.o \ + ostype.o \ + randomize.o \ + read.o \ + readjoy.o \ + remove.o \ + revers.o \ + rs232.o \ + rwcommon.o \ + savevec.o \ + scroll.o \ + setcolor.o \ + siocall.o \ + systime.o \ + tvtype.o \ + sysuname.o \ + ucase_fn.o \ + wherex.o \ + wherey.o \ + write.o #-------------------------------------------------------------------------- diff --git a/libsrc/atari/sysuname.s b/libsrc/atari/sysuname.s new file mode 100644 index 000000000..25a891a1b --- /dev/null +++ b/libsrc/atari/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Atari" + + + diff --git a/libsrc/atmos/Makefile b/libsrc/atmos/Makefile index 55a57c860..7dbd82e93 100644 --- a/libsrc/atmos/Makefile +++ b/libsrc/atmos/Makefile @@ -38,6 +38,7 @@ S_OBJS = _scrsize.o \ mainargs.o \ revers.o \ systime.o \ + sysuname.o \ wherex.o \ wherey.o \ write.o diff --git a/libsrc/atmos/sysuname.s b/libsrc/atmos/sysuname.s new file mode 100644 index 000000000..85fba9738 --- /dev/null +++ b/libsrc/atmos/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Oric Atmos" + + + diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile index ee0741469..a9cdeb4cd 100644 --- a/libsrc/c128/Makefile +++ b/libsrc/c128/Makefile @@ -46,6 +46,7 @@ OBJS = _scrsize.o \ revers.o \ rs232.o \ slow.o \ + sysuname.o \ tgi_mode_table.o \ toggle_videomode.o diff --git a/libsrc/c128/sysuname.s b/libsrc/c128/sysuname.s new file mode 100644 index 000000000..55fe5ba28 --- /dev/null +++ b/libsrc/c128/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore 128" + + + diff --git a/libsrc/c16/Makefile b/libsrc/c16/Makefile index 45645c96d..06e518233 100644 --- a/libsrc/c16/Makefile +++ b/libsrc/c16/Makefile @@ -40,7 +40,8 @@ OBJS = _scrsize.o \ kernal.o \ mainargs.o \ randomize.o \ - revers.o + revers.o \ + sysuname.o #-------------------------------------------------------------------------- # Drivers diff --git a/libsrc/c16/sysuname.s b/libsrc/c16/sysuname.s new file mode 100644 index 000000000..c44ab6acc --- /dev/null +++ b/libsrc/c16/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore 16" + + + diff --git a/libsrc/c64/Makefile b/libsrc/c64/Makefile index 5e8d1bcfe..5d8eeea5f 100644 --- a/libsrc/c64/Makefile +++ b/libsrc/c64/Makefile @@ -44,6 +44,7 @@ OBJS = _scrsize.o \ randomize.o \ revers.o \ rs232.o \ + sysuname.o \ tgi_mode_table.o #-------------------------------------------------------------------------- diff --git a/libsrc/c64/sysuname.s b/libsrc/c64/sysuname.s new file mode 100644 index 000000000..15546bfa3 --- /dev/null +++ b/libsrc/c64/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore 64" + + + diff --git a/libsrc/cbm510/Makefile b/libsrc/cbm510/Makefile index 4609aeb6a..1a6b412c3 100644 --- a/libsrc/cbm510/Makefile +++ b/libsrc/cbm510/Makefile @@ -55,6 +55,7 @@ OBJS = _scrsize.o \ randomize.o \ revers.o \ rs232.o \ + sysuname.o \ tgi_mode_table.o #-------------------------------------------------------------------------- diff --git a/libsrc/cbm510/sysuname.s b/libsrc/cbm510/sysuname.s new file mode 100644 index 000000000..24d4dc03b --- /dev/null +++ b/libsrc/cbm510/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore 510" + + + diff --git a/libsrc/cbm610/Makefile b/libsrc/cbm610/Makefile index 6856f764a..cc810d19c 100644 --- a/libsrc/cbm610/Makefile +++ b/libsrc/cbm610/Makefile @@ -42,7 +42,8 @@ OBJS = _scrsize.o \ pokesys.o \ randomize.o \ revers.o \ - rs232.o + rs232.o \ + sysuname.o #-------------------------------------------------------------------------- # Drivers diff --git a/libsrc/cbm610/sysuname.s b/libsrc/cbm610/sysuname.s new file mode 100644 index 000000000..984cb93df --- /dev/null +++ b/libsrc/cbm610/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore 610" + + + diff --git a/libsrc/common/Makefile b/libsrc/common/Makefile index f4cee0cc1..f316b4027 100644 --- a/libsrc/common/Makefile +++ b/libsrc/common/Makefile @@ -146,6 +146,7 @@ S_OBJS = _cwd.o \ toupper.o \ uname.o \ unlink.o \ + utscopy.o \ vfprintf.o \ vprintf.o \ vsprintf.o \ diff --git a/libsrc/common/utscopy.s b/libsrc/common/utscopy.s new file mode 100644 index 000000000..adf8a006e --- /dev/null +++ b/libsrc/common/utscopy.s @@ -0,0 +1,67 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; This module contains a utility function for the machine dependent parts +; of uname (__sysuname): It copies a packed struct utsname (just the strings +; without padding) into a struct utsname. The source of the data is an +; external symbol named "utsdata", the target is passed in a/x. +; The function is written so that it is a direct replacement for __sysuname +; for systems where utsdata is fixed. It may also be called via jump or +; subroutine on systems where utsdata must be changed at runtime. +; + + .export utscopy + + .import utsdata + .importzp ptr1, tmp1 + + .include "utsname.inc" + + + +;-------------------------------------------------------------------------- +; Data. + +.rodata + +; Table with offsets into struct utsname +fieldoffs: + .byte utsname_sysname + .byte utsname_nodename + .byte utsname_release + .byte utsname_version + .byte utsname_machine + +;-------------------------------------------------------------------------- + +.code + +.proc utscopy + + sta ptr1 + stx ptr1+1 ; Save buf + + ldx #0 + stx tmp1 ; Field number + +next: ldy tmp1 + cpy #utsname_fieldcount + beq done + inc tmp1 ; Bump field counter + lda fieldoffs,y ; Get next field offset + tay ; Field offset -> y + +loop: lda utsdata,x + sta (ptr1),y + inx ; Next char in utsdata + cmp #$00 ; Check for end of string + beq next ; Jump for next field + iny ; Next char in utsname struct + bne loop ; Copy string + +done: lda #$00 ; Always successful + rts + +.endproc + + diff --git a/libsrc/geos/system/Makefile b/libsrc/geos/system/Makefile index 6c4fddc5c..e4bbceaf1 100644 --- a/libsrc/geos/system/Makefile +++ b/libsrc/geos/system/Makefile @@ -22,7 +22,8 @@ S_OBJS = ctype.o \ mainloop.o \ panic.o \ tobasic.o \ - setdevice.o + setdevice.o \ + sysuname.o C_OBJS = systime.o diff --git a/libsrc/geos/system/sysuname.s b/libsrc/geos/system/sysuname.s new file mode 100644 index 000000000..c0cd91410 --- /dev/null +++ b/libsrc/geos/system/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "GEOS" + + + diff --git a/libsrc/nes/Makefile b/libsrc/nes/Makefile index e5148d517..81a54a1e8 100644 --- a/libsrc/nes/Makefile +++ b/libsrc/nes/Makefile @@ -39,6 +39,7 @@ S_OBJS = _scrsize.o \ randomize.o \ revers.o \ setcursor.o \ + sysuname.o \ waitvblank.o \ wherex.o \ wherey.o diff --git a/libsrc/nes/sysuname.s b/libsrc/nes/sysuname.s new file mode 100644 index 000000000..2606d1a60 --- /dev/null +++ b/libsrc/nes/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "NES" + + + diff --git a/libsrc/pet/Makefile b/libsrc/pet/Makefile index a09bde862..67f52e37e 100644 --- a/libsrc/pet/Makefile +++ b/libsrc/pet/Makefile @@ -40,7 +40,8 @@ OBJS = _scrsize.o \ ksetnam.o \ mainargs.o \ randomize.o \ - revers.o + revers.o \ + sysuname.o #-------------------------------------------------------------------------- # Targets diff --git a/libsrc/pet/sysuname.s b/libsrc/pet/sysuname.s new file mode 100644 index 000000000..59174d821 --- /dev/null +++ b/libsrc/pet/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore PET" + + + diff --git a/libsrc/plus4/Makefile b/libsrc/plus4/Makefile index e453c9e4b..21ced76c3 100644 --- a/libsrc/plus4/Makefile +++ b/libsrc/plus4/Makefile @@ -63,6 +63,7 @@ OBJS = _scrsize.o \ mainargs.o \ randomize.o \ revers.o \ + sysuname.o \ tgi_mode_table.o #-------------------------------------------------------------------------- diff --git a/libsrc/plus4/sysuname.s b/libsrc/plus4/sysuname.s new file mode 100644 index 000000000..332daae0d --- /dev/null +++ b/libsrc/plus4/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore Plus/4" + + + diff --git a/libsrc/vic20/Makefile b/libsrc/vic20/Makefile index 1be2fae72..fe6743572 100644 --- a/libsrc/vic20/Makefile +++ b/libsrc/vic20/Makefile @@ -40,7 +40,8 @@ OBJS = _scrsize.o \ kplot.o \ mainargs.o \ randomize.o \ - revers.o + revers.o \ + sysuname.o #-------------------------------------------------------------------------- # Drivers diff --git a/libsrc/vic20/sysuname.s b/libsrc/vic20/sysuname.s new file mode 100644 index 000000000..18d5db9a9 --- /dev/null +++ b/libsrc/vic20/sysuname.s @@ -0,0 +1,39 @@ +; +; Ullrich von Bassewitz, 2003-08-12 +; +; unsigned char __fastcall__ _sysuname (struct utsname* buf); +; + + .export __sysuname, utsdata + + .import utscopy + + __sysuname = utscopy + +;-------------------------------------------------------------------------- +; Data. We define a fixed utsname struct here and just copy it. + +.rodata + +utsdata: + ; sysname + .asciiz "cc65" + + ; nodename + .asciiz "" + + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Commodore VIC20" + + +