ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
bank.c File Reference
#include "../../ugbc.h"

Go to the source code of this file.

Functions

Bankbank_define (Environment *_environment, char *_name, BankType _type, int _address, char *_filename)
 Implementation for BANK xxx AT [WITH yyy].

Variables

char DATATYPE_AS_STRING [][16]
char BANK_TYPE_AS_STRING [][16]
 Description of BANK TYPE, in readable format.

Function Documentation

◆ bank_define()

Bank * bank_define ( Environment * _environment,
char * _name,
BankType _type,
int _address,
char * _filename )

Implementation for BANK xxx AT [WITH yyy].

This method deals with populating the data structures for the definition of a "bank" of memory. The memory banks are defined and separate areas, identified by a name (optionally given) and a starting address and populated (optionally) with data coming from an external file. This definition occurs when the program presents a BANK instruction. Banks are characterized by a "type", which represents the nature of the data contained therein. The types surveyed are the following:

There can be only one definition of a bank with a specific name. Any duplicate definitions will be ignored.

Parameters
_environmentCurrent calling environment
_nameName of the bank (NULL if automatic)
_type
_address
_filename
Returns
Bank*

Definition at line 108 of file bank.c.

Variable Documentation

◆ BANK_TYPE_AS_STRING

char BANK_TYPE_AS_STRING[][16]
extern

Description of BANK TYPE, in readable format.

Definition at line 125 of file _infrastructure.c.

◆ DATATYPE_AS_STRING

char DATATYPE_AS_STRING[][16]
extern

This variable defines as an array of constant pointers. Each element of the array represents the "human" name of a ugBASIC's data type. The main reason is to map an IDto a readable string. If ugBASIC encounters an error, you don't want it to print "Error in type 2," but rather "Error in type FLOAT.". Note that it's vital that the order of strings in the array exactly reflects the order of the IDs in your enum. If you move an element to one, you must also move it to the other, otherwise the mapping will be staggered. Often, a final NULL or UNKNOWN string is added to handle error cases or to allow you to loop through the array without knowing its size beforehand.

Definition at line 133 of file _infrastructure.c.