mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2025-01-30 11:30:54 +00:00
38666ee111
These are the stdio.asm changes that were present in the beta source code on Opus ][, but had been reverted in commit e3c0c962d4b0f8077. As it turns out, the changes to stdio.asm were OK--the issue was simply that the definitions of stdin/stdout/stderr and the associated initialization code in vars.asm had not been updated to account for the new version of the FILE structure. That has now been done, allowing the changes to work properly. This fixes #7.
153 lines
5.4 KiB
NASM
153 lines
5.4 KiB
NASM
keep obj/vars
|
|
mcopy vars.macros
|
|
case on
|
|
****************************************************************
|
|
*
|
|
* VARS.ASM
|
|
*
|
|
* This module contains the global variables used by C. When
|
|
* using the large memory module, these variables are replaced by
|
|
* GVARS.ASM, which places the variables in the ~GLOBALS
|
|
* segment.
|
|
*
|
|
****************************************************************
|
|
*
|
|
Dummy start (dummy root segment)
|
|
|
|
copy equates.asm
|
|
end
|
|
|
|
****************************************************************
|
|
*
|
|
* Global variables used by C
|
|
*
|
|
****************************************************************
|
|
*
|
|
CVars start
|
|
|
|
errno entry library error number
|
|
ds 2
|
|
_ownerid entry user ID (C)
|
|
~USER_ID entry user ID (Pascal, libraries)
|
|
ds 2
|
|
sys_nerr entry # of error messages
|
|
dc i'13'
|
|
_toolErr entry last error in a tool call (C)
|
|
~TOOLERROR entry last error in a tool call (Pascal)
|
|
ds 2
|
|
end
|
|
|
|
****************************************************************
|
|
*
|
|
* ~InitIO - initialize the standard I/O files
|
|
*
|
|
****************************************************************
|
|
*
|
|
~InitIO start
|
|
|
|
ldx #sizeofFILE-4-2 set up the file records
|
|
lb1 lda stderr+4+sizeofFILE,X
|
|
sta stderr+8,X
|
|
lda stdin+4+sizeofFILE,X
|
|
sta stdin+8,X
|
|
lda stdout+4+sizeofFILE,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,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,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,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,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,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,EOF' putback buffer
|
|
dc i'_IONBF+_IOWRT+_IOTEXT' no buffering; allow writes; text file
|
|
dc i'stdoutID' standard out
|
|
end
|