mirror of
https://github.com/cc65/cc65.git
synced 2025-04-01 18:30:06 +00:00
Merge branch 'master' into ca65_jmp_abs_wrap_error
This commit is contained in:
commit
5ed7153841
Contributing.mdREADME.md
asminc
doc
include
libsrc
apple2
atari
atari5200/joy
atari7800/joy
atmos
c128
emd
joy
mou
ser
c16/emd
c64
emd
c64-65816.sc64-c256k.sc64-dqbb.sc64-georam.sc64-isepic.sc64-kerberos.sc64-ram.sc64-ramcart.sc64-reu.sc64-vdc.sdtv-himem.s
joy
mou
ser
cbm510
cbm610
common
creativision/joy
cx16
gamate/joy
geos-cbm
joystick
kim1
lynx
mouse
nes/joy
pce/joy
pet/joy
plus4
serial
supervision/joy
telestrat
vic20
samples/kim1
@ -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).
|
||||
|
@ -12,7 +12,7 @@ Core team members:
|
||||
* [Christian Groessler](https://github.com/groessler): Atari, Atari5200, and CreatiVision library Maintainer
|
||||
* [dqh](https://github.com/dqh-au): GHA help
|
||||
* [Greg King](https://github.com/greg-king5): all around hackery
|
||||
* [groepaz](https://github.com/mrdudz): CBM libary, Project Maintainer
|
||||
* [groepaz](https://github.com/mrdudz): CBM library, Project Maintainer
|
||||
* [Oliver Schmidt](https://github.com/oliverschmidt): Apple II library Maintainer
|
||||
|
||||
External contributors:
|
||||
|
@ -239,12 +239,12 @@ BASIC_BUF := $0200 ; Location of command-line
|
||||
BASIC_BUF_LEN = 81 ; Maximum length of command-line
|
||||
|
||||
SCREEN_PTR := $0262 ; Pointer to current row on text screen (16 bits)
|
||||
STATUS := $0289 ; Status from previous I/O operation
|
||||
IN_DEV := $028D ; Current input device number
|
||||
OUT_DEV := $028E ; Current output device number
|
||||
FNAM_LEN := $0291 ; Length of filename
|
||||
SECADR := $0293 ; Secondary address
|
||||
DEVNUM := $0294 ; Device number
|
||||
STATUS := $0287 ; Status from previous I/O operation
|
||||
IN_DEV := $028B ; Current input device number
|
||||
OUT_DEV := $028C ; Current output device number
|
||||
FNAM_LEN := $028F ; Length of filename
|
||||
SECADR := $0291 ; Secondary address
|
||||
DEVNUM := $0292 ; Device number
|
||||
CURS_COLOR := $0373 ; Color under the cursor
|
||||
CHARCOLOR := $0376 ; Cursor's color nybbles (high: background, low: foreground)
|
||||
RVS := $0377 ; Reverse flag
|
||||
@ -258,8 +258,8 @@ LLEN := $0386 ; Line length
|
||||
NLINES := $0387 ; Number of screen lines
|
||||
|
||||
; BASIC
|
||||
VARTAB := $03E2 ; Pointer to start of BASIC variables
|
||||
MEMSIZE := $03EA ; Pointer to highest BASIC RAM location (+1)
|
||||
VARTAB := $03E1 ; Pointer to start of BASIC variables
|
||||
MEMSIZE := $03E9 ; Pointer to highest BASIC RAM location (+1)
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Vector and other locations
|
||||
|
@ -15,6 +15,10 @@ OUTCHR := $1EA0 ; Output character
|
||||
INTCHR := $1E5A ; Input character without case conversion
|
||||
DUMPT := $1800 ; Dump memory to tape
|
||||
LOADT := $1873 ; Load memory from tape
|
||||
START := $1C4F ; Enter KIM-1 monitor
|
||||
SCANDS := $1F1F ; Scan 7-segment display
|
||||
KEYIN := $1F40 ; Open up keyboard channel
|
||||
GETKEY := $1F6A ; Return key from keyboard
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -277,6 +277,8 @@ XRECLK = $3C ; Reset clock
|
||||
XCLCL = $3D ; Close clock
|
||||
XWRCLK = $3E ; Displays clock in the address in A & Y registers
|
||||
|
||||
XFSEEK = $3F ; Only in Orix
|
||||
|
||||
; Sound primitives
|
||||
XSONPS = $40 ; Send data to PSG register (14 values)
|
||||
XOUPS = $42 ; Send Oups sound into PSG
|
||||
|
128
doc/ca65.sgml
128
doc/ca65.sgml
@ -184,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>
|
||||
@ -439,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>
|
||||
|
||||
@ -456,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>
|
||||
|
||||
@ -2027,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.
|
||||
@ -2037,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.
|
||||
@ -2120,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.
|
||||
|
||||
|
||||
|
||||
@ -2263,7 +2283,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
Switch on or off case sensitivity on identifiers. The default is off
|
||||
(that is, identifiers are case sensitive), but may be changed by the
|
||||
-i switch on the command line.
|
||||
The command must be followed by a '+' or '-' character to switch the
|
||||
The command can be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
@ -2412,7 +2432,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
Switch on or off debug info generation. The default is off (that is,
|
||||
the object file will not contain debug infos), but may be changed by the
|
||||
-g switch on the command line.
|
||||
The command must be followed by a '+' or '-' character to switch the
|
||||
The command can be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
@ -2522,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>,
|
||||
@ -2746,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>
|
||||
@ -2833,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
|
||||
@ -3044,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.
|
||||
@ -3055,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.
|
||||
@ -3327,7 +3380,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
Note: Line continuations do not work in a comment. A backslash at the
|
||||
end of a comment is treated as part of the comment and does not trigger
|
||||
line continuation.
|
||||
The command must be followed by a '+' or '-' character to switch the
|
||||
The command can be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
@ -3342,7 +3395,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
|
||||
<sect1><tt>.LIST</tt><label id=".LIST"><p>
|
||||
|
||||
Enable output to the listing. The command must be followed by a boolean
|
||||
Enable output to the listing. The command can be followed by a boolean
|
||||
switch ("on", "off", "+" or "-") and will enable or disable listing
|
||||
output.
|
||||
The option has no effect if the listing is not enabled by the command line
|
||||
@ -3987,7 +4040,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
|
||||
<sect1><tt>.SMART</tt><label id=".SMART"><p>
|
||||
|
||||
Switch on or off smart mode. The command must be followed by a '+' or '-'
|
||||
Switch on or off smart mode. The command can be followed by a '+' or '-'
|
||||
character to switch the option on or off respectively. The default is off
|
||||
(that is, the assembler doesn't try to be smart), but this default may be
|
||||
changed by the -s switch on the command line.
|
||||
@ -4002,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.
|
||||
@ -4207,8 +4262,13 @@ macro actually takes in the definition. You may also leave intermediate
|
||||
parameters empty. Empty parameters are replaced by empty space (that is,
|
||||
they are removed when the macro is expanded). If you have a look at our
|
||||
macro definition above, you will see, that replacing the "addr" parameter
|
||||
by nothing will lead to wrong code in most lines. To help you, writing
|
||||
macros with a variable parameter list, there are some control commands:
|
||||
by nothing will lead to wrong code in most lines.
|
||||
|
||||
The names "a", "x" and "y" should be avoided for macro parameters, as these
|
||||
will usually conflict with the 6502 registers.
|
||||
|
||||
For writing macros with a variable parameter list, control commands are
|
||||
available:
|
||||
|
||||
<tt><ref id=".IFBLANK" name=".IFBLANK"></tt> tests the rest of the line and
|
||||
returns true, if there are any tokens on the remainder of the line. Since
|
||||
@ -4219,15 +4279,15 @@ opposite.
|
||||
Look at this example:
|
||||
|
||||
<tscreen><verb>
|
||||
.macro ldaxy a, x, y
|
||||
.ifnblank a
|
||||
lda #a
|
||||
.macro ldaxy i, j, k
|
||||
.ifnblank i
|
||||
lda #i
|
||||
.endif
|
||||
.ifnblank x
|
||||
ldx #x
|
||||
.ifnblank j
|
||||
ldx #j
|
||||
.endif
|
||||
.ifnblank y
|
||||
ldy #y
|
||||
.ifnblank k
|
||||
ldy #k
|
||||
.endif
|
||||
.endmacro
|
||||
</verb></tscreen>
|
||||
|
@ -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>
|
||||
|
@ -741,7 +741,7 @@ Here is a description of all the command line options:
|
||||
<tag><tt/return-type/</tag>
|
||||
Warn about no return statement in function returning non-void.
|
||||
<tag><tt/struct-param/</tag>
|
||||
Warn when passing structs by value.
|
||||
Warn when passing structs by value. (Disabled by default.)
|
||||
<tag><tt/unknown-pragma/</tag>
|
||||
Warn about #pragmas that aren't recognized by cc65.
|
||||
<tag><tt/unreachable-code/</tag>
|
||||
@ -806,9 +806,8 @@ and the one defined by the ISO standard:
|
||||
|
||||
<item> The datatypes "float" and "double" are not available.
|
||||
<p>
|
||||
<item> C Functions may not return structs (or unions), and structs may not
|
||||
be passed as parameters by value. However, struct assignment *is*
|
||||
possible.
|
||||
<item> C Functions may pass and return structs (or unions) by value, but only
|
||||
of 1, 2 or 4 byte sizes.
|
||||
<p>
|
||||
<item> Most of the C library is available with only the fastcall calling
|
||||
convention (<ref id="extension-fastcall" name="see below">). It means
|
||||
|
@ -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.
|
||||
|
@ -45,8 +45,10 @@ system configuration before compiling and linking user programs.
|
||||
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points
|
||||
for useful subroutines in the KIM-1 monitor ROM. cc65 generated programs compiled and linked
|
||||
using 4k config run in the memory range of $200 - $0FFF. The 60k config expands
|
||||
this range to $DFFF. The starting memory location and entry point for running the program is
|
||||
$200, so when the program is transferred to the KIM-1, it is executed by typing '200 G'.
|
||||
this range to $DFFF. When using the 4k config the starting memory location and entry point
|
||||
for running the program is $200, so when the program is transferred to the KIM-1, it is
|
||||
executed by typing '200 G'. With the 60k config the default starting memory location and entry
|
||||
point is $2000.
|
||||
|
||||
Special locations:
|
||||
|
||||
@ -65,7 +67,7 @@ Special locations:
|
||||
|
||||
<sect>Platform specific header files<p>
|
||||
|
||||
Programs containing KIM-1 code may use the <tt/kim.h/ header file. See the header file for more information.
|
||||
Programs containing KIM-1 code may use the <tt/kim1.h/ header file. See the header file for more information.
|
||||
|
||||
<sect>Loadable drivers<p>
|
||||
|
||||
|
@ -56,5 +56,18 @@ int __fastcall__ loadt (unsigned char);
|
||||
/* Write to tape */
|
||||
int __fastcall__ dumpt (unsigned char, const void*, const void*);
|
||||
|
||||
/* End of sym1.h */
|
||||
|
||||
/* Write to 7-segment LED display. Due to hardware limitations it only
|
||||
** displays briefly, so must be called repeatedly to update the
|
||||
** display.
|
||||
**/
|
||||
void __fastcall__ scandisplay(unsigned char left, unsigned char middle, unsigned char right);
|
||||
|
||||
/*
|
||||
** Get a keypress from the keypad. Returns $00-$0F(0-F), $10(AD), $11(DA), $12(+),
|
||||
** $13(GO), $14(PC) or $15 for no keypress.
|
||||
**/
|
||||
int __fastcall__ getkey();
|
||||
|
||||
/* End of kim1.h */
|
||||
#endif
|
||||
|
@ -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
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -40,8 +40,6 @@ _init: cld ; Clear decimal mode
|
||||
|
||||
jsr _main
|
||||
|
||||
; Back from main (this is also the _exit entry). There may be a more elegant way to
|
||||
; return to the monitor on the KIM-1, but I don't know it!
|
||||
|
||||
_exit: brk
|
||||
; Back from main (this is also the _exit entry). Jumps to the KIM-1 monitor.
|
||||
|
||||
_exit: jmp START
|
||||
|
18
libsrc/kim1/getkey.s
Normal file
18
libsrc/kim1/getkey.s
Normal file
@ -0,0 +1,18 @@
|
||||
;
|
||||
; int __fastcall__ getkey();
|
||||
;
|
||||
|
||||
.include "kim1.inc"
|
||||
|
||||
.import popa
|
||||
|
||||
.export _getkey
|
||||
|
||||
.proc _getkey
|
||||
|
||||
jsr KEYIN ; Open up keyboard channel
|
||||
jsr GETKEY ; Get key code
|
||||
ldx #0 ; MSB of return value is zero
|
||||
rts
|
||||
|
||||
.endproc
|
@ -27,15 +27,10 @@ begin: dec ptr2
|
||||
beq done ; If buffer full, return
|
||||
|
||||
getch: jsr INTCHR ; Get character using Monitor ROM call
|
||||
;jsr OUTCHR ; Echo it
|
||||
and #$7F ; Clear top bit
|
||||
cmp #$07 ; Check for '\a'
|
||||
bne chkcr ; ...if BEL character
|
||||
;jsr BEEP ; Make beep sound TODO
|
||||
chkcr: cmp #$0D ; Check for '\r'
|
||||
cmp #$0D ; Check for '\r'
|
||||
bne putch ; ...if CR character
|
||||
lda #$0A ; Replace with '\n'
|
||||
jsr OUTCHR ; and echo it
|
||||
|
||||
putch: ldy #$00 ; Put char into return buffer
|
||||
sta (ptr1),y
|
||||
|
21
libsrc/kim1/scandisplay.s
Normal file
21
libsrc/kim1/scandisplay.s
Normal file
@ -0,0 +1,21 @@
|
||||
;
|
||||
; void __fastcall__ scandisplay(unsigned char left, unsigned char middle, unsigned char right);
|
||||
;
|
||||
|
||||
.include "kim1.inc"
|
||||
|
||||
.import popa
|
||||
|
||||
.export _scandisplay
|
||||
|
||||
.proc _scandisplay
|
||||
|
||||
sta $F9 ; Rightmost display data
|
||||
jsr popa
|
||||
sta $FA ; Middle display data
|
||||
jsr popa
|
||||
sta $FB ; Leftmost display data
|
||||
jsr SCANDS
|
||||
rts
|
||||
|
||||
.endproc
|
@ -28,11 +28,10 @@ begin: dec ptr2
|
||||
|
||||
outch: ldy #0
|
||||
lda (ptr1),y
|
||||
pha ; Save A (changed by OUTCHR)
|
||||
jsr OUTCHR ; Send character using Monitor call
|
||||
cmp #$07 ; Check for '\a'
|
||||
bne chklf ; ...if BEL character
|
||||
;jsr BEEP ; Make beep sound
|
||||
chklf: cmp #$0A ; Check for 'n'
|
||||
pla ; Restore A
|
||||
cmp #$0A ; Check for '\n'
|
||||
bne next ; ...if LF character
|
||||
lda #$0D ; Add a carriage return
|
||||
jsr OUTCHR
|
||||
|
@ -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
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
39
libsrc/telestrat/lseek.s
Normal file
39
libsrc/telestrat/lseek.s
Normal file
@ -0,0 +1,39 @@
|
||||
;
|
||||
; Jede (jede@oric.org), 2023-03-13
|
||||
;
|
||||
|
||||
; off_t __fastcall__ lseek(int fd, off_t offset, int whence);
|
||||
|
||||
.export _lseek
|
||||
|
||||
.include "telestrat.inc"
|
||||
.include "zeropage.inc"
|
||||
|
||||
.import popax
|
||||
|
||||
.proc _lseek
|
||||
; Save whence
|
||||
sta tmp1
|
||||
; Skip X
|
||||
|
||||
; Get offset and store
|
||||
|
||||
jsr popax
|
||||
sta tmp2
|
||||
stx tmp3
|
||||
|
||||
jsr popax
|
||||
sta RESB
|
||||
stx RESB+1
|
||||
|
||||
; Get FD
|
||||
jsr popax
|
||||
; Does not need X
|
||||
sta RES ; Save FD
|
||||
|
||||
lda tmp2
|
||||
ldy tmp3
|
||||
ldx tmp1 ; Get whence
|
||||
BRK_TELEMON XFSEEK
|
||||
rts
|
||||
.endproc
|
@ -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
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
52
samples/kim1/kimKeyDisp.c
Normal file
52
samples/kim1/kimKeyDisp.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* Example illustrating scandisplay() and getkey() functions. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <kim1.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int i, j, k, l;
|
||||
int last = 15;
|
||||
|
||||
printf("\nKIM-1 Demo\n");
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
for (k = 0; k < 16; k++) {
|
||||
scandisplay(i, j, k);
|
||||
|
||||
l = getkey();
|
||||
|
||||
if (l != last) {
|
||||
switch (l) {
|
||||
case 0x0: case 0x1: case 0x2: case 0x3:
|
||||
case 0x4: case 0x5: case 0x6: case 0x7:
|
||||
case 0x8: case 0x9: case 0xa: case 0xb:
|
||||
case 0xc: case 0xd: case 0xe: case 0xf:
|
||||
printf("Key pressed: %X\n", l);
|
||||
break;
|
||||
case 0x10:
|
||||
printf("Key pressed: AD\n");
|
||||
break;
|
||||
case 0x11:
|
||||
printf("Key pressed: DA\n");
|
||||
break;
|
||||
case 0x12:
|
||||
printf("Key pressed: +\n");
|
||||
break;
|
||||
case 0x13:
|
||||
printf("Key pressed: GO\n");
|
||||
break;
|
||||
case 0x14:
|
||||
printf("Key pressed: PC\n");
|
||||
break;
|
||||
}
|
||||
|
||||
last = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user