BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
inputoutputlib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"
#include <dos/dos.h>
#include <proto/dos.h>

Data Structures

struct  channel

Macros

#define __NOLIBBASE__
#define DOSBase   dosbase /* for proto/dos.h */
#define DISPATCH(entry, code, off)

Functions

void dodefin (void)
void dodefout (void)
void dosetin (void)
void dosetout (void)
void dogetsingle (void)
void dogetstring (void)
void dooutsingle (void)
void dooutstring1 (void)
void dooutstring2 (void)
void dopopinput (void)
void dopopoutput (void)
void inputoutputlib_codeinit (void)
void popinputcheck (void)
void popoutputcheck (void)
void ctrlcout (void)
void ctrlcin (void)
static ULONG setchannel (struct channel *c, void *handler)
static void popchannel (struct channel *c)
static ULONG dosetin_c (void *handler)
 dosetin (+3): make a handler the current input channel.
static ULONG dosetout_c (void *handler)
 dosetout (+4): make a handler the current output channel, as dosetin.
static void dopopinput_c (void)
 PopInput: go back to the previous input channel.
 BLITZ_ALIAS (dopopinput, dopopinput_c)
static void dopopoutput_c (void)
 PopOutput: go back to the previous output channel, as PopInput.
 BLITZ_ALIAS (dopopoutput, dopopoutput_c)
static LONG defout_c (ULONG c)
static LONG defout2_c (ULONG len, const UBYTE *s)
static void defout3_c (const UBYTE *s)
void defout (void)
static LONG defin2_c (ULONG len, UBYTE *buf)
void defin (void)
static ULONG dodefin_c (void)
 DefaultInput: make the default input (dos Input(), handler defin) the current input channel; the previous one is pushed.
 BLITZ_ALIAS (dodefin, dodefin_c)
static ULONG dodefout_c (void)
 DefaultOutput: make the default output (dos Output(), handler defout) the current output channel; the previous one is pushed.
 BLITZ_ALIAS (dodefout, dodefout_c)
static void codeinit_c (struct DosLibrary *dos)
 The library's init: remember the dos base and Input()/Output(), empty stacks, then DefaultInput and DefaultOutput (each pushes the handler 0).
 DISPATCH (dogetsingle, "_iochan_in", "0")
 The channel dispatchers for other libraries: dogetsingle (+5, JSR (incode)), dogetstring (+6, JSR -4(incode)), dooutsingle (+7, JSR (outcode)), dooutstring1 (+8, JSR -4(outcode)), dooutstring2 (+9, JSR -8(outcode)).
 DISPATCH (dogetstring, "_iochan_in", "-4")
 DISPATCH (dooutsingle, "_iochan_out", "0")
 DISPATCH (dooutstring1, "_iochan_out", "-4")
 DISPATCH (dooutstring2, "_iochan_out", "-8")
static void popinputcheck_c (void)
static void popoutputcheck_c (void)
 BLITZ_ERRCHK_ASM (breaktext, "_breaktext:\n" " .ascii \"***Break\"\n" " .byte 10\n" " .even")
static void ctrlc_c (const void *code, void(*def)(void))
static void ctrlcout_c (void)
static void ctrlcin_c (void)

Variables

struct channel iochan_in iochan_out
static struct DosLibrary * dosbase
static BPTR inputh
static BPTR outputh
static UBYTE outchar
const char mess1 [] = "Can't Input Character from Default Input"

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ DISPATCH

#define DISPATCH ( entry,
code,
off )
Value:
" move.l a6,-(sp)\n" \
" move.l " code "(pc),a6\n" \
" jsr " off "(a6)\n" \
" move.l (sp)+,a6\n" \
" rts")
#define BLITZ_ASM_ROUTINE(entry, text)
Definition blitzlib.h:972
UBYTE code[4]
Definition ridisasmlib.c:375
static struct snowfield * entry(ULONG n)
Definition risnowlib.c:205

◆ DOSBase

#define DOSBase   dosbase /* for proto/dos.h */

Function Documentation

◆ BLITZ_ALIAS() [1/4]

BLITZ_ALIAS ( dodefin ,
dodefin_c  )

◆ BLITZ_ALIAS() [2/4]

BLITZ_ALIAS ( dodefout ,
dodefout_c  )

◆ BLITZ_ALIAS() [3/4]

BLITZ_ALIAS ( dopopinput ,
dopopinput_c  )

◆ BLITZ_ALIAS() [4/4]

BLITZ_ALIAS ( dopopoutput ,
dopopoutput_c  )

◆ BLITZ_ERRCHK_ASM()

BLITZ_ERRCHK_ASM ( breaktext ,
"_breaktext:\n" " .ascii \"***Break\"\n" " .byte 10\n" " .even"  )

◆ codeinit_c()

void codeinit_c ( struct DosLibrary * dos)
static

The library's init: remember the dos base and Input()/Output(), empty stacks, then DefaultInput and DefaultOutput (each pushes the handler 0).

Parameters
dosa6: dos.library (!libs doslib,la6)

◆ ctrlc_c()

void ctrlc_c ( const void * code,
void(* def )(void) )
static

◆ ctrlcin()

void ctrlcin ( void )

◆ ctrlcin_c()

void ctrlcin_c ( void )
static

◆ ctrlcout()

void ctrlcout ( void )

◆ ctrlcout_c()

void ctrlcout_c ( void )
static

◆ defin()

void defin ( void )

◆ defin2_c()

LONG defin2_c ( ULONG len,
UBYTE * buf )
static

◆ defout()

void defout ( void )

◆ defout2_c()

LONG defout2_c ( ULONG len,
const UBYTE * s )
static

◆ defout3_c()

void defout3_c ( const UBYTE * s)
static

◆ defout_c()

LONG defout_c ( ULONG c)
static

◆ DISPATCH() [1/5]

DISPATCH ( dogetsingle ,
"_iochan_in" ,
"0"  )

The channel dispatchers for other libraries: dogetsingle (+5, JSR (incode)), dogetstring (+6, JSR -4(incode)), dooutsingle (+7, JSR (outcode)), dooutstring1 (+8, JSR -4(outcode)), dooutstring2 (+9, JSR -8(outcode)).

All registers go unchanged to the handler, with a6 = the handler address; d0 and the rest come back as the handler leaves them, only a6 is restored. The parameters and results are the handler's (head comment).

◆ DISPATCH() [2/5]

DISPATCH ( dogetstring ,
"_iochan_in" ,
"-4"  )

◆ DISPATCH() [3/5]

DISPATCH ( dooutsingle ,
"_iochan_out" ,
"0"  )

◆ DISPATCH() [4/5]

DISPATCH ( dooutstring1 ,
"_iochan_out" ,
"-4"  )

◆ DISPATCH() [5/5]

DISPATCH ( dooutstring2 ,
"_iochan_out" ,
"-8"  )

◆ dodefin()

void dodefin ( void )

◆ dodefin_c()

ULONG dodefin_c ( void )
static

DefaultInput: make the default input (dos Input(), handler defin) the current input channel; the previous one is pushed.

Returns
d0: the previous handler (a statement: not used by Blitz)

◆ dodefout()

void dodefout ( void )

◆ dodefout_c()

ULONG dodefout_c ( void )
static

DefaultOutput: make the default output (dos Output(), handler defout) the current output channel; the previous one is pushed.

Returns
d0: the previous handler (a statement: not used by Blitz)

◆ dogetsingle()

void dogetsingle ( void )

◆ dogetstring()

void dogetstring ( void )

◆ dooutsingle()

void dooutsingle ( void )

◆ dooutstring1()

void dooutstring1 ( void )

◆ dooutstring2()

void dooutstring2 ( void )

◆ dopopinput()

void dopopinput ( void )

◆ dopopinput_c()

void dopopinput_c ( void )
static

PopInput: go back to the previous input channel.

Errors (debugger only): "No Input channel to pop!" (count <= 1, the initial push of init does not count; fixed, #1032). Without the debugger popping more than was pushed takes old ring entries, By design (#194).

◆ dopopoutput()

void dopopoutput ( void )

◆ dopopoutput_c()

void dopopoutput_c ( void )
static

PopOutput: go back to the previous output channel, as PopInput.

Errors (debugger only): "No Output channel to pop!". By design (#194) as PopInput; after one PopOutput at the start the handler is 0.

◆ dosetin()

void dosetin ( void )

◆ dosetin_c()

ULONG dosetin_c ( void * handler)
static

dosetin (+3): make a handler the current input channel.

The previous handler is pushed on the input stack (a ring of 16).

Parameters
handlera0: the handler (entries at -4 and 0, see the head comment)
Returns
d0: the previous handler

◆ dosetout()

void dosetout ( void )

◆ dosetout_c()

ULONG dosetout_c ( void * handler)
static

dosetout (+4): make a handler the current output channel, as dosetin.

Parameters
handlera0: the handler (entries at -8, -4 and 0)
Returns
d0: the previous handler

◆ inputoutputlib_codeinit()

void inputoutputlib_codeinit ( void )

◆ popchannel()

void popchannel ( struct channel * c)
static

◆ popinputcheck()

void popinputcheck ( void )

◆ popinputcheck_c()

void popinputcheck_c ( void )
static

◆ popoutputcheck()

void popoutputcheck ( void )

◆ popoutputcheck_c()

void popoutputcheck_c ( void )
static

◆ setchannel()

ULONG setchannel ( struct channel * c,
void * handler )
static

Variable Documentation

◆ dosbase

struct DosLibrary* dosbase
static

◆ inputh

BPTR inputh
static

◆ iochan_out

struct channel iochan_in iochan_out

◆ mess1

const char mess1[] = "Can't Input Character from Default Input"

◆ outchar

UBYTE outchar
static

◆ outputh

BPTR outputh
static