ORCALib changes for GNO.

This is a reconstruction of the ORCALib source changes for the version of ORCALib distributed with GNO 2.0.6. The library built with this code should be identical to the original GNO one, apart from insignificant junk bytes at the ends of segments and the build date in the resource fork.
This commit is contained in:
Stephen Heumann 2020-02-18 23:29:40 -06:00
parent e4a8afe476
commit 97c3ecad73
9 changed files with 94 additions and 158 deletions

17
Makefile Normal file
View File

@ -0,0 +1,17 @@
#
# Makefile for GNO version of ORCALib
#
# To use this, you need a GNO system with the GNO source code in /src.
#
# This currently builds the library as "liborca".
# You will have to manually copy it to /lib/ORCALib.
#
# The assert.o file is not included in ORCALib but is used in libc.
LIB = orca
SRCS = cc.asm ctype.asm orca.asm signal2.c stdlib.asm string.asm \
time.asm toolglue.asm vars.asm
buildall .PHONY: build assert.o
.INCLUDE: /src/gno/lib/lib.mk

View File

@ -38,7 +38,7 @@ __assert start
ph2 l
ph4 f
ph4 #msg
ph4 >stderr
ph4 >__assertfp
jsl fprintf
jsl abort

21
cc.asm
View File

@ -184,9 +184,6 @@ TAB equ 9 TAB key code
stz ~ExitList no exit routines, yet
stz ~ExitList+2
case on
jsl ~InitIO reset standard I/O
case off
lda cLine if cLine == 0 then
ora cLine+2
@ -401,13 +398,19 @@ lb2 ldy #2 dereference the pointer
; Close (and flush) any open files
;
case on
lb3 lda >stderr+6 while there is a next file
ora >stderr+4
lb3 lda >__cleanup+2
ora >__cleanup
beq lb4
ph4 >stderr+4 close it
dc h'22' (jsl fclose, soft reference)
dc s3'fclose'
bra lb3
phk
pea lb4-1
short I,M
lda >__cleanup+2
pha
long I,M
lda >__cleanup
dec A
pha
rtl
case off
;
; return

View File

@ -103,7 +103,7 @@ yes lda #1
****************************************************************
*
* int isctrl (int c)
* int isblank (int c)
*
* Inputs:
* 4,S - digit to test
@ -113,7 +113,34 @@ yes lda #1
*
****************************************************************
*
isctrl start
isblank start
lda 4,S fetch the operand
tax
lda 2,S remove parm from stack
sta 4,S
pla
sta 1,S
inx form the result
lda >__ctype2,X
and #_blank
rtl
end
****************************************************************
*
* int iscntrl (int c)
*
* Inputs:
* 4,S - digit to test
*
* Outputs:
* A - result
*
****************************************************************
*
iscntrl start
isctrl entry
lda 4,S fetch the operand
tax
@ -840,7 +867,7 @@ __ctype2 start
dc i1'0' $06
dc i1'0' $07
dc i1'0' $08
dc i1'0' $09
dc i1'_blank' $09
dc i1'0' $0A
dc i1'0' $0B
dc i1'0' $0C
@ -863,7 +890,7 @@ __ctype2 start
dc i1'0' $1D
dc i1'0' $1E
dc i1'0' $1F
dc i1'0' ' '
dc i1'_blank' ' '
dc i1'0' !
dc i1'0' "
dc i1'0' #

View File

@ -36,6 +36,7 @@ _print gequ $80 [' '..'~']
_csym gequ $01 ['0'..'9','A'..'Z','a'..'z','_']
_csymf gequ $02 ['A'..'Z','a'..'z'.'_']
_octal gequ $04 ['0'..'7']
_blank gequ $08 ['\t', ' ']
;
; signal numbers
;

20
liborca.rez Normal file
View File

@ -0,0 +1,20 @@
#include "Types.rez"
resource rVersion (0x1, purgeable3) {
{
2,0,6,beta,4
},
verUS,
"ORCALib (GNO Version)",
"Byte Works' General Purpose Library.\n"
"This library is only for use with GNO.\n"
"Build Date: " $$DATE
};
resource rComment (0x1, purgeable3) {
"ORCALib (GNO Version)\n"
"Byte Works' General Purpose Library.\n"
"This library is only for use with GNO.\n"
"Build Date: " $$DATE
};

10
signal2.c Normal file
View File

@ -0,0 +1,10 @@
#ifdef __ORCAC__
segment "libc_sys__";
#endif
#include <gno/kerntool.h>
#include <errno.h>
int raise(int sig) {
return Kkill(Kgetpid(), sig, &errno);
}

View File

@ -878,34 +878,6 @@ lb2 sty set set the disp past the current disp
rtl
end
****************************************************************
*
* strerror - return the addr of an error message
*
* Inputs:
* err - error number to return the error for
*
****************************************************************
*
strerror start
phb get the error number
plx
ply
pla
phy
phx
phk use local data bank
plb
asl A compute the index
asl A
tay
ldx sys_errlist+2,Y load the address
lda sys_errlist,Y
plb restore caller's data bank
rtl
end
****************************************************************
*
* strlen - find the length of a string

118
vars.asm
View File

@ -30,123 +30,9 @@ errno entry library error number
_ownerid entry user ID (C)
~USER_ID entry user ID (Pascal, libraries)
ds 2
sys_nerr entry # of error messages
dc i'6'
__cleanup entry function to clean up files at exit
dc i4'0'
_toolErr entry last error in a tool call (C)
~TOOLERROR entry last error in a tool call (Pascal)
ds 2
end
****************************************************************
*
* ~InitIO - initialize the standad I/O files
*
****************************************************************
*
~InitIO start
ldx #24 set up the file records
lb1 lda stderr+34,X
sta stderr+8,X
lda stdin+34,X
sta stdin+8,X
lda stdout+34,X
sta stdout+8,X
dex
dex
bpl lb1
lla stderr,stderr+4 set up the file pointers
lla stdin,stdin+4
lla stdout,stdout+4
rtl
end
****************************************************************
*
* stderr - error out file
*
****************************************************************
*
stderr start
dc a4'lb1'
lb1 dc a4'0' next file
dc a4'0' next location to write to
dc a4'0' first byte of buffer
dc a4'0' end of the file buffer
dc i4'0' size of the file buffer
dc i4'0' count
dc i'EOF' putback buffer
dc i'_IONBF+_IOWRT+_IOTEXT' no buffering; allow writes; text file
dc i'stderrID' error out
dc a4'0' next location to write to
dc a4'0' first byte of buffer
dc a4'0' end of the file buffer
dc i4'0' size of the file buffer
dc i4'0' count
dc i'EOF' putback buffer
dc i'_IONBF+_IOWRT+_IOTEXT' no buffering; allow writes; text file
dc i'stderrID' error out
end
****************************************************************
*
* stdin - standard in file
*
****************************************************************
*
stdin start
dc a4'lb1'
lb1 dc a4'stdout+4' next file
dc a4'0' next location to write to
dc a4'0' first byte of buffer
dc a4'0' end of the file buffer
dc i4'0' size of the file buffer
dc i4'0' count
dc i'EOF' putback buffer
dc i'_IONBF+_IOREAD+_IOTEXT' no buffering; allow reads; text file
dc i'stdinID' standard in
dc a4'0' next location to write to
dc a4'0' first byte of buffer
dc a4'0' end of the file buffer
dc i4'0' size of the file buffer
dc i4'0' count
dc i'EOF' putback buffer
dc i'_IONBF+_IOREAD+_IOTEXT' no buffering; allow reads; text file
dc i'stdinID' standard in
end
****************************************************************
*
* stdout - standard out file
*
****************************************************************
*
stdout start
dc a4'lb1'
lb1 dc a4'stderr+4' next file
dc a4'0' next location to write to
dc a4'0' first byte of buffer
dc a4'0' end of the file buffer
dc i4'0' size of the file buffer
dc i4'0' count
dc i'EOF' putback buffer
dc i'_IONBF+_IOWRT+_IOTEXT' no buffering; allow writes; text file
dc i'stdoutID' standard out
dc a4'0' next location to write to
dc a4'0' first byte of buffer
dc a4'0' end of the file buffer
dc i4'0' size of the file buffer
dc i4'0' count
dc i'EOF' putback buffer
dc i'_IONBF+_IOWRT+_IOTEXT' no buffering; allow writes; text file
dc i'stdoutID' standard out
end