mirror of
https://github.com/cc65/cc65.git
synced 2024-06-18 07:29:36 +00:00
Merge branch 'master' into fptest
This commit is contained in:
commit
c92a8f863a
|
@ -134,7 +134,22 @@ You can refer to Annex B of the ISO C99 standard ([here](https://www.open-std.or
|
|||
* Hexadecimal number constants should be used except where decimal or binary numbers make much more sense in that constant's context.
|
||||
* Hexadecimal letters should be upper-case.
|
||||
* When you set two registers or two memory locations to an immediate 16-bit zero, you should use the expressions ```#<$0000``` and ```#>$0000``` (they make it obvious where you are putting the lower and upper bytes).
|
||||
* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.)
|
||||
* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.) This must be done in one of the following ways:
|
||||
<pre>
|
||||
lda #RETURN_VALUE
|
||||
ldx #0 ; return value is char
|
||||
</pre>
|
||||
or, if the value is 0, you can use:
|
||||
<pre>
|
||||
lda #RETURN_VALUE
|
||||
.assert RETURN_VALUE = 0
|
||||
tax
|
||||
</pre>
|
||||
sometimes jumping to return0 could save a byte:
|
||||
<pre>
|
||||
.assert RETURN_VALUE = 0
|
||||
jmp return 0
|
||||
</pre>
|
||||
* Functions, that are intended for a platform's system library, should be optimized as much as possible.
|
||||
* Sometimes, there must be a trade-off between size and speed. If you think that a library function won't be used often, then you should make it small. Otherwise, you should make it fast.
|
||||
* Comments that are put on the right side of instructions must be aligned (start in the same character columns).
|
||||
|
|
103
doc/ca65.sgml
103
doc/ca65.sgml
|
@ -125,6 +125,7 @@ Long options:
|
|||
--target sys Set the target system
|
||||
--verbose Increase verbosity
|
||||
--version Print the assembler version
|
||||
--warnings-as-errors Treat warnings as errors
|
||||
---------------------------------------------------------------------------
|
||||
</verb></tscreen>
|
||||
|
||||
|
@ -183,7 +184,7 @@ Here is a description of all the command line options:
|
|||
|
||||
Enable an emulation feature. This is identical as using <tt/.FEATURE/
|
||||
in the source with two exceptions: Feature names must be lower case, and
|
||||
each feature must be specified by using an extra <tt/--feature/ option,
|
||||
each feature must be specified by using a separate <tt/--feature/ option,
|
||||
comma separated lists are not allowed.
|
||||
|
||||
See the discussion of the <tt><ref id=".FEATURE" name=".FEATURE"></tt>
|
||||
|
@ -359,6 +360,13 @@ Here is a description of all the command line options:
|
|||
warning level is 1, and it would probably be silly to set it to
|
||||
something lower.
|
||||
|
||||
|
||||
<label id="option--warnings-as-errors">
|
||||
<tag><tt>--warnings-as-errors</tt></tag>
|
||||
|
||||
An error will be generated if any warnings were produced.
|
||||
|
||||
|
||||
</descrip>
|
||||
<p>
|
||||
|
||||
|
@ -431,6 +439,15 @@ The assembler accepts
|
|||
<tt><ref id=".P4510" name=".P4510"></tt> command was given).
|
||||
</itemize>
|
||||
|
||||
On 6502-derived platforms the <tt/BRK/ instruction has an optional signature
|
||||
byte. If omitted, the assembler will only produce only 1 byte.
|
||||
|
||||
<tscreen><verb>
|
||||
brk ; 1-byte: $00
|
||||
brk $34 ; 2-bytes: $00 $34
|
||||
brk #$34 ; 2-bytes: $00 $34
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1>65816 mode<p>
|
||||
|
||||
|
@ -448,6 +465,17 @@ mnemonics:
|
|||
<item><tt>TSA</tt> is an alias for <tt>TSC</tt>
|
||||
</itemize>
|
||||
|
||||
The <tt/MVN/ and <tt/MVP/ instructions accept two different argument forms.
|
||||
Either two bank bytes may be given with a <tt/#/ prefix,
|
||||
or two far addresses whose high byte will be used.
|
||||
|
||||
<tscreen><verb>
|
||||
mvn #^src, #^dst ; bank of src to bank of dst
|
||||
mvn src, dst ; bank of src to bank of dst
|
||||
mvp #$12, #$78 ; bank $12 to $78
|
||||
mvp $123456, $789ABC ; bank $12 to $78
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1>6502X mode<label id="6502X-mode"><p>
|
||||
|
||||
|
@ -2019,7 +2047,7 @@ Here's a list of all control commands and a description, what they do:
|
|||
|
||||
<sect1><tt>.A16</tt><label id=".A16"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the accumulator to 16 bit.
|
||||
Valid only in 65816 mode. Assume the accumulator is 16 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 16 bit operands for immediate accumulator addressing mode.
|
||||
|
@ -2029,7 +2057,7 @@ Here's a list of all control commands and a description, what they do:
|
|||
|
||||
<sect1><tt>.A8</tt><label id=".A8"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the accumulator to 8 bit.
|
||||
Valid only in 65816 mode. Assume the accumulator is 8 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 8 bit operands for immediate accu addressing mode.
|
||||
|
@ -2112,15 +2140,15 @@ Here's a list of all control commands and a description, what they do:
|
|||
</verb></tscreen>
|
||||
|
||||
the assembler will force a segment alignment to the least common multiple of
|
||||
15, 18 and 251 - which is 22590. To protect the user against errors, the
|
||||
assembler will issue a warning when the combined alignment exceeds 256. The
|
||||
command line option <tt><ref id="option--large-alignment"
|
||||
name="--large-alignment"></tt> will disable this warning.
|
||||
15, 18 and 251 - which is 22590. To protect the user against errors, when the
|
||||
combined alignment is larger than the explicitly requested alignments,
|
||||
the assembler will issue a warning if it also exceeds 256. The command line
|
||||
option <tt><ref id="option--large-alignment" name="--large-alignment"></tt>
|
||||
will disable this warning.
|
||||
|
||||
Please note that with alignments that are a power of two (which were the
|
||||
only alignments possible in older versions of the assembler), the problem is
|
||||
less severe, because the least common multiple of powers to the same base is
|
||||
always the larger one.
|
||||
Please note that with only alignments that are a power of two, a warning will
|
||||
never occur, because the least common multiple of powers to the same base is
|
||||
always simply the larger one.
|
||||
|
||||
|
||||
|
||||
|
@ -2514,7 +2542,19 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
|
||||
<sect1><tt>.ENDMAC, .ENDMACRO</tt><label id=".ENDMACRO"><p>
|
||||
|
||||
Marks the end of a macro definition.
|
||||
Marks the end of a macro definition. Note, <tt>.ENDMACRO</tt> should be on
|
||||
its own line to successfully end the macro definition. It is possible to use
|
||||
<tt><ref id=".DEFINE" name=".DEFINE"></tt> to create a symbol that references
|
||||
<tt>.ENDMACRO</tt> without ending the macro definition.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.macro new_mac
|
||||
.define startmac .macro
|
||||
.define endmac .endmacro
|
||||
.endmacro
|
||||
</verb></tscreen>
|
||||
|
||||
See: <tt><ref id=".DELMACRO" name=".DELMACRO"></tt>,
|
||||
<tt><ref id=".EXITMACRO" name=".EXITMACRO"></tt>,
|
||||
|
@ -2738,15 +2778,19 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
This directive may be used to enable one or more compatibility features
|
||||
of the assembler. While the use of <tt/.FEATURE/ should be avoided when
|
||||
possible, it may be useful when porting sources written for other
|
||||
assemblers. There is no way to switch a feature off, once you have
|
||||
enabled it, so using
|
||||
assemblers. After the feature name an optional '+' or '-' may specify whether
|
||||
to enable or disable the feature (enable if omitted). Multiple features may be
|
||||
enabled, separated by commas. Examples:
|
||||
|
||||
<tscreen><verb>
|
||||
.FEATURE xxx
|
||||
; enable c_comments
|
||||
.feature c_comments
|
||||
.feature c_comments +
|
||||
; enable force_range, disable underline_in_numbers, enable labels_without_colons
|
||||
.feature force_range, underline_in_numbers -, labels_without_colons +
|
||||
.feature force_range +, underline_in_numbers off, labels_without_colons on
|
||||
</verb></tscreen>
|
||||
|
||||
will enable the feature until end of assembly is reached.
|
||||
|
||||
The following features are available:
|
||||
|
||||
<descrip>
|
||||
|
@ -2825,6 +2869,23 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
overridden. When using this feature, you may also get into trouble if
|
||||
later versions of the assembler define new keywords starting with a dot.
|
||||
|
||||
<tag><tt>long_jsr_jmp_rts</tt><label id="long_jsr_jmp_rts"></tag>
|
||||
|
||||
Affects 65816 mode only.
|
||||
|
||||
Allows <tt>jsr</tt> and <tt>jmp</tt> to produce long jumps if the target
|
||||
address has been previously declared in a <tt>far</tt> segment,
|
||||
or imported as <tt>far</tt>.
|
||||
Otherwise <tt>jsl</tt> and <tt>jml</tt> must be used instead.
|
||||
|
||||
Also allows <tt><ref id=".SMART" name=".SMART"></tt> to convert <tt>rts</tt>
|
||||
to a long return <tt>rtl</tt> when the enclosing scope or memory model
|
||||
indicates returning from a <tt>far</tt> procedure.
|
||||
|
||||
This permits compatibility with the old behavior of this assembler, or other
|
||||
assemblers which similarly allowed <tt>jsr</tt> and <tt>jmp</tt> to be used
|
||||
this way.
|
||||
|
||||
<tag><tt>loose_char_term</tt><label id="loose_char_term"></tag>
|
||||
|
||||
Accept single quotes as well as double quotes as terminators for char
|
||||
|
@ -3036,7 +3097,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
|
||||
<sect1><tt>.I16</tt><label id=".I16"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the index registers to 16 bit.
|
||||
Valid only in 65816 mode. Assume the index registers are 16 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 16 bit operands for immediate operands.
|
||||
|
@ -3047,7 +3108,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
|
||||
<sect1><tt>.I8</tt><label id=".I8"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the index registers to 8 bit.
|
||||
Valid only in 65816 mode. Assume the index registers are 8 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 8 bit operands for immediate operands.
|
||||
|
@ -3994,7 +4055,9 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
|||
the assembler cannot trace the execution flow this may lead to false
|
||||
results in some cases. If in doubt, use the <tt/.Inn/ and <tt/.Ann/
|
||||
instructions to tell the assembler about the current settings.
|
||||
<item>In 65816 mode, replace a <tt/RTS/ instruction by <tt/RTL/ if it is
|
||||
<item>In 65816 mode, if the <tt><ref id="long_jsr_jmp_rts"
|
||||
name="long_jsr_jmp_rts"></tt> feature is enabled,
|
||||
smart mode will replace a <tt/RTS/ instruction by <tt/RTL/ if it is
|
||||
used within a procedure declared as <tt/far/, or if the procedure has
|
||||
no explicit address specification, but it is <tt/far/ because of the
|
||||
memory model used.
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
<abstract>
|
||||
Internal details of cc65 code generation,
|
||||
such as calling assembly functions from C.
|
||||
such as the expected linker configuration,
|
||||
and calling assembly functions from C.
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
|
@ -16,6 +17,76 @@ such as calling assembly functions from C.
|
|||
|
||||
|
||||
|
||||
<sect>Linker configuration<p>
|
||||
|
||||
The C libraries and code generation depend directly on a suitable linker configuration.
|
||||
There are premade configuration files in the <tt/cfg// directory, normally chosen by the
|
||||
linker's selected target. These can be used as a template for customization.
|
||||
|
||||
The C libraries depend on several special segments to be defined in your linker configuration.
|
||||
Generated code will also use some of them by default.
|
||||
Some platform libraries have additional special segments.
|
||||
|
||||
Memory areas are free to be defined in a way that is appropriate to each platform,
|
||||
and the segments they contain are used as a layer of semantics and abstraction,
|
||||
to allow much of the reorganization to be done with the linker config,
|
||||
rather than requiring platform-specific code source changes.
|
||||
|
||||
<sect1><tt/ZEROPAGE/ segment<p>
|
||||
|
||||
Used by the C library and generated code for efficient internal and temporary state storage,
|
||||
also called "pseudo-registers".
|
||||
|
||||
<sect1><tt/STARTUP/ segment<p>
|
||||
|
||||
Used by each platform instance of the C library in <tt/crt0.s/ to contain the entry point
|
||||
of the program.
|
||||
|
||||
The startup module will export <tt/__STARTUP__ : absolute = 1/ to force the linker to
|
||||
always include <tt/crt0.s/ from the library.
|
||||
|
||||
<sect1><tt/CODE/ segment<p>
|
||||
|
||||
The default segment for generated code, and most C library code will be located here.
|
||||
|
||||
Use <tt/#pragma code-name/ to redirect generated code to another segment.
|
||||
|
||||
<sect1><tt/BSS/ segment<p>
|
||||
|
||||
Used for uninitialized variables.
|
||||
Originally an acronym for "Block Started by Symbol", but the meaning of this is now obscure.
|
||||
|
||||
Use <tt/#pragma bss-name/ to redirect uninitialized variables to another segment.
|
||||
|
||||
<sect1><tt/DATA/ segment<p>
|
||||
|
||||
Used for initialized variables.
|
||||
|
||||
On some platforms, this may be initialized as part of the program loading process,
|
||||
but on others it may have a separate <tt/LOAD/ and <tt/RUN/ address,
|
||||
allowing <tt/copydata/ to copy the initialization from the loaded location
|
||||
into their run destination in RAM.
|
||||
|
||||
Use <tt/#pragma data-name/ to redirect initialized variables to another segment.
|
||||
|
||||
<sect1><tt/RODATA/ segment<p>
|
||||
|
||||
Used for read-only (constant) data.
|
||||
|
||||
Use <tt/#pragma rodata-name/ to redirect constant data to another segment.
|
||||
|
||||
<sect1><tt/FEATURES/ table<p>
|
||||
|
||||
This currently defines table locations for the <tt/CONDES/
|
||||
constructor, destructor, and interruptor features.
|
||||
Some platform libraries use these.
|
||||
|
||||
The constructors will be called with <tt/initlib/ at startup,
|
||||
and the destructors with <tt/donelib/ at program exit.
|
||||
Interruptors are called with <tt/callirq/.
|
||||
|
||||
|
||||
|
||||
<sect>Calling assembly functions from C<p>
|
||||
|
||||
<sect1>Calling conventions<p>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
Contains hints on creating the most effective code with cc65.
|
||||
|
||||
<tag><htmlurl url="cc65-intern.html" name="cc65-intern.html"></tag>
|
||||
Describes internal details of cc65, such as calling conventions.
|
||||
Describes internal details of cc65: linker configuration, calling conventions, etc.
|
||||
|
||||
<tag><htmlurl url="using-make.html" name="using-make.html"></tag>
|
||||
Build programs, using the GNU Make utility.
|
||||
|
|
|
@ -90,6 +90,7 @@ Long options:
|
|||
--start-group Start a library group
|
||||
--target sys Set the target system
|
||||
--version Print the linker version
|
||||
--warnings-as-errors Treat warnings as errors
|
||||
---------------------------------------------------------------------------
|
||||
</verb></tscreen>
|
||||
|
||||
|
@ -330,6 +331,13 @@ Here is a description of all of the command-line options:
|
|||
directory, in the list of directories specified using <tt/--obj-path/, in
|
||||
directories given by environment variables, and in a built-in default directory.
|
||||
|
||||
|
||||
<label id="option--warnings-as-errors">
|
||||
<tag><tt>--warnings-as-errors</tt></tag>
|
||||
|
||||
An error will be generated if any warnings were produced.
|
||||
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ INSTALL:
|
|||
and #$f0
|
||||
cmp #$80
|
||||
bne @L1
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
@L1: lda #EM_ERR_NO_DEVICE
|
||||
; rts
|
||||
|
|
|
@ -71,8 +71,9 @@ INSTALL:
|
|||
stx gettype+2
|
||||
gettype:jsr $0000
|
||||
sta ostype
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; Fall through
|
||||
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
|
|
|
@ -133,8 +133,8 @@ next: inc ptr1+1
|
|||
bcc :+
|
||||
|
||||
; Mouse firmware not found
|
||||
lda #<MOUSE_ERR_NO_DEVICE
|
||||
ldx #>MOUSE_ERR_NO_DEVICE
|
||||
lda #MOUSE_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check Pascal 1.1 Firmware Protocol ID bytes
|
||||
|
|
|
@ -168,8 +168,9 @@ SER_CLOSE:
|
|||
sta ACIA_CMD,x
|
||||
|
||||
; Done, return an error code
|
||||
: lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
: lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
stx Index ; Mark port as closed
|
||||
rts
|
||||
|
||||
|
@ -256,23 +257,24 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
stx Index ; Mark port as open
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Device (hardware) not found
|
||||
NoDevice:lda #<SER_ERR_NO_DEVICE
|
||||
ldx #>SER_ERR_NO_DEVICE
|
||||
NoDevice:lda #SER_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
InvParam:lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
InvParam:lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
InvBaud:lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -292,8 +294,8 @@ SER_GET:
|
|||
: lda RecvFreeCnt ; (25)
|
||||
cmp #$FF
|
||||
bne :+
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -336,8 +338,8 @@ SER_PUT:
|
|||
; Put byte into send buffer & send
|
||||
: ldy SendFreeCnt
|
||||
bne :+
|
||||
lda #<SER_ERR_OVERFLOW
|
||||
ldx #>SER_ERR_OVERFLOW
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
: ldy SendTail
|
||||
|
@ -346,7 +348,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$FF ; TryHard = true
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -359,7 +362,8 @@ SER_STATUS:
|
|||
lda ACIA_STATUS,x
|
||||
ldx #$00
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -379,11 +383,12 @@ SER_IOCTL:
|
|||
bcs :+
|
||||
|
||||
stx Slot
|
||||
tax ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
: lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
: lda #SER_ERR_INV_IOCTL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -69,7 +69,8 @@ INSTALL:
|
|||
lda #$34
|
||||
sta PACTL
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -62,7 +62,8 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
|||
|
||||
INSTALL:
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -137,9 +137,10 @@ INSTALL:
|
|||
ldx YPos+1
|
||||
jsr CMOVEY
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -268,9 +268,10 @@ INSTALL:
|
|||
and #$0f
|
||||
sta old_porta_vbi
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -132,9 +132,10 @@ INSTALL:
|
|||
ldx YPos+1
|
||||
jsr CMOVEY
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -135,8 +135,8 @@ my_CIOV:
|
|||
.code
|
||||
|
||||
invbaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
openerr:
|
||||
rts
|
||||
|
||||
|
@ -229,8 +229,9 @@ SER_OPEN:
|
|||
jsr my_CIOV
|
||||
bmi cioerr
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
inverr: jmp my___inviocb
|
||||
|
@ -240,8 +241,8 @@ cioerr:
|
|||
jsr my_fddecusage ; decrement usage counter of fd as open failed
|
||||
|
||||
init_err:
|
||||
ldx #0
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;---- open the device
|
||||
|
@ -313,8 +314,9 @@ SER_CLOSE:
|
|||
stx rshand+1
|
||||
inx
|
||||
stx cm_run
|
||||
@done: lda #<SER_ERR_OK
|
||||
ldx #>SER_ERR_OK
|
||||
@done: lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -365,16 +367,16 @@ SER_GET:
|
|||
rts
|
||||
|
||||
@nix_da:lda #SER_ERR_NO_DATA
|
||||
ldx #0
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
ser_error:
|
||||
lda #SER_ERR_OVERFLOW ; there is no large selection of serial error codes... :-/
|
||||
ldx #0
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
ni_err: lda #SER_ERR_NOT_OPEN
|
||||
ldx #0
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -427,8 +429,8 @@ SER_STATUS:
|
|||
;
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -456,8 +458,8 @@ search: lda HATABS,y ; get device name
|
|||
|
||||
; R: device not found, return error
|
||||
|
||||
lda #<SER_ERR_NO_DEVICE
|
||||
ldx #0
|
||||
lda #SER_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; R: device found, initialize jump table into main program
|
||||
|
@ -554,8 +556,9 @@ found: lda ptr3
|
|||
pla
|
||||
sta ptr3
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ INSTALL:
|
|||
lda #$04 ; enable POT input from the joystick ports, see section "GTIA" in
|
||||
sta CONSOL ; http://www.atarimuseum.com/videogames/consoles/5200/conv_to_5200.html
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -62,8 +62,9 @@ INSTALL:
|
|||
sty SWCHB ; enable 2-button 7800 controller 2: pull pin 6 (INPT4) high
|
||||
|
||||
reset:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -55,11 +55,12 @@ INSTALL:
|
|||
lda VIA::PRA
|
||||
and #%00100000
|
||||
bne ijkPresent
|
||||
lda #<JOY_ERR_NO_DEVICE
|
||||
lda #JOY_ERR_NO_DEVICE
|
||||
.byte $2C ; Skip next opcode
|
||||
ijkPresent:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -58,7 +58,8 @@ temp2: .byte $00
|
|||
|
||||
INSTALL:
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -141,8 +141,9 @@ SER_CLOSE:
|
|||
sta ACIA::CMD,x
|
||||
|
||||
; Done, return an error code
|
||||
: lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
: lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
stx Index ; Mark port as closed
|
||||
rts
|
||||
|
||||
|
@ -205,8 +206,9 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
stx Index ; Mark port as open
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
|
@ -235,8 +237,8 @@ SER_GET:
|
|||
: lda RecvFreeCnt ; (25)
|
||||
cmp #$FF
|
||||
bne :+
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -277,8 +279,8 @@ SER_PUT:
|
|||
; Put byte into send buffer & send
|
||||
: ldy SendFreeCnt
|
||||
bne :+
|
||||
lda #<SER_ERR_OVERFLOW
|
||||
ldx #>SER_ERR_OVERFLOW
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
: ldy SendTail
|
||||
|
@ -287,7 +289,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$FF ; TryHard = true
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -299,7 +302,8 @@ SER_STATUS:
|
|||
lda ACIA::STATUS
|
||||
ldx #$00
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -308,8 +312,8 @@ SER_STATUS:
|
|||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -215,7 +215,8 @@ SETPALETTE:
|
|||
jsr PAPER
|
||||
ldy #1
|
||||
jsr flipcolor
|
||||
dey ; TGI_ERR_OK
|
||||
.assert TGI_ERR_OK = 0, error
|
||||
dey
|
||||
sty ERROR
|
||||
sty PARAM1+1
|
||||
jmp INK
|
||||
|
|
|
@ -87,16 +87,17 @@ INSTALL:
|
|||
cli
|
||||
cmp tmp1
|
||||
beq @ram_present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@ram_present:
|
||||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -120,16 +120,16 @@ INSTALL:
|
|||
bne @setok
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@setok:
|
||||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
check:
|
||||
|
|
|
@ -87,16 +87,17 @@ INSTALL:
|
|||
cli
|
||||
cmp tmp1
|
||||
beq @ram_present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@ram_present:
|
||||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -68,8 +68,9 @@ INSTALL:
|
|||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -107,8 +107,9 @@ INSTALL:
|
|||
ldx #$FF
|
||||
stx curpage
|
||||
stx curpage+1 ; Invalidate the current page
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa ; A = X = EM_ERR_OK
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -97,13 +97,14 @@ INSTALL:
|
|||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
@notpresent:
|
||||
@readonly:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -126,8 +126,9 @@ size_found:
|
|||
pagecount_ok:
|
||||
stx pagecount
|
||||
sty pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; common REU setup for size check
|
||||
|
|
|
@ -121,8 +121,9 @@ INSTALL:
|
|||
lda vdc_cset_save
|
||||
jsr vdcputreg
|
||||
@keep64kBit:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
test64k:
|
||||
|
|
|
@ -53,8 +53,9 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -57,8 +57,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -194,9 +194,10 @@ INSTALL:
|
|||
sta (ptr3),y
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -228,9 +228,10 @@ INSTALL:
|
|||
jsr MoveX
|
||||
cli
|
||||
|
||||
; Done, return zero.
|
||||
; Done
|
||||
|
||||
lda #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
|
|
@ -195,9 +195,10 @@ INSTALL:
|
|||
sta (ptr3),y
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -195,9 +195,10 @@ INSTALL:
|
|||
sta (ptr3),y
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -187,8 +187,9 @@ SetNMI: sta NMIVec
|
|||
|
||||
; Done, return an error code
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -264,22 +265,23 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
|
||||
InvParam:
|
||||
lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
|
||||
InvBaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -300,8 +302,9 @@ SER_CLOSE:
|
|||
|
||||
; Return OK
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -322,8 +325,8 @@ SER_GET:
|
|||
@L1: lda RecvFreeCnt ; (25)
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -370,7 +373,7 @@ SER_PUT:
|
|||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
lda #<SER_ERR_OVERFLOW ; X is already zero
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
|
@ -379,7 +382,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$ff
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -392,7 +396,8 @@ SER_STATUS:
|
|||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -402,8 +407,8 @@ SER_STATUS:
|
|||
;
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -77,12 +77,13 @@ INSTALL:
|
|||
|
||||
ldx #$FF
|
||||
stx curpage ; Invalidate the current page
|
||||
inx ; X = 0
|
||||
txa ; A = X = EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa
|
||||
rts
|
||||
|
||||
nomem: ldx #>EM_ERR_NO_DEVICE
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
nomem: ldx #EM_ERR_NO_DEVICE
|
||||
lda #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -120,13 +120,14 @@ INSTALL:
|
|||
dex
|
||||
@noextradex:
|
||||
stx bankcount
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
@not_present:
|
||||
cli
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
||||
|
|
|
@ -158,13 +158,14 @@ INSTALL:
|
|||
jsr restore_data
|
||||
cpy #$01
|
||||
beq @present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -147,13 +147,14 @@ INSTALL:
|
|||
jsr restore_data
|
||||
cpy #$01
|
||||
beq @present
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -121,16 +121,17 @@ INSTALL:
|
|||
bne @setok
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@setok:
|
||||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
check:
|
||||
|
|
|
@ -76,13 +76,14 @@ INSTALL:
|
|||
beq @setok
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@setok:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -82,13 +82,14 @@ INSTALL:
|
|||
cmp #$AA
|
||||
bne @notpresent
|
||||
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; use rts from UNINSTALL below
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -65,8 +65,9 @@ window: .res 256 ; Memory "window"
|
|||
INSTALL:
|
||||
ldx #$FF
|
||||
stx curpage ; Invalidate the current page
|
||||
inx ; X = 0
|
||||
txa ; A = X = EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -98,13 +98,13 @@ INSTALL:
|
|||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
@notpresent:
|
||||
@readonly:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -127,8 +127,9 @@ size_found:
|
|||
pagecount_ok:
|
||||
stx pagecount
|
||||
sty pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; common REU setup for size check
|
||||
|
@ -152,6 +153,7 @@ reu_size_check_common:
|
|||
|
||||
nodevice:
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
.assert EM_ERR_OK = 0, error
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -87,8 +87,8 @@ INSTALL:
|
|||
bne @L0
|
||||
iny
|
||||
bne @L0
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
; ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
|
@ -131,8 +131,9 @@ INSTALL:
|
|||
sta pagecount
|
||||
stx pagecount+1
|
||||
@endok:
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
test64k:
|
||||
|
|
|
@ -93,15 +93,16 @@ INSTALL:
|
|||
|
||||
; DTV not found
|
||||
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@present:
|
||||
ldx #$FF
|
||||
stx curpage+1 ; Invalidate curpage
|
||||
inx ; X = 0
|
||||
txa ; A/X = EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
|
|
@ -59,8 +59,9 @@ temp4: .byte 0
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
|
|
@ -100,12 +100,14 @@ masktable:
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #JOY_ERR_OK ; Assume we have a joystick
|
||||
ldx VIC_CLK_128 ; Test for a C128
|
||||
cpx #$FF
|
||||
lda #JOY_ERR_OK ; Assume we have a "joystick"
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax ; Set high byte
|
||||
ldy VIC_CLK_128 ; Test for a C128
|
||||
cpy #$FF
|
||||
bne @C128 ; Jump if we have one
|
||||
lda #JOY_ERR_NO_DEVICE ; No C128 -> no numpad
|
||||
@C128: ldx #0 ; Set high byte
|
||||
@C128:
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
|
|
@ -52,8 +52,9 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -56,8 +56,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
|
|
@ -152,9 +152,10 @@ INSTALL:
|
|||
jsr CMOVEY
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
@ -307,8 +308,8 @@ INFO: jsr POS
|
|||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
IOCTL: lda #MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -168,6 +168,7 @@ INSTALL:
|
|||
; Done, return zero.
|
||||
|
||||
lda #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -319,8 +320,8 @@ INFO: jsr POS
|
|||
; Must return an error code in .XA.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
IOCTL: lda #MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -156,9 +156,10 @@ INSTALL:
|
|||
jsr CMOVEY
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
@ -312,8 +313,8 @@ INFO: jsr POS
|
|||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
IOCTL: lda #MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -139,9 +139,10 @@ INSTALL:
|
|||
jsr CMOVEY
|
||||
cli
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
@ -297,8 +298,8 @@ INFO: jsr POS
|
|||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
IOCTL: lda #MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -161,8 +161,9 @@ SetNMI: sta NMIVec
|
|||
|
||||
; Done, return an error code
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -238,22 +239,23 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
|
||||
InvParam:
|
||||
lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
|
||||
InvBaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -274,8 +276,9 @@ SER_CLOSE:
|
|||
|
||||
; Return OK
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -296,8 +299,8 @@ SER_GET:
|
|||
@L1: lda RecvFreeCnt ; (25)
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -344,7 +347,7 @@ SER_PUT:
|
|||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
lda #<SER_ERR_OVERFLOW ; X is already zero
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
|
@ -353,7 +356,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$ff
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -366,7 +370,8 @@ SER_STATUS:
|
|||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -376,8 +381,8 @@ SER_STATUS:
|
|||
;
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
.import pusha0, tosudiva0
|
||||
.importzp sreg, ptr1, ptr2
|
||||
|
||||
.macpack generic
|
||||
|
||||
initcwd:
|
||||
lda #<__cwd
|
||||
ldx #>__cwd
|
||||
|
@ -27,15 +25,20 @@ devicestr:
|
|||
lda #10
|
||||
jsr tosudiva0
|
||||
ldy #0
|
||||
lda sreg
|
||||
beq @L0 ; >=10
|
||||
add #'0'
|
||||
tax ; result of the division (lsb)
|
||||
beq @L0 ; < 10
|
||||
|
||||
clc
|
||||
adc #'0'
|
||||
sta (ptr2),y
|
||||
iny
|
||||
@L0: lda ptr1 ; rem
|
||||
add #'0'
|
||||
@L0:
|
||||
lda sreg ; reminder of the division
|
||||
clc
|
||||
adc #'0'
|
||||
sta (ptr2),y
|
||||
iny
|
||||
lda #0
|
||||
|
||||
lda #0 ; terminating 0
|
||||
sta (ptr2),y
|
||||
rts
|
||||
|
|
|
@ -81,8 +81,9 @@ INSTALL:
|
|||
sbc #$00
|
||||
sta pagecount
|
||||
|
||||
@L1: lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
@L1: lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -57,8 +57,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -175,6 +175,7 @@ INSTALL:
|
|||
; Done, return zero.
|
||||
|
||||
lda #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -331,8 +332,8 @@ INFO: jsr POS
|
|||
; Must return an error code in .XA.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
IOCTL: lda #MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -140,7 +140,8 @@ INSTALL:
|
|||
|
||||
; Done, return zero.
|
||||
|
||||
ldx #>MOUSE_ERR_OK
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
@ -315,8 +316,8 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset
|
|||
; Must return an error code in .XA.
|
||||
;
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
IOCTL: lda #MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -148,8 +148,9 @@ SER_CLOSE:
|
|||
|
||||
; Done, return an error code
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -217,22 +218,23 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
|
||||
InvParam:
|
||||
lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
|
||||
InvBaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -253,8 +255,8 @@ SER_GET:
|
|||
@L1: lda RecvFreeCnt
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -301,7 +303,7 @@ SER_PUT:
|
|||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
lda #<SER_ERR_OVERFLOW ; X is already zero
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
|
@ -310,7 +312,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$ff
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -328,7 +331,8 @@ SER_STATUS:
|
|||
sta (ptr1,x)
|
||||
lda IndReg
|
||||
sta ExecReg
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -338,8 +342,8 @@ SER_STATUS:
|
|||
;
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -81,8 +81,9 @@ INSTALL:
|
|||
sbc #$00
|
||||
sta pagecount
|
||||
|
||||
@L1: lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
@L1: lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -149,8 +149,9 @@ SER_CLOSE:
|
|||
|
||||
; Done, return an error code
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -218,22 +219,23 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
|
||||
InvParam:
|
||||
lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
|
||||
InvBaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -254,8 +256,8 @@ SER_GET:
|
|||
@L1: lda RecvFreeCnt
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -302,7 +304,7 @@ SER_PUT:
|
|||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
lda #<SER_ERR_OVERFLOW ; X is already zero
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
|
@ -311,7 +313,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$ff
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -339,8 +342,8 @@ SER_STATUS:
|
|||
;
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -502,10 +502,10 @@ DoFormat:
|
|||
; It is a character
|
||||
|
||||
jsr GetIntArg ; Get the argument (promoted to int)
|
||||
sta Buf ; Place it as zero terminated string...
|
||||
lda #0
|
||||
sta Buf+1 ; ...into the buffer
|
||||
jmp HaveArg ; Done
|
||||
sta Buf ; Place it into the buffer
|
||||
ldx #0
|
||||
lda #1 ; Buffer length is 1
|
||||
jmp HaveArg1
|
||||
|
||||
; Is it an integer?
|
||||
|
||||
|
@ -671,6 +671,7 @@ HaveArg:
|
|||
lda Str
|
||||
ldx Str+1
|
||||
jsr _strlen ; Get length of argument
|
||||
HaveArg1: ; Jumped into here from %c handling
|
||||
sta ArgLen
|
||||
stx ArgLen+1
|
||||
|
||||
|
|
|
@ -59,7 +59,8 @@ JOY_RIGHT = $08
|
|||
;
|
||||
|
||||
INSTALL: lda #JOY_ERR_OK
|
||||
ldx #>$0000
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Fall through
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -55,8 +55,9 @@ JOY_COUNT = $05 ; Number of joysticks we support
|
|||
; Must return a JOY_ERR_xx code in .XA .
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -139,7 +139,8 @@ INSTALL:
|
|||
|
||||
; Done, return zero
|
||||
|
||||
ldx #>MOUSE_ERR_OK
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
@ -300,8 +301,8 @@ INFO: jsr BUTTONS ; Will not touch ptr1
|
|||
; specific data in ptr1, and the ioctl code in A.
|
||||
; Must return an error code in .XA .
|
||||
|
||||
IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #>MOUSE_ERR_INV_IOCTL
|
||||
IOCTL: lda #MOUSE_ERR_INV_IOCTL ; We don't support ioctls, for now
|
||||
ldx #0 ; return value is char
|
||||
; rts ; Fall through
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -47,8 +47,9 @@ JOY_COUNT = 1 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
|
|
@ -125,8 +125,9 @@ INSTALL:
|
|||
pla
|
||||
sta $01
|
||||
plp
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
test64k:
|
||||
|
|
|
@ -53,8 +53,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
.include "modload.inc"
|
||||
|
||||
.import joy_clear_ptr
|
||||
.import return0
|
||||
.import return0, return1
|
||||
|
||||
|
||||
|
||||
|
@ -31,7 +31,6 @@ _joy_unload:
|
|||
jmp return0 ; Return JOY_ERR_OK
|
||||
|
||||
no_driver:
|
||||
tax ; X = 0
|
||||
pla ; Remove pushed junk
|
||||
lda #JOY_ERR_NO_DRIVER
|
||||
rts
|
||||
.assert JOY_ERR_NO_DRIVER = 1, error
|
||||
jmp return1 ; Return JOY_ERR_NO_DRIVER
|
||||
|
|
|
@ -58,8 +58,9 @@ JOY_COUNT = 1 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -75,8 +75,9 @@ SER_UNINSTALL:
|
|||
SER_CLOSE:
|
||||
; Disable interrupts
|
||||
; Done, return an error code
|
||||
lda #<SER_ERR_OK
|
||||
ldx #>SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -190,8 +191,8 @@ SER_OPEN:
|
|||
cmp #SER_BAUD_134_5
|
||||
beq setbaudrate
|
||||
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
setprescaler:
|
||||
stx TIM4CTLA
|
||||
|
@ -238,12 +239,13 @@ checkhs:
|
|||
lda contrl
|
||||
ora #RxIntEnable|ResetErr
|
||||
sta SERCTL
|
||||
lda #<SER_ERR_OK
|
||||
ldx #>SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
invparameter:
|
||||
lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -255,8 +257,8 @@ SER_GET:
|
|||
lda RxPtrIn
|
||||
cmp RxPtrOut
|
||||
bne GetByte
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
GetByte:
|
||||
ldy RxPtrOut
|
||||
|
@ -277,8 +279,8 @@ SER_PUT:
|
|||
ina
|
||||
cmp TxPtrOut
|
||||
bne PutByte
|
||||
lda #<SER_ERR_OVERFLOW
|
||||
ldx #>SER_ERR_OVERFLOW
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
PutByte:
|
||||
ldy TxPtrIn
|
||||
|
@ -296,7 +298,8 @@ PutByte:
|
|||
sta TxDone
|
||||
plp
|
||||
@L1:
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -317,8 +320,8 @@ SER_STATUS:
|
|||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
.include "mouse-kernel.inc"
|
||||
.include "modload.inc"
|
||||
|
||||
.import return0
|
||||
.import return0, return1
|
||||
|
||||
|
||||
|
||||
|
@ -29,7 +29,6 @@ _mouse_unload:
|
|||
jmp return0 ; Return MOUSE_ERR_OK
|
||||
|
||||
no_driver:
|
||||
tax ; X = 0
|
||||
pla ; Remove pushed junk
|
||||
lda #<MOUSE_ERR_NO_DRIVER
|
||||
rts
|
||||
.assert MOUSE_ERR_NO_DRIVER = 1, error
|
||||
jmp return1 ; Return MOUSE_ERR_NO_DRIVER
|
||||
|
|
|
@ -53,7 +53,8 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||
|
||||
INSTALL:
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -50,8 +50,9 @@ padbuffer: .res JOY_COUNT
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
|
|
@ -51,8 +51,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -58,8 +58,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -157,8 +157,9 @@ SER_CLOSE:
|
|||
|
||||
; Done, return an error code
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -225,22 +226,23 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
|
||||
InvParam:
|
||||
lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
|
||||
InvBaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -261,8 +263,8 @@ SER_GET:
|
|||
@L1: lda RecvFreeCnt ; (25)
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -309,7 +311,7 @@ SER_PUT:
|
|||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
lda #<SER_ERR_OVERFLOW ; X is already zero
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
|
@ -318,7 +320,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$ff
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -331,7 +334,8 @@ SER_STATUS:
|
|||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -341,8 +345,8 @@ SER_STATUS:
|
|||
;
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts ; Run into IRQ instead
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
.include "modload.inc"
|
||||
|
||||
.import ser_clear_ptr
|
||||
.import return0
|
||||
.import return0, return1
|
||||
|
||||
|
||||
|
||||
|
@ -28,10 +28,10 @@ _ser_unload:
|
|||
tax
|
||||
pla ; Get pointer to driver
|
||||
jsr _mod_free ; Free the driver
|
||||
jmp return0 ; Return SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
jmp return0
|
||||
|
||||
no_driver:
|
||||
tax ; X = 0
|
||||
pla ; Remove pushed junk
|
||||
lda #<SER_ERR_NO_DRIVER
|
||||
rts
|
||||
.assert SER_ERR_NO_DRIVER = 1, error
|
||||
jmp return1
|
||||
|
|
|
@ -46,8 +46,9 @@ JOY_COUNT = 1 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
|
|
|
@ -54,8 +54,9 @@ INSTALL:
|
|||
sta VIA2::PRB
|
||||
; We could detect joysticks because with previous command bit0,1,2,3,4 should be set to 1 after
|
||||
; But if some one press fire or press direction, we could reach others values which could break joystick detection.
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -119,16 +119,16 @@ INSTALL:
|
|||
bne @setok
|
||||
|
||||
@notpresent:
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
ldx #>EM_ERR_NO_DEVICE
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
@setok:
|
||||
lda #0
|
||||
sta pagecount
|
||||
stx pagecount+1
|
||||
lda #<EM_ERR_OK
|
||||
ldx #>EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
check:
|
||||
|
|
|
@ -71,12 +71,13 @@ INSTALL:
|
|||
|
||||
ldx #$FF
|
||||
stx curpage ; Invalidate the current page
|
||||
inx ; X = 0
|
||||
txa ; A = X = EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
inx
|
||||
txa
|
||||
rts
|
||||
|
||||
nomem: ldx #>EM_ERR_NO_DEVICE
|
||||
lda #<EM_ERR_NO_DEVICE
|
||||
nomem: ldx #0 ; return value is char
|
||||
lda #EM_ERR_NO_DEVICE
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -53,8 +53,9 @@ JOY_COUNT = 3 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -57,8 +57,9 @@ JOY_COUNT = 1 ; Number of joysticks we support
|
|||
;
|
||||
|
||||
INSTALL:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -115,7 +115,11 @@ install:
|
|||
$(INSTALL) ../bin/* $(DESTDIR)$(bindir)
|
||||
|
||||
avail:
|
||||
ifneq ($(patsubst %,../bin/%,$(PROGS)),$(wildcard $(patsubst %,../bin/%,$(PROGS))))
|
||||
$(error executables are missing, please run make first)
|
||||
else
|
||||
$(foreach prog,$(PROGS),$(AVAIL_recipe))
|
||||
endif
|
||||
|
||||
unavail:
|
||||
$(foreach prog,$(PROGS),$(UNAVAIL_recipe))
|
||||
|
|
|
@ -66,6 +66,7 @@ static const char* const FeatureKeys[FEAT_COUNT] = {
|
|||
"addrsize",
|
||||
"bracket_as_indirect",
|
||||
"string_escapes",
|
||||
"long_jsr_jmp_rts",
|
||||
};
|
||||
|
||||
|
||||
|
@ -97,37 +98,30 @@ feature_t FindFeature (const StrBuf* Key)
|
|||
|
||||
|
||||
|
||||
feature_t SetFeature (const StrBuf* Key)
|
||||
/* Find the feature and set the corresponding flag if the feature is known.
|
||||
** In any case, return the feature found. An invalid Key will return
|
||||
** FEAT_UNKNOWN.
|
||||
void SetFeature (feature_t Feature, unsigned char On)
|
||||
/* Set the corresponding feature flag if Feature is valid.
|
||||
*/
|
||||
{
|
||||
/* Map the string to an enum value */
|
||||
feature_t Feature = FindFeature (Key);
|
||||
|
||||
/* Set the flags */
|
||||
switch (Feature) {
|
||||
case FEAT_DOLLAR_IS_PC: DollarIsPC = 1; break;
|
||||
case FEAT_LABELS_WITHOUT_COLONS: NoColonLabels = 1; break;
|
||||
case FEAT_LOOSE_STRING_TERM: LooseStringTerm = 1; break;
|
||||
case FEAT_LOOSE_CHAR_TERM: LooseCharTerm = 1; break;
|
||||
case FEAT_AT_IN_IDENTIFIERS: AtInIdents = 1; break;
|
||||
case FEAT_DOLLAR_IN_IDENTIFIERS: DollarInIdents = 1; break;
|
||||
case FEAT_LEADING_DOT_IN_IDENTIFIERS: LeadingDotInIdents= 1; break;
|
||||
case FEAT_ORG_PER_SEG: OrgPerSeg = 1; break;
|
||||
case FEAT_PC_ASSIGNMENT: PCAssignment = 1; break;
|
||||
case FEAT_MISSING_CHAR_TERM: MissingCharTerm = 1; break;
|
||||
case FEAT_UBIQUITOUS_IDENTS: UbiquitousIdents = 1; break;
|
||||
case FEAT_C_COMMENTS: CComments = 1; break;
|
||||
case FEAT_FORCE_RANGE: ForceRange = 1; break;
|
||||
case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break;
|
||||
case FEAT_ADDRSIZE: AddrSize = 1; break;
|
||||
case FEAT_BRACKET_AS_INDIRECT: BracketAsIndirect = 1; break;
|
||||
case FEAT_STRING_ESCAPES: StringEscapes = 1; break;
|
||||
default: /* Keep gcc silent */ break;
|
||||
case FEAT_DOLLAR_IS_PC: DollarIsPC = On; break;
|
||||
case FEAT_LABELS_WITHOUT_COLONS: NoColonLabels = On; break;
|
||||
case FEAT_LOOSE_STRING_TERM: LooseStringTerm = On; break;
|
||||
case FEAT_LOOSE_CHAR_TERM: LooseCharTerm = On; break;
|
||||
case FEAT_AT_IN_IDENTIFIERS: AtInIdents = On; break;
|
||||
case FEAT_DOLLAR_IN_IDENTIFIERS: DollarInIdents = On; break;
|
||||
case FEAT_LEADING_DOT_IN_IDENTIFIERS: LeadingDotInIdents= On; break;
|
||||
case FEAT_ORG_PER_SEG: OrgPerSeg = On; break;
|
||||
case FEAT_PC_ASSIGNMENT: PCAssignment = On; break;
|
||||
case FEAT_MISSING_CHAR_TERM: MissingCharTerm = On; break;
|
||||
case FEAT_UBIQUITOUS_IDENTS: UbiquitousIdents = On; break;
|
||||
case FEAT_C_COMMENTS: CComments = On; break;
|
||||
case FEAT_FORCE_RANGE: ForceRange = On; break;
|
||||
case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= On; break;
|
||||
case FEAT_ADDRSIZE: AddrSize = On; break;
|
||||
case FEAT_BRACKET_AS_INDIRECT: BracketAsIndirect = On; break;
|
||||
case FEAT_STRING_ESCAPES: StringEscapes = On; break;
|
||||
case FEAT_LONG_JSR_JMP_RTS: LongJsrJmpRts = On; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
/* Return the value found */
|
||||
return Feature;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef enum {
|
|||
FEAT_ADDRSIZE,
|
||||
FEAT_BRACKET_AS_INDIRECT,
|
||||
FEAT_STRING_ESCAPES,
|
||||
FEAT_LONG_JSR_JMP_RTS,
|
||||
|
||||
/* Special value: Number of features available */
|
||||
FEAT_COUNT
|
||||
|
@ -86,10 +87,8 @@ feature_t FindFeature (const StrBuf* Key);
|
|||
** feature is invalid, return FEAT_UNKNOWN.
|
||||
*/
|
||||
|
||||
feature_t SetFeature (const StrBuf* Key);
|
||||
/* Find the feature and set the corresponding flag if the feature is known.
|
||||
** In any case, return the feature found. An invalid Key will return
|
||||
** FEAT_UNKNOWN.
|
||||
void SetFeature (feature_t Feature, unsigned char On);
|
||||
/* Set the corresponding feature flag if Feature is valid.
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ unsigned char LineCont = 0; /* Allow line continuation */
|
|||
unsigned char LargeAlignment = 0; /* Don't warn about large alignments */
|
||||
unsigned char RelaxChecks = 0; /* Relax a few assembler checks */
|
||||
unsigned char StringEscapes = 0; /* Allow C-style escapes in strings */
|
||||
unsigned char LongJsrJmpRts = 0; /* Allow JSR/JMP/RTS as alias for JSL/JML/RTL */
|
||||
unsigned char WarningsAsErrors = 0; /* Error if any warnings */
|
||||
|
||||
/* Emulation features */
|
||||
unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */
|
||||
|
|
|
@ -69,6 +69,8 @@ extern unsigned char LineCont; /* Allow line continuation */
|
|||
extern unsigned char LargeAlignment; /* Don't warn about large alignments */
|
||||
extern unsigned char RelaxChecks; /* Relax a few assembler checks */
|
||||
extern unsigned char StringEscapes; /* Allow C-style escapes in strings */
|
||||
extern unsigned char LongJsrJmpRts; /* Allow JSR/JMP/RTS as alias for JSL/JML/RTL */
|
||||
extern unsigned char WarningsAsErrors; /* Error if any warnings */
|
||||
|
||||
/* Emulation features */
|
||||
extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */
|
||||
|
|
|
@ -120,9 +120,21 @@ static void PutJMP (const InsDesc* Ins);
|
|||
** to check for this case and is otherwise identical to PutAll.
|
||||
*/
|
||||
|
||||
static void PutJMP816 (const InsDesc* Ins);
|
||||
/* Handle the JMP instruction for the 816.
|
||||
** Allowing the long_jsr_jmp_rts feature to permit a long JMP.
|
||||
** Note that JMP [abs] and JML [abs] are always both permitted for instruction $DC,
|
||||
** because the [] notation for long indirection makes the generated instruction unambiguous.
|
||||
*/
|
||||
|
||||
static void PutJSR816 (const InsDesc* Ins);
|
||||
/* Handle the JSR instruction for the 816.
|
||||
** Allowing the long_jsr_jmp_rts feature to permit a long JSR.
|
||||
*/
|
||||
|
||||
static void PutRTS (const InsDesc* Ins attribute ((unused)));
|
||||
/* Handle the RTS instruction for the 816. In smart mode emit a RTL opcode if
|
||||
** the enclosing scope is FAR.
|
||||
** the enclosing scope is FAR, but only if the long_jsr_jmp_rts feature applies.
|
||||
*/
|
||||
|
||||
static void PutAll (const InsDesc* Ins);
|
||||
|
@ -169,7 +181,7 @@ static const struct {
|
|||
{ "BMI", 0x0020000, 0x30, 0, PutPCRel8 },
|
||||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRK", 0x0000001, 0x00, 0, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
{ "CLC", 0x0000001, 0x18, 0, PutAll },
|
||||
|
@ -240,7 +252,7 @@ static const struct {
|
|||
{ "BMI", 0x0020000, 0x30, 0, PutPCRel8 },
|
||||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRK", 0x0000001, 0x00, 0, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
{ "CLC", 0x0000001, 0x18, 0, PutAll },
|
||||
|
@ -330,7 +342,7 @@ static const struct {
|
|||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRA", 0x0020000, 0x12, 0, PutPCRel8 }, /* DTV */
|
||||
{ "BRK", 0x0000001, 0x00, 0, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
{ "CLC", 0x0000001, 0x18, 0, PutAll },
|
||||
|
@ -406,7 +418,7 @@ static const struct {
|
|||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
|
||||
{ "BRK", 0x0000001, 0x00, 0, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
{ "CLC", 0x0000001, 0x18, 0, PutAll },
|
||||
|
@ -498,7 +510,7 @@ static const struct {
|
|||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
|
||||
{ "BRK", 0x0000001, 0x00, 0, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
{ "CLC", 0x0000001, 0x18, 0, PutAll },
|
||||
|
@ -610,7 +622,7 @@ static const struct {
|
|||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
|
||||
{ "BRK", 0x0000001, 0x00, 0, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BSR", 0x0040000, 0x63, 0, PutPCRel4510 },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
|
@ -735,7 +747,7 @@ static const struct {
|
|||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
|
||||
{ "BRK", 0x0000005, 0x00, 6, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BRL", 0x0040000, 0x82, 0, PutPCRel16 },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
|
@ -744,7 +756,7 @@ static const struct {
|
|||
{ "CLI", 0x0000001, 0x58, 0, PutAll },
|
||||
{ "CLV", 0x0000001, 0xb8, 0, PutAll },
|
||||
{ "CMP", 0x0b8f6fc, 0xc0, 0, PutAll },
|
||||
{ "COP", 0x0000004, 0x02, 6, PutAll },
|
||||
{ "COP", 0x0800005, 0x02, 6, PutAll },
|
||||
{ "CPA", 0x0b8f6fc, 0xc0, 0, PutAll }, /* == CMP */
|
||||
{ "CPX", 0x0c0000c, 0xe0, 1, PutAll },
|
||||
{ "CPY", 0x0c0000c, 0xc0, 1, PutAll },
|
||||
|
@ -758,9 +770,9 @@ static const struct {
|
|||
{ "INX", 0x0000001, 0xe8, 0, PutAll },
|
||||
{ "INY", 0x0000001, 0xc8, 0, PutAll },
|
||||
{ "JML", 0x4000010, 0x5c, 1, PutAll },
|
||||
{ "JMP", 0x4010818, 0x4c, 6, PutAll },
|
||||
{ "JMP", 0x4010818, 0x4c, 6, PutJMP816 },
|
||||
{ "JSL", 0x0000010, 0x20, 7, PutAll },
|
||||
{ "JSR", 0x0010018, 0x20, 7, PutAll },
|
||||
{ "JSR", 0x0010018, 0x20, 7, PutJSR816 },
|
||||
{ "LDA", 0x0b8f6fc, 0xa0, 0, PutAll },
|
||||
{ "LDX", 0x0c0030c, 0xa2, 1, PutAll },
|
||||
{ "LDY", 0x0c0006c, 0xa0, 1, PutAll },
|
||||
|
@ -821,7 +833,7 @@ static const struct {
|
|||
{ "TYA", 0x0000001, 0x98, 0, PutAll },
|
||||
{ "TYX", 0x0000001, 0xbb, 0, PutAll },
|
||||
{ "WAI", 0x0000001, 0xcb, 0, PutAll },
|
||||
{ "WDM", 0x0000004, 0x42, 6, PutAll },
|
||||
{ "WDM", 0x0800004, 0x42, 6, PutAll },
|
||||
{ "XBA", 0x0000001, 0xeb, 0, PutAll },
|
||||
{ "XCE", 0x0000001, 0xfb, 0, PutAll }
|
||||
}
|
||||
|
@ -897,7 +909,7 @@ static const struct {
|
|||
{ "BNE", 0x0020000, 0xd0, 0, PutPCRel8 },
|
||||
{ "BPL", 0x0020000, 0x10, 0, PutPCRel8 },
|
||||
{ "BRA", 0x0020000, 0x80, 0, PutPCRel8 },
|
||||
{ "BRK", 0x0000001, 0x00, 0, PutAll },
|
||||
{ "BRK", 0x0800005, 0x00, 6, PutAll },
|
||||
{ "BSR", 0x0020000, 0x44, 0, PutPCRel8 },
|
||||
{ "BVC", 0x0020000, 0x50, 0, PutPCRel8 },
|
||||
{ "BVS", 0x0020000, 0x70, 0, PutPCRel8 },
|
||||
|
@ -1627,12 +1639,46 @@ static void PutJMP (const InsDesc* Ins)
|
|||
|
||||
|
||||
|
||||
static void PutRTS (const InsDesc* Ins attribute ((unused)))
|
||||
/* Handle the RTS instruction for the 816. In smart mode emit a RTL opcode if
|
||||
** the enclosing scope is FAR.
|
||||
static void PutJMP816 (const InsDesc* Ins)
|
||||
/* Handle the JMP instruction for the 816.
|
||||
** Allowing the long_jsr_jmp_rts feature to permit a long JMP.
|
||||
** Note that JMP [abs] and JML [abs] are always both permitted for instruction $DC,
|
||||
** because the [] notation for long indirection makes the generated instruction unambiguous.
|
||||
*/
|
||||
{
|
||||
if (SmartMode && CurrentScope->AddrSize == ADDR_SIZE_FAR) {
|
||||
if (LongJsrJmpRts) {
|
||||
PutJMP (Ins);
|
||||
} else {
|
||||
InsDesc InsAbs = *Ins;
|
||||
InsAbs.AddrMode &= ~(AM65_ABS_LONG);
|
||||
PutJMP (&InsAbs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void PutJSR816 (const InsDesc* Ins)
|
||||
/* Handle the JSR instruction for the 816.
|
||||
** Allowing the long_jsr_jmp_rts feature to permit a long JSR.
|
||||
*/
|
||||
{
|
||||
if (LongJsrJmpRts) {
|
||||
PutAll (Ins);
|
||||
} else {
|
||||
InsDesc InsAbs = *Ins;
|
||||
InsAbs.AddrMode &= ~(AM65_ABS_LONG);
|
||||
PutJMP (&InsAbs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void PutRTS (const InsDesc* Ins attribute ((unused)))
|
||||
/* Handle the RTS instruction for the 816. In smart mode emit a RTL opcode if
|
||||
** the enclosing scope is FAR, but only if the long_jsr_jmp_rts feature applies.
|
||||
*/
|
||||
{
|
||||
if (LongJsrJmpRts && SmartMode && CurrentScope->AddrSize == ADDR_SIZE_FAR) {
|
||||
Emit0 (0x6B); /* RTL */
|
||||
} else {
|
||||
Emit0 (0x60); /* RTS */
|
||||
|
|
|
@ -390,7 +390,20 @@ void MacDef (unsigned Style)
|
|||
{
|
||||
Macro* M;
|
||||
TokNode* N;
|
||||
FilePos Pos;
|
||||
int HaveParams;
|
||||
int LastTokWasSep;
|
||||
|
||||
/* For classic macros, remember if we are at the beginning of the line.
|
||||
** If the macro name and parameters pass our checks then we will be on a
|
||||
** new line, so set it now
|
||||
*/
|
||||
LastTokWasSep = 1;
|
||||
|
||||
/* Save the position of the start of the macro definition to allow
|
||||
** using Perror to display the error if .endmacro isn't found
|
||||
*/
|
||||
Pos = CurTok.Pos;
|
||||
|
||||
/* We expect a macro name here */
|
||||
if (CurTok.Tok != TOK_IDENT) {
|
||||
|
@ -491,14 +504,16 @@ void MacDef (unsigned Style)
|
|||
while (1) {
|
||||
/* Check for end of macro */
|
||||
if (Style == MAC_STYLE_CLASSIC) {
|
||||
/* In classic macros, only .endmacro is allowed */
|
||||
if (CurTok.Tok == TOK_ENDMACRO) {
|
||||
/* In classic macros, if .endmacro is not at the start of the line
|
||||
** it will be added to the macro definition instead of closing it.
|
||||
*/
|
||||
if (CurTok.Tok == TOK_ENDMACRO && LastTokWasSep) {
|
||||
/* Done */
|
||||
break;
|
||||
}
|
||||
/* May not have end of file in a macro definition */
|
||||
if (CurTok.Tok == TOK_EOF) {
|
||||
Error ("'.ENDMACRO' expected");
|
||||
PError (&Pos, "'.ENDMACRO' expected for macro '%m%p'", &M->Name);
|
||||
goto Done;
|
||||
}
|
||||
} else {
|
||||
|
@ -573,6 +588,11 @@ void MacDef (unsigned Style)
|
|||
}
|
||||
++M->TokCount;
|
||||
|
||||
/* Save if last token was a separator to know if .endmacro is at
|
||||
** the start of a line
|
||||
*/
|
||||
LastTokWasSep = TokIsSep(CurTok.Tok);
|
||||
|
||||
/* Read the next token */
|
||||
NextTok ();
|
||||
}
|
||||
|
|
|
@ -489,12 +489,15 @@ static void OptDebugInfo (const char* Opt attribute ((unused)),
|
|||
static void OptFeature (const char* Opt attribute ((unused)), const char* Arg)
|
||||
/* Set an emulation feature */
|
||||
{
|
||||
/* Make a string buffer from Arg */
|
||||
StrBuf Feature;
|
||||
/* Make a string buffer from Arg and use it to find the feature. */
|
||||
StrBuf StrFeature;
|
||||
feature_t Feature = FindFeature (SB_InitFromString (&StrFeature, Arg));
|
||||
|
||||
/* Set the feature, check for errors */
|
||||
if (SetFeature (SB_InitFromString (&Feature, Arg)) == FEAT_UNKNOWN) {
|
||||
/* Enable the feature, check for errors */
|
||||
if (Feature == FEAT_UNKNOWN) {
|
||||
AbEnd ("Illegal emulation feature: '%s'", Arg);
|
||||
} else {
|
||||
SetFeature (Feature, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -656,6 +659,15 @@ static void OptVersion (const char* Opt attribute ((unused)),
|
|||
|
||||
|
||||
|
||||
static void OptWarningsAsErrors (const char* Opt attribute ((unused)),
|
||||
const char* Arg attribute ((unused)))
|
||||
/* Generate an error if any warnings occur */
|
||||
{
|
||||
WarningsAsErrors = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void DoPCAssign (void)
|
||||
/* Start absolute code */
|
||||
{
|
||||
|
@ -919,27 +931,28 @@ int main (int argc, char* argv [])
|
|||
{
|
||||
/* Program long options */
|
||||
static const LongOpt OptTab[] = {
|
||||
{ "--auto-import", 0, OptAutoImport },
|
||||
{ "--bin-include-dir", 1, OptBinIncludeDir },
|
||||
{ "--cpu", 1, OptCPU },
|
||||
{ "--create-dep", 1, OptCreateDep },
|
||||
{ "--create-full-dep", 1, OptCreateFullDep },
|
||||
{ "--debug", 0, OptDebug },
|
||||
{ "--debug-info", 0, OptDebugInfo },
|
||||
{ "--feature", 1, OptFeature },
|
||||
{ "--help", 0, OptHelp },
|
||||
{ "--ignore-case", 0, OptIgnoreCase },
|
||||
{ "--include-dir", 1, OptIncludeDir },
|
||||
{ "--large-alignment", 0, OptLargeAlignment },
|
||||
{ "--list-bytes", 1, OptListBytes },
|
||||
{ "--listing", 1, OptListing },
|
||||
{ "--memory-model", 1, OptMemoryModel },
|
||||
{ "--pagelength", 1, OptPageLength },
|
||||
{ "--relax-checks", 0, OptRelaxChecks },
|
||||
{ "--smart", 0, OptSmart },
|
||||
{ "--target", 1, OptTarget },
|
||||
{ "--verbose", 0, OptVerbose },
|
||||
{ "--version", 0, OptVersion },
|
||||
{ "--auto-import", 0, OptAutoImport },
|
||||
{ "--bin-include-dir", 1, OptBinIncludeDir },
|
||||
{ "--cpu", 1, OptCPU },
|
||||
{ "--create-dep", 1, OptCreateDep },
|
||||
{ "--create-full-dep", 1, OptCreateFullDep },
|
||||
{ "--debug", 0, OptDebug },
|
||||
{ "--debug-info", 0, OptDebugInfo },
|
||||
{ "--feature", 1, OptFeature },
|
||||
{ "--help", 0, OptHelp },
|
||||
{ "--ignore-case", 0, OptIgnoreCase },
|
||||
{ "--include-dir", 1, OptIncludeDir },
|
||||
{ "--large-alignment", 0, OptLargeAlignment },
|
||||
{ "--list-bytes", 1, OptListBytes },
|
||||
{ "--listing", 1, OptListing },
|
||||
{ "--memory-model", 1, OptMemoryModel },
|
||||
{ "--pagelength", 1, OptPageLength },
|
||||
{ "--relax-checks", 0, OptRelaxChecks },
|
||||
{ "--smart", 0, OptSmart },
|
||||
{ "--target", 1, OptTarget },
|
||||
{ "--verbose", 0, OptVerbose },
|
||||
{ "--version", 0, OptVersion },
|
||||
{ "--warnings-as-errors", 0, OptWarningsAsErrors },
|
||||
};
|
||||
|
||||
/* Name of the global name space */
|
||||
|
@ -1144,6 +1157,10 @@ int main (int argc, char* argv [])
|
|||
SegDump ();
|
||||
}
|
||||
|
||||
if (WarningCount > 0 && WarningsAsErrors) {
|
||||
Error("Warnings as errors");
|
||||
}
|
||||
|
||||
/* If we didn't have an errors, finish off the line infos */
|
||||
DoneLineInfo ();
|
||||
|
||||
|
|
|
@ -1023,7 +1023,10 @@ static void DoFatal (void)
|
|||
static void DoFeature (void)
|
||||
/* Switch the Feature option */
|
||||
{
|
||||
/* Allow a list of comma separated keywords */
|
||||
feature_t Feature;
|
||||
unsigned char On;
|
||||
|
||||
/* Allow a list of comma separated feature keywords with optional +/- or ON/OFF */
|
||||
while (1) {
|
||||
|
||||
/* We expect an identifier */
|
||||
|
@ -1034,18 +1037,24 @@ static void DoFeature (void)
|
|||
|
||||
/* Make the string attribute lower case */
|
||||
LocaseSVal ();
|
||||
|
||||
/* Set the feature and check for errors */
|
||||
if (SetFeature (&CurTok.SVal) == FEAT_UNKNOWN) {
|
||||
Feature = FindFeature(&CurTok.SVal);
|
||||
if (Feature == FEAT_UNKNOWN) {
|
||||
/* Not found */
|
||||
ErrorSkip ("Invalid feature: '%m%p'", &CurTok.SVal);
|
||||
return;
|
||||
} else {
|
||||
/* Skip the keyword */
|
||||
NextTok ();
|
||||
}
|
||||
NextTok ();
|
||||
|
||||
/* Optional +/- or ON/OFF */
|
||||
On = 1;
|
||||
if (CurTok.Tok != TOK_COMMA && !TokIsSep (CurTok.Tok)) {
|
||||
SetBoolOption(&On);
|
||||
}
|
||||
|
||||
/* Allow more than one keyword */
|
||||
/* Apply feature setting. */
|
||||
SetFeature (Feature, On);
|
||||
|
||||
/* Allow more than one feature separated by commas. */
|
||||
if (CurTok.Tok == TOK_COMMA) {
|
||||
NextTok ();
|
||||
} else {
|
||||
|
|
|
@ -306,7 +306,7 @@ void SegAlign (unsigned long Alignment, int FillVal)
|
|||
ActiveSeg->Align = CombinedAlignment;
|
||||
|
||||
/* Output a warning for larger alignments if not suppressed */
|
||||
if (CombinedAlignment >= LARGE_ALIGNMENT && !LargeAlignment) {
|
||||
if (CombinedAlignment >= LARGE_ALIGNMENT && CombinedAlignment > ActiveSeg->Align && CombinedAlignment > Alignment && !LargeAlignment) {
|
||||
Warning (0, "Combined alignment is suspiciously large (%lu)",
|
||||
CombinedAlignment);
|
||||
}
|
||||
|
|
|
@ -570,7 +570,18 @@ void SymCheck (void)
|
|||
|
||||
/* Check for open scopes */
|
||||
if (CurrentScope->Parent != 0) {
|
||||
Error ("Local scope was not closed");
|
||||
if (CurrentScope->Label) {
|
||||
/* proc has a label indicating the line it was opened. */
|
||||
LIError (&CurrentScope->Label->DefLines,
|
||||
"Local proc '%s' was not closed",
|
||||
GetString (CurrentScope->Name));
|
||||
} else {
|
||||
/* scope has no label to track a line number, uses end-of-document line instead.
|
||||
** Anonymous scopes will reveal their internal automatic name.
|
||||
*/
|
||||
Error ("Local scope '%s' was not closed",
|
||||
GetString (CurrentScope->Name));
|
||||
}
|
||||
}
|
||||
|
||||
/* First pass: Walk through all symbols, checking for undefined's and
|
||||
|
|
|
@ -1153,6 +1153,8 @@ static unsigned Opt_a_toscmpbool (StackOpData* D, const char* BoolTransformer)
|
|||
|
||||
/* Save lhs into zeropage */
|
||||
AddStoreLhsA (D);
|
||||
/* AddStoreLhsA may have moved the OpIndex, recalculate insertion point to prevent label migration. */
|
||||
D->IP = D->OpIndex + 1;
|
||||
|
||||
/* cmp */
|
||||
X = NewCodeEntry (OP65_CMP, AM65_ZP, D->ZPLo, 0, D->OpEntry->LI);
|
||||
|
@ -1206,6 +1208,8 @@ static unsigned Opt_a_tosicmp (StackOpData* D)
|
|||
/* RHS src is not directly comparable */
|
||||
X = NewCodeEntry (OP65_STA, AM65_ZP, D->ZPHi, 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->Rhs.A.ChgIndex + 1);
|
||||
/* RHS insertion may have moved the OpIndex, recalculate insertion point to prevent label migration. */
|
||||
D->IP = D->OpIndex + 1;
|
||||
|
||||
/* Cmp with stored RHS */
|
||||
X = NewCodeEntry (OP65_CMP, AM65_ZP, D->ZPHi, 0, D->OpEntry->LI);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user