1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +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 \
revers.o \
systime.o \
sysuname.o \
where.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

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

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 \
revers.o \
systime.o \
sysuname.o \
wherex.o \
wherey.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 \
rs232.o \
slow.o \
sysuname.o \
tgi_mode_table.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 \
mainargs.o \
randomize.o \
revers.o
revers.o \
sysuname.o
#--------------------------------------------------------------------------
# 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 \
revers.o \
rs232.o \
sysuname.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 \
revers.o \
rs232.o \
sysuname.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 \
randomize.o \
revers.o \
rs232.o
rs232.o \
sysuname.o
#--------------------------------------------------------------------------
# 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 \
uname.o \
unlink.o \
utscopy.o \
vfprintf.o \
vprintf.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 \
panic.o \
tobasic.o \
setdevice.o
setdevice.o \
sysuname.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 \
revers.o \
setcursor.o \
sysuname.o \
waitvblank.o \
wherex.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 \
mainargs.o \
randomize.o \
revers.o
revers.o \
sysuname.o
#--------------------------------------------------------------------------
# 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 \
randomize.o \
revers.o \
sysuname.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 \
mainargs.o \
randomize.o \
revers.o
revers.o \
sysuname.o
#--------------------------------------------------------------------------
# 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"