2020-11-19 15:34:02 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF bin/uname
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/mli.e.i
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPPtr1 .BS 2
|
|
|
|
|
ZPPtr2 .BS 2
|
|
|
|
|
|
|
|
|
|
Index .BS 1
|
|
|
|
|
Count .BS 1
|
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
hFILE .BS 1
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2020-11-19 15:34:02 +00:00
|
|
|
|
bHostName .BS 1
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2020-11-19 15:34:02 +00:00
|
|
|
|
bMachineType .BS 1
|
|
|
|
|
bCPUType .BS 1
|
|
|
|
|
bCPUSpeed .BS 1
|
|
|
|
|
bAltCPU .BS 1
|
|
|
|
|
bKernelVersion .BS 1
|
2021-06-23 17:43:04 +00:00
|
|
|
|
bKernelBuild .BS 1
|
2020-11-19 15:34:02 +00:00
|
|
|
|
bKernelMode .BS 1
|
|
|
|
|
bKernelClk .BS 1
|
|
|
|
|
ZS.END .ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA #0 S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
|
|
|
|
.DA CS.END-CS.START Code Size (without Constants)
|
|
|
|
|
.DA DS.END-DS.START Data SegmentSize
|
|
|
|
|
.DA #32 Stack Size
|
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
|
|
|
|
L.MSG.CRLF .DA MSG.CRLF
|
2021-06-23 17:43:04 +00:00
|
|
|
|
L.ETCHOSTNAME .DA ETCHOSTNAME
|
|
|
|
|
L.ETCVERSION .DA ETCVERSION
|
2020-11-19 15:34:02 +00:00
|
|
|
|
L.TYPES .DA TYPE.UNKNOWN
|
|
|
|
|
.DA TYPE.IIe
|
|
|
|
|
.DA TYPE.IIc
|
|
|
|
|
.DA TYPE.IIgs
|
|
|
|
|
L.CPUS .DA CPU.65C02
|
|
|
|
|
.DA CPU.65R02
|
|
|
|
|
.DA CPU.65816
|
|
|
|
|
L.CPU.SPEED .DA CPU.SPEED
|
|
|
|
|
L.KERNEL.VER .DA KERNEL.VER
|
|
|
|
|
L.KERNEL.MODES .DA KERNEL.POLLING
|
|
|
|
|
.DA KERNEL.IRQ
|
|
|
|
|
.DA KERNEL.PREEMPT
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN ldy #S.PS.ARGC
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.1 inc Index
|
|
|
|
|
lda Index
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs CS.RUN.PRINT
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.CheckOpt
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
.99 >PUSHW L.MSG.USAGE
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
|
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 lda #$ff
|
|
|
|
|
sta bKernelVersion
|
2021-06-23 17:43:04 +00:00
|
|
|
|
sta bKernelBuild
|
2020-11-19 15:34:02 +00:00
|
|
|
|
sta bKernelMode
|
|
|
|
|
sta bMachineType
|
|
|
|
|
sta bCPUType
|
|
|
|
|
sta bCPUSpeed
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.PRINT bit bHostName
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
jsr CS.RUN.GetHostName
|
|
|
|
|
bcs .1
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
>LDYA pData
|
|
|
|
|
jsr CS.RUN.PRINTYA
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
|
|
|
|
.1 bit bMachineType
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
lda A2osX.HWType
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
>LDYA L.TYPES,x
|
|
|
|
|
jsr CS.RUN.PRINTYA
|
|
|
|
|
|
|
|
|
|
.2 bit bCPUType
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
lda A2osX.CPUTYPE
|
|
|
|
|
|
|
|
|
|
asl
|
|
|
|
|
and #$0F
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
>LDYA L.CPUS-2,x
|
|
|
|
|
jsr CS.RUN.PRINTYA
|
|
|
|
|
|
|
|
|
|
.3 bit bCPUSpeed
|
|
|
|
|
bpl .4
|
|
|
|
|
|
|
|
|
|
>PUSHW L.CPU.SPEED
|
|
|
|
|
>PUSHW A2osX.CPUSPEED
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
jsr CS.RUN.PRINTF
|
|
|
|
|
|
|
|
|
|
.4 bit bAltCPU
|
|
|
|
|
bpl .5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.5 bit bKernelVersion
|
|
|
|
|
bpl .6
|
|
|
|
|
|
|
|
|
|
>PUSHW L.KERNEL.VER
|
|
|
|
|
>PUSHW A2osX.KVER
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
jsr CS.RUN.PRINTF
|
|
|
|
|
|
2021-06-23 17:43:04 +00:00
|
|
|
|
.6 bit bKernelBuild
|
|
|
|
|
bpl .60
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.GetBuild
|
|
|
|
|
bcs .60
|
|
|
|
|
|
|
|
|
|
>LDYA pData
|
|
|
|
|
jsr CS.RUN.PRINTYA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.60 bit bKernelMode
|
2020-11-19 15:34:02 +00:00
|
|
|
|
bpl .7
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
bit A2osX.IRQMode
|
2021-06-23 17:43:04 +00:00
|
|
|
|
bpl .61
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
inx
|
|
|
|
|
bit A2osX.F
|
2021-06-23 17:43:04 +00:00
|
|
|
|
bvc .61
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
inx
|
|
|
|
|
|
2021-06-23 17:43:04 +00:00
|
|
|
|
.61 >LDYA L.KERNEL.MODES,x
|
2020-11-19 15:34:02 +00:00
|
|
|
|
jsr CS.RUN.PRINTYA
|
|
|
|
|
|
|
|
|
|
.7 bit bKernelClk
|
|
|
|
|
bpl .8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.8 >PUSHW L.MSG.CRLF
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-06-26 20:24:25 +00:00
|
|
|
|
CS.RUN.GetHostName
|
|
|
|
|
>LDYA L.ETCHOSTNAME
|
|
|
|
|
bra CS.RUN.GetFile
|
|
|
|
|
|
2021-06-23 17:43:04 +00:00
|
|
|
|
CS.RUN.GetBuild >LDYA L.ETCVERSION
|
2021-06-26 20:24:25 +00:00
|
|
|
|
|
|
|
|
|
CS.RUN.GetFile stz hFILE
|
|
|
|
|
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHBI O.RDONLY
|
|
|
|
|
>PUSHBI 0
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
sta (pData)
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
>PUSHWZ
|
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .9
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
sta hFILE
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
>LEA.G FGetSBuf
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
.1 >PUSHB hFILE
|
|
|
|
|
>PUSHW ZPPtr1
|
|
|
|
|
>PUSHWI 64
|
|
|
|
|
>SYSCALL FGetS
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
beq .1
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
cmp #'#'
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPPtr1),y
|
2021-06-23 17:43:04 +00:00
|
|
|
|
sta (pData),y
|
2021-06-26 20:24:25 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
.9 php
|
|
|
|
|
pha
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
lda hFILE
|
|
|
|
|
beq .90
|
2021-06-23 17:43:04 +00:00
|
|
|
|
|
2021-06-26 20:24:25 +00:00
|
|
|
|
>SYSCALL FClose
|
|
|
|
|
|
|
|
|
|
.90 pla
|
|
|
|
|
plp
|
|
|
|
|
rts
|
2021-06-23 17:43:04 +00:00
|
|
|
|
*--------------------------------------
|
2020-11-19 15:34:02 +00:00
|
|
|
|
CS.RUN.PRINTYA >PUSHYA
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
|
|
|
|
|
CS.RUN.PRINTF lda Count
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
lda #C.SPACE
|
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
|
|
|
|
|
.1 >SYSCALL PrintF
|
|
|
|
|
|
|
|
|
|
inc Count
|
|
|
|
|
|
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CheckOpt ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldx #OptionVars-OptionList-1
|
|
|
|
|
|
|
|
|
|
.2 cmp OptionList,x
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 ldy OptionVars,x
|
|
|
|
|
ldx #$ff
|
|
|
|
|
stx 0,y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2021-06-26 20:24:25 +00:00
|
|
|
|
OptionList .AS "HhMmCcSsAaVvBbKkZz"
|
2020-11-19 15:34:02 +00:00
|
|
|
|
OptionVars .DA #bHostName,#bHostName
|
|
|
|
|
.DA #bMachineType,#bMachineType
|
|
|
|
|
.DA #bCPUType,#bCPUType
|
|
|
|
|
.DA #bCPUSpeed,#bCPUSpeed
|
|
|
|
|
.DA #bAltCPU,#bAltCPU
|
|
|
|
|
.DA #bKernelVersion,#bKernelVersion
|
2021-06-23 17:43:04 +00:00
|
|
|
|
.DA #bKernelBuild,#bKernelBuild
|
2020-11-19 15:34:02 +00:00
|
|
|
|
.DA #bKernelMode,#bKernelMode
|
|
|
|
|
.DA #bKernelClk,#bKernelClk
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MSG.USAGE .AS "Usage : UNAME\r\n"
|
|
|
|
|
.AS " -H : Hostname\r\n"
|
|
|
|
|
.AS " -M : Machine Type/SubType\r\n"
|
|
|
|
|
.AS " -C : CPU Type\r\n"
|
|
|
|
|
.AS " -S : CPU Speed\r\n"
|
|
|
|
|
.AS " -A : Alternate CPU\r\n"
|
|
|
|
|
.AS " -V : Kernel Version\r\n"
|
2021-06-23 17:43:04 +00:00
|
|
|
|
.AS " -B : Kernel Build\r\n"
|
2020-11-19 15:34:02 +00:00
|
|
|
|
.AS " -K : Kernel Mode\r\n"
|
|
|
|
|
.AS " -Z : Kernel Timing\r\n"
|
|
|
|
|
MSG.CRLF .AZ "\r\n"
|
2021-06-23 17:43:04 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ETCHOSTNAME .AZ "${ROOT}etc/hostname"
|
|
|
|
|
ETCVERSION .AZ "${ROOT}etc/version"
|
|
|
|
|
*--------------------------------------
|
2020-11-19 15:34:02 +00:00
|
|
|
|
TYPE.UNKNOWN .AZ "Unknown_HW"
|
|
|
|
|
TYPE.IIe .AZ "Apple//e"
|
|
|
|
|
TYPE.IIc .AZ "Apple//c"
|
|
|
|
|
TYPE.IIgs .AZ "AppleIIgs"
|
|
|
|
|
CPU.65C02 .AZ "65c02"
|
|
|
|
|
CPU.65R02 .AZ "65r02"
|
|
|
|
|
CPU.65816 .AZ "65816"
|
|
|
|
|
CPU.SPEED .AZ "%d.%02dmhz"
|
|
|
|
|
KERNEL.VER .AZ "A2osX_%d.%02d"
|
|
|
|
|
KERNEL.POLLING .AZ "Polling_Mode"
|
|
|
|
|
KERNEL.IRQ .AZ "IRQ_Mode"
|
|
|
|
|
KERNEL.PREEMPT .AZ "Preemptive_Mode"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2021-06-23 17:43:04 +00:00
|
|
|
|
DS.START .BS 65
|
2021-06-26 20:24:25 +00:00
|
|
|
|
FGetSBuf .BS 65
|
2020-11-19 15:34:02 +00:00
|
|
|
|
DS.END .ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/uname.s
|
|
|
|
|
ASM
|