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

Data Structures

struct  hunkitem

Macros

#define __NOLIBBASE__
#define DOS_BASE_NAME   dos
#define FIBSIZE
#define ENTRY(tab, n)
#define ISBANK(n)
#define LDF_FINDVOLUME   (LDF_READ | LDF_DEVICES | LDF_VOLUMES | LDF_ASSIGNS | LDF_ENTRY)

Functions

void _cacheon (void)
void _cacheoff (void)
void _reboot (void)
void _lisa (void)
void _makedir (void)
void _rename (void)
void _memfree (void)
void riamosfunclib_gttags (void)
 GTTagValue([tagvalue]): GadTools' tag base TAG_USER|$80000 (+ tagvalue in d0) - inline code, copied by the compiler.
void _gttags2 (void)
void _timer (void)
void _min (void)
void _max (void)
void _copybyte (void)
void _copyword (void)
void _copylong (void)
void _filesize (void)
void _bload4 (void)
void _bload1 (void)
void _bload0 (void)
void _bload (void)
void _bload2 (void)
void _bsave2 (void)
void _bsave (void)
void _start (void)
void _length (void)
void _erase (void)
void _eraseall (void)
void _allocmem2 (void)
void _allocmem1 (void)
void riamosfunclib_allocmem (void)
void _findfreebank (void)
void _nextbank0 (void)
void _fillmemzeros (void)
void _fillmem (void)
void _keycode (void)
void _blitdone (void)
void _blitwait (void)
void riamosfunclib_finddev (void)
void _swapbank (void)
void _getdevname (void)
void _cd (void)
void _banklimit (void)
void _getbanklimit (void)
void _saveexec (void)
void riamosfunclib_libinit (void)
void riamosfunclib_libfinit (void)
static void bloadchk (void)
static ULONG start_c (LONG bank)
 Start(bank): the address of a bank.
static ULONG length_c (LONG bank)
 Length(bank): the length of a bank.
static void eraseit (LONG bank)
static BB_BOOL newbank (LONG bank, ULONG len, ULONG flags)
static void erase_c (LONG bank)
 Erase bank: frees a bank (FreeMem) if it is in use.
static void eraseall_c (void)
 EraseAll: frees every bank in use, from maxbanks-1 down to 0.
static BB_BOOL allocmem_c (LONG bank, ULONG len, ULONG flags)
 Reserve(bank,length,requirements): allocates a bank (exec AllocMem).
static BB_BOOL allocmem1_c (LONG bank, ULONG len)
 Reserve(bank,length): as above with MEMF_PUBLIC.
static ULONG findfreebank_c (LONG bank)
 NextBank [startbank]: the first free bank from startbank on.
static ULONG nextbank0_c (void)
 NextBank: the first free bank (from bank 0).
static ULONG allocmem2_c (LONG len)
 Reserve(length): allocates the next free bank (NextBank from 0, MEMF_PUBLIC).
static BB_BOOL swapbank_c (LONG a, LONG b)
 SwapBank(sourcebank,destbank): exchanges two banks (address and length).
static void fillmem_c (ULONG adr, ULONG len, UBYTE v)
 FillMem address,length,value: fills memory (or a bank) with a byte.
static void fillmemzeros_c (ULONG adr, ULONG len)
 FillMem address,length: as above with 0.
static ULONG libinit_c (void)
 init: opens dos.library and allocates the bank tables.
static void finitbanks (void)
static void libfinit_c (void)
 finit: makes the directory the first ChangeDir replaced current again, unlocks ChangeDir's lock, frees every bank and the tables, closes dos.library.
static ULONG banklimit_c (LONG n)
 BankLimit numbanks: a new number of banks - finit (every bank freed), the new number, init.
static ULONG getbanklimit_c (void)
 BankLimit: the number of banks (50 at the start).
static ULONG filesize_c (CONST_STRPTR name)
 FileSize(filename$): the size of a file.
static BB_BOOL bload2_c (CONST_STRPTR name, ULONG adr, ULONG len, LONG offset, ULONG memtype)
 BLoad(filename$,address,length,offset,memtype): loads a file (or a part of it) to an address or into a bank.
static BB_BOOL bload_c (CONST_STRPTR name, ULONG adr, ULONG len, LONG offset)
 BLoad(filename$,address,length,offset): as above, memtype 0.
static BB_BOOL bload0_c (CONST_STRPTR name, ULONG adr, ULONG len)
 BLoad(filename$,address,length): as above from the start of the file, memtype 0.
static BB_BOOL bload1_c (CONST_STRPTR name, ULONG adr)
 BLoad(filename$,address): the whole file to an address or into a bank (memtype 0).
static ULONG bload4_c (CONST_STRPTR name)
 BLoad(filename$): loads a file into a new bank (Reserve(length)).
static BB_BOOL bsave_c (CONST_STRPTR name, ULONG adr, ULONG len)
 BSave(filename$,address/bank,length): writes memory (or a bank) to a file.
static BB_BOOL bsave2_c (CONST_STRPTR name, ULONG adr)
 BSave(filename$,bank): writes a whole bank (an address: nothing).
static BB_BOOL makedir_c (CONST_STRPTR name)
 MakeDir(dirname$): creates a directory (dos CreateDir) and gives its lock back.
static ULONG rename_c (CONST_STRPTR from, CONST_STRPTR to)
 Rename(oldfilename$,newfilename$): renames a file (dos Rename).
static BB_BOOL cd_c (CONST_STRPTR name)
 ChangeDir dir$: makes a directory the current one (CurrentDir(Lock(dir$))).
static ULONG finddev_c (CONST_STRPTR name)
 FindVolume(volumename): whether a device, volume or assign of that name is present (FindDosEntry).
static ULONG devname (const struct DosList *dl)
static ULONG getdevname_c (const ULONG *lens)
 DeviceName$(volumename$): the name of the handler task of a device or volume, with ":" (AmiBlitz3's version).
static ULONG hunklongs (const struct hunkitem *h)
static ULONG execinit (CONST_STRPTR name, const struct hunkitem *h, ULONG n)
static void docode (const struct hunkitem *h, ULONG num)
static ULONG saveexec_c (CONST_STRPTR name, const UBYTE *list)
 SaveExec filename$,list(): writes an executable from a Blitz list of NEWTYPE .hunk (code hunks with RELOC32).
static ULONG cacheon_c (ULONG mask)
 CachesOn bitmask: switches caches on (exec CacheControl(bitmask,bitmask)).
static ULONG cacheoff_c (ULONG mask)
 CachesOff bitmask: switches caches off (exec CacheControl(0,bitmask)).
void riamosfunclib_oldreboot (void)
static void reboot_c (void)
 Reboot: a cold reboot (exec ColdReboot); does not return.
static ULONG memfree_c (void)
 MemFree: the free public memory (AvailMem(MEMF_PUBLIC)).
static ULONG lisa_c (ULONG result)
 Lisa: the Lisa (Denise) chip version, DENISEID ($DFF07C).
static ULONG timer_c (void)
 Timer: the CIA-A TOD counter (vertical blanks).
static ULONG keycode_c (void)
 KeyCode: the raw keyboard byte of CIA-A SDR ($BFEC01).
static BB_BOOL blitdone_c (void)
 BlitterDone: whether the blitter is idle (one BTST of DMACONR's BBUSY, no Agnus wait).
static void blitwait_c (void)
 WaitBlitter: waits until the blitter is idle (DMACONR's BBUSY). Returns nothing (all registers kept).
static LONG max_c (LONG a, LONG b)
 Max(a,b): the larger of two signed longs.
static LONG min_c (LONG a, LONG b)
 Min(a,b): the smaller of two signed longs.
static ULONG copybyte_c (const UBYTE *src, UBYTE *d, LONG n)
 CopyByte sourceaddr,destaddr,bytes: copies bytes, ascending.
static ULONG copyword_c (const UWORD *src, UWORD *d, LONG n)
 CopyWord sourceaddr,destaddr,words: copies words, ascending.
static ULONG copylong_c (const ULONG *src, ULONG *d, LONG n)
 CopyLong sourceaddr,destaddr,longs: copies longs, ascending.

Variables

static ULONG * lenptr
static ULONG * startptr
static LONG maxbanks = 50
static BPTR oldlock
static BPTR startdir
static BOOL startkept
static struct DosLibrary * dosbase_
static const char dosname [] = "dos.library"
static BPTR fh
static ULONG hunkbuff [8]

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ DOS_BASE_NAME

#define DOS_BASE_NAME   dos

◆ ENTRY

#define ENTRY ( tab,
n )
Value:
(*(ULONG *)((ULONG)(tab) + ((ULONG)(n) << 2)))
ULONG WORD UWORD UWORD border ULONG ULONG struct bb_bitmap *dst void UWORD n
Definition 2dlib.c:2498
static void tab(struct out *o)
Definition basictest_write.c:87

◆ FIBSIZE

#define FIBSIZE
Value:
264 /* AllocMem'd for Examine (no AllocDosObject:
OS 1.3, see the source's header) */

◆ ISBANK

#define ISBANK ( n)
Value:
((ULONG)(n) < (ULONG)maxbanks)
static LONG maxbanks
Definition riamosfunclib.c:434

◆ LDF_FINDVOLUME

#define LDF_FINDVOLUME   (LDF_READ | LDF_DEVICES | LDF_VOLUMES | LDF_ASSIGNS | LDF_ENTRY)

Function Documentation

◆ _allocmem1()

void _allocmem1 ( void )

◆ _allocmem2()

void _allocmem2 ( void )

◆ _banklimit()

void _banklimit ( void )

◆ _blitdone()

void _blitdone ( void )

◆ _blitwait()

void _blitwait ( void )

◆ _bload()

void _bload ( void )

◆ _bload0()

void _bload0 ( void )

◆ _bload1()

void _bload1 ( void )

◆ _bload2()

void _bload2 ( void )

◆ _bload4()

void _bload4 ( void )

◆ _bsave()

void _bsave ( void )

◆ _bsave2()

void _bsave2 ( void )

◆ _cacheoff()

void _cacheoff ( void )

◆ _cacheon()

void _cacheon ( void )

◆ _cd()

void _cd ( void )

◆ _copybyte()

void _copybyte ( void )

◆ _copylong()

void _copylong ( void )

◆ _copyword()

void _copyword ( void )

◆ _erase()

void _erase ( void )

◆ _eraseall()

void _eraseall ( void )

◆ _filesize()

void _filesize ( void )

◆ _fillmem()

void _fillmem ( void )

◆ _fillmemzeros()

void _fillmemzeros ( void )

◆ _findfreebank()

void _findfreebank ( void )

◆ _getbanklimit()

void _getbanklimit ( void )

◆ _getdevname()

void _getdevname ( void )

◆ _gttags2()

void _gttags2 ( void )

◆ _keycode()

void _keycode ( void )

◆ _length()

void _length ( void )

◆ _lisa()

void _lisa ( void )

◆ _makedir()

void _makedir ( void )

◆ _max()

void _max ( void )

◆ _memfree()

void _memfree ( void )

◆ _min()

void _min ( void )

◆ _nextbank0()

void _nextbank0 ( void )

◆ _reboot()

void _reboot ( void )

◆ _rename()

void _rename ( void )

◆ _saveexec()

void _saveexec ( void )

◆ _start()

void _start ( void )

◆ _swapbank()

void _swapbank ( void )

◆ _timer()

void _timer ( void )

◆ allocmem1_c()

BB_BOOL allocmem1_c ( LONG bank,
ULONG len )
static

Reserve(bank,length): as above with MEMF_PUBLIC.

Parameters
bankd0: the bank
lend1: the length
Returns
d0: -1 if allocated, 0 if not

◆ allocmem2_c()

ULONG allocmem2_c ( LONG len)
static

Reserve(length): allocates the next free bank (NextBank from 0, MEMF_PUBLIC).

Fixed (#498): -1 when every bank is in use; the original tested only the sign of the length and reserved "bank -1". Fixed (#500): -1 for a negative length; the original returned 0, a bank number.

Parameters
lend0: the length
Returns
d0: the bank number, -1 for a negative length, if no bank is free or if AllocMem fails

◆ allocmem_c()

BB_BOOL allocmem_c ( LONG bank,
ULONG len,
ULONG flags )
static

Reserve(bank,length,requirements): allocates a bank (exec AllocMem).

A bank in use is erased first, also when the new allocation fails (#499). Fixed (#484): 0 for a bank outside 0..maxbanks-1; the original did not check - bank >= maxbanks wrote behind the start table, a negative bank before the tables.

Parameters
bankd0: the bank
lend1: the length
flagsd2: the memory requirements (MEMF_...)
Returns
d0: -1 if allocated, 0 if not

◆ banklimit_c()

ULONG banklimit_c ( LONG n)
static

BankLimit numbanks: a new number of banks - finit (every bank freed), the new number, init.

Fixed (#483): returns the new number of banks; the original returned the address of the new start table (init's d0). Fixed (#491): the current directory and ChangeDir's lock stay; the original unlocked the lock as finit does, while it was current.

Parameters
nd0: numbanks
Returns
d0: numbanks

◆ blitdone_c()

BB_BOOL blitdone_c ( void )
static

BlitterDone: whether the blitter is idle (one BTST of DMACONR's BBUSY, no Agnus wait).

Returns
d0: -1 if idle, 0 if busy

◆ blitwait_c()

void blitwait_c ( void )
static

WaitBlitter: waits until the blitter is idle (DMACONR's BBUSY). Returns nothing (all registers kept).

◆ bload0_c()

BB_BOOL bload0_c ( CONST_STRPTR name,
ULONG adr,
ULONG len )
static

BLoad(filename$,address,length): as above from the start of the file, memtype 0.

Parameters
named0: filename$
adrd1: the address or bank
lend2: the number of bytes (0 = the file's size)
Returns
d0: -1 if something was read, 0 if not

◆ bload1_c()

BB_BOOL bload1_c ( CONST_STRPTR name,
ULONG adr )
static

BLoad(filename$,address): the whole file to an address or into a bank (memtype 0).

Parameters
named0: filename$
adrd1: the address or bank
Returns
d0: -1 if something was read, 0 if not

◆ bload2_c()

BB_BOOL bload2_c ( CONST_STRPTR name,
ULONG adr,
ULONG len,
LONG offset,
ULONG memtype )
static

BLoad(filename$,address,length,offset,memtype): loads a file (or a part of it) to an address or into a bank.

Length 0 = the file's size (0 for an empty or missing file). A number from 0 to maxbanks-1 is a bank: erased and reserved anew with that length and memtype (#499); anything else is an address (fixed, #484: the original compared signed). The file is opened first: one that cannot be opened leaves the bank as it was (fixed, #487: the original erased and reserved the bank first and left it so). A failed read (Read's -1) is 0 (fixed, #488: the original tested for 0 only; a short read stays success: a length beyond the file is a valid call). The error check is switched off (#485, not a defect: see bloadchk).

Parameters
named0: filename$
adrd1: the address or bank
lend2: the number of bytes
offsetd3: the start in the file (0 = from the start)
memtyped4: the memory type of a bank
Returns
d0: -1 if something was read, 0 if not

◆ bload4_c()

ULONG bload4_c ( CONST_STRPTR name)
static

BLoad(filename$): loads a file into a new bank (Reserve(length)).

Fixed (#486): -1 when Reserve fails, and when the load fails (the bank is erased); the original returned 0 for the first and the bank, still reserved, for the second.

Parameters
named0: filename$
Returns
d0: the bank, -1 for failure (an empty or missing file, no bank free or no memory, the load failed)

◆ bload_c()

BB_BOOL bload_c ( CONST_STRPTR name,
ULONG adr,
ULONG len,
LONG offset )
static

BLoad(filename$,address,length,offset): as above, memtype 0.

Parameters
named0: filename$
adrd1: the address or bank
lend2: the number of bytes (0 = the file's size)
offsetd3: the start in the file
Returns
d0: -1 if something was read, 0 if not

◆ bloadchk()

void bloadchk ( void )
static

◆ bsave2_c()

BB_BOOL bsave2_c ( CONST_STRPTR name,
ULONG adr )
static

BSave(filename$,bank): writes a whole bank (an address: nothing).

Parameters
named0: filename$
adrd1: the bank
Returns
d0: -1 if written, 0 if not

◆ bsave_c()

BB_BOOL bsave_c ( CONST_STRPTR name,
ULONG adr,
ULONG len )
static

BSave(filename$,address/bank,length): writes memory (or a bank) to a file.

A number from 0 to maxbanks-1 is a bank, anything else an address (fixed, #484: the original compared signed). Length 0 = the bank's length (an address without a length: 0); a length beyond the bank's is the bank's (fixed, #489: the original wrote that many bytes from the bank's start, whatever the bank's size).

Parameters
named0: filename$
adrd1: the address or bank
lend2: the number of bytes
Returns
d0: -1 if written, 0 if not

◆ cacheoff_c()

ULONG cacheoff_c ( ULONG mask)
static

CachesOff bitmask: switches caches off (exec CacheControl(0,bitmask)).

Fixed (#1145): below exec V36 (no CacheControl) 0, nothing switched; the original called CacheControl there, a crash on Kickstart 1.x.

Parameters
maskd0: the CACRF_ bits
Returns
d0: the old cache bits, 0 below exec V36

◆ cacheon_c()

ULONG cacheon_c ( ULONG mask)
static

CachesOn bitmask: switches caches on (exec CacheControl(bitmask,bitmask)).

Fixed (#1145): below exec V36 (no CacheControl) 0, nothing switched; the original called CacheControl there, a crash on Kickstart 1.x.

Parameters
maskd0: the CACRF_ bits
Returns
d0: the old cache bits, 0 below exec V36

◆ cd_c()

BB_BOOL cd_c ( CONST_STRPTR name)
static

ChangeDir dir$: makes a directory the current one (CurrentDir(Lock(dir$))).

The previous ChangeDir lock is unlocked (AmiBlitz3: MOVE.L oldlock - func-library7 and BSS2 tested and unlocked the word MOVE oldlock,d1 left in d1). The directory the first call replaces (the program's own) is kept for finit (fixed, #491: the original dropped it). Fixed (#490): CurrentDir's result is not tested (0 is a valid current directory); the original returned 0 for it, with the new lock current but not remembered.

Parameters
named0: dir$
Returns
d0: -1 if changed, 0 if not

◆ copybyte_c()

ULONG copybyte_c ( const UBYTE * src,
UBYTE * d,
LONG n )
static

CopyByte sourceaddr,destaddr,bytes: copies bytes, ascending.

Nothing for a count of 0 or below (fixed, #492: the original copied 2^32 bytes for 0).

Parameters
srcd0: sourceaddr
dd1: destaddr
nd2: the number of bytes
Returns
d0: 0 for n <= 0, else the source (as the original leaves it)

◆ copylong_c()

ULONG copylong_c ( const ULONG * src,
ULONG * d,
LONG n )
static

CopyLong sourceaddr,destaddr,longs: copies longs, ascending.

Nothing for a count of 0 or below (fixed, #492: the original copied 2^32 longs for 0).

Parameters
srcd0: sourceaddr
dd1: destaddr
nd2: the number of longs
Returns
d0: 0 for n <= 0, else the source

◆ copyword_c()

ULONG copyword_c ( const UWORD * src,
UWORD * d,
LONG n )
static

CopyWord sourceaddr,destaddr,words: copies words, ascending.

Nothing for a count of 0 or below (fixed, #492: the original copied 2^32 words for 0).

Parameters
srcd0: sourceaddr
dd1: destaddr
nd2: the number of words
Returns
d0: 0 for n <= 0, else the source

◆ devname()

ULONG devname ( const struct DosList * dl)
static

◆ docode()

void docode ( const struct hunkitem * h,
ULONG num )
static

◆ erase_c()

void erase_c ( LONG bank)
static

Erase bank: frees a bank (FreeMem) if it is in use.

Nothing for a number that is no bank (Start gives 0; fixed, #484: the original freed an "entry" before the tables for a negative one).

Parameters
bankd0: the bank Returns nothing (all registers kept).

◆ eraseall_c()

void eraseall_c ( void )
static

EraseAll: frees every bank in use, from maxbanks-1 down to 0.

Fixed (#495): the count is the whole long; the original counted with DBRA on the low word - with more than 65536 banks only those down to the next multiple of 65536 were freed, BankLimit 0 ran through 65536 negative banks. Returns nothing (all registers kept).

◆ eraseit()

void eraseit ( LONG bank)
static

◆ execinit()

ULONG execinit ( CONST_STRPTR name,
const struct hunkitem * h,
ULONG n )
static

◆ filesize_c()

ULONG filesize_c ( CONST_STRPTR name)
static

FileSize(filename$): the size of a file.

fib_Size of Examine (its result unchecked) into an AllocMem'd FileInfoBlock.

Parameters
named0: filename$
Returns
d0: the size, 0 without a lock or memory

◆ fillmem_c()

void fillmem_c ( ULONG adr,
ULONG len,
UBYTE v )
static

FillMem address,length,value: fills memory (or a bank) with a byte.

A number from 0 to maxbanks-1 is a bank: nothing for a free bank; anything else is an address (fixed, #484: the original compared signed, a negative number was a bank before the tables). Fixed (#492): nothing for a length of 0 or below; the original filled 2^32 bytes for 0 (it tested the length only after the first byte).

Parameters
adrd0: the address or bank
lend1: the number of bytes
vd2.b: the value Returns nothing (all registers kept).

◆ fillmemzeros_c()

void fillmemzeros_c ( ULONG adr,
ULONG len )
static

FillMem address,length: as above with 0.

Parameters
adrd0: the address or bank
lend1: the number of bytes Returns nothing (all registers kept).

◆ finddev_c()

ULONG finddev_c ( CONST_STRPTR name)
static

FindVolume(volumename): whether a device, volume or assign of that name is present (FindDosEntry).

Fixed (#1082): -1 for a name that is present, as the manual documents; the original returned the entry's address, an entry of the list after UnLockDosList. Fixed (#1145): below dos.library V36 (no LockDosList) the device list of DosInfo is walked under Forbid; the original called the V36 functions there, a crash on Kickstart 1.x.

Parameters
named0: the name (without ":")
Returns
d0: -1 if found, 0 if not

◆ findfreebank_c()

ULONG findfreebank_c ( LONG bank)
static

NextBank [startbank]: the first free bank from startbank on.

Fixed (#484): -1 for a start outside 0..maxbanks-1; the original compared signed and searched from a negative start before the tables.

Parameters
bankd0: startbank
Returns
d0: the bank, -1 if none is free

◆ finitbanks()

void finitbanks ( void )
static

◆ getbanklimit_c()

ULONG getbanklimit_c ( void )
static

BankLimit: the number of banks (50 at the start).

Returns
d0: maxbanks

◆ getdevname_c()

ULONG getdevname_c ( const ULONG * lens)
static

DeviceName$(volumename$): the name of the handler task of a device or volume, with ":" (AmiBlitz3's version).

A ":" at the end of the argument is cut; the result is written over the argument (a3 = its start, the length below a2), with a terminating 0. The name is taken from the string space (a3), not from d0 (the same string in compiled code). Fixed (#493): the ":" test only for an argument that is not empty; the original tested -2(a3) also for an empty one, a byte of the expression in front. Fixed (#494): "" for an entry without a handler task (or name); the original read through dol_Task without a check. Fixed (#1145): below dos.library V36 (no LockDosList) the device list of DosInfo is walked and the name copied under Forbid; the original called the V36 functions there, a crash on Kickstart 1.x.

Parameters
lensa2: the argument stack, the argument's length at -4(a2)
Returns
d0: the length of the name, 0 ("") if not found

◆ hunklongs()

ULONG hunklongs ( const struct hunkitem * h)
static

◆ keycode_c()

ULONG keycode_c ( void )
static

KeyCode: the raw keyboard byte of CIA-A SDR ($BFEC01).

Returns
d0: the byte (not decoded)

◆ length_c()

ULONG length_c ( LONG bank)
static

Length(bank): the length of a bank.

Fixed (#484): 0 for a negative number too; the original read before the table.

Parameters
bankd0: the bank
Returns
d0: its length, 0 if free or no bank (outside 0..maxbanks-1)

◆ libfinit_c()

void libfinit_c ( void )
static

finit: makes the directory the first ChangeDir replaced current again, unlocks ChangeDir's lock, frees every bank and the tables, closes dos.library.

If the current directory is not ChangeDir's lock (the program changed it itself), it stays. Fixed (#491): the original unlocked the lock while it was still the current directory and did not clear oldlock.

◆ libinit_c()

ULONG libinit_c ( void )
static

init: opens dos.library and allocates the bank tables.

One memlib globalloc block (MEMF_CLEAR) of 2 * maxbanks longs: the lengths, then the start addresses. The result is not checked (memlib raises "Out of Memory" itself).

Returns
d0: the start table

◆ lisa_c()

ULONG lisa_c ( ULONG result)
static

Lisa: the Lisa (Denise) chip version, DENISEID ($DFF07C).

Parameters
resultd0: the caller's d0 (its high word stays, MOVE.w)
Returns
d0.w: DENISEID

◆ makedir_c()

BB_BOOL makedir_c ( CONST_STRPTR name)
static

MakeDir(dirname$): creates a directory (dos CreateDir) and gives its lock back.

Fixed (#496): the lock CreateDir returns is unlocked; the original unlocked whatever CreateDir left in d1 (JSR _CreateDir : TST.l d0 : BEQ oops : JSR _UnLock; OS 3.2 leaves the lock in d1 as well).

Parameters
named0: dirname$
Returns
d0: -1 if created, 0 if not

◆ max_c()

LONG max_c ( LONG a,
LONG b )
static

Max(a,b): the larger of two signed longs.

Parameters
ad0: a
bd1: b
Returns
d0: the larger

◆ memfree_c()

ULONG memfree_c ( void )
static

MemFree: the free public memory (AvailMem(MEMF_PUBLIC)).

Returns
d0: the bytes

◆ min_c()

LONG min_c ( LONG a,
LONG b )
static

Min(a,b): the smaller of two signed longs.

Parameters
ad0: a
bd1: b
Returns
d0: the smaller

◆ newbank()

BB_BOOL newbank ( LONG bank,
ULONG len,
ULONG flags )
static

◆ nextbank0_c()

ULONG nextbank0_c ( void )
static

NextBank: the first free bank (from bank 0).

Fixed (#497): the original used findfreebank for this form too and started at whatever d0 held.

Returns
d0: the bank, -1 if none is free

◆ reboot_c()

void reboot_c ( void )
static

Reboot: a cold reboot (exec ColdReboot); does not return.

Fixed (#1145): below exec V36 (no ColdReboot) Commodore's reset routine for older Kickstarts; the original called ColdReboot there, a crash on Kickstart 1.x.

◆ rename_c()

ULONG rename_c ( CONST_STRPTR from,
CONST_STRPTR to )
static

Rename(oldfilename$,newfilename$): renames a file (dos Rename).

Parameters
fromd0: oldfilename$
tod1: newfilename$
Returns
d0: dos.library's result (DOSTRUE / 0)

◆ riamosfunclib_allocmem()

void riamosfunclib_allocmem ( void )

◆ riamosfunclib_finddev()

void riamosfunclib_finddev ( void )

◆ riamosfunclib_gttags()

void riamosfunclib_gttags ( void )

GTTagValue([tagvalue]): GadTools' tag base TAG_USER|$80000 (+ tagvalue in d0) - inline code, copied by the compiler.

_gttags: the form with an argument (ADDI.l to d0), _gttags2: without.

Result
d0: the tag

◆ riamosfunclib_libfinit()

void riamosfunclib_libfinit ( void )

◆ riamosfunclib_libinit()

void riamosfunclib_libinit ( void )

◆ riamosfunclib_oldreboot()

void riamosfunclib_oldreboot ( void )

◆ saveexec_c()

ULONG saveexec_c ( CONST_STRPTR name,
const UBYTE * list )
static

SaveExec filename$,list(): writes an executable from a Blitz list of NEWTYPE .hunk (code hunks with RELOC32).

Fixed (#501): 0 for a file that cannot be made, and for an empty list (tested before the file is created); the original returned the name's address, wrote an empty list's tail node as a hunk and left the file open for a first pointer 0. Fixed (#502): only the code hunks written are counted (table size, RELOC32 hunk numbers); the original counted the skipped items too. Fixed (#503): the header has last = n-1 and one size per hunk, every hunk its HUNK_END; a list without code items writes no file. The original wrote one size slot (the sum, last 0) and one HUNK_END behind all hunks.

Parameters
named0: filename$
listd1: the list array (its header in front of it)
Returns
d0: -1; 0 if list() is no list, empty or without code items, or the file cannot be made

◆ start_c()

ULONG start_c ( LONG bank)
static

Start(bank): the address of a bank.

Fixed (#484): 0 for a negative number too; the original read before the table.

Parameters
bankd0: the bank
Returns
d0: its address, 0 if free or no bank (outside 0..maxbanks-1)

◆ swapbank_c()

BB_BOOL swapbank_c ( LONG a,
LONG b )
static

SwapBank(sourcebank,destbank): exchanges two banks (address and length).

Both must have a length (a number that is no bank has none; fixed, #484: the original indexed before the tables for a negative one).

Parameters
ad0: sourcebank
bd1: destbank
Returns
d0: -1 if swapped, 0 if not

◆ timer_c()

ULONG timer_c ( void )
static

Timer: the CIA-A TOD counter (vertical blanks).

High, mid, low byte (the read of high latches it).

Returns
d0: the 24-bit count (a word function: its low word)

Variable Documentation

◆ dosbase_

struct DosLibrary* dosbase_
static

◆ dosname

const char dosname[] = "dos.library"
static

◆ fh

BPTR fh
static

◆ hunkbuff

ULONG hunkbuff[8]
static

◆ lenptr

ULONG* lenptr
static

◆ maxbanks

LONG maxbanks = 50
static

◆ oldlock

BPTR oldlock
static

◆ startdir

BPTR startdir
static

◆ startkept

BOOL startkept
static

◆ startptr

ULONG * startptr
static