Merge branch 'cc65:master' into master
This commit is contained in:
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
**Compiler and OS**
|
||||
It is important to know what version of the compiler/assembler you used (call it with --version to get this info). Sometimes we also need to know what OS you are using.
|
||||
|
||||
**Describe the bug**
|
||||
Please tell us what you did, what happened, and what you expected to happen instead.
|
||||
|
||||
**To Reproduce**
|
||||
If it isnt obvious how to reproduce the problem, please give use some detailed instructions on how to reproduce it. Ideally provide a testcase (program) that we can put into the testbench later.
|
||||
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: feature request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
## Summary
|
||||
|
||||
Provide description of the bug (if an issue exists, link to it) and the fix.
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] The fix meets the codestyle requirements
|
||||
- [ ] New unit tests have been added to prevent future regressions
|
||||
- [ ] The documentation has been updated if necessary
|
||||
5
.github/checks/sorted.sh
vendored
5
.github/checks/sorted.sh
vendored
@@ -33,7 +33,8 @@ function checkarray_quoted_name
|
||||
}
|
||||
|
||||
|
||||
for N in `grep -rl "BEGIN SORTED.SH" "$CHECK_DIR"`; do
|
||||
checkarray_quoted_name $N
|
||||
FILES=$(find "$CHECK_DIR" -name \*.\[ch\] -print)
|
||||
for N in $FILES; do
|
||||
grep -q "BEGIN SORTED.SH" "$N" && checkarray_quoted_name "$N"
|
||||
done
|
||||
exit 0
|
||||
|
||||
7
.github/checks/sorted_codeopt.sh
vendored
7
.github/checks/sorted_codeopt.sh
vendored
@@ -63,7 +63,8 @@ function checkarray
|
||||
}
|
||||
|
||||
|
||||
find "$CHECK_DIR" -name \*.\[ch\] -print | while read N; do
|
||||
grep -q "BEGIN DECL SORTED_CODEOPT.SH" "$N" && checkarray $N
|
||||
FILES=$(find "$CHECK_DIR" -name \*.\[ch\] -print)
|
||||
for N in $FILES; do
|
||||
grep -q "BEGIN DECL SORTED_CODEOPT.SH" "$N" && checkarray "$N"
|
||||
done
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
5
.github/checks/sorted_opcodes.sh
vendored
5
.github/checks/sorted_opcodes.sh
vendored
@@ -34,7 +34,8 @@ function checkarray_quoted_name
|
||||
rm -rf .a.tmp
|
||||
}
|
||||
|
||||
for N in `grep -rl "BEGIN SORTED_OPCODES.SH" "$CHECK_DIR"`; do
|
||||
checkarray_quoted_name $N
|
||||
FILES=$(find "$CHECK_DIR" -name \*.\[ch\] -print)
|
||||
for N in $FILES; do
|
||||
grep -q "BEGIN SORTED_OPCODES.SH" "$N" && checkarray_quoted_name "$N"
|
||||
done
|
||||
exit 0
|
||||
|
||||
122
Code_of_Conduct.md
Normal file
122
Code_of_Conduct.md
Normal file
@@ -0,0 +1,122 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
groepaz@gmx.net.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
8
Makefile
8
Makefile
@@ -25,7 +25,9 @@ zip:
|
||||
|
||||
install:
|
||||
ifndef PREFIX
|
||||
$(error Error: PREFIX must be set for install to work)
|
||||
ifndef DESTDIR
|
||||
$(error Error: PREFIX or DESTDIR must be set for install to work)
|
||||
endif
|
||||
endif
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
@@ -73,7 +75,9 @@ util:
|
||||
|
||||
checkprefix:
|
||||
ifndef PREFIX
|
||||
$(warning Warning: PREFIX is empty - make install will not work)
|
||||
ifndef DESTDIR
|
||||
$(warning Warning: PREFIX and DESTDIR are empty - make install will not work)
|
||||
endif
|
||||
endif
|
||||
|
||||
# check the code style
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
; Just output the character
|
||||
_scrcode arg1
|
||||
|
||||
; Check for an identifier
|
||||
.elseif .match (.left (1, {arg1}), identifier)
|
||||
|
||||
; Just output the identifier
|
||||
_scrcode arg1
|
||||
|
||||
; Anything else is an error
|
||||
.else
|
||||
|
||||
|
||||
@@ -46,6 +46,12 @@
|
||||
; Just output the character
|
||||
_scrcode arg1
|
||||
|
||||
; Check for an identifier
|
||||
.elseif .match (.left (1, {arg1}), identifier)
|
||||
|
||||
; Just output the identifier
|
||||
_scrcode arg1
|
||||
|
||||
; Anything else is an error
|
||||
.else
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
; Just output the character
|
||||
_scrcode arg1
|
||||
|
||||
; Check for an identifier
|
||||
.elseif .match (.left (1, {arg1}), identifier)
|
||||
|
||||
; Just output the identifier
|
||||
_scrcode arg1
|
||||
|
||||
; Anything else is an error
|
||||
.else
|
||||
.error "scrcode: invalid argument type"
|
||||
|
||||
@@ -15,6 +15,8 @@ IndReg := $01 ; Controls indirect indexed load-store bank
|
||||
|
||||
TXTPTR := $85 ; Far pointer into BASIC source code
|
||||
FNAM := $90 ; Far pointer to LOAD/SAVE file-name
|
||||
FNAM_SEG := $92
|
||||
STATUS := $9C ; Kernal I/O completion status
|
||||
FNAM_LEN := $9D ; Holds length of file-name
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
@@ -15,6 +15,8 @@ IndReg := $01 ; Controls indirect indexed load-store bank
|
||||
|
||||
TXTPTR := $85 ; Far pointer into BASIC source code
|
||||
FNAM := $90 ; Far pointer to LOAD/SAVE file-name
|
||||
FNAM_SEG := $92
|
||||
STATUS := $9C ; Kernal I/O completion status
|
||||
FNAM_LEN := $9D ; Holds length of file-name
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,38 +1,4 @@
|
||||
; CPU bitmask constants (make sure this matches src/common/cpu.h)
|
||||
|
||||
CPU_ISET_NONE = $0001
|
||||
CPU_ISET_6502 = $0002
|
||||
CPU_ISET_6502X = $0004
|
||||
CPU_ISET_6502DTV = $0008
|
||||
CPU_ISET_65SC02 = $0010
|
||||
CPU_ISET_65C02 = $0020 ; Rockwell extensions
|
||||
CPU_ISET_65816 = $0040
|
||||
CPU_ISET_SWEET16 = $0080
|
||||
CPU_ISET_HUC6280 = $0100
|
||||
CPU_ISET_M740 = $0200
|
||||
CPU_ISET_4510 = $0400
|
||||
CPU_ISET_45GS02 = $0800
|
||||
CPU_ISET_W65C02 = $1000 ; WDC extensions
|
||||
CPU_ISET_65CE02 = $2000 ; CSG extensions
|
||||
|
||||
; CPU capabilities
|
||||
; make sure to only combine the instruction sets that are 100% compatible
|
||||
CPU_NONE = CPU_ISET_NONE
|
||||
CPU_6502 = CPU_ISET_6502
|
||||
CPU_6502X = CPU_ISET_6502X | CPU_ISET_6502
|
||||
CPU_6502DTV = CPU_ISET_6502DTV | CPU_ISET_6502
|
||||
CPU_65SC02 = CPU_ISET_65SC02 | CPU_ISET_6502
|
||||
CPU_65C02 = CPU_ISET_65C02 | CPU_ISET_6502 | CPU_ISET_65SC02
|
||||
CPU_W65C02 = CPU_ISET_W65C02 | CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02
|
||||
|
||||
; FIXME: CPU_ISET_65SC02 does not apply to the following, because the zp-indirect
|
||||
; addressing was replaced with zp-indirect,z-indexed in 652SCE02
|
||||
|
||||
CPU_HUC6280 = CPU_ISET_HUC6280 | CPU_ISET_6502 | CPU_ISET_65C02
|
||||
CPU_4510 = CPU_ISET_4510 | CPU_ISET_6502 | CPU_ISET_65C02 | CPU_ISET_65CE02
|
||||
CPU_45GS02 = CPU_ISET_45GS02 | CPU_ISET_6502 | CPU_ISET_65C02 | CPU_ISET_65CE02 | CPU_ISET_4510
|
||||
CPU_M740 = CPU_ISET_M740 | CPU_ISET_6502
|
||||
CPU_65CE02 = CPU_ISET_65CE02 | CPU_ISET_6502 | CPU_ISET_65C02
|
||||
|
||||
CPU_65816 = CPU_ISET_65816 | CPU_ISET_6502 | CPU_ISET_65SC02
|
||||
CPU_SWEET16 = CPU_ISET_SWEET16
|
||||
; This file is no longer needed as the symbols that were defined here are now
|
||||
; internal symbols generated by the assembler. It is kept to avoid breaking
|
||||
; old sources.
|
||||
.warning "'.macpack cpu' is no longer required"
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
; iax = ($0000,X)
|
||||
; rel = $0000 (PC-relative) (supressed here)
|
||||
|
||||
.macpack cpu
|
||||
|
||||
OPC_BRK = $00
|
||||
OPC_ORA_izx = $01
|
||||
OPC_ORA_zp = $05
|
||||
|
||||
@@ -10,6 +10,7 @@ VARTAB := $2A ; Pointer to start of BASIC variables
|
||||
MEMSIZE := $34 ; Size of memory installed
|
||||
TXTPTR := $77 ; Pointer into BASIC source code
|
||||
TIME := $8D ; 60HZ clock
|
||||
STATUS := $96 ; IEC status byte
|
||||
KEY_COUNT := $9E ; Number of keys in input buffer
|
||||
RVS := $9F ; Reverse flag
|
||||
CURS_FLAG := $A7 ; 1 = cursor off
|
||||
|
||||
@@ -39,7 +39,7 @@ MEMORY {
|
||||
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
EXTZP: load = ZP, type = zp;
|
||||
EXTZP: load = ZP, type = zp, optional = yes;
|
||||
EXEHDR: load = HEADER, type = ro, optional = yes;
|
||||
STARTUP: load = ROMS, type = ro, define = yes;
|
||||
ONCE: load = ROMS, type = ro, define = yes;
|
||||
|
||||
@@ -23,7 +23,7 @@ FEATURES {
|
||||
CONDES: type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__,
|
||||
segment = INIT;
|
||||
segment = ONCE;
|
||||
CONDES: type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__,
|
||||
|
||||
@@ -2,12 +2,32 @@ FEATURES {
|
||||
STARTADDRESS: default = $0400;
|
||||
}
|
||||
SYMBOLS {
|
||||
__BACKBUFSIZE__: type = weak, value = $2000;
|
||||
__HIMEM__: type = weak, value = $8000 - __BACKBUFSIZE__;
|
||||
__OVERLAYSIZE__: type = weak, value = $0000;
|
||||
__OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__;
|
||||
__STACKSIZE__: type = weak, value = $0400; # 1k stack
|
||||
__STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__;
|
||||
__BACKBUFSIZE__: type = weak, value = $2000;
|
||||
__HIMEM__: type = weak, value = $8000 - __BACKBUFSIZE__;
|
||||
__OVERLAYSIZE__: type = weak, value = $0000;
|
||||
__OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__;
|
||||
__STACKSIZE__: type = weak, value = $0400; # 1k stack
|
||||
__STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__;
|
||||
__VLIR0_BLOCKS__: type = export, value = ((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254;
|
||||
__VLIR1_BLOCKS__: type = export, value = ((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254;
|
||||
__VLIR2_BLOCKS__: type = export, value = ((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254;
|
||||
__VLIR3_BLOCKS__: type = export, value = ((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254;
|
||||
__VLIR4_BLOCKS__: type = export, value = ((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254;
|
||||
__VLIR5_BLOCKS__: type = export, value = ((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254;
|
||||
__VLIR6_BLOCKS__: type = export, value = ((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254;
|
||||
__VLIR7_BLOCKS__: type = export, value = ((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254;
|
||||
__VLIR8_BLOCKS__: type = export, value = ((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254;
|
||||
__VLIR9_BLOCKS__: type = export, value = ((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254;
|
||||
__VLIR10_BLOCKS__: type = export, value = ((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254;
|
||||
__VLIR11_BLOCKS__: type = export, value = ((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254;
|
||||
__VLIR12_BLOCKS__: type = export, value = ((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254;
|
||||
__VLIR13_BLOCKS__: type = export, value = ((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254;
|
||||
__VLIR14_BLOCKS__: type = export, value = ((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254;
|
||||
__VLIR15_BLOCKS__: type = export, value = ((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254;
|
||||
__VLIR16_BLOCKS__: type = export, value = ((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254;
|
||||
__VLIR17_BLOCKS__: type = export, value = ((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254;
|
||||
__VLIR18_BLOCKS__: type = export, value = ((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254;
|
||||
__VLIR19_BLOCKS__: type = export, value = ((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254;
|
||||
}
|
||||
MEMORY {
|
||||
CVT: file = %O, start = $0, size = $40000;
|
||||
|
||||
@@ -354,6 +354,8 @@ usage.
|
||||
<item>allow_lowercase
|
||||
<item>beep
|
||||
<item>dir_entry_count
|
||||
<item>file_set_auxtype
|
||||
<item>file_set_type
|
||||
<item>get_tv
|
||||
<item>get_ostype
|
||||
<item>gmtime_dt
|
||||
|
||||
@@ -333,6 +333,8 @@ usage.
|
||||
<item>_datetime
|
||||
<item>beep
|
||||
<item>dir_entry_count
|
||||
<item>file_set_auxtype
|
||||
<item>file_set_type
|
||||
<item>get_tv
|
||||
<item>get_ostype
|
||||
<item>gmtime_dt
|
||||
|
||||
318
doc/ca65.sgml
318
doc/ca65.sgml
@@ -94,23 +94,29 @@ Short options:
|
||||
-W n Set warning level n
|
||||
-d Debug mode
|
||||
-g Add debug info to object file
|
||||
-x Expand macros in the listing
|
||||
repeat -x for full expansion
|
||||
-h Help (this text)
|
||||
-i Ignore case of symbols
|
||||
-l name Create a listing file if assembly was ok
|
||||
-mm model Set the memory model
|
||||
-o name Name the output file
|
||||
-s Enable smart mode
|
||||
-S Generate segment offsets in listing
|
||||
-t sys Set the target system
|
||||
-v Increase verbosity
|
||||
|
||||
Long options:
|
||||
--auto-import Mark unresolved symbols as import
|
||||
--bin-include-dir dir Set a search path for binary includes
|
||||
--color [on|auto|off] Color diagnostics (default: auto)
|
||||
--cpu type Set cpu type
|
||||
--create-dep name Create a make dependency file
|
||||
--create-full-dep name Create a full make dependency file
|
||||
--debug Debug mode
|
||||
--debug-info Add debug info to object file
|
||||
--expand-macros Expand macros in listing
|
||||
Repeat to get full expansion
|
||||
--feature name Set an emulation feature
|
||||
--help Help (this text)
|
||||
--ignore-case Ignore case of symbols
|
||||
@@ -119,8 +125,10 @@ Long options:
|
||||
--listing name Create a listing file if assembly was ok
|
||||
--list-bytes n Maximum number of bytes per listing line
|
||||
--memory-model model Set the memory model
|
||||
--no-utf8 Disable use of UTF-8 in diagnostics
|
||||
--pagelength n Set the page length for the listing
|
||||
--relax-checks Disables some error checks
|
||||
--relax-checks Relax some checks (see docs)
|
||||
--segment-list Generate segment offsets in listing
|
||||
--smart Enable smart mode
|
||||
--target sys Set the target system
|
||||
--verbose Increase verbosity
|
||||
@@ -146,6 +154,14 @@ Here is a description of all the command line options:
|
||||
name="search paths">.
|
||||
|
||||
|
||||
<label id="option--color">
|
||||
<tag><tt>--color</tt></tag>
|
||||
|
||||
This option controls if the assembler will use colors when printing
|
||||
diagnostics. The default is "auto" which will enable colors if the output
|
||||
goes to a terminal (not to a file).
|
||||
|
||||
|
||||
<label id="option--cpu">
|
||||
<tag><tt>--cpu type</tt></tag>
|
||||
|
||||
@@ -192,6 +208,16 @@ Here is a description of all the command line options:
|
||||
mortals:-)
|
||||
|
||||
|
||||
<label id="option-D">
|
||||
<tag><tt>-D</tt></tag>
|
||||
|
||||
This option allows you to define symbols on the command line. Without a
|
||||
value, the symbol is defined with the value zero. When giving a value,
|
||||
you may use the '$' prefix for hexadecimal symbols. Please note
|
||||
that for some operating systems, '$' has a special meaning, so
|
||||
you may have to quote the expression.
|
||||
|
||||
|
||||
<label id="option--feature">
|
||||
<tag><tt>--feature name</tt></tag>
|
||||
|
||||
@@ -221,6 +247,16 @@ Here is a description of all the command line options:
|
||||
Print the short option summary shown above.
|
||||
|
||||
|
||||
<label id="option-I">
|
||||
<tag><tt>-I dir, --include-dir dir</tt></tag>
|
||||
|
||||
Name a directory which is searched for include files. The option may be
|
||||
used more than once to specify more than one directory to search. The
|
||||
current directory is always searched first before considering any
|
||||
additional directories. See also the section about <ref id="search-paths"
|
||||
name="search paths">.
|
||||
|
||||
|
||||
<label id="option-i">
|
||||
<tag><tt>-i, --ignore-case</tt></tag>
|
||||
|
||||
@@ -259,6 +295,14 @@ Here is a description of all the command line options:
|
||||
huge.
|
||||
|
||||
|
||||
<label id="option--no-utf8">
|
||||
<tag><tt>--no-utf8</tt></tag>
|
||||
|
||||
Disable the use of UTF-8 characters in diagnostics. This might be necessary
|
||||
if auto detection fails or if the output is captured for processing with a
|
||||
tool that is not UTF-8 capable.
|
||||
|
||||
|
||||
<label id="option-o">
|
||||
<tag><tt>-o name</tt></tag>
|
||||
|
||||
@@ -292,6 +336,12 @@ Here is a description of all the command line options:
|
||||
</itemize>
|
||||
|
||||
|
||||
<label id="option-S">
|
||||
<tag><tt>-S, --segment-list</tt></tag>
|
||||
|
||||
Add the segment ID in front of each address in the listing file.
|
||||
|
||||
|
||||
<label id="option-s">
|
||||
<tag><tt>-s, --smart-mode</tt></tag>
|
||||
|
||||
@@ -321,34 +371,6 @@ Here is a description of all the command line options:
|
||||
overridden by using the <tt/<ref id="option--cpu" name="--cpu">/ option.
|
||||
|
||||
|
||||
<label id="option-v">
|
||||
<tag><tt>-v, --verbose</tt></tag>
|
||||
|
||||
Increase the assembler verbosity. Usually only needed for debugging
|
||||
purposes. You may use this option more than one time for even more
|
||||
verbose output.
|
||||
|
||||
|
||||
<label id="option-D">
|
||||
<tag><tt>-D</tt></tag>
|
||||
|
||||
This option allows you to define symbols on the command line. Without a
|
||||
value, the symbol is defined with the value zero. When giving a value,
|
||||
you may use the '$' prefix for hexadecimal symbols. Please note
|
||||
that for some operating systems, '$' has a special meaning, so
|
||||
you may have to quote the expression.
|
||||
|
||||
|
||||
<label id="option-I">
|
||||
<tag><tt>-I dir, --include-dir dir</tt></tag>
|
||||
|
||||
Name a directory which is searched for include files. The option may be
|
||||
used more than once to specify more than one directory to search. The
|
||||
current directory is always searched first before considering any
|
||||
additional directories. See also the section about <ref id="search-paths"
|
||||
name="search paths">.
|
||||
|
||||
|
||||
<label id="option-U">
|
||||
<tag><tt>-U, --auto-import</tt></tag>
|
||||
|
||||
@@ -361,6 +383,14 @@ Here is a description of all the command line options:
|
||||
which is not always true for assembler programmers.
|
||||
|
||||
|
||||
<label id="option-v">
|
||||
<tag><tt>-v, --verbose</tt></tag>
|
||||
|
||||
Increase the assembler verbosity. Usually only needed for debugging
|
||||
purposes. You may use this option more than one time for even more
|
||||
verbose output.
|
||||
|
||||
|
||||
<label id="option-V">
|
||||
<tag><tt>-V, --version</tt></tag>
|
||||
|
||||
@@ -383,6 +413,12 @@ Here is a description of all the command line options:
|
||||
An error will be generated if any warnings were produced.
|
||||
|
||||
|
||||
<label id="option-x">
|
||||
<tag><tt>-x, --expand-macros</tt></tag>
|
||||
|
||||
In the listing file, show exactly how macros were expanded. Use twice for
|
||||
more verbose output.
|
||||
|
||||
</descrip>
|
||||
<p>
|
||||
|
||||
@@ -918,6 +954,7 @@ See the description of the <tt><ref id=".PROC" name=".PROC"></tt>
|
||||
directive for more information.
|
||||
|
||||
|
||||
<label id=cheap-locals>
|
||||
<sect1>Cheap local labels<p>
|
||||
|
||||
Cheap local labels are defined like standard labels, but the name of the
|
||||
@@ -1401,16 +1438,44 @@ writable.
|
||||
Reading this pseudo variable will give a constant integer value that
|
||||
tells which CPU is currently enabled. It can also tell which instruction
|
||||
set the CPU is able to translate. The value read from the pseudo variable
|
||||
should be further examined by using one of the constants defined by the
|
||||
"cpu" macro package (see <tt/<ref id=".MACPACK" name=".MACPACK">/).
|
||||
should be further examined by using one of the following constants:
|
||||
|
||||
It may be used to replace the .IFPxx pseudo instructions or to construct
|
||||
even more complex expressions.
|
||||
<tscreen><verb>
|
||||
CPU_6502
|
||||
CPU_65SC02
|
||||
CPU_65C02
|
||||
CPU_65816
|
||||
CPU_SWEET16
|
||||
CPU_HUC6280
|
||||
CPU_4510
|
||||
CPU_45GS02
|
||||
CPU_6502DTV
|
||||
CPU_M740
|
||||
</verb></tscreen>
|
||||
|
||||
Above constants may be used to determine the exact type of the currently
|
||||
enabled CPU. In addition to that, for each CPU instruction set, another
|
||||
constant is defined:
|
||||
|
||||
<tscreen><verb>
|
||||
CPU_ISET_6502
|
||||
CPU_ISET_65SC02
|
||||
CPU_ISET_65C02
|
||||
CPU_ISET_65816
|
||||
CPU_ISET_SWEET16
|
||||
CPU_ISET_HUC6280
|
||||
CPU_ISET_4510
|
||||
CPU_ISET_45GS02
|
||||
CPU_ISET_6502DTV
|
||||
CPU_ISET_M740
|
||||
</verb></tscreen>
|
||||
|
||||
<tt/.CPU/ may be used to replace the .IFPxx pseudo instructions or to
|
||||
construct even more complex expressions.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.macpack cpu
|
||||
.if (.cpu .bitand CPU_ISET_65816)
|
||||
phx
|
||||
phy
|
||||
@@ -1422,6 +1487,44 @@ writable.
|
||||
.endif
|
||||
</verb></tscreen>
|
||||
|
||||
<bf>The dilemma:</bf>
|
||||
|
||||
The original design of this feature was made under the assumption, that any
|
||||
"higher" CPU will support the entire instruction set of the "lower" CPU. For
|
||||
example: the WDC W65C02 supports all instructions of the 65C02, which again
|
||||
support all instructions of the 65SC02. Unfortunately this is not true for all
|
||||
CMOS CPUs - when the 65CE02 was made, some instructions were changed, and a new
|
||||
addressingmode was added. As a result all CPUS after (and including) 65CE02
|
||||
are no more (source code) compatible with all instructions originally introduced
|
||||
by the 65SC02.
|
||||
|
||||
Because of this, the .CPU function and the ISET* macros were repurposed to
|
||||
indicate <em>groups of instructions</em> only, ie only the set of instructions
|
||||
that was added by that particular CPU. In the value returned by .CPU only the
|
||||
bits will be set, that refer to the groups of instructions that are completely
|
||||
supported by that CPU.
|
||||
|
||||
The advantage of this is, that the mechanism keeps working for all new CPUs
|
||||
added. The inevitable disadvantage is that you now have to know exactly which
|
||||
CPU added which instructions (look <htmlurl url="cpus.html" name="here"> for reference).
|
||||
|
||||
<tscreen><verb>
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
; This will be assembled for the W65C02, 65C02, 65SC02, 65816, HUC6820
|
||||
lda (c_sp)
|
||||
.elseif (.cpu .bitand CPU_ISET_65CE02)
|
||||
; This will be assembled for the 65CE02, 4510, 45GS02
|
||||
ldz #$00
|
||||
lda (c_sp),z
|
||||
.else
|
||||
ldy #$00
|
||||
lda (c_sp),y
|
||||
.endif
|
||||
</verb></tscreen>
|
||||
|
||||
See also: <tt><ref id=".CAP" name=".CAP"></tt>, which is a similar mechanism,
|
||||
but without the problem outlined above.
|
||||
|
||||
|
||||
<sect1><tt>.ISIZE</tt><label id=".ISIZE"><p>
|
||||
|
||||
@@ -1594,6 +1697,61 @@ either a string or an expression value.
|
||||
|
||||
|
||||
|
||||
<sect1><tt>.CAP, .CAPABILITY</tt><label id=".CAP"><p>
|
||||
|
||||
Builtin function. The function allows to check for capabilities of the
|
||||
currently selected CPU or target system. It must be called with a comma
|
||||
separated list of identifiers and returns non zero if all of the given
|
||||
capabilities are available. Otherwise it returns zero.
|
||||
|
||||
Existing capabilities are:
|
||||
|
||||
<descrip>
|
||||
|
||||
<tag><tt>CPU_HAS_BITIMM</tt></tag>
|
||||
Checks for the availability of the "bit #imm" instruction.
|
||||
|
||||
<tag><tt>CPU_HAS_BRA8</tt></tag>
|
||||
Checks for the availability of a short (8 bit) branch.
|
||||
|
||||
<tag><tt>CPU_HAS_INA</tt></tag>
|
||||
Checks for the availability of accu inc/dec instructions.
|
||||
|
||||
<tag><tt>CPU_HAS_PUSHXY</tt></tag>
|
||||
Checks for the capability to push and pop the X and Y registers.
|
||||
|
||||
<tag><tt>CPU_HAS_ZPIND</tt></tag>
|
||||
Checks for the availability of the "zeropage indirect" addressing mode as it
|
||||
is implemented in the 65SC02 CPU.
|
||||
|
||||
<tag><tt>CPU_HAS_STZ</tt></tag>
|
||||
Checks for the availability of the "store zero" instruction as it is
|
||||
implemented in the 65SC02 CPU.
|
||||
|
||||
</descrip>
|
||||
|
||||
Case is ignored when checking the identifiers. The <tt/.cap/ function is
|
||||
easier to use than checking <tt/.cpu/ and requires no intimate knowledge
|
||||
of all instruction sets. For more detailed checking <tt/.cpu/ is still
|
||||
available.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.if .cap(CPU_HAS_BRA, CPU_HAS_PUSHXY)
|
||||
phx
|
||||
bra L1
|
||||
.else
|
||||
txa
|
||||
pha
|
||||
jmp L1
|
||||
.endif
|
||||
</verb></tscreen>
|
||||
|
||||
See also: <tt><ref id=".CPU" name=".CPU"></tt>
|
||||
|
||||
|
||||
|
||||
<sect1><tt>.CONCAT</tt><label id=".CONCAT"><p>
|
||||
|
||||
Builtin string function. The function allows to concatenate a list of string
|
||||
@@ -3633,20 +3791,23 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
|
||||
<sect1><tt>.LOCAL</tt><label id=".LOCAL"><p>
|
||||
|
||||
This command may only be used inside a macro definition. It declares a
|
||||
list of identifiers as local to the macro expansion.
|
||||
This command may only be used inside a macro definition. It declares a list
|
||||
of identifiers as local to the macro expansion. The identifers may be
|
||||
standard identifiers or cheap local identifiers depending on the planed use.
|
||||
|
||||
A problem when using macros are labels: Since they don't change their name,
|
||||
you get a "duplicate symbol" error if the macro is expanded the second time.
|
||||
Labels declared with <tt><ref id=".LOCAL" name=".LOCAL"></tt> have their
|
||||
name mapped to an internal unique name (<tt/___ABCD__/) with each macro
|
||||
name replaced by an internally generated unique name for each macro
|
||||
invocation.
|
||||
|
||||
Some other assemblers start a new lexical block inside a macro expansion.
|
||||
This has some drawbacks however, since that will not allow <em/any/ symbol
|
||||
to be visible outside a macro, a feature that is sometimes useful. The
|
||||
<tt><ref id=".LOCAL" name=".LOCAL"></tt> command is in my eyes a better way
|
||||
to address the problem.
|
||||
Please note that while the generated names are unique and guaranteed to not
|
||||
clash with any user generated names, they are still regular symbols and
|
||||
added to the current scope. This means that a local macro label will start a
|
||||
new scope for cheap locals whenever the macro is expanded. To avoid that,
|
||||
you may also use a <ref id="cheap-locals" name="cheap local symbol"> for the
|
||||
name. In this case the assembler will generate unique cheap local
|
||||
identifiers instead of standard ones.
|
||||
|
||||
You get an error when using <tt><ref id=".LOCAL" name=".LOCAL"></tt> outside
|
||||
a macro.
|
||||
@@ -3685,7 +3846,6 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
<tscreen><verb>
|
||||
atari Defines the scrcode macro.
|
||||
cbm Defines the scrcode macro.
|
||||
cpu Defines constants for the .CPU variable.
|
||||
generic Defines generic macros like add, sub, and blt.
|
||||
longbranch Defines conditional long-jump macros.
|
||||
</verb></tscreen>
|
||||
@@ -4985,69 +5145,6 @@ This macro package defines a macro named <tt/scrcode/. It takes a string
|
||||
as argument and places this string into memory translated into screen codes.
|
||||
|
||||
|
||||
<sect1><tt>.MACPACK cpu</tt><p>
|
||||
|
||||
This macro package does not define any macros but constants used to examine
|
||||
the value read from the <tt/<ref id=".CPU" name=".CPU">/ pseudo variable. For
|
||||
each supported CPU a constant similar to
|
||||
|
||||
<tscreen><verb>
|
||||
CPU_6502
|
||||
CPU_65SC02
|
||||
CPU_65C02
|
||||
CPU_65816
|
||||
CPU_SWEET16
|
||||
CPU_HUC6280
|
||||
CPU_4510
|
||||
CPU_45GS02
|
||||
CPU_6502DTV
|
||||
CPU_M740
|
||||
</verb></tscreen>
|
||||
|
||||
is defined. These constants may be used to determine the exact type of the
|
||||
currently enabled CPU. In addition to that, for each CPU instruction set,
|
||||
another constant is defined:
|
||||
|
||||
<tscreen><verb>
|
||||
CPU_ISET_6502
|
||||
CPU_ISET_65SC02
|
||||
CPU_ISET_65C02
|
||||
CPU_ISET_65816
|
||||
CPU_ISET_SWEET16
|
||||
CPU_ISET_HUC6280
|
||||
CPU_ISET_4510
|
||||
CPU_ISET_45GS02
|
||||
CPU_ISET_6502DTV
|
||||
CPU_ISET_M740
|
||||
</verb></tscreen>
|
||||
|
||||
The value read from the <tt/<ref id=".CPU" name=".CPU">/ pseudo variable may
|
||||
be checked with <tt/<ref id="operators" name=".BITAND">/ to determine if the
|
||||
currently enabled CPU supports a specific instruction set. For example the
|
||||
65C02 supports all instructions of the 65SC02 CPU, so it has the
|
||||
<tt/CPU_ISET_65SC02/ bit set in addition to its native <tt/CPU_ISET_65C02/
|
||||
bit. Using
|
||||
|
||||
<tscreen><verb>
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
lda (c_sp)
|
||||
.else
|
||||
ldy #$00
|
||||
lda (c_sp),y
|
||||
.endif
|
||||
</verb></tscreen>
|
||||
|
||||
it is possible to determine if the
|
||||
|
||||
<tscreen><verb>
|
||||
lda (c_sp)
|
||||
</verb></tscreen>
|
||||
|
||||
instruction is supported, which is the case for the 65SC02, 65C02 and 65816
|
||||
CPUs (the latter two are upwards compatible to the 65SC02).
|
||||
|
||||
see section <ref id="6502-mode" name="6502 format"> and following.
|
||||
|
||||
<sect1><tt>.MACPACK module</tt><p>
|
||||
|
||||
This macro package defines a macro named <tt/module_header/. It takes an
|
||||
@@ -5062,6 +5159,7 @@ For better orthogonality, the assembler defines similar symbols as the
|
||||
compiler, depending on the target system selected:
|
||||
|
||||
<itemize>
|
||||
<item><tt/__AGAT__/ - Target system is <tt/agat/
|
||||
<item><tt/__APPLE2__/ - Target system is <tt/apple2/ or <tt/apple2enh/
|
||||
<item><tt/__APPLE2ENH__/ - Target system is <tt/apple2enh/
|
||||
<item><tt/__ATARI2600__/ - Target system is <tt/atari2600/
|
||||
@@ -5074,23 +5172,31 @@ compiler, depending on the target system selected:
|
||||
<item><tt/__C128__/ - Target system is <tt/c128/
|
||||
<item><tt/__C16__/ - Target system is <tt/c16/ or <tt/plus4/
|
||||
<item><tt/__C64__/ - Target system is <tt/c64/
|
||||
<item><tt/__C65__/ - Target system is <tt/c65/
|
||||
<item><tt/__CBM__/ - Target is a Commodore or Commodore-alike system
|
||||
<item><tt/__CBM510__/ - Target system is <tt/cbm510/
|
||||
<item><tt/__CBM610__/ - Target system is <tt/cbm610/
|
||||
<item><tt/__CREATIVISION__/ - Target system is <tt/creativision/
|
||||
<item><tt/__CX16__/ - Target system is <tt/cx16/
|
||||
<item><tt/__GAMATE__/ - Target system is <tt/gamate/
|
||||
<item><tt/__GEOS__/ - Target is a GEOS system
|
||||
<item><tt/__GEOS_APPLE__/ - Target system is <tt/geos-apple/
|
||||
<item><tt/__GEOS_CBM__/ - Target system is <tt/geos-cbm/
|
||||
<item><tt/__KIM1__/ - Target system is <tt/kim1/
|
||||
<item><tt/__LUNIX__/ - Target system is <tt/lunix/
|
||||
<item><tt/__LYNX__/ - Target system is <tt/lynx/
|
||||
<item><tt/__MEGA65__/ - Target system is <tt/mega65/
|
||||
<item><tt/__NES__/ - Target system is <tt/nes/
|
||||
<item><tt/__OSIC1P__/ - Target system is <tt/osic1p/
|
||||
<item><tt/__PCE__/ - Target system is <tt/pce/
|
||||
<item><tt/__PET__/ - Target system is <tt/pet/
|
||||
<item><tt/__PLUS4__/ - Target system is <tt/plus4/
|
||||
<item><tt/__RP6502__/ - Target system is <tt/rp6502/
|
||||
<item><tt/__SIM6502__/ - Target system is <tt/sim6502/
|
||||
<item><tt/__SIM65C02__/ - Target system is <tt/sim65c02/
|
||||
<item><tt/__SUPERVISION__/ - Target system is <tt/supervision/
|
||||
<item><tt/__SYM1__/ - Target system is <tt/sym1/
|
||||
<item><tt/__TELESTRAT__/ - Target system is <tt/telestrat/
|
||||
<item><tt/__VIC20__/ - Target system is <tt/vic20/
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ Long options:
|
||||
--target sys Set the target system
|
||||
--verbose Increase verbosity
|
||||
--version Print the compiler version number
|
||||
--warnings-as-errors Treat warnings as errors
|
||||
--writable-strings Make string literals writable
|
||||
---------------------------------------------------------------------------
|
||||
</verb></tscreen>
|
||||
@@ -514,6 +515,28 @@ Here is a description of all the command line options:
|
||||
name="#pragma local-strings"></tt> for fine grained control.
|
||||
|
||||
|
||||
<tag><tt>-mm model, --memory-model model</tt></tag>
|
||||
|
||||
This option sets the code and data models for the compiler to use. Please
|
||||
note that memory models are an unfinished feature and using this option
|
||||
with any other memory model than <tt/near/ will cause compile errors.
|
||||
Possible arguments are:
|
||||
|
||||
<descrip>
|
||||
<tag/near/
|
||||
This memory model uses 16 bit addresses for code and data. It is
|
||||
currently the only supported memory model and suited for the 6502.
|
||||
|
||||
<tag/far/
|
||||
This memory model uses 24 bit addresses for code and 16 bit addresses
|
||||
for data. It is suited for the 65816 but currently unsupported.
|
||||
|
||||
<tag/huge/
|
||||
This memory model uses 24 bit addresses for code and data. It is
|
||||
suited for the 65816 but currently unsupported.
|
||||
</descrip>
|
||||
|
||||
|
||||
<tag><tt>-o name</tt></tag>
|
||||
|
||||
Specify the name of the output file. If you don't specify a name, the
|
||||
@@ -641,7 +664,7 @@ Here is a description of all the command line options:
|
||||
<item>pce (PC engine)
|
||||
<item>pet (all CBM PET systems except the 2001)
|
||||
<item>plus4
|
||||
<item>p6502
|
||||
<item>rp6502
|
||||
<item>sim6502
|
||||
<item>sim65c02
|
||||
<item>supervision
|
||||
@@ -656,6 +679,15 @@ Here is a description of all the command line options:
|
||||
or warnings are encountered.
|
||||
|
||||
|
||||
<label id="option--warnings-as-errors">
|
||||
<tag><tt>--warnings-as-errors</tt></tag>
|
||||
|
||||
Treat all warnings as error. This makes the compiler exit with an appropriate
|
||||
error code in case of warnings. The effect of this switch is identical to
|
||||
the command line option <tt/<ref id="option-W" name="-W error">/. It is
|
||||
available for compatibility with the other tools.
|
||||
|
||||
|
||||
<label id="option-writable-strings">
|
||||
<tag><tt>--writable-strings</tt></tag>
|
||||
|
||||
@@ -766,7 +798,9 @@ Here is a description of all the command line options:
|
||||
<tag><tt/const-comparison/</tag>
|
||||
Warn if the result of a comparison is constant.
|
||||
<tag><tt/error/</tag>
|
||||
Treat all warnings as errors.
|
||||
Treat all warnings as errors. This has the same effect as using the
|
||||
<tt/<ref id="option--warnings-as-errors" name="--warnings-as-errors">/
|
||||
option.
|
||||
<tag><tt/no-effect/</tag>
|
||||
Warn about statements that don't have an effect.
|
||||
<tag><tt/pointer-sign/</tag>
|
||||
@@ -1112,6 +1146,10 @@ This cc65 version has some extensions to the ISO C standard.
|
||||
The compiler defines several macros at startup:
|
||||
|
||||
<descrip>
|
||||
<tag><tt>__AGAT__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Agat (-t agat).
|
||||
|
||||
<tag><tt>__APPLE2__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Apple ][ (-t apple2) or the enhanced Apple //e (-t apple2enh).
|
||||
@@ -1122,11 +1160,15 @@ The compiler defines several macros at startup:
|
||||
|
||||
<tag><tt>__ATARI2600__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Atari 2600 game console.
|
||||
This macro is defined if the target is the Atari 2600 game console (-t atari2600).
|
||||
|
||||
<tag><tt>__ATARI5200__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Atari 5200 game console.
|
||||
This macro is defined if the target is the Atari 5200 game console (-t atari5200).
|
||||
|
||||
<tag><tt>__ATARI7800__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Atari 7800 game console (-t atari7800).
|
||||
|
||||
<tag><tt>__ATARI__</tt></tag>
|
||||
|
||||
@@ -1140,6 +1182,10 @@ The compiler defines several macros at startup:
|
||||
|
||||
This macro is defined if the target is the Oric Atmos (-t atmos).
|
||||
|
||||
<tag><tt>__BBC__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the BBC (-t bbc).
|
||||
|
||||
<tag><tt>__C128__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Commodore 128 (-t c128).
|
||||
@@ -1152,6 +1198,10 @@ The compiler defines several macros at startup:
|
||||
|
||||
This macro is defined if the target is the Commodore 64 (-t c64).
|
||||
|
||||
<tag><tt>__C65__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Commodore 65 (-t c65).
|
||||
|
||||
<tag><tt>__CBM__</tt></tag>
|
||||
|
||||
This macro is defined if the target system is one of the CBM targets.
|
||||
@@ -1196,10 +1246,8 @@ The compiler defines several macros at startup:
|
||||
<label id="macro-CPU">
|
||||
<tag><tt>__CPU__</tt></tag>
|
||||
|
||||
This macro contains a bitset that allows to check if a specific instruction
|
||||
set is supported. For example, the 65C02 CPU supports all instructions of the
|
||||
65SC02. So testing for the instruction set of the 65SC02 using the following
|
||||
check will succeed for both CPUs (and also for the 65816 and HUC6280).
|
||||
This macro contains a bitset that allows to check if a specific group of
|
||||
instructions is supported.
|
||||
|
||||
<tscreen><verb>
|
||||
#if (__CPU__ & __CPU_ISET_65SC02__)
|
||||
@@ -1212,6 +1260,13 @@ The compiler defines several macros at startup:
|
||||
given, but can be changed using the <tt/<ref id="option--cpu" name="--cpu">/
|
||||
command line option.
|
||||
|
||||
Note that, since the different CMOS instruction sets are not orthogonal, the
|
||||
following test macros only test for the group of instructions <bf>added</bf>
|
||||
by this particular CPU.
|
||||
|
||||
see <htmlurl url="ca65.html#.CPU" name=".CPU"> for details on the ISET*
|
||||
dilemma.
|
||||
|
||||
<tag><tt>__CPU_4510__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 4510 CPU.
|
||||
@@ -1321,6 +1376,10 @@ The compiler defines several macros at startup:
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the W65C02 CPU.
|
||||
|
||||
<tag><tt>__CREATIVISION__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the VTech Creativision game console (-t creativision).
|
||||
|
||||
<tag><tt>__CX16__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Commander X16 (-t cx16).
|
||||
@@ -1339,6 +1398,10 @@ The compiler defines several macros at startup:
|
||||
|
||||
This macro expands to a string containing the name of the C source file.
|
||||
|
||||
<tag><tt>__GAMATE__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Gamate handheld (-t gamate).
|
||||
|
||||
<tag><tt>__GEOS__</tt></tag>
|
||||
|
||||
This macro is defined if you are compiling for one of the GEOS systems.
|
||||
@@ -1351,6 +1414,10 @@ The compiler defines several macros at startup:
|
||||
|
||||
This macro is defined if you are compiling for the GEOS 64/128 system (-t geos-cbm).
|
||||
|
||||
<tag><tt>__KIM1__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the KIM-1 (-t kmi1).
|
||||
|
||||
<tag><tt>__LINE__</tt></tag>
|
||||
|
||||
This macro expands to the current line number.
|
||||
@@ -1363,6 +1430,10 @@ The compiler defines several macros at startup:
|
||||
|
||||
This macro is defined if the target is the Atari Lynx (-t lynx).
|
||||
|
||||
<tag><tt>__MEGA65__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Mega 65 (-t mega65).
|
||||
|
||||
<tag><tt>__NES__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Nintendo Entertainment System (-t nes).
|
||||
@@ -1388,6 +1459,10 @@ The compiler defines several macros at startup:
|
||||
This macro is defined if the target is the Ohio Scientific Challenger 1P
|
||||
(-t osic1p).
|
||||
|
||||
<tag><tt>__PCE__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the PC Engine game console (-t pce).
|
||||
|
||||
<tag><tt>__PET__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the PET family of computers (-t pet).
|
||||
@@ -1396,6 +1471,10 @@ The compiler defines several macros at startup:
|
||||
|
||||
This macro is defined if the target is the Commodore Plus/4 (-t plus4).
|
||||
|
||||
<tag><tt>__RP6502__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Picocomputer 6502 (-t rp6502).
|
||||
|
||||
<tag><tt>__SIM6502__</tt></tag>
|
||||
|
||||
This macro is defined if the target is sim65 in 6502 mode (-t sim6502).
|
||||
|
||||
@@ -34,7 +34,7 @@ and other things.
|
||||
---------------------------------------------------------------------------
|
||||
Usage: cl65 [options] file [...]
|
||||
Short options:
|
||||
-c Compile and assemble but don't link
|
||||
-c Compile and assemble, but don't link
|
||||
-d Debug mode
|
||||
-g Add debug info
|
||||
-h Help (this text)
|
||||
@@ -55,10 +55,10 @@ Short options:
|
||||
-L path Specify a library search path
|
||||
-Ln name Create a VICE label file
|
||||
-O Optimize code
|
||||
-Oi Optimize code, inline more code
|
||||
-Oi Optimize code, inline runtime functions
|
||||
-Or Optimize code, honour the register keyword
|
||||
-Os Optimize code, inline standard functions
|
||||
-S Compile but don't assemble and link
|
||||
-Os Optimize code, inline known C functions
|
||||
-S Compile, but don't assemble and link
|
||||
-T Include source as comment
|
||||
-V Print the version number
|
||||
-W name[,...] Suppress compiler warnings
|
||||
@@ -81,8 +81,9 @@ Long options:
|
||||
--code-label name Define and export a CODE segment label
|
||||
--code-name seg Set the name of the CODE segment
|
||||
--codesize x Accept larger code by factor x
|
||||
--color [on|auto|off] Color diagnostics (default: auto)
|
||||
--config name Use linker config file
|
||||
--cpu type Set cpu type
|
||||
--cpu type Set CPU type
|
||||
--create-dep name Create a make dependency file
|
||||
--create-full-dep name Create a full make dependency file
|
||||
--data-label name Define and export a DATA segment label
|
||||
@@ -101,8 +102,9 @@ Long options:
|
||||
--mapfile name Create a map file
|
||||
--memory-model model Set the memory model
|
||||
--module Link as a module
|
||||
--module-id id Specify a module id for the linker
|
||||
--module-id id Specify a module ID for the linker
|
||||
--no-target-lib Don't link the target library
|
||||
--no-utf8 Disable use of UTF-8 in diagnostics
|
||||
--o65-model model Override the o65 model
|
||||
--obj file Link this object file
|
||||
--obj-path path Specify an object file search path
|
||||
|
||||
106
doc/funcref.sgml
106
doc/funcref.sgml
@@ -98,6 +98,8 @@ function.
|
||||
<item>allow_lowercase
|
||||
<item><ref id="beep" name="beep">
|
||||
<item><ref id="dir_entry_count" name="dir_entry_count">
|
||||
<item><ref id="file_set_type" name="file_set_type">
|
||||
<item><ref id="file_set_auxtype" name="file_set_auxtype">
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<item><ref id="gmtime_dt" name="gmtime_dt">
|
||||
@@ -114,6 +116,8 @@ function.
|
||||
<item>_dos_type
|
||||
<item><ref id="beep" name="beep">
|
||||
<item><ref id="dir_entry_count" name="dir_entry_count">
|
||||
<item><ref id="file_set_type" name="file_set_type">
|
||||
<item><ref id="file_set_auxtype" name="file_set_auxtype">
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<item><ref id="gmtime_dt" name="gmtime_dt">
|
||||
@@ -369,9 +373,14 @@ function.
|
||||
|
||||
<sect1><tt/dbg.h/<label id="dbg.h"><p>
|
||||
|
||||
<!-- <itemize> -->
|
||||
<!-- <item><ref id="DbgInit" name="DbgInit"> -->
|
||||
<!-- </itemize> -->
|
||||
<itemize>
|
||||
<item><ref id="DbgInit" name="DbgInit">
|
||||
<!-- <item><ref id="BREAK" name="BREAK"> -->
|
||||
<!-- <item><ref id="DbgDisAsm" name="DbgDisAsm"> -->
|
||||
<!-- <item><ref id="DbgDisAsmLen" name="DbgDisAsmLen"> -->
|
||||
<!-- <item><ref id="DbgIsRAM" name="DbgIsRAM"> -->
|
||||
<!-- <item><ref id="DbgMemDump" name="DbgMemDump"> -->
|
||||
</itemize>
|
||||
|
||||
(incomplete)
|
||||
|
||||
@@ -785,6 +794,7 @@ communication, see also <tt>testcode/lib/ser-test.c</tt>.
|
||||
<item><ref id="strcpy" name="strcpy">
|
||||
<item><ref id="strcspn" name="strcspn">
|
||||
<item><ref id="strdup" name="strdup">
|
||||
<item><ref id="strndup" name="strndup">
|
||||
<item><ref id="strerror" name="strerror">
|
||||
<item><ref id="stricmp" name="stricmp">
|
||||
<item><ref id="strlen" name="strlen">
|
||||
@@ -3471,6 +3481,24 @@ used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>DbgInit<label id="DbgInit"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Initialize the debugger.
|
||||
<tag/Header/<tt/<ref id="dbg.h" name="dbg.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ DbgInit (unsigned unused);/
|
||||
<tag/Description/<tt/DbgInit/ initializes the debugger.
|
||||
<tag/Notes/<itemize>
|
||||
<item>Use 0 as parameter.
|
||||
<item>The debugger will popup on next brk encountered.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>decompress_lz4<label id="decompress_lz4"><p>
|
||||
|
||||
<quote>
|
||||
@@ -4243,6 +4271,48 @@ file may have unpredictable results.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>file_set_auxtype<label id="file_set_auxtype"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Updates the ProDOS auxiliary type of a file.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ file_set_auxtype(const char *pathname, unsigned int auxtype);/
|
||||
<tag/Description/<tt/file_set_auxtype/ is machine dependent and does not exist for
|
||||
all supported targets. It updates the ProDOS auxiliary
|
||||
type of the <tt/pathname/ file, and returns 0 on success
|
||||
or sets <tt/errno/ on error.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function does not exist on all platforms.
|
||||
<item>See <tt/apple2_filetype.h/ for a list of known auxtypes.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>file_set_type<label id="file_set_type"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Updates the ProDOS type of a file.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ file_set_type(const char *pathname, unsigned char type);/
|
||||
<tag/Description/<tt/file_set_type/ is machine dependent and does not exist for
|
||||
all supported targets. It updates the ProDOS type of the
|
||||
<tt/pathname/ file, and returns 0 on success or sets
|
||||
<tt/errno/ on error.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function does not exist on all platforms.
|
||||
<item>See <tt/apple2_filetype.h/ for a list of known file types.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>free<label id="free"><p>
|
||||
|
||||
<quote>
|
||||
@@ -5621,6 +5691,7 @@ be used in presence of a prototype.
|
||||
<ref id="free" name="free">,
|
||||
<ref id="realloc" name="realloc">,
|
||||
<ref id="strdup" name="strdup">
|
||||
<ref id="strndup" name="strndup">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@@ -7774,6 +7845,35 @@ be used in presence of a prototype.
|
||||
<tag/See also/
|
||||
<ref id="free" name="free">,
|
||||
<ref id="malloc" name="malloc">
|
||||
<ref id="strndup" name="strndup">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
|
||||
|
||||
<sect1>strndup<label id="strndup"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Allocate a copy of a string on the heap, of a given maximum length.
|
||||
<tag/Header/<tt/<ref id="string.h" name="string.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ strndup (const char* s, size_t maxlen);/
|
||||
<tag/Description/<tt/strndup/ allocates a memory block on the heap, big enough
|
||||
to hold a copy of <tt/s/ including the terminating zero. If the allocation
|
||||
fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
|
||||
memory block, maxlen characters are kept, and a pointer to the block is returned.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>It is up to the caller to free the allocated memory block.
|
||||
</itemize>
|
||||
<tag/Availability/ISO 9899
|
||||
<tag/See also/
|
||||
<ref id="free" name="free">,
|
||||
<ref id="malloc" name="malloc">
|
||||
<ref id="strndup" name="strndup">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
@@ -73,6 +73,7 @@ Short options:
|
||||
Long options:
|
||||
--allow-multiple-definition Allow multiple definitions
|
||||
--cfg-path path Specify a config file search path
|
||||
--color [on|auto|off] Color diagnostics (default: auto)
|
||||
--config name Use linker config file
|
||||
--dbgfile name Generate debug information
|
||||
--define sym=val Define a symbol
|
||||
@@ -84,13 +85,13 @@ Long options:
|
||||
--lib-path path Specify a library search path
|
||||
--mapfile name Create a map file
|
||||
--module-id id Specify a module id
|
||||
--no-utf8 Disable use of UTF-8 in diagnostics
|
||||
--obj file Link this object file
|
||||
--obj-path path Specify an object file search path
|
||||
--start-addr addr Set the default start address
|
||||
--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>
|
||||
|
||||
@@ -292,6 +293,14 @@ Here is a description of all of the command-line options:
|
||||
and in a built-in default directory.
|
||||
|
||||
|
||||
<label id="option--color">
|
||||
<tag><tt>--color</tt></tag>
|
||||
|
||||
This option controls if the linker will use colors when printing
|
||||
diagnostics. The default is "auto" which will enable colors if the output
|
||||
goes to a terminal (not to a file).
|
||||
|
||||
|
||||
<label id="option--dbgfile">
|
||||
<tag><tt>--dbgfile name</tt></tag>
|
||||
|
||||
@@ -315,6 +324,14 @@ Here is a description of all of the command-line options:
|
||||
type because of an unusual extension.
|
||||
|
||||
|
||||
<label id="option--no-utf8">
|
||||
<tag><tt>--no-utf8</tt></tag>
|
||||
|
||||
Disable the use of UTF-8 characters in diagnostics. This might be necessary
|
||||
if auto detection fails or if the output is captured for processing with a
|
||||
tool that is not UTF-8 capable.
|
||||
|
||||
|
||||
<tag><tt>--obj file</tt></tag>
|
||||
|
||||
Links an object file to the output. Use this command-line option instead
|
||||
|
||||
@@ -294,6 +294,12 @@ unsigned char get_tv (void);
|
||||
unsigned char get_ostype (void);
|
||||
/* Get the machine type. Returns one of the APPLE_xxx codes. */
|
||||
|
||||
int __fastcall__ file_set_type(const char *pathname, unsigned char type);
|
||||
/* Sets the ProDOS type for the file, returns 0 on success, sets errno on failure */
|
||||
|
||||
int __fastcall__ file_set_auxtype(const char *pathname, unsigned int auxtype);
|
||||
/* Sets the ProDOS auxtype for the file, returns 0 on success, sets errno on failure */
|
||||
|
||||
void rebootafterexit (void);
|
||||
/* Reboot machine after program termination has completed. */
|
||||
|
||||
|
||||
@@ -318,5 +318,7 @@
|
||||
extern unsigned char _filetype; /* Default: PRODOS_T_BIN */
|
||||
extern unsigned int _auxtype; /* Default: 0 */
|
||||
|
||||
|
||||
|
||||
/* End of apple2_filetype.h */
|
||||
#endif
|
||||
|
||||
@@ -79,6 +79,7 @@ void* __fastcall__ __bzero (void* ptr, size_t n);
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
void __fastcall__ bzero (void* ptr, size_t n); /* BSD */
|
||||
char* __fastcall__ strdup (const char* s); /* SYSV/BSD */
|
||||
char* __fastcall__ strndup (const char* s, size_t maxlen); /* SYSV/BSD */
|
||||
int __fastcall__ stricmp (const char* s1, const char* s2); /* DOS/Windows */
|
||||
int __fastcall__ strcasecmp (const char* s1, const char* s2); /* Same for Unix */
|
||||
char* __fastcall__ strcasestr (const char* str, const char* substr);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.import COUT
|
||||
.export _cputcxy, _cputc, newline, putchar,putchardirect
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.constructor initconio
|
||||
.export _cputcxy, _cputc
|
||||
@@ -18,8 +20,6 @@
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initconio:
|
||||
|
||||
78
libsrc/apple2/file_set_info.s
Normal file
78
libsrc/apple2/file_set_info.s
Normal file
@@ -0,0 +1,78 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 2025 <colin@colino.net>
|
||||
;
|
||||
; int __fastcall__ file_set_type(const char *pathname, unsigned char type);
|
||||
; int __fastcall__ file_set_auxtype(const char *pathname, unsigned int auxtype);
|
||||
;
|
||||
|
||||
.export _file_set_type, _file_set_auxtype
|
||||
.import pushname, popname, mli_file_info_direct
|
||||
.import popa, popax
|
||||
.include "zeropage.inc"
|
||||
.include "errno.inc"
|
||||
.include "mli.inc"
|
||||
|
||||
new_value = ptr2 ; ptr1 is used by pushname
|
||||
mod_flag = tmp1
|
||||
|
||||
UPDATE_TYPE = $00
|
||||
UPDATE_AUXTYPE = $80
|
||||
|
||||
_file_set_type:
|
||||
sta new_value
|
||||
ldy #UPDATE_TYPE
|
||||
beq mli_update
|
||||
_file_set_auxtype:
|
||||
sta new_value
|
||||
stx new_value+1
|
||||
ldy #UPDATE_AUXTYPE
|
||||
|
||||
mli_update:
|
||||
sty mod_flag
|
||||
|
||||
; Get pathname
|
||||
jsr popax
|
||||
jsr pushname
|
||||
bne oserr
|
||||
|
||||
; ProDOS 8 TechRef, 4.4.4: You should use
|
||||
; the GET_FILE_INFO call to read a file’s
|
||||
; attributes into a parameter list, modify
|
||||
; them as needed, and then use the same
|
||||
; parameter list for the SET_FILE_INFO call.
|
||||
jsr mli_file_info_direct
|
||||
; Bail if we could not get the information.
|
||||
bcs cleanup
|
||||
|
||||
; Update type if needed
|
||||
bit mod_flag
|
||||
bmi :+
|
||||
lda new_value
|
||||
sta mliparam + MLI::INFO::FILE_TYPE
|
||||
jmp set_info
|
||||
|
||||
: ; Otherwise update auxtype
|
||||
lda new_value
|
||||
sta mliparam + MLI::INFO::AUX_TYPE
|
||||
lda new_value+1
|
||||
sta mliparam + MLI::INFO::AUX_TYPE+1
|
||||
|
||||
set_info:
|
||||
; Set file information
|
||||
lda #SET_INFO_CALL
|
||||
ldx #SET_INFO_COUNT
|
||||
jsr callmli
|
||||
|
||||
cleanup:
|
||||
php ; Save return status
|
||||
|
||||
jsr popname ; Preserves A
|
||||
|
||||
plp
|
||||
bcs oserr
|
||||
rts
|
||||
|
||||
oserr:
|
||||
jsr ___mappederrno
|
||||
sec
|
||||
rts
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
.export _lseek
|
||||
.import popax, popptr1
|
||||
.macpack cpu
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "errno.inc"
|
||||
|
||||
@@ -20,6 +20,9 @@ DESTROY_COUNT = 1
|
||||
RENAME_CALL = $C2
|
||||
RENAME_COUNT = 2
|
||||
|
||||
SET_INFO_CALL = $C3
|
||||
SET_INFO_COUNT = 7
|
||||
|
||||
GET_INFO_CALL = $C4
|
||||
GET_INFO_COUNT = $A
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
.include "ser-error.inc"
|
||||
|
||||
.macpack module
|
||||
.macpack cpu
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Header. Includes jump table
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc
|
||||
.export plot, cputdirect, putchar
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.include "atari5200.inc"
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputc
|
||||
.import gotox, gotoy, pusha0
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc
|
||||
.export setscrptr, cputdirect, putchar
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
.import push0, callmain
|
||||
.import RESTOR, BSOUT, CLRCH
|
||||
.import __MAIN_START__, __MAIN_SIZE__, __STACKSIZE__
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "c128.inc"
|
||||
@@ -65,6 +64,15 @@ L1: lda c_sp,x
|
||||
|
||||
jsr initlib
|
||||
|
||||
; Disable the BASIC part of the IRQ handler. It would usually (once per frame)
|
||||
; copy the VIC shadow register, move sprites, play music. This would only get
|
||||
; in the way, so we turn it off.
|
||||
|
||||
lda INIT_STATUS
|
||||
sta initsave
|
||||
and #$fe
|
||||
sta INIT_STATUS
|
||||
|
||||
; Set the bank for the file name to our execution bank. We must do this
|
||||
; *after* calling the constructors because some of them might depend on
|
||||
; the original value of this register.
|
||||
@@ -89,10 +97,15 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Enable the BASIC interrupt again
|
||||
|
||||
lda initsave
|
||||
sta INIT_STATUS
|
||||
|
||||
; Place the program return code into BASIC's status variable.
|
||||
|
||||
pla
|
||||
sta ST
|
||||
sta STATUS
|
||||
|
||||
; Reset the stack and the memory configuration.
|
||||
|
||||
@@ -116,5 +129,6 @@ zpsave: .res zpspace
|
||||
|
||||
.bss
|
||||
|
||||
spsave: .res 1
|
||||
mmusave:.res 1
|
||||
spsave: .res 1
|
||||
mmusave: .res 1
|
||||
initsave: .res 1
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-30
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.exportzp ST := $90 ; IEC status byte
|
||||
.export initst
|
||||
|
||||
.include "c128.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
lda #$00
|
||||
sta STATUS
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
.import initlib, donelib
|
||||
.import callmain, zerobss
|
||||
.import MEMTOP, RESTOR, BSOUT, CLRCH
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "c16.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Startup code
|
||||
@@ -76,7 +76,7 @@ L2: lda zpsave,x
|
||||
; Store the return code into BASIC's status variable.
|
||||
|
||||
pla
|
||||
sta ST
|
||||
sta STATUS
|
||||
|
||||
; Restore the stack pointer.
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
.import BSOUT
|
||||
.import __MAIN_START__, __MAIN_SIZE__ ; Linker generated
|
||||
.import __STACKSIZE__ ; from configure file
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "c64.inc"
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
@@ -62,7 +62,7 @@ L2: lda zpsave,x
|
||||
; Place the program return code into BASIC's status variable.
|
||||
|
||||
pla
|
||||
sta ST
|
||||
sta STATUS
|
||||
|
||||
; Restore the system stuff.
|
||||
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-30
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.exportzp ST := $90 ; IEC status byte
|
||||
.export initst
|
||||
|
||||
.include "c64.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
lda #$00
|
||||
sta STATUS
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-30
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.exportzp ST := $90 ; IEC status byte
|
||||
.export initst
|
||||
|
||||
.include "c65.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
lda #$00
|
||||
sta STATUS
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
.importzp sreg
|
||||
|
||||
.include "cbm.inc"
|
||||
.macpack cpu
|
||||
|
||||
|
||||
.proc _clock
|
||||
|
||||
; Some accelerator adaptors have CMOS ICs.
|
||||
|
||||
.if (.cpu & ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_STZ)
|
||||
stz sreg + 1
|
||||
.else
|
||||
lda #$00 ; Byte 3 always is zero
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
.import isdisk
|
||||
.import opencmdchannel
|
||||
.import closecmdchannel
|
||||
.importzp ST
|
||||
.import initst
|
||||
.import READST
|
||||
.importzp tmp2
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
@@ -33,26 +34,25 @@ next: inx
|
||||
; interpret a non-disk as a no-op while we need to interpret it
|
||||
; as an error here
|
||||
|
||||
jsr isdisk
|
||||
jsr isdisk ; carry clear if the unit number in X is a disk
|
||||
bcs next
|
||||
|
||||
; [open|close]cmdchannel don't call into the Kernal at all if they
|
||||
; only [in|de]crement the reference count of the shared cmdchannel
|
||||
; so we need to explicitly initialize ST here
|
||||
|
||||
lda #$00
|
||||
sta ST
|
||||
stx tmp2 ; further calls my use X
|
||||
|
||||
stx tmp2
|
||||
jsr initst
|
||||
|
||||
ldx tmp2 ; get unit number back
|
||||
jsr opencmdchannel
|
||||
ldx tmp2
|
||||
ldx tmp2 ; get unit number back
|
||||
jsr closecmdchannel
|
||||
ldx tmp2
|
||||
|
||||
; As we had to reference ST above anyway we can as well do so
|
||||
; here too (instead of calling READST)
|
||||
ldx tmp2 ; get unit number back
|
||||
|
||||
lda ST
|
||||
jsr READST ; preserves X, returns A and Flags
|
||||
|
||||
; Either the Kernal calls above were successful or there was
|
||||
; already a cmdchannel to the device open - which is a pretty
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -16,11 +16,9 @@
|
||||
|
||||
jsr sys_bank
|
||||
sty ktmp ; Save Y register
|
||||
ldy #$9C ; STATUS
|
||||
ldy #STATUS
|
||||
lda (sysp0),y ; Load STATUS from system bank
|
||||
ldy ktmp
|
||||
jmp restore_bank ; Will set condition codes on A
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
sty ktmp
|
||||
|
||||
txa
|
||||
ldy #$90 ; FNAM
|
||||
ldy #FNAM
|
||||
sta (sysp0),y
|
||||
|
||||
lda ktmp
|
||||
@@ -33,13 +33,10 @@
|
||||
ldy #$92 ; FNAM_SEG
|
||||
sta (sysp0),y
|
||||
|
||||
ldy #$9D ; FNAM_LEN
|
||||
ldy #FNAM_LEN
|
||||
pla
|
||||
sta (sysp0),y
|
||||
ldy ktmp
|
||||
jmp restore_bank
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
|
||||
21
libsrc/cbm510/status.s
Normal file
21
libsrc/cbm510/status.s
Normal file
@@ -0,0 +1,21 @@
|
||||
;
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.export initst
|
||||
|
||||
.include "extzp.inc"
|
||||
.include "cbm510.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
ldx IndReg
|
||||
ldy #$0F
|
||||
sty IndReg ; Switch to the system bank
|
||||
ldy #STATUS
|
||||
lda #$00 ; Initialize value
|
||||
sta (sysp0),y
|
||||
stx IndReg
|
||||
rts
|
||||
|
||||
.endproc
|
||||
@@ -4,6 +4,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -394,7 +394,7 @@ _exit: pha ; Save the return code
|
||||
; Place the program return code into BASIC's status variable.
|
||||
|
||||
pla
|
||||
ldy #$9C ; ST
|
||||
ldy #STATUS
|
||||
sta (sysp0),y
|
||||
|
||||
; Set up the welcome code at the stack bottom in the system bank.
|
||||
|
||||
@@ -11,16 +11,14 @@
|
||||
|
||||
.include "cbm610.inc"
|
||||
|
||||
|
||||
; preserves X and Y, returns status in A and in status flags
|
||||
.proc READST
|
||||
|
||||
jsr sys_bank
|
||||
sty ktmp ; Save Y register
|
||||
ldy #$9C ; STATUS
|
||||
ldy #STATUS
|
||||
lda (sysp0),y ; Load STATUS from system bank
|
||||
ldy ktmp
|
||||
jmp restore_bank ; Will set condition codes on A
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
sty ktmp
|
||||
|
||||
txa
|
||||
ldy #$90 ; FNAM
|
||||
ldy #FNAM
|
||||
sta (sysp0),y
|
||||
|
||||
lda ktmp
|
||||
@@ -30,14 +30,13 @@
|
||||
sta (sysp0),y
|
||||
|
||||
lda ExecReg ; Assume name is always in this segment
|
||||
ldy #$92 ; FNAM_SEG
|
||||
ldy #FNAM_SEG
|
||||
sta (sysp0),y
|
||||
|
||||
ldy #$9D ; FNAM_LEN
|
||||
ldy #FNAM_LEN
|
||||
pla
|
||||
sta (sysp0),y
|
||||
ldy ktmp
|
||||
jmp restore_bank
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
21
libsrc/cbm610/status.s
Normal file
21
libsrc/cbm610/status.s
Normal file
@@ -0,0 +1,21 @@
|
||||
;
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.export initst
|
||||
|
||||
.include "extzp.inc"
|
||||
.include "cbm610.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
ldx IndReg
|
||||
ldy #$0F
|
||||
sty IndReg ; Switch to the system bank
|
||||
ldy #STATUS
|
||||
lda #$00 ; Initialize value
|
||||
sta (sysp0),y
|
||||
stx IndReg
|
||||
rts
|
||||
|
||||
.endproc
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; int __fastcall__ __directerrno (unsigned char code);
|
||||
; /* Set errno to a specific error code, clear __oserror, and return -1. Used
|
||||
@@ -18,7 +16,7 @@
|
||||
___directerrno:
|
||||
jsr ___seterrno ; Set errno (returns with .A = 0)
|
||||
sta ___oserror ; Clear ___oserror
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_INA)
|
||||
dec a
|
||||
.else
|
||||
lda #$FF ; Return -1
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
.include "_heap.inc"
|
||||
|
||||
.macpack generic
|
||||
.macpack cpu
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Code
|
||||
@@ -39,7 +38,7 @@ ___heapblocksize:
|
||||
ldy #usedblock::size+1
|
||||
lda (ptr2),y
|
||||
tax
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
lda (ptr2)
|
||||
.else
|
||||
dey
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
.include "errno.inc"
|
||||
|
||||
.macpack generic
|
||||
.macpack cpu
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; int __fastcall__ __mappederrno (unsigned char code);
|
||||
@@ -24,7 +23,7 @@ ___mappederrno:
|
||||
bze ok ; Branch if no
|
||||
jsr ___osmaperrno ; Map OS error into errno code
|
||||
jsr ___seterrno ; Save in errno (returns with .A = 0)
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_INA)
|
||||
dec a
|
||||
.else
|
||||
lda #$FF ; Return -1 if error
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
.import _strlower, _strlen
|
||||
|
||||
.macpack generic
|
||||
.macpack cpu
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; We will store variables into the register bank in the zeropage. Define
|
||||
@@ -38,7 +37,7 @@ FCount = ptr2
|
||||
|
||||
GetFormatChar:
|
||||
ldy #0
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
lda (Format)
|
||||
.else
|
||||
lda (Format),y
|
||||
@@ -115,7 +114,7 @@ GetIntArg:
|
||||
lda (ArgList),y
|
||||
tax
|
||||
dey
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
lda (ArgList)
|
||||
.else
|
||||
lda (ArgList),y
|
||||
@@ -274,7 +273,7 @@ Save: lda regbank,y
|
||||
; Initialize the output counter in the output descriptor to zero
|
||||
|
||||
lda #0
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
sta (OutData)
|
||||
ldy #$01
|
||||
sta (OutData),y
|
||||
@@ -353,7 +352,7 @@ MainLoop:
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FCount
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
sta (c_sp)
|
||||
.else
|
||||
sta (c_sp),y
|
||||
@@ -570,7 +569,7 @@ CheckCount:
|
||||
jsr GetIntArg
|
||||
sta ptr1
|
||||
stx ptr1+1 ; Get user supplied pointer
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
lda (OutData) ; Low byte of OutData->ccount
|
||||
sta (ptr1)
|
||||
ldy #1
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
.include "time.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
__time_t_to_tm:
|
||||
; Divide number of seconds since epoch, in ptr1:sreg,
|
||||
; by 86400 to get the number of days since epoch, and
|
||||
@@ -80,7 +78,7 @@ __time_t_to_tm:
|
||||
|
||||
; Zero the two high bytes of the divisor and the high byte
|
||||
; of the dividend.
|
||||
.if .cpu .bitand CPU_ISET_65SC02
|
||||
.if .cap(CPU_HAS_STZ)
|
||||
stz ptr4
|
||||
stz ptr4+1
|
||||
stz sreg+1
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
.importzp ptr1
|
||||
.include "time.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Special values
|
||||
|
||||
@@ -24,7 +22,7 @@ MAX_BUF_LEN = 38
|
||||
|
||||
_asctime:
|
||||
; Backup timep
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_PUSHXY)
|
||||
pha
|
||||
phx
|
||||
.else
|
||||
@@ -48,7 +46,7 @@ _asctime:
|
||||
jsr pushax
|
||||
|
||||
; Restore timep
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_PUSHXY)
|
||||
plx
|
||||
pla
|
||||
.else
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.proc _atexit
|
||||
@@ -41,7 +39,7 @@
|
||||
jsr ___seterrno
|
||||
ldx #$FF ; Return -1
|
||||
txa
|
||||
rts
|
||||
Exit: rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -54,7 +52,7 @@
|
||||
.proc doatexit
|
||||
|
||||
ldy exitfunc_index ; Get index
|
||||
beq @L9 ; Jump if done
|
||||
beq _atexit::Exit ; Jump if done
|
||||
dey
|
||||
lda exitfunc_table,y
|
||||
tax
|
||||
@@ -62,14 +60,12 @@
|
||||
lda exitfunc_table,y
|
||||
sty exitfunc_index
|
||||
jsr callax ; Call the function
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_BRA8)
|
||||
bra doatexit
|
||||
.else
|
||||
jmp doatexit ; Next one
|
||||
.endif
|
||||
|
||||
@L9: rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
.include "stdio.inc"
|
||||
.include "_file.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
_fgetc:
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
@@ -22,7 +20,7 @@ _fgetc:
|
||||
jsr checkferror
|
||||
bne ret_eof
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_BITIMM)
|
||||
bit #_FPUSHBACK ; Check for pushed back char
|
||||
beq do_read
|
||||
.else
|
||||
|
||||
@@ -14,12 +14,10 @@
|
||||
.include "stdio.inc"
|
||||
.include "_file.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
terminate_ptr:
|
||||
lda #$00
|
||||
tax
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
sta (ptr4)
|
||||
.else
|
||||
tay
|
||||
@@ -41,7 +39,7 @@ _fgets:
|
||||
sta buf
|
||||
stx buf+1
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_STZ)
|
||||
stz didread
|
||||
.else
|
||||
lda #$00 ; We have read nothing yet
|
||||
@@ -79,7 +77,7 @@ read_loop:
|
||||
ldy #$01
|
||||
sty didread ; We read at least one char
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
sta (ptr4)
|
||||
.else
|
||||
dey
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
.include "_file.inc"
|
||||
|
||||
.macpack generic
|
||||
.macpack cpu
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Code
|
||||
@@ -48,7 +47,7 @@
|
||||
|
||||
ldy #_FILE::f_flags
|
||||
lda (file),y
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_BITIMM)
|
||||
bit #_FOPEN ; Is the file open?
|
||||
.else
|
||||
and #_FOPEN ; Is the file open?
|
||||
@@ -57,7 +56,7 @@
|
||||
|
||||
; Check if the stream is in an error state
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_BITIMM)
|
||||
bit #_FERROR
|
||||
.else
|
||||
lda (file),y ; get file->f_flags again
|
||||
@@ -74,17 +73,15 @@
|
||||
|
||||
; Remember if we have a pushed back character and reset the flag.
|
||||
|
||||
@L2: .if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
@L2: .if .cap(CPU_HAS_BITIMM)
|
||||
ldx #$00
|
||||
bit #_FPUSHBACK
|
||||
beq @L3
|
||||
.else
|
||||
tax ; X = 0
|
||||
lda (file),y
|
||||
and #_FPUSHBACK
|
||||
.endif
|
||||
beq @L3
|
||||
|
||||
.if (.not .cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (file),y
|
||||
.endif
|
||||
and #<~_FPUSHBACK
|
||||
@@ -135,7 +132,7 @@
|
||||
; Copy the buffer pointer into ptr1, and increment the pointer value passed
|
||||
; to read() by one, so read() starts to store data at buf+1.
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
lda (c_sp)
|
||||
sta ptr1
|
||||
add #1
|
||||
@@ -159,7 +156,7 @@
|
||||
|
||||
ldy #_FILE::f_pushback
|
||||
lda (file),y
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
sta (ptr1) ; *buf = file->f_pushback;
|
||||
.else
|
||||
ldy #0
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
.include "errno.inc"
|
||||
.include "_file.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Code
|
||||
|
||||
@@ -34,7 +32,7 @@
|
||||
|
||||
ldy #_FILE::f_flags
|
||||
lda (ptr1),y
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_BITIMM)
|
||||
bit #_FOPEN
|
||||
.else
|
||||
and #_FOPEN ; Is the file open?
|
||||
@@ -50,7 +48,7 @@
|
||||
|
||||
; Check if the stream is in an error state
|
||||
|
||||
@L2: .if (.not .cpu .bitand ::CPU_ISET_65SC02)
|
||||
@L2: .if .not .cap(CPU_HAS_BITIMM)
|
||||
lda (ptr1),y ; get file->f_flags again
|
||||
.endif
|
||||
and #_FERROR
|
||||
|
||||
@@ -29,7 +29,7 @@ int optopt; /* character checked for validity */
|
||||
char *optarg; /* argument associated with option */
|
||||
|
||||
#define tell(s) fputs(*argv,stderr);fputs(s,stderr); \
|
||||
fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);
|
||||
fputc(optopt,stderr);fputc('\n',stderr);return(BADCH)
|
||||
|
||||
int __fastcall__ getopt (int argc, char* const* argv, const char* optstring)
|
||||
/* Get option letter from argument vector */
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
.import __hextab, __longminstr
|
||||
.importzp sreg, ptr1, ptr2, ptr3, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
.code
|
||||
|
||||
;
|
||||
@@ -64,7 +62,7 @@ L2: txa ; get high byte
|
||||
bpl ultoa
|
||||
lda #'-'
|
||||
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
sta (ptr2)
|
||||
.else
|
||||
ldy #0
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
.export _strcat
|
||||
.import popax
|
||||
.importzp ptr1, ptr2, tmp3
|
||||
.macpack cpu
|
||||
|
||||
_strcat:
|
||||
sta ptr1 ; Save src
|
||||
@@ -16,7 +15,7 @@ _strcat:
|
||||
jsr popax ; Get dest
|
||||
sta tmp3 ; Remember for function return
|
||||
tay
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_STZ)
|
||||
stz ptr2
|
||||
.else
|
||||
lda #0
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
.export _strchr
|
||||
.import popax
|
||||
.importzp ptr1, tmp1
|
||||
.macpack cpu
|
||||
|
||||
_strchr:
|
||||
sta tmp1 ; Save c
|
||||
jsr popax ; get s
|
||||
tay ; low byte of pointer to y
|
||||
stx ptr1+1
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_STZ)
|
||||
stz ptr1
|
||||
.else
|
||||
lda #0
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
.import _strlen_ptr4, _malloc, _memcpy, pushax
|
||||
.export _strdup
|
||||
|
||||
.macpack cpu
|
||||
|
||||
_strdup:
|
||||
; Get length (and store source in ptr4)
|
||||
sta ptr4
|
||||
@@ -22,7 +20,7 @@ _strdup:
|
||||
jsr _strlen_ptr4 ; strlen may increment
|
||||
|
||||
; Add null byte for terminator
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_INA)
|
||||
inc a
|
||||
.else
|
||||
clc
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
.export _strlen, _strlen_ptr4
|
||||
.importzp ptr4
|
||||
.macpack cpu
|
||||
|
||||
_strlen:
|
||||
sta ptr4 ; Save s
|
||||
|
||||
@@ -8,64 +8,63 @@
|
||||
.export _strncat
|
||||
.import popax, popptr1
|
||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||
.macpack cpu
|
||||
|
||||
_strncat:
|
||||
inx
|
||||
stx tmp2
|
||||
tax
|
||||
inx
|
||||
stx tmp1 ; save count with each byte incremented separately
|
||||
inx
|
||||
stx tmp2
|
||||
tax
|
||||
inx
|
||||
stx tmp1 ; save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; get src
|
||||
jsr popptr1 ; get src
|
||||
|
||||
jsr popax ; get dest
|
||||
sta ptr3 ; remember for function return
|
||||
stx ptr3+1
|
||||
stx ptr2+1
|
||||
tay ; low byte as offset in Y
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz ptr2
|
||||
jsr popax ; get dest
|
||||
sta ptr3 ; remember for function return
|
||||
stx ptr3+1
|
||||
stx ptr2+1
|
||||
tay ; low byte as offset in Y
|
||||
.if .cap(CPU_HAS_STZ)
|
||||
stz ptr2
|
||||
.else
|
||||
ldx #0
|
||||
stx ptr2 ; destination on page boundary
|
||||
ldx #0
|
||||
stx ptr2 ; destination on page boundary
|
||||
.endif
|
||||
|
||||
; find end of dest
|
||||
|
||||
L1: lda (ptr2),y
|
||||
beq L2
|
||||
iny
|
||||
bne L1
|
||||
inc ptr2+1
|
||||
bne L1
|
||||
L1: lda (ptr2),y
|
||||
beq L2
|
||||
iny
|
||||
bne L1
|
||||
inc ptr2+1
|
||||
bne L1
|
||||
|
||||
; end found, apply offset to dest ptr and reset y
|
||||
L2: sty ptr2
|
||||
L2: sty ptr2
|
||||
|
||||
; copy src. We've put the ones complement of the count into the counter, so
|
||||
; we'll increment the counter on top of the loop
|
||||
|
||||
L3: ldy #0
|
||||
ldx tmp1 ; low counter byte
|
||||
L3: ldy #0
|
||||
ldx tmp1 ; low counter byte
|
||||
|
||||
L4: dex
|
||||
bne L5
|
||||
dec tmp2
|
||||
beq L6 ; jump if done
|
||||
L5: lda (ptr1),y
|
||||
sta (ptr2),y
|
||||
beq L7
|
||||
iny
|
||||
bne L4
|
||||
inc ptr1+1
|
||||
inc ptr2+1
|
||||
bne L4
|
||||
L4: dex
|
||||
bne L5
|
||||
dec tmp2
|
||||
beq L6 ; jump if done
|
||||
L5: lda (ptr1),y
|
||||
sta (ptr2),y
|
||||
beq L7
|
||||
iny
|
||||
bne L4
|
||||
inc ptr1+1
|
||||
inc ptr2+1
|
||||
bne L4
|
||||
|
||||
; done, set the trailing zero and return pointer to dest
|
||||
|
||||
L6: lda #0
|
||||
sta (ptr2),y
|
||||
L7: lda ptr3
|
||||
ldx ptr3+1
|
||||
rts
|
||||
L6: lda #0
|
||||
sta (ptr2),y
|
||||
L7: lda ptr3
|
||||
ldx ptr3+1
|
||||
rts
|
||||
|
||||
53
libsrc/common/strndup.s
Normal file
53
libsrc/common/strndup.s
Normal file
@@ -0,0 +1,53 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 03.07.2025
|
||||
;
|
||||
; char* __fastcall__ strndup (const char* S, size_t maxlen);
|
||||
;
|
||||
|
||||
.importzp tmp1, tmp2, ptr2
|
||||
.import _strncpy, _strlen, _malloc
|
||||
.import pushax, popax, incsp2, incax1, swapstk
|
||||
.import ___errno
|
||||
|
||||
.export _strndup
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
.proc _strndup
|
||||
sta tmp1 ; Remember maxlen
|
||||
stx tmp1+1
|
||||
|
||||
jsr popax ; Get string
|
||||
jsr pushax ; Keep it in TOS
|
||||
|
||||
jsr _strlen ; Get string length,
|
||||
cpx tmp1+1 ; Compare to max,
|
||||
bcc alloc
|
||||
bne :+
|
||||
cmp tmp1
|
||||
bcc alloc
|
||||
|
||||
: lda tmp1 ; Use maxlen if shorter
|
||||
ldx tmp1+1
|
||||
|
||||
alloc: jsr incax1 ; Add 1 for terminator
|
||||
jsr _malloc ; Allocate output
|
||||
cpx #$00 ; Check allocation
|
||||
beq errmem
|
||||
|
||||
jsr swapstk ; Put dest in TOS and get string back
|
||||
jsr pushax ; Put src in TOS
|
||||
lda tmp1 ; Get length for strncpy
|
||||
ldx tmp1+1
|
||||
|
||||
jsr _strncpy ; Copy
|
||||
pha ; Terminate
|
||||
lda #$00
|
||||
sta (ptr2),y
|
||||
pla
|
||||
rts
|
||||
|
||||
errmem: ldy #ENOMEM
|
||||
sty ___errno
|
||||
jmp incsp2 ; Pop string and return
|
||||
.endproc
|
||||
@@ -8,13 +8,12 @@
|
||||
.export _cputsxy, _cputs
|
||||
.import gotoxy, _cputc
|
||||
.importzp ptr1, tmp1
|
||||
.macpack cpu
|
||||
|
||||
_cputsxy:
|
||||
sta ptr1 ; Save s for later
|
||||
stx ptr1+1
|
||||
jsr gotoxy ; Set cursor, pop x and y
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_BRA8)
|
||||
bra L0 ; Same as cputs...
|
||||
.else
|
||||
jmp L0 ; Same as cputs...
|
||||
@@ -23,8 +22,12 @@ _cputsxy:
|
||||
_cputs: sta ptr1 ; Save s
|
||||
stx ptr1+1
|
||||
|
||||
; Important note: The implementation below relies on the _cputc() function not
|
||||
; clobbering ptr1. This might not be the case when rewriting this function so
|
||||
; beware!
|
||||
|
||||
L0:
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
lda (ptr1) ; (5)
|
||||
.else
|
||||
ldy #0 ; (2)
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
.import screensize
|
||||
.importzp ptr1, ptr2
|
||||
|
||||
.macpack cpu
|
||||
|
||||
.proc _screensize
|
||||
|
||||
sta ptr2 ; Store the y pointer
|
||||
@@ -20,7 +18,7 @@
|
||||
jsr screensize ; Get screensize into X/Y
|
||||
tya ; Get Y size into A
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
sta (ptr2)
|
||||
txa
|
||||
sta (ptr1)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
.importzp c_sp, ptr1, ptr2, ptr3, tmp1
|
||||
|
||||
.macpack generic
|
||||
.macpack cpu
|
||||
|
||||
.data
|
||||
|
||||
@@ -74,7 +73,7 @@ out: jsr popax ; count
|
||||
|
||||
; Loop outputting characters
|
||||
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND, CPU_HAS_BRA8)
|
||||
|
||||
@L1: dec outdesc+6
|
||||
beq @L4
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -332,7 +332,7 @@ BreakPoint DbgBreaks [MAX_USERBREAKS+2];
|
||||
BreakPoint* DbgGetBreakSlot (void);
|
||||
/* Search for a free breakpoint slot. Return a pointer to the slot or 0 */
|
||||
|
||||
BreakPoint* DbgIsBreak (unsigned Addr);
|
||||
BreakPoint* __cdecl__ DbgIsBreak (unsigned Addr);
|
||||
/* Check if there is a user breakpoint at the given address, if so, return
|
||||
** a pointer to the slot, else return 0.
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
; note that there are conflicts between control characters and keyboard:
|
||||
; HOME = KEY_ENTER, KEY_HOME = REV_ON,
|
||||
; UPLINE = ?, KEY_UPARROW = GOTOY, ...
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc
|
||||
.import gotoxy, fixcursor
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-30
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.exportzp ST := $90 ; IEC status byte
|
||||
.export initst
|
||||
|
||||
.include "mega65.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
lda #$00
|
||||
sta STATUS
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
;
|
||||
|
||||
.export checkst
|
||||
.importzp ST
|
||||
|
||||
.include "pet.inc"
|
||||
|
||||
.proc checkst
|
||||
|
||||
lda ST
|
||||
lda STATUS
|
||||
beq @L1
|
||||
lda #5 ; ### Device not present
|
||||
sec
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
.import zerobss, push0
|
||||
.import callmain
|
||||
.import CLRCH, BSOUT
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "pet.inc"
|
||||
@@ -80,7 +79,7 @@ L2: lda zpsave,x
|
||||
; Store the program return code into BASIC's status variable.
|
||||
|
||||
pla
|
||||
sta ST
|
||||
sta STATUS
|
||||
|
||||
; Restore the stack pointer.
|
||||
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
;
|
||||
|
||||
.export READST
|
||||
.importzp ST
|
||||
|
||||
.include "pet.inc"
|
||||
|
||||
.proc READST
|
||||
|
||||
lda ST
|
||||
lda STATUS
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-30
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.exportzp ST := $96 ; IEC status byte
|
||||
.export initst
|
||||
|
||||
.include "pet.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
lda #$00
|
||||
sta STATUS
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
; Important note: The implementation of cputs() relies on the cputc() function
|
||||
; not clobbering ptr1. Beware when rewriting or changing this function!
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
.import callmain, zerobss
|
||||
.import __INTERRUPTOR_COUNT__
|
||||
.import __HIMEM__ ; Linker generated
|
||||
.importzp ST
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "plus4.inc"
|
||||
@@ -121,7 +120,7 @@ L2: lda zpsave,x
|
||||
; Place the program return code into BASIC's status variable.
|
||||
|
||||
pla
|
||||
sta ST
|
||||
sta STATUS
|
||||
|
||||
; Restore the stack pointer.
|
||||
|
||||
|
||||
@@ -7,12 +7,11 @@
|
||||
.export READST
|
||||
|
||||
.include "plus4.inc"
|
||||
.importzp ST
|
||||
|
||||
; Read the status byte from the zero page instead of banking in the ROM
|
||||
|
||||
.proc READST
|
||||
lda ST ; Load status
|
||||
lda STATUS ; Load status
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-30
|
||||
; Stefan Haubenthal, 2023-01-16
|
||||
;
|
||||
|
||||
.exportzp ST := $90 ; IEC status byte
|
||||
.export initst
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.proc initst
|
||||
|
||||
lda #$00
|
||||
sta STATUS
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
.export tosadda0, tosaddax
|
||||
.importzp c_sp, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosadda0:
|
||||
ldx #0
|
||||
tosaddax:
|
||||
clc ; (2)
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
.if .cap(CPU_HAS_ZPIND)
|
||||
|
||||
adc (c_sp) ; (7)
|
||||
tay ; (9)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user