1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-12 02:30:44 +00:00

New uname function

git-svn-id: svn://svn.cc65.org/cc65/trunk@2286 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-08-12 17:24:02 +00:00
parent fd8e2bd2c6
commit 4e76d0155d
28 changed files with 646 additions and 58 deletions

View File

@ -45,6 +45,7 @@ OBJS= _scrsize.o \
read.o \ read.o \
revers.o \ revers.o \
systime.o \ systime.o \
sysuname.o \
where.o \ where.o \
write.o write.o

39
libsrc/apple2/sysuname.s Normal file
View File

@ -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 ]["

View File

@ -79,6 +79,7 @@ OBJS = _scrsize.o \
siocall.o \ siocall.o \
systime.o \ systime.o \
tvtype.o \ tvtype.o \
sysuname.o \
ucase_fn.o \ ucase_fn.o \
wherex.o \ wherex.o \
wherey.o \ wherey.o \

39
libsrc/atari/sysuname.s Normal file
View File

@ -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"

View File

@ -38,6 +38,7 @@ S_OBJS = _scrsize.o \
mainargs.o \ mainargs.o \
revers.o \ revers.o \
systime.o \ systime.o \
sysuname.o \
wherex.o \ wherex.o \
wherey.o \ wherey.o \
write.o write.o

39
libsrc/atmos/sysuname.s Normal file
View File

@ -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"

View File

@ -46,6 +46,7 @@ OBJS = _scrsize.o \
revers.o \ revers.o \
rs232.o \ rs232.o \
slow.o \ slow.o \
sysuname.o \
tgi_mode_table.o \ tgi_mode_table.o \
toggle_videomode.o toggle_videomode.o

39
libsrc/c128/sysuname.s Normal file
View File

@ -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"

View File

@ -40,7 +40,8 @@ OBJS = _scrsize.o \
kernal.o \ kernal.o \
mainargs.o \ mainargs.o \
randomize.o \ randomize.o \
revers.o revers.o \
sysuname.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Drivers # Drivers

39
libsrc/c16/sysuname.s Normal file
View File

@ -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"

View File

@ -44,6 +44,7 @@ OBJS = _scrsize.o \
randomize.o \ randomize.o \
revers.o \ revers.o \
rs232.o \ rs232.o \
sysuname.o \
tgi_mode_table.o tgi_mode_table.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------

39
libsrc/c64/sysuname.s Normal file
View File

@ -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"

View File

@ -55,6 +55,7 @@ OBJS = _scrsize.o \
randomize.o \ randomize.o \
revers.o \ revers.o \
rs232.o \ rs232.o \
sysuname.o \
tgi_mode_table.o tgi_mode_table.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------

39
libsrc/cbm510/sysuname.s Normal file
View File

@ -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"

View File

@ -42,7 +42,8 @@ OBJS = _scrsize.o \
pokesys.o \ pokesys.o \
randomize.o \ randomize.o \
revers.o \ revers.o \
rs232.o rs232.o \
sysuname.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Drivers # Drivers

39
libsrc/cbm610/sysuname.s Normal file
View File

@ -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"

View File

@ -146,6 +146,7 @@ S_OBJS = _cwd.o \
toupper.o \ toupper.o \
uname.o \ uname.o \
unlink.o \ unlink.o \
utscopy.o \
vfprintf.o \ vfprintf.o \
vprintf.o \ vprintf.o \
vsprintf.o \ vsprintf.o \

67
libsrc/common/utscopy.s Normal file
View File

@ -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

View File

@ -22,7 +22,8 @@ S_OBJS = ctype.o \
mainloop.o \ mainloop.o \
panic.o \ panic.o \
tobasic.o \ tobasic.o \
setdevice.o setdevice.o \
sysuname.o
C_OBJS = systime.o C_OBJS = systime.o

View File

@ -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"

View File

@ -39,6 +39,7 @@ S_OBJS = _scrsize.o \
randomize.o \ randomize.o \
revers.o \ revers.o \
setcursor.o \ setcursor.o \
sysuname.o \
waitvblank.o \ waitvblank.o \
wherex.o \ wherex.o \
wherey.o wherey.o

39
libsrc/nes/sysuname.s Normal file
View File

@ -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"

View File

@ -40,7 +40,8 @@ OBJS = _scrsize.o \
ksetnam.o \ ksetnam.o \
mainargs.o \ mainargs.o \
randomize.o \ randomize.o \
revers.o revers.o \
sysuname.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Targets # Targets

39
libsrc/pet/sysuname.s Normal file
View File

@ -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"

View File

@ -63,6 +63,7 @@ OBJS = _scrsize.o \
mainargs.o \ mainargs.o \
randomize.o \ randomize.o \
revers.o \ revers.o \
sysuname.o \
tgi_mode_table.o tgi_mode_table.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------

39
libsrc/plus4/sysuname.s Normal file
View File

@ -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"

View File

@ -40,7 +40,8 @@ OBJS = _scrsize.o \
kplot.o \ kplot.o \
mainargs.o \ mainargs.o \
randomize.o \ randomize.o \
revers.o revers.o \
sysuname.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Drivers # Drivers

39
libsrc/vic20/sysuname.s Normal file
View File

@ -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"