Merge remote-tracking branch 'upstream/master' into pcenginetarget
This commit is contained in:
commit
d0a1dc73b8
18 changed files with 218 additions and 104 deletions
|
@ -3,10 +3,10 @@
|
|||
<article>
|
||||
<title>ca65 Users Guide
|
||||
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
||||
<date>2014-04-24
|
||||
<date>2015-08-01
|
||||
|
||||
<abstract>
|
||||
ca65 is a powerful macro assembler for the 6502, 65C02 and 65816 CPUs. It is
|
||||
ca65 is a powerful macro assembler for the 6502, 65C02, and 65816 CPUs. It is
|
||||
used as a companion assembler for the cc65 crosscompiler, but it may also be
|
||||
used as a standalone product.
|
||||
</abstract>
|
||||
|
@ -430,24 +430,21 @@ The assembler accepts
|
|||
|
||||
<sect1>65816 mode<p>
|
||||
|
||||
In 65816 mode several aliases are accepted in addition to the official
|
||||
In 65816 mode, several aliases are accepted, in addition to the official
|
||||
mnemonics:
|
||||
|
||||
<tscreen><verb>
|
||||
BGE is an alias for BCS
|
||||
BLT is an alias for BCC
|
||||
CPA is an alias for CMP
|
||||
DEA is an alias for DEC A
|
||||
INA is an alias for INC A
|
||||
SWA is an alias for XBA
|
||||
TAD is an alias for TCD
|
||||
TAS is an alias for TCS
|
||||
TDA is an alias for TDC
|
||||
TSA is an alias for TSC
|
||||
CPA is an alias for CMP
|
||||
DEA is an alias for DEC A
|
||||
INA is an alias for INC A
|
||||
SWA is an alias for XBA
|
||||
TAD is an alias for TCD
|
||||
TAS is an alias for TCS
|
||||
TDA is an alias for TDC
|
||||
TSA is an alias for TSC
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
||||
<sect1>6502X mode<label id="6502X-mode"><p>
|
||||
|
||||
6502X mode is an extension to the normal 6502 mode. In this mode, several
|
||||
|
@ -3330,8 +3327,8 @@ Here's a list of all control commands and a description, what they do:
|
|||
atari Defines the scrcode macro.
|
||||
cbm Defines the scrcode macro.
|
||||
cpu Defines constants for the .CPU variable.
|
||||
generic Defines generic macros like add and sub.
|
||||
longbranch Defines conditional long jump macros.
|
||||
generic Defines generic macroes like add, sub, and blt.
|
||||
longbranch Defines conditional long-jump macroes.
|
||||
</verb></tscreen>
|
||||
|
||||
Including a macro package twice, or including a macro package that
|
||||
|
@ -3670,7 +3667,7 @@ Here's a list of all control commands and a description, what they do:
|
|||
segment, that is, a named section of data. The default segment is
|
||||
"CODE". There may be up to 254 different segments per object file
|
||||
(and up to 65534 per executable). There are shortcut commands for
|
||||
the most common segments ("CODE", "DATA" and "BSS").
|
||||
the most common segments ("ZEROPAGE", "CODE", "RODATA", "DATA", and "BSS").
|
||||
|
||||
The command is followed by a string containing the segment name (there are
|
||||
some constraints for the name - as a rule of thumb use only those segment
|
||||
|
@ -3704,8 +3701,9 @@ Here's a list of all control commands and a description, what they do:
|
|||
</verb></tscreen>
|
||||
|
||||
See: <tt><ref id=".BSS" name=".BSS"></tt>, <tt><ref id=".CODE"
|
||||
name=".CODE"></tt>, <tt><ref id=".DATA" name=".DATA"></tt> and <tt><ref
|
||||
id=".RODATA" name=".RODATA"></tt>
|
||||
name=".CODE"></tt>, <tt><ref id=".DATA" name=".DATA"></tt>, <tt><ref
|
||||
id=".RODATA" name=".RODATA"></tt>, and <tt><ref id=".ZEROPAGE"
|
||||
name=".ZEROPAGE"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.SET</tt><label id=".SET"><p>
|
||||
|
@ -3866,7 +3864,7 @@ Here's a list of all control commands and a description, what they do:
|
|||
shortcut for
|
||||
|
||||
<tscreen><verb>
|
||||
.segment "ZEROPAGE", zeropage
|
||||
.segment "ZEROPAGE": zeropage
|
||||
</verb></tscreen>
|
||||
|
||||
Because of the "zeropage" attribute, labels declared in this segment are
|
||||
|
@ -4317,48 +4315,47 @@ are:
|
|||
|
||||
<sect1><tt>.MACPACK generic</tt><p>
|
||||
|
||||
This macro package defines macros that are useful in almost any program.
|
||||
Currently defined macros are:
|
||||
This macro package defines macroes that are useful in almost any program.
|
||||
Currently defined macroes are:
|
||||
|
||||
<tscreen><verb>
|
||||
.macro add Arg
|
||||
.macro add Arg ; add without carry
|
||||
clc
|
||||
adc Arg
|
||||
.endmacro
|
||||
|
||||
.macro sub Arg
|
||||
.macro sub Arg ; subtract without borrow
|
||||
sec
|
||||
sbc Arg
|
||||
.endmacro
|
||||
|
||||
.macro bge Arg
|
||||
.macro bge Arg ; branch on greater-than or equal
|
||||
bcs Arg
|
||||
.endmacro
|
||||
|
||||
.macro blt Arg
|
||||
.macro blt Arg ; branch on less-than
|
||||
bcc Arg
|
||||
.endmacro
|
||||
|
||||
.macro bgt Arg
|
||||
.macro bgt Arg ; branch on greater-than
|
||||
.local L
|
||||
beq L
|
||||
bcs Arg
|
||||
L:
|
||||
.endmacro
|
||||
|
||||
.macro ble Arg
|
||||
.macro ble Arg ; branch on less-than or equal
|
||||
beq Arg
|
||||
bcc Arg
|
||||
.endmacro
|
||||
|
||||
.macro bnz Arg
|
||||
.macro bnz Arg ; branch on not zero
|
||||
bne Arg
|
||||
.endmacro
|
||||
|
||||
.macro bze Arg
|
||||
.macro bze Arg ; branch on zero
|
||||
beq Arg
|
||||
.endmacro
|
||||
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<article>
|
||||
<title>cc65 function reference
|
||||
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
||||
<date>2014-05-26
|
||||
<date>2015-07-21
|
||||
|
||||
<abstract>
|
||||
cc65 is a C compiler for 6502 based systems. This function reference describes
|
||||
|
@ -840,6 +840,8 @@ the CBM systems are classified as being "regular" files, for example.
|
|||
<tag/Notes/<itemize>
|
||||
<item>The minimum blocksize that can be added is 6 bytes; the function will
|
||||
ignore smaller blocks.
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
|
@ -868,6 +870,8 @@ id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
|
|||
<tag/Notes/<itemize>
|
||||
<item>Passing a pointer to a block that was is not the result of one of the
|
||||
allocation functions, or that has been free'd will give unpredicable results.
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
|
@ -912,7 +916,7 @@ be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
|
|||
<descrip>
|
||||
<tag/Function/Return the total available space on the heap.
|
||||
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
||||
<tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
|
||||
<tag/Declaration/<tt/size_t _heapmemavail (void);/
|
||||
<tag/Description/The function returns the total number of bytes available on
|
||||
the heap.
|
||||
<tag/Notes/<itemize>
|
||||
|
@ -1323,6 +1327,10 @@ used in presence of a prototype.
|
|||
<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
|
||||
<tag/Description/<tt/atmos_load/ reads a memory block from tape.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="atmos_save" name="atmos_save">
|
||||
|
@ -1339,6 +1347,10 @@ used in presence of a prototype.
|
|||
<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
|
||||
<tag/Description/<tt/atmos_save/ writes a memory block to tape.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="atmos_load" name="atmos_load">
|
||||
|
@ -1460,7 +1472,7 @@ be used in presence of a prototype.
|
|||
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
||||
<tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
|
||||
const void* base, size_t n, size_t size,
|
||||
int (*cmp) (const void*, const void*));/
|
||||
int __fastcall__ (* cmp) (const void*, const void*));/
|
||||
<tag/Description/<tt/bsearch/ searches a sorted array for a member that
|
||||
matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
|
||||
<tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
|
||||
|
@ -1473,6 +1485,8 @@ the compare function given.
|
|||
return one of the members.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
|
||||
convention.
|
||||
</itemize>
|
||||
<tag/Availability/ISO 9899
|
||||
<tag/See also/
|
||||
|
@ -4132,6 +4146,8 @@ the <tt/<ref id="mod_load" name="mod_load">/ function.
|
|||
<tag/Notes/<itemize>
|
||||
<item>The pointer passed as parameter is the pointer to the module memory,
|
||||
not the pointer to the control structure.
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
|
@ -4147,7 +4163,7 @@ not the pointer to the control structure.
|
|||
<descrip>
|
||||
<tag/Function/Load a relocatable module.
|
||||
<tag/Header/<tt/<ref id="modload.h" name="modload.h">/
|
||||
<tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
|
||||
<tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
|
||||
<tag/Description/The function will load a code module into memory and relocate
|
||||
it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
|
||||
outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
|
||||
|
@ -4163,6 +4179,8 @@ the module just loaded. Possible error codes are:
|
|||
<tag/Notes/<itemize>
|
||||
<item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
|
||||
relocatable o65 modules for use with this function.
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
|
@ -4501,7 +4519,7 @@ from memory.
|
|||
<descrip>
|
||||
<tag/Function/Unload a mouse driver.
|
||||
<tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
|
||||
<tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
|
||||
<tag/Declaration/<tt/unsigned char mouse_unload (void);/
|
||||
<tag/Description/The function unloads a loaded mouse driver and frees all
|
||||
memory allocated for the driver.
|
||||
<tag/Notes/<itemize>
|
||||
|
@ -4726,7 +4744,7 @@ be used in presence of a prototype.
|
|||
<tag/Function/Sort an array.
|
||||
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
|
||||
size_t size, int (*compare) (const void*, const void*));/
|
||||
size_t size, int __fastcall__ (* compare) (const void*, const void*));/
|
||||
<tag/Description/<tt/qsort/ sorts an array according to a given compare
|
||||
function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
|
||||
is the number of elements, <tt/size/ the size of an element and <tt/compare/
|
||||
|
@ -4736,6 +4754,8 @@ the function used to compare the members.
|
|||
the function is undefined.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>The function to which <tt/compare/ points must have the <tt/fastcall/
|
||||
calling convention.
|
||||
</itemize>
|
||||
<tag/Availability/ISO 9899
|
||||
<tag/See also/
|
||||
|
@ -6919,6 +6939,8 @@ ratio for a loaded driver. The value is not reset by <ref id="tgi_init"
|
|||
name="tgi_init">, so if a driver is linked statically to an application,
|
||||
switching into and out of graphics mode will not restore the original aspect
|
||||
ratio.
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Oliver Schmidt, 2012-01-18
|
||||
; 2012-01-18, Oliver Schmidt
|
||||
; 2015-08-22, Greg King
|
||||
;
|
||||
; void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);
|
||||
; void reset_irq (void);
|
||||
|
@ -7,8 +8,7 @@
|
|||
|
||||
.export _set_irq, _reset_irq
|
||||
.interruptor clevel_irq, 1 ; Export as low priority IRQ handler
|
||||
.import popax
|
||||
.importzp __ZP_START__
|
||||
.import popax, __ZP_START__
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
|
@ -31,6 +31,8 @@ zpsave: .res zpsavespace
|
|||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
.proc _set_irq
|
||||
|
||||
; Keep clevel_irq from being called right now
|
||||
|
@ -77,7 +79,7 @@ zpsave: .res zpsavespace
|
|||
|
||||
; Save our zero page locations
|
||||
@L1: ldx #.sizeof(::zpsave)-1
|
||||
@L2: lda __ZP_START__,x
|
||||
@L2: lda <__ZP_START__,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl @L2
|
||||
|
@ -94,7 +96,7 @@ zpsave: .res zpsavespace
|
|||
; Copy back our zero page content
|
||||
ldx #.sizeof(::zpsave)-1
|
||||
@L3: ldy zpsave,x
|
||||
sty __ZP_START__,x
|
||||
sty <__ZP_START__,x
|
||||
dex
|
||||
bpl @L3
|
||||
|
||||
|
@ -103,4 +105,3 @@ zpsave: .res zpsavespace
|
|||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;
|
||||
; int vcprintf (const char* Format, va_list ap);
|
||||
; int __fastcall__ vcprintf (const char* Format, va_list ap);
|
||||
;
|
||||
; Ullrich von Bassewitz, 2.12.2000
|
||||
;
|
||||
|
@ -30,7 +30,7 @@ outdesc: ; Static outdesc structure
|
|||
; ----------------------------------------------------------------------------
|
||||
; Callback routine used for the actual output.
|
||||
;
|
||||
; static void out (struct outdesc* d, const char* buf, unsigned count)
|
||||
; static void __cdecl__ out (struct outdesc* d, const char* buf, unsigned count)
|
||||
; /* Routine used for writing */
|
||||
; {
|
||||
; /* Fast screen output */
|
||||
|
@ -94,7 +94,7 @@ out: jsr popax ; count
|
|||
; ----------------------------------------------------------------------------
|
||||
; vcprintf - formatted console i/o
|
||||
;
|
||||
; int vcprintf (const char* format, va_list ap)
|
||||
; int __fastcall__ vcprintf (const char* format, va_list ap)
|
||||
; {
|
||||
; struct outdesc d;
|
||||
;
|
||||
|
@ -107,10 +107,6 @@ out: jsr popax ; count
|
|||
; /* Return bytes written */
|
||||
; return d.ccount;
|
||||
; }
|
||||
;
|
||||
; It is intentional that this function does not have __fastcall__ calling
|
||||
; conventions - we need the space on the stack anyway, so there's nothing
|
||||
; gained by using __fastcall__.
|
||||
|
||||
_vcprintf:
|
||||
sta ptr1 ; Save ap
|
||||
|
@ -153,6 +149,3 @@ _vcprintf:
|
|||
lda outdesc ; ccount
|
||||
ldx outdesc+1
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ L1: jsr _cgetc
|
|||
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; static int unget(int c) {
|
||||
; static int cdecl unget(int c) {
|
||||
; pushed = true;
|
||||
; return back = c;
|
||||
; }
|
||||
|
@ -127,4 +127,3 @@ d: .addr get ; SCANFDATA::GET
|
|||
pla
|
||||
jmp __scanf
|
||||
.endproc
|
||||
|
||||
|
|
19
libsrc/nes/irq.s
Normal file
19
libsrc/nes/irq.s
Normal file
|
@ -0,0 +1,19 @@
|
|||
;
|
||||
; IRQ handling (NES version)
|
||||
;
|
||||
|
||||
.export initirq, doneirq
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
initirq:
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
doneirq:
|
||||
rts
|
|
@ -1418,11 +1418,14 @@ CharAgain:
|
|||
/* Line continuation? */
|
||||
if (LineCont) {
|
||||
NextChar ();
|
||||
/* Next char should be a LF, if not, will result in an error later */
|
||||
if (C == '\n') {
|
||||
/* Handle as white space */
|
||||
/* Ignore the '\n' */
|
||||
NextChar ();
|
||||
C = ' ';
|
||||
goto Again;
|
||||
} else {
|
||||
/* Make it clear what the problem is: */
|
||||
Error ("EOL expected.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -126,19 +126,19 @@ void DumpSymEntry (FILE* F, const SymEntry* E)
|
|||
/* Print the assembler name if we have one */
|
||||
if (E->AsmName) {
|
||||
fprintf (F, " AsmName: %s\n", E->AsmName);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print the flags */
|
||||
SymFlags = E->Flags;
|
||||
fprintf (F, " Flags: ");
|
||||
fprintf (F, " Flags:");
|
||||
for (I = 0; I < sizeof (Flags) / sizeof (Flags[0]) && SymFlags != 0; ++I) {
|
||||
if ((SymFlags & Flags[I].Val) == Flags[I].Val) {
|
||||
SymFlags &= ~Flags[I].Val;
|
||||
fprintf (F, "%s ", Flags[I].Name);
|
||||
fprintf (F, " %s", Flags[I].Name);
|
||||
}
|
||||
}
|
||||
if (SymFlags != 0) {
|
||||
fprintf (F, "%04X", SymFlags);
|
||||
fprintf (F, " 0x%05X", SymFlags);
|
||||
}
|
||||
fprintf (F, "\n");
|
||||
|
||||
|
|
|
@ -813,6 +813,25 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags)
|
|||
}
|
||||
}
|
||||
|
||||
/* If a static declaration follows a non-static declaration, then
|
||||
** warn about the conflict. (It will compile a public declaration.)
|
||||
*/
|
||||
if ((Flags & SC_EXTERN) == 0 && (Entry->Flags & SC_EXTERN) != 0) {
|
||||
Warning ("static declaration follows non-static declaration of `%s'.", Name);
|
||||
}
|
||||
|
||||
/* An extern declaration must not change the current linkage. */
|
||||
if (IsFunc || (Flags & (SC_EXTERN | SC_DEF)) == SC_EXTERN) {
|
||||
Flags &= ~SC_EXTERN;
|
||||
}
|
||||
|
||||
/* If a public declaration follows a static declaration, then
|
||||
** warn about the conflict. (It will compile a public declaration.)
|
||||
*/
|
||||
if ((Flags & SC_EXTERN) != 0 && (Entry->Flags & SC_EXTERN) == 0) {
|
||||
Warning ("public declaration follows static declaration of `%s'.", Name);
|
||||
}
|
||||
|
||||
/* Add the new flags */
|
||||
Entry->Flags |= Flags;
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
|
||||
|
||||
/* Mode argument for spawn. This value is ignored by the function and only
|
||||
* provided for DOS/Windows compatibility.
|
||||
*/
|
||||
** provided for DOS/Windows compatibility.
|
||||
*/
|
||||
#ifndef P_WAIT
|
||||
#define P_WAIT 0
|
||||
#endif
|
||||
|
@ -56,10 +56,10 @@ int spawnvp (int Mode attribute ((unused)),
|
|||
const char* File attribute ((unused)),
|
||||
char* const argv [])
|
||||
/* Execute the given program searching and wait til it terminates. The Mode
|
||||
* argument is ignored (compatibility only). The result of the function is
|
||||
* the return code of the program. The function will terminate the program
|
||||
* on errors.
|
||||
*/
|
||||
** argument is ignored (compatibility only). The result of the function is
|
||||
** the return code of the program. The function will terminate the program
|
||||
** on errors.
|
||||
*/
|
||||
{
|
||||
int Status;
|
||||
StrBuf Command = AUTO_STRBUF_INITIALIZER;
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
|
||||
|
||||
/* Mode argument for spawn. This value is ignored by the function and only
|
||||
* provided for DOS/Windows compatibility.
|
||||
*/
|
||||
** provided for DOS/Windows compatibility.
|
||||
*/
|
||||
#ifndef P_WAIT
|
||||
#define P_WAIT 0
|
||||
#endif
|
||||
|
@ -64,10 +64,10 @@
|
|||
|
||||
int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [])
|
||||
/* Execute the given program searching and wait til it terminates. The Mode
|
||||
* argument is ignored (compatibility only). The result of the function is
|
||||
* the return code of the program. The function will terminate the program
|
||||
* on errors.
|
||||
*/
|
||||
** argument is ignored (compatibility only). The result of the function is
|
||||
** the return code of the program. The function will terminate the program
|
||||
** on errors.
|
||||
*/
|
||||
{
|
||||
int Status = 0;
|
||||
|
||||
|
@ -99,7 +99,7 @@ int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [
|
|||
}
|
||||
|
||||
/* Only the father goes here, we place a return here regardless of that
|
||||
* to avoid compiler warnings.
|
||||
*/
|
||||
** to avoid compiler warnings.
|
||||
*/
|
||||
return WEXITSTATUS (Status);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ static void ExpandFile (CmdLine* L, const char* Name)
|
|||
|
||||
|
||||
|
||||
void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
||||
void InitCmdLine (int* aArgCount, char*** aArgVec, const char* aProgName)
|
||||
/* Initialize command line parsing. aArgVec is the argument array terminated by
|
||||
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||
** array. Both arguments are remembered in static storage.
|
||||
|
@ -171,7 +171,7 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
|||
int I;
|
||||
|
||||
/* Get the program name from argv[0] but strip a path */
|
||||
if (*(aArgVec)[0] == 0) {
|
||||
if ((*aArgVec)[0] == 0) {
|
||||
/* Use the default name given */
|
||||
ProgName = aProgName;
|
||||
} else {
|
||||
|
@ -190,7 +190,7 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
|||
** special handling for arguments preceeded by the '@' sign - these are
|
||||
** actually files containing arguments.
|
||||
*/
|
||||
for (I = 0; I < *aArgCount; ++I) {
|
||||
for (I = 0; I <= *aArgCount; ++I) {
|
||||
|
||||
/* Get the next argument */
|
||||
char* Arg = (*aArgVec)[I];
|
||||
|
@ -210,11 +210,11 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
|||
}
|
||||
|
||||
/* Store the new argument list in a safe place... */
|
||||
ArgCount = L.Count;
|
||||
ArgCount = L.Count - 1;
|
||||
ArgVec = L.Vec;
|
||||
|
||||
/* ...and pass back the changed data also */
|
||||
*aArgCount = L.Count;
|
||||
*aArgCount = L.Count - 1;
|
||||
*aArgVec = L.Vec;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ struct LongOpt {
|
|||
|
||||
|
||||
|
||||
void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName);
|
||||
void InitCmdLine (int* aArgCount, char*** aArgVec, const char* aProgName);
|
||||
/* Initialize command line parsing. aArgVec is the argument array terminated by
|
||||
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||
** array. Both arguments are remembered in static storage.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# makefile for the tests that MUST NOT compile
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
|
@ -13,36 +12,18 @@ else
|
|||
DEL = $(RM) $1
|
||||
endif
|
||||
|
||||
CC65FLAGS := -t sim6502
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
CC65 := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65)
|
||||
|
||||
WORKDIR := ../../testwrk
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg))
|
||||
TESTS := $(patsubst %.c,$(WORKDIR)/%.s,$(wildcard *.c))
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
$(WORKDIR)/%.prg: %.c
|
||||
$(NOT) $(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.o.prg: %.c
|
||||
$(NOT) $(CL65) -O $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.os.prg: %.c
|
||||
$(NOT) $(CL65) -Os $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.osi.prg: %.c
|
||||
$(NOT) $(CL65) -Osi $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.osir.prg: %.c
|
||||
$(NOT) $(CL65) -Osir $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.oi.prg: %.c
|
||||
$(NOT) $(CL65) -Oi $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.oir.prg: %.c
|
||||
$(NOT) $(CL65) -Oir $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.or.prg: %.c
|
||||
$(NOT) $(CL65) -Or $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.s: %.c
|
||||
$(NOT) $(CC65) -o $@ $<
|
||||
|
||||
clean:
|
||||
@$(call DEL,$(TESTS))
|
||||
@$(call DEL,$(SOURCES:.c=.o))
|
||||
|
|
20
test/err/static-2.c
Normal file
20
test/err/static-2.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
int n;
|
||||
static int n; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
20
test/err/static-3.c
Normal file
20
test/err/static-3.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
extern int n;
|
||||
static int n; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
20
test/err/static-4.c
Normal file
20
test/err/static-4.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
static int n;
|
||||
int n; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
20
test/val/static-1.c
Normal file
20
test/val/static-1.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
static int n = 0;
|
||||
extern int n; /* should not give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
Loading…
Add table
Reference in a new issue