========================================================================
MISCELLANEOUS CHANGES
-* There is a bug in LKMAIN: it tests S_DEF flag in "s_flag".
+* There is a bug in LKMAIN: it tests S_DEF flag in "s_flag".
No one else uses s_flag in the linker - S_DEF is defined in s_type
instead. Presumably LKMAIN should use s_type as well? Changed.
case insensitive, regardless of the CASE_SENSITIVE flag. This simplifies
using the assembler on existing code.
-* The scheme described below for debug information can make for very long
- symbol names. Thus, I have modified the assembler and linker to allow
- names up to 80 characters, moving the name strings out of the sym struct.
+* The scheme described below for debug information can make for very long
+ symbol names. Thus, I have modified the assembler and linker to allow
+ names up to 80 characters, moving the name strings out of the sym struct.
This will save significant heap space over simply increasing NCPS to 80.
* I have added one module, ASNOICE.C, to each assembler; and one module,
i51mch.c
i51adr.c
i51ext.c
- appexdk.txt "Appendix K" about the 8051 for the documentation
+ appendk.txt "Appendix K" about the 8051 for the documentation
I added four attributes to the .area directive to support
the 8051's multiple address spaces:
.area IDATA (DATA)
.area IBIT (BIT)
.area MYXDATA (REL,CON,XDATA)
- .area MYCODE (REL,CON,CODE)
+ .area MYCODE (REL,CON,CODE)
The default segment, _CODE, should not be used for the 8051. For
compatibility reasons, _CODE is allocated in "DATA" space. You
* as an 'r' error by the assembler,
* but it is processed here anyway.
This is no longer true, so the code in question is #defined out
-in the linker only. I suspect that thie would cause problems
+in the linker only. I suspect that this would cause problems
if a module with R_WORD | R_BYT1 by other cause were to be processed.
I am not entirely happy with outr11 in the case where the destination
is an absolute value. The ideal would be to pass the value thru to the
linker, and resolve at link time whether or not the address is within
2K of the instruction location. Unfortunately, I couldn't figure out
-how to pass an absolute value to the linker, as it has no area. Thus,
-I interpreted absolute values as being relative to the beginning of the
+how to pass an absolute value to the linker, as it has no area. Thus,
+I interpreted absolute values as being relative to the beginning of the
current area, as is done in the other assemblers for relative branch
instructions. I am less happy with this solution here, as a 2K range
is far larger than the +-128 for a branch instruction. I can envision
file. You may also wish to use the "-a" switch to make all symbols
global. Non-global symbols are not passed to the object file.
-2) The assemblers will pass any line beginning with the characters
+2) The assemblers will pass any line beginning with the characters
";!" (semi-colon, exclamation point) intact to the object file.
You can use such comments in your assembly modules to embed NoICE
commands in your source code.
";!" comments will be included. Specifying the -j switch will force
a map file to be produced as well.
-4) The linker will process any line beginning with the characters
+4) The linker will process any line beginning with the characters
";!" (semi-colon, exclamation point) by removing the ";!" and
passing the remainder of the line to the .NOI file (if any).
This allows NoICE commands to be placed as ";!" comments in
switches), a LOAD command for the hex file will be placed in the
.NOI file (if any).
-6) The linker will output the ";!" lines after all symbols have been
- output. Thus, such lines can contain NoICE commands which refer to
+6) The linker will output the ";!" lines after all symbols have been
+ output. Thus, such lines can contain NoICE commands which refer to
symbols by name.
========================================================================
described below. if your project contains a mixture of C and assembly
source files, you may wish to use "-j" on the assembly modules.
-2) The assemblers will pass any line beginning with the characters
+2) The assemblers will pass any line beginning with the characters
";!" (semi-colon, exclamation point) intact to the .REL file.
The compiler can make use of this fact to pass datatype information
and stack offsets for automatic symbols through the assembler and
will be as described below. Specifying the -j switch will force
a map file to be produced as well.
-4) The linker will process any line beginning with the characters
+4) The linker will process any line beginning with the characters
";!" (semi-colon, exclamation point) by removing the ";!" and
passing the remainder of the line to the .NOI file (if any).
text.integer
into NoICE FILE and LINE (line number) commands in the .NOI output file.
- It will assume that "text" is the file name without path or extension,
+ It will assume that "text" is the file name without path or extension,
that "integer" is the decimal line number within the file, and that
- the value of the symbol is equal to the address of the first instruction
+ the value of the symbol is equal to the address of the first instruction
produced by the line.
8) The linker will process symbols with names of the form
text.name
- into NoICE FILE and DEFINESCOPED commands in the .NOI file
+ into NoICE FILE and DEFINESCOPED commands in the .NOI file
(if any), to define file-scope variables:
FILE text
DEFS name symbolvalue
9) The linker will process symbols with names of the form
text.name.name2
- into NoICE FILE, FUNCTION, and DEFINESCOPED commands in the
+ into NoICE FILE, FUNCTION, and DEFINESCOPED commands in the
.NOI file (if any), to define function-scope variables:
FILE text
FUNC name
10) The linker will process symbols with names of the form
text.name.name2.integer
- into NoICE FILE, FUNCTION, and DEFINESCOPED commands in the
+ into NoICE FILE, FUNCTION, and DEFINESCOPED commands in the
.NOI file (if any), to define function-scope variables, to allow
multiple scopes within a single C function. "Integer" is a scope
number, and should be zero for the first scope, and increment
11) The linker will process symbols with names of the form
text.name..FN
- into NoICE FILE, DEFINE, and FUNCTION commands in the .NOI
+ into NoICE FILE, DEFINE, and FUNCTION commands in the .NOI
file (if any), to define the start of a global function:
FILE text
DEF name symbolvalue %code
12) The linker will process symbols with names of the form
text.name..SFN
- into NoICE FILE, DEFINESCOPED, and SFUNCTION commands in the .NOI
+ into NoICE FILE, DEFINESCOPED, and SFUNCTION commands in the .NOI
file (if any), to define the start of a file-scope (static)
function:
FILE text
compiling it illustrate this. The comments in the file describe
the information, but would not be present in an actual implementation.
-1) Begin each file with a ";!FILE" specifying the file name and its
- original extension (usually ".c"), and with the path if the file is
+1) Begin each file with a ";!FILE" specifying the file name and its
+ original extension (usually ".c"), and with the path if the file is
not in the current directory.
;!FILE ctest1.c
-2) Define any basic data types: char defaults to S08. Redefine as U08 or
+2) Define any basic data types: char defaults to S08. Redefine as U08 or
ASCII if you desire. "int" defaults to S16. Redefine if necessary.
;!DEFT 0 char %ASCII
-3) Define any data structures, typedefs, enums, etc. (C generally
- does this per source file. Types will remain in scope unless
+3) Define any data structures, typedefs, enums, etc. (C generally
+ does this per source file. Types will remain in scope unless
redefined). For example, the C structure
typedef struct {
;!DEFT 23. pi %*int
;!ENDS 25.
- Since the user can change input radix at will, it is generally
+ Since the user can change input radix at will, it is generally
recommended to specify radix explicitly in the ;! commands: by
a trailing "." for decimal, or leading "0x" for hex.
-4) Use ;!FUNC, (or ;!SFUNC), ;!DEFS, and ;!ENDF to define any
+4) Use ;!FUNC, (or ;!SFUNC), ;!DEFS, and ;!ENDF to define any
function arguments and local variables. The function
void main( void )
{
5) In general, it is desirable to generate two symbols for each
function: one with an underbar, at the first byte of the
- function, so that the disassembler will show it as the destination
+ function, so that the disassembler will show it as the destination
of the JSR; and a second without an underbar at the address of
the first source line after stack frame is set up. The latter
will be a common breakpoint location.
CUG292 can generate global symbols by using a "::"
- _main::
+ _main::
tsx
xgdx
subd #44
ldd #6
std _gestr
-8) Declare the end of the function body. The value of this symbol
- is the highest address which NoICE will consider to be within the
- function for scoping purposes. The address must be on or before
+8) Declare the end of the function body. The value of this symbol
+ is the highest address which NoICE will consider to be within the
+ function for scoping purposes. The address must be on or before
the RTS, so that it does not overlap the following function.
- Normally, the address will be the last C source line in the
+ Normally, the address will be the last C source line in the
function before stack frame is destroyed.
- ctest1.main..EFN::
+ ctest1.main..EFN::
xgdx
addd #44
xgdx
rts
9) Global variables defined in the file, and their datatypes, may be
- defined at any time. Debugging is most convenient if the
+ defined at any time. Debugging is most convenient if the
traditional C leading underbar is omitted. The global declarations
int gi;
STR *pgstr;
the assembler, while the "::" defintion defines the value, which
is unknown until link time.
-10) File-scope static variables, and their datatypes, must be defined
+10) File-scope static variables, and their datatypes, must be defined
between the ;!FILE and the ;!ENDFILE in order to set proper scope.
- Debugging is most convenient if the traditional C leading underbar
+ Debugging is most convenient if the traditional C leading underbar
is omitted. The static declarations
static int si;
static STR sstr;
the "::" definitions may be elsewhere in the file if it is
convenient, as the symbol name carries the scoping information.
-11) Function-scope static variables, and their datatypes, must be
+11) Function-scope static variables, and their datatypes, must be
defined between the ;!FUNC (or ;!SFUNC) and the corresponding
- ;!ENDF in order to set proper scope. Debugging is most convenient
- if the traditional C leading underbar is omitted. The static
+ ;!ENDF in order to set proper scope. Debugging is most convenient
+ if the traditional C leading underbar is omitted. The static
declarations
void main( void )
{
;!ENDFILE
CTEST1.C - sample C source code
- CTEST1.S - output from ImageCraft compiler, hand-doctored
+ CTEST1.S - output from ImageCraft compiler, hand-doctored
to add additional debug information
CTEST2.C - second C module
CTEST2.S - output from ImageCraft compiler, undoctored