Merge remote-tracking branch 'upstream/master' into pcenginetarget
This commit is contained in:
@@ -3,10 +3,10 @@
|
|||||||
<article>
|
<article>
|
||||||
<title>ca65 Users Guide
|
<title>ca65 Users Guide
|
||||||
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
||||||
<date>2014-04-24
|
<date>2015-08-01
|
||||||
|
|
||||||
<abstract>
|
<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 companion assembler for the cc65 crosscompiler, but it may also be
|
||||||
used as a standalone product.
|
used as a standalone product.
|
||||||
</abstract>
|
</abstract>
|
||||||
@@ -430,12 +430,10 @@ The assembler accepts
|
|||||||
|
|
||||||
<sect1>65816 mode<p>
|
<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:
|
mnemonics:
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
BGE is an alias for BCS
|
|
||||||
BLT is an alias for BCC
|
|
||||||
CPA is an alias for CMP
|
CPA is an alias for CMP
|
||||||
DEA is an alias for DEC A
|
DEA is an alias for DEC A
|
||||||
INA is an alias for INC A
|
INA is an alias for INC A
|
||||||
@@ -447,7 +445,6 @@ mnemonics:
|
|||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sect1>6502X mode<label id="6502X-mode"><p>
|
<sect1>6502X mode<label id="6502X-mode"><p>
|
||||||
|
|
||||||
6502X mode is an extension to the normal 6502 mode. In this mode, several
|
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.
|
atari Defines the scrcode macro.
|
||||||
cbm Defines the scrcode macro.
|
cbm Defines the scrcode macro.
|
||||||
cpu Defines constants for the .CPU variable.
|
cpu Defines constants for the .CPU variable.
|
||||||
generic Defines generic macros like add and sub.
|
generic Defines generic macroes like add, sub, and blt.
|
||||||
longbranch Defines conditional long jump macros.
|
longbranch Defines conditional long-jump macroes.
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
Including a macro package twice, or including a macro package that
|
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
|
segment, that is, a named section of data. The default segment is
|
||||||
"CODE". There may be up to 254 different segments per object file
|
"CODE". There may be up to 254 different segments per object file
|
||||||
(and up to 65534 per executable). There are shortcut commands for
|
(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
|
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
|
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>
|
</verb></tscreen>
|
||||||
|
|
||||||
See: <tt><ref id=".BSS" name=".BSS"></tt>, <tt><ref id=".CODE"
|
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
|
name=".CODE"></tt>, <tt><ref id=".DATA" name=".DATA"></tt>, <tt><ref
|
||||||
id=".RODATA" name=".RODATA"></tt>
|
id=".RODATA" name=".RODATA"></tt>, and <tt><ref id=".ZEROPAGE"
|
||||||
|
name=".ZEROPAGE"></tt>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>.SET</tt><label id=".SET"><p>
|
<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
|
shortcut for
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
.segment "ZEROPAGE", zeropage
|
.segment "ZEROPAGE": zeropage
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
Because of the "zeropage" attribute, labels declared in this segment are
|
Because of the "zeropage" attribute, labels declared in this segment are
|
||||||
@@ -4317,48 +4315,47 @@ are:
|
|||||||
|
|
||||||
<sect1><tt>.MACPACK generic</tt><p>
|
<sect1><tt>.MACPACK generic</tt><p>
|
||||||
|
|
||||||
This macro package defines macros that are useful in almost any program.
|
This macro package defines macroes that are useful in almost any program.
|
||||||
Currently defined macros are:
|
Currently defined macroes are:
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
.macro add Arg
|
.macro add Arg ; add without carry
|
||||||
clc
|
clc
|
||||||
adc Arg
|
adc Arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro sub Arg
|
.macro sub Arg ; subtract without borrow
|
||||||
sec
|
sec
|
||||||
sbc Arg
|
sbc Arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro bge Arg
|
.macro bge Arg ; branch on greater-than or equal
|
||||||
bcs Arg
|
bcs Arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro blt Arg
|
.macro blt Arg ; branch on less-than
|
||||||
bcc Arg
|
bcc Arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro bgt Arg
|
.macro bgt Arg ; branch on greater-than
|
||||||
.local L
|
.local L
|
||||||
beq L
|
beq L
|
||||||
bcs Arg
|
bcs Arg
|
||||||
L:
|
L:
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro ble Arg
|
.macro ble Arg ; branch on less-than or equal
|
||||||
beq Arg
|
beq Arg
|
||||||
bcc Arg
|
bcc Arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro bnz Arg
|
.macro bnz Arg ; branch on not zero
|
||||||
bne Arg
|
bne Arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro bze Arg
|
.macro bze Arg ; branch on zero
|
||||||
beq Arg
|
beq Arg
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<article>
|
<article>
|
||||||
<title>cc65 function reference
|
<title>cc65 function reference
|
||||||
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
||||||
<date>2014-05-26
|
<date>2015-07-21
|
||||||
|
|
||||||
<abstract>
|
<abstract>
|
||||||
cc65 is a C compiler for 6502 based systems. This function reference describes
|
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>
|
<tag/Notes/<itemize>
|
||||||
<item>The minimum blocksize that can be added is 6 bytes; the function will
|
<item>The minimum blocksize that can be added is 6 bytes; the function will
|
||||||
ignore smaller blocks.
|
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>
|
</itemize>
|
||||||
<tag/Availability/cc65
|
<tag/Availability/cc65
|
||||||
<tag/See also/
|
<tag/See also/
|
||||||
@@ -868,6 +870,8 @@ id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
|
|||||||
<tag/Notes/<itemize>
|
<tag/Notes/<itemize>
|
||||||
<item>Passing a pointer to a block that was is not the result of one of the
|
<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.
|
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>
|
</itemize>
|
||||||
<tag/Availability/cc65
|
<tag/Availability/cc65
|
||||||
<tag/See also/
|
<tag/See also/
|
||||||
@@ -912,7 +916,7 @@ be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
|
|||||||
<descrip>
|
<descrip>
|
||||||
<tag/Function/Return the total available space on the heap.
|
<tag/Function/Return the total available space on the heap.
|
||||||
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
<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
|
<tag/Description/The function returns the total number of bytes available on
|
||||||
the heap.
|
the heap.
|
||||||
<tag/Notes/<itemize>
|
<tag/Notes/<itemize>
|
||||||
@@ -1323,6 +1327,10 @@ used in presence of a prototype.
|
|||||||
<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
|
<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
|
||||||
<tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
|
<tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
|
||||||
<tag/Description/<tt/atmos_load/ reads a memory block from tape.
|
<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/Availability/cc65
|
||||||
<tag/See also/
|
<tag/See also/
|
||||||
<ref id="atmos_save" name="atmos_save">
|
<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/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/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/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/Availability/cc65
|
||||||
<tag/See also/
|
<tag/See also/
|
||||||
<ref id="atmos_load" name="atmos_load">
|
<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/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
||||||
<tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
|
<tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
|
||||||
const void* base, size_t n, size_t size,
|
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
|
<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,
|
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/
|
<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.
|
return one of the members.
|
||||||
<item>The function is only available as fastcall function, so it may only
|
<item>The function is only available as fastcall function, so it may only
|
||||||
be used in presence of a prototype.
|
be used in presence of a prototype.
|
||||||
|
<item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
|
||||||
|
convention.
|
||||||
</itemize>
|
</itemize>
|
||||||
<tag/Availability/ISO 9899
|
<tag/Availability/ISO 9899
|
||||||
<tag/See also/
|
<tag/See also/
|
||||||
@@ -4132,6 +4146,8 @@ the <tt/<ref id="mod_load" name="mod_load">/ function.
|
|||||||
<tag/Notes/<itemize>
|
<tag/Notes/<itemize>
|
||||||
<item>The pointer passed as parameter is the pointer to the module memory,
|
<item>The pointer passed as parameter is the pointer to the module memory,
|
||||||
not the pointer to the control structure.
|
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>
|
</itemize>
|
||||||
<tag/Availability/cc65
|
<tag/Availability/cc65
|
||||||
<tag/See also/
|
<tag/See also/
|
||||||
@@ -4147,7 +4163,7 @@ not the pointer to the control structure.
|
|||||||
<descrip>
|
<descrip>
|
||||||
<tag/Function/Load a relocatable module.
|
<tag/Function/Load a relocatable module.
|
||||||
<tag/Header/<tt/<ref id="modload.h" name="modload.h">/
|
<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
|
<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
|
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
|
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>
|
<tag/Notes/<itemize>
|
||||||
<item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
|
<item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
|
||||||
relocatable o65 modules for use with this function.
|
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>
|
</itemize>
|
||||||
<tag/Availability/cc65
|
<tag/Availability/cc65
|
||||||
<tag/See also/
|
<tag/See also/
|
||||||
@@ -4501,7 +4519,7 @@ from memory.
|
|||||||
<descrip>
|
<descrip>
|
||||||
<tag/Function/Unload a mouse driver.
|
<tag/Function/Unload a mouse driver.
|
||||||
<tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
|
<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
|
<tag/Description/The function unloads a loaded mouse driver and frees all
|
||||||
memory allocated for the driver.
|
memory allocated for the driver.
|
||||||
<tag/Notes/<itemize>
|
<tag/Notes/<itemize>
|
||||||
@@ -4726,7 +4744,7 @@ be used in presence of a prototype.
|
|||||||
<tag/Function/Sort an array.
|
<tag/Function/Sort an array.
|
||||||
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
||||||
<tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
|
<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
|
<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/
|
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/
|
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.
|
the function is undefined.
|
||||||
<item>The function is only available as fastcall function, so it may only
|
<item>The function is only available as fastcall function, so it may only
|
||||||
be used in presence of a prototype.
|
be used in presence of a prototype.
|
||||||
|
<item>The function to which <tt/compare/ points must have the <tt/fastcall/
|
||||||
|
calling convention.
|
||||||
</itemize>
|
</itemize>
|
||||||
<tag/Availability/ISO 9899
|
<tag/Availability/ISO 9899
|
||||||
<tag/See also/
|
<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,
|
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
|
switching into and out of graphics mode will not restore the original aspect
|
||||||
ratio.
|
ratio.
|
||||||
|
<item>The function is available only as a fastcall function; so, it may be used
|
||||||
|
only in the presence of a prototype.
|
||||||
</itemize>
|
</itemize>
|
||||||
<tag/Availability/cc65
|
<tag/Availability/cc65
|
||||||
<tag/See also/
|
<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 __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);
|
||||||
; void reset_irq (void);
|
; void reset_irq (void);
|
||||||
@@ -7,8 +8,7 @@
|
|||||||
|
|
||||||
.export _set_irq, _reset_irq
|
.export _set_irq, _reset_irq
|
||||||
.interruptor clevel_irq, 1 ; Export as low priority IRQ handler
|
.interruptor clevel_irq, 1 ; Export as low priority IRQ handler
|
||||||
.import popax
|
.import popax, __ZP_START__
|
||||||
.importzp __ZP_START__
|
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
|
||||||
@@ -31,6 +31,8 @@ zpsave: .res zpsavespace
|
|||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
.proc _set_irq
|
.proc _set_irq
|
||||||
|
|
||||||
; Keep clevel_irq from being called right now
|
; Keep clevel_irq from being called right now
|
||||||
@@ -77,7 +79,7 @@ zpsave: .res zpsavespace
|
|||||||
|
|
||||||
; Save our zero page locations
|
; Save our zero page locations
|
||||||
@L1: ldx #.sizeof(::zpsave)-1
|
@L1: ldx #.sizeof(::zpsave)-1
|
||||||
@L2: lda __ZP_START__,x
|
@L2: lda <__ZP_START__,x
|
||||||
sta zpsave,x
|
sta zpsave,x
|
||||||
dex
|
dex
|
||||||
bpl @L2
|
bpl @L2
|
||||||
@@ -94,7 +96,7 @@ zpsave: .res zpsavespace
|
|||||||
; Copy back our zero page content
|
; Copy back our zero page content
|
||||||
ldx #.sizeof(::zpsave)-1
|
ldx #.sizeof(::zpsave)-1
|
||||||
@L3: ldy zpsave,x
|
@L3: ldy zpsave,x
|
||||||
sty __ZP_START__,x
|
sty <__ZP_START__,x
|
||||||
dex
|
dex
|
||||||
bpl @L3
|
bpl @L3
|
||||||
|
|
||||||
@@ -103,4 +105,3 @@ zpsave: .res zpsavespace
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.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
|
; Ullrich von Bassewitz, 2.12.2000
|
||||||
;
|
;
|
||||||
@@ -30,7 +30,7 @@ outdesc: ; Static outdesc structure
|
|||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Callback routine used for the actual output.
|
; 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 */
|
; /* Routine used for writing */
|
||||||
; {
|
; {
|
||||||
; /* Fast screen output */
|
; /* Fast screen output */
|
||||||
@@ -94,7 +94,7 @@ out: jsr popax ; count
|
|||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; vcprintf - formatted console i/o
|
; 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;
|
; struct outdesc d;
|
||||||
;
|
;
|
||||||
@@ -107,10 +107,6 @@ out: jsr popax ; count
|
|||||||
; /* Return bytes written */
|
; /* Return bytes written */
|
||||||
; return d.ccount;
|
; 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:
|
_vcprintf:
|
||||||
sta ptr1 ; Save ap
|
sta ptr1 ; Save ap
|
||||||
@@ -153,6 +149,3 @@ _vcprintf:
|
|||||||
lda outdesc ; ccount
|
lda outdesc ; ccount
|
||||||
ldx outdesc+1
|
ldx outdesc+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ L1: jsr _cgetc
|
|||||||
|
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; static int unget(int c) {
|
; static int cdecl unget(int c) {
|
||||||
; pushed = true;
|
; pushed = true;
|
||||||
; return back = c;
|
; return back = c;
|
||||||
; }
|
; }
|
||||||
@@ -127,4 +127,3 @@ d: .addr get ; SCANFDATA::GET
|
|||||||
pla
|
pla
|
||||||
jmp __scanf
|
jmp __scanf
|
||||||
.endproc
|
.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? */
|
/* Line continuation? */
|
||||||
if (LineCont) {
|
if (LineCont) {
|
||||||
NextChar ();
|
NextChar ();
|
||||||
|
/* Next char should be a LF, if not, will result in an error later */
|
||||||
if (C == '\n') {
|
if (C == '\n') {
|
||||||
/* Handle as white space */
|
/* Ignore the '\n' */
|
||||||
NextChar ();
|
NextChar ();
|
||||||
C = ' ';
|
|
||||||
goto Again;
|
goto Again;
|
||||||
|
} else {
|
||||||
|
/* Make it clear what the problem is: */
|
||||||
|
Error ("EOL expected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void DumpSymEntry (FILE* F, const SymEntry* E)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SymFlags != 0) {
|
if (SymFlags != 0) {
|
||||||
fprintf (F, "%04X", SymFlags);
|
fprintf (F, " 0x%05X", SymFlags);
|
||||||
}
|
}
|
||||||
fprintf (F, "\n");
|
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 */
|
/* Add the new flags */
|
||||||
Entry->Flags |= Flags;
|
Entry->Flags |= Flags;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Mode argument for spawn. This value is ignored by the function and only
|
/* 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
|
#ifndef P_WAIT
|
||||||
#define P_WAIT 0
|
#define P_WAIT 0
|
||||||
@@ -56,9 +56,9 @@ int spawnvp (int Mode attribute ((unused)),
|
|||||||
const char* File attribute ((unused)),
|
const char* File attribute ((unused)),
|
||||||
char* const argv [])
|
char* const argv [])
|
||||||
/* Execute the given program searching and wait til it terminates. The Mode
|
/* Execute the given program searching and wait til it terminates. The Mode
|
||||||
* argument is ignored (compatibility only). The result of the function is
|
** argument is ignored (compatibility only). The result of the function is
|
||||||
* the return code of the program. The function will terminate the program
|
** the return code of the program. The function will terminate the program
|
||||||
* on errors.
|
** on errors.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int Status;
|
int Status;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Mode argument for spawn. This value is ignored by the function and only
|
/* 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
|
#ifndef P_WAIT
|
||||||
#define P_WAIT 0
|
#define P_WAIT 0
|
||||||
@@ -64,9 +64,9 @@
|
|||||||
|
|
||||||
int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [])
|
int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [])
|
||||||
/* Execute the given program searching and wait til it terminates. The Mode
|
/* Execute the given program searching and wait til it terminates. The Mode
|
||||||
* argument is ignored (compatibility only). The result of the function is
|
** argument is ignored (compatibility only). The result of the function is
|
||||||
* the return code of the program. The function will terminate the program
|
** the return code of the program. The function will terminate the program
|
||||||
* on errors.
|
** on errors.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int Status = 0;
|
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
|
/* Only the father goes here, we place a return here regardless of that
|
||||||
* to avoid compiler warnings.
|
** to avoid compiler warnings.
|
||||||
*/
|
*/
|
||||||
return WEXITSTATUS (Status);
|
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
|
/* 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
|
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||||
** array. Both arguments are remembered in static storage.
|
** array. Both arguments are remembered in static storage.
|
||||||
@@ -171,7 +171,7 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
|||||||
int I;
|
int I;
|
||||||
|
|
||||||
/* Get the program name from argv[0] but strip a path */
|
/* Get the program name from argv[0] but strip a path */
|
||||||
if (*(aArgVec)[0] == 0) {
|
if ((*aArgVec)[0] == 0) {
|
||||||
/* Use the default name given */
|
/* Use the default name given */
|
||||||
ProgName = aProgName;
|
ProgName = aProgName;
|
||||||
} else {
|
} else {
|
||||||
@@ -190,7 +190,7 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
|
|||||||
** special handling for arguments preceeded by the '@' sign - these are
|
** special handling for arguments preceeded by the '@' sign - these are
|
||||||
** actually files containing arguments.
|
** actually files containing arguments.
|
||||||
*/
|
*/
|
||||||
for (I = 0; I < *aArgCount; ++I) {
|
for (I = 0; I <= *aArgCount; ++I) {
|
||||||
|
|
||||||
/* Get the next argument */
|
/* Get the next argument */
|
||||||
char* Arg = (*aArgVec)[I];
|
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... */
|
/* Store the new argument list in a safe place... */
|
||||||
ArgCount = L.Count;
|
ArgCount = L.Count - 1;
|
||||||
ArgVec = L.Vec;
|
ArgVec = L.Vec;
|
||||||
|
|
||||||
/* ...and pass back the changed data also */
|
/* ...and pass back the changed data also */
|
||||||
*aArgCount = L.Count;
|
*aArgCount = L.Count - 1;
|
||||||
*aArgVec = L.Vec;
|
*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
|
/* 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
|
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
|
||||||
** array. Both arguments are remembered in static storage.
|
** array. Both arguments are remembered in static storage.
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# makefile for the tests that MUST NOT compile
|
# makefile for the tests that MUST NOT compile
|
||||||
|
|
||||||
ifneq ($(shell echo),)
|
ifneq ($(shell echo),)
|
||||||
@@ -13,36 +12,18 @@ else
|
|||||||
DEL = $(RM) $1
|
DEL = $(RM) $1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC65FLAGS := -t sim6502
|
CC65 := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65)
|
||||||
|
|
||||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
|
||||||
|
|
||||||
WORKDIR := ../../testwrk
|
WORKDIR := ../../testwrk
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
SOURCES := $(wildcard *.c)
|
TESTS := $(patsubst %.c,$(WORKDIR)/%.s,$(wildcard *.c))
|
||||||
TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg))
|
|
||||||
|
|
||||||
all: $(TESTS)
|
all: $(TESTS)
|
||||||
|
|
||||||
$(WORKDIR)/%.prg: %.c
|
$(WORKDIR)/%.s: %.c
|
||||||
$(NOT) $(CL65) $(CC65FLAGS) $< -o $@
|
$(NOT) $(CC65) -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 $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(call DEL,$(TESTS))
|
@$(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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user