mirror of
https://github.com/cc65/cc65.git
synced 2024-06-26 05:29:30 +00:00
style update and add rp6502 doc
This commit is contained in:
parent
b17c4d3434
commit
564c85235f
|
@ -1,8 +1,4 @@
|
||||||
; Copyright (c) 2023 Rumbledethumps
|
; Picocomputer 6502 general defines
|
||||||
;
|
|
||||||
; SPDX-License-Identifier: Zlib
|
|
||||||
; SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
; SPDX-License-Identifier: Unlicense
|
|
||||||
|
|
||||||
; RIA UART
|
; RIA UART
|
||||||
RIA_READY := $FFE0 ; TX=$80 RX=$40
|
RIA_READY := $FFE0 ; TX=$80 RX=$40
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2023 Rumbledethumps
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Zlib
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
# SPDX-License-Identifier: Unlicense
|
|
||||||
#
|
|
||||||
|
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__STARTUP__: type = import;
|
__STARTUP__: type = import;
|
||||||
__STACKSIZE__: type = weak, value = $0800;
|
__STACKSIZE__: type = weak, value = $0800;
|
||||||
|
|
|
@ -175,6 +175,9 @@
|
||||||
<tag><htmlurl url="plus4.html" name="plus4.html"></tag>
|
<tag><htmlurl url="plus4.html" name="plus4.html"></tag>
|
||||||
Topics specific to the Commodore Plus/4.
|
Topics specific to the Commodore Plus/4.
|
||||||
|
|
||||||
|
<tag><htmlurl url="rp6502.html" name="rp6502.html"></tag>
|
||||||
|
Topics specific to the Picocomputer 6502.
|
||||||
|
|
||||||
<tag><htmlurl url="supervision.html" name="supervision.html"></tag>
|
<tag><htmlurl url="supervision.html" name="supervision.html"></tag>
|
||||||
Topics specific to the Watara Supervision Console.
|
Topics specific to the Watara Supervision Console.
|
||||||
|
|
||||||
|
|
96
doc/rp6502.sgml
Normal file
96
doc/rp6502.sgml
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
<!doctype linuxdoc system>
|
||||||
|
|
||||||
|
<article>
|
||||||
|
<title>Picocomputer 6502 - specific information for cc65
|
||||||
|
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
An overview over the Picocomputer 6502 and its interfaces to the cc65 C
|
||||||
|
compiler.
|
||||||
|
</abstract>
|
||||||
|
|
||||||
|
<!-- Table of contents -->
|
||||||
|
<toc>
|
||||||
|
|
||||||
|
<!-- Begin the document -->
|
||||||
|
|
||||||
|
<sect>Overview<p>
|
||||||
|
|
||||||
|
The Picocomputer 6502 is a modern W65C02S computer with a custom operating
|
||||||
|
system designed to be POSIX-like. The reference design includes a W65C02S,
|
||||||
|
W65C22S, RP6502-RIA, and optionally a RP6502-VGA. Peripheral devices like
|
||||||
|
keyboards, mice, and flash storage are connected by USB to the RP6502-RIA.
|
||||||
|
Audio is generated by the RP6502-RIA. Video is generated by the RP6502-VGA.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<sect>Binary format<p>
|
||||||
|
|
||||||
|
The standard binary output format generated by the linker for the RP6502 target
|
||||||
|
is a plain machine language program without any prefix or postfix.
|
||||||
|
|
||||||
|
The RP6502 Integrated Development Environment, based on Visual Studio Code,
|
||||||
|
will convert the cc65 binary output into RP6502 ROM files that can be loaded
|
||||||
|
directly from the RP6502 monitor or installed on the RIA to be loaded at boot.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<sect>Memory layout<p>
|
||||||
|
|
||||||
|
<descrip>
|
||||||
|
<tag/Stack/
|
||||||
|
The C run-time stack is located at $FEFF, and grows downward.
|
||||||
|
|
||||||
|
<tag/Heap/
|
||||||
|
The C heap is located at the end of the program, and grows toward the C
|
||||||
|
run-time stack.
|
||||||
|
|
||||||
|
<tag/RAM/
|
||||||
|
RAM is located at $0000 - $FEFF. Default binaries load and
|
||||||
|
start at $0200.
|
||||||
|
|
||||||
|
<tag/ROM/
|
||||||
|
The RP6502 is designed with no ROM in the 6502 address space.
|
||||||
|
|
||||||
|
<tag/VIA/
|
||||||
|
A Versatile Interface Adapter (6522) is 16 registers located
|
||||||
|
at $FFD0.
|
||||||
|
|
||||||
|
<tag/RIA/
|
||||||
|
The RP6502 Interface Adapter is 32 registers located at $FFE0.
|
||||||
|
|
||||||
|
<tag/User/
|
||||||
|
User I/O expansion is from $FF00 to $FFCF.
|
||||||
|
|
||||||
|
</descrip><p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<sect>Platform-specific header files<p>
|
||||||
|
|
||||||
|
Programs containing RP6502-specific code may use the <tt/rp6502.h/ or
|
||||||
|
<tt/rp6502.inc/ include files.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<sect>License<p>
|
||||||
|
|
||||||
|
This software is provided "as-is", without any expressed or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
<enum>
|
||||||
|
<item> The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated, but is not required.
|
||||||
|
<item> Altered source versions must be plainly marked as such, and must not
|
||||||
|
be misrepresented as being the original software.
|
||||||
|
<item> This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
</article>
|
|
@ -1,10 +1,28 @@
|
||||||
/*
|
/*****************************************************************************/
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
/* */
|
||||||
*
|
/* rp6502.h */
|
||||||
* SPDX-License-Identifier: Zlib
|
/* */
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
/* Picocomputer 6502 */
|
||||||
* SPDX-License-Identifier: Unlicense
|
/* */
|
||||||
*/
|
/* */
|
||||||
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
/* warranty. In no event will the authors be held liable for any damages */
|
||||||
|
/* arising from the use of this software. */
|
||||||
|
/* */
|
||||||
|
/* Permission is granted to anyone to use this software for any purpose, */
|
||||||
|
/* including commercial applications, and to alter it and redistribute it */
|
||||||
|
/* freely, subject to the following restrictions: */
|
||||||
|
/* */
|
||||||
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||||
|
/* claim that you wrote the original software. If you use this software */
|
||||||
|
/* in a product, an acknowledgment in the product documentation would be */
|
||||||
|
/* appreciated but is not required. */
|
||||||
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||||
|
/* be misrepresented as being the original software. */
|
||||||
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
|
/* distribution. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
#ifndef _RP6502_H
|
#ifndef _RP6502_H
|
||||||
#define _RP6502_H
|
#define _RP6502_H
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
int __fastcall__ codepage (void)
|
int __fastcall__ codepage (void)
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
; Copyright (c) 2023 Rumbledethumps
|
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: Zlib
|
; 2023, Rumbledethumps
|
||||||
; SPDX-License-Identifier: BSD-3-Clause
|
;
|
||||||
; SPDX-License-Identifier: Unlicense
|
; crt0.s
|
||||||
|
|
||||||
; Boilerplate crt0.s
|
|
||||||
|
|
||||||
.export _init, _exit
|
.export _init, _exit
|
||||||
.import _main
|
.import _main
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
@ -13,8 +5,7 @@ int __clock_gettimespec(struct timespec *ts, unsigned char op)
|
||||||
/* Internal method shared by clock_getres and clock_gettime. */
|
/* Internal method shared by clock_getres and clock_gettime. */
|
||||||
{
|
{
|
||||||
int ax = ria_call_int_errno (op);
|
int ax = ria_call_int_errno (op);
|
||||||
if (ax >= 0)
|
if (ax >= 0) {
|
||||||
{
|
|
||||||
ts->tv_sec = ria_pop_long ();
|
ts->tv_sec = ria_pop_long ();
|
||||||
ts->tv_nsec = ria_pop_long ();
|
ts->tv_nsec = ria_pop_long ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
@ -14,8 +6,7 @@ int clock_gettimezone(clockid_t clock_id, struct _timezone *tz)
|
||||||
int ax;
|
int ax;
|
||||||
ria_set_ax (clock_id);
|
ria_set_ax (clock_id);
|
||||||
ax = ria_call_int_errno (RIA_OP_CLOCK_GETTIMEZONE);
|
ax = ria_call_int_errno (RIA_OP_CLOCK_GETTIMEZONE);
|
||||||
if (ax >= 0)
|
if (ax >= 0) {
|
||||||
{
|
|
||||||
char i;
|
char i;
|
||||||
for (i = 0; i < sizeof (struct _timezone); i++)
|
for (i = 0; i < sizeof (struct _timezone); i++)
|
||||||
((char*)tz)[i] = ria_pop_char ();
|
((char*)tz)[i] = ria_pop_char ();
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
; Copyright (c) 2023 Rumbledethumps
|
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: Zlib
|
; 2023, Rumbledethumps
|
||||||
; SPDX-License-Identifier: BSD-3-Clause
|
;
|
||||||
; SPDX-License-Identifier: Unlicense
|
|
||||||
|
|
||||||
.constructor initenv, 24
|
.constructor initenv, 24
|
||||||
.import __environ, __envcount, __envsize
|
.import __environ, __envcount, __envsize
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
; Copyright (c) 2023 Rumbledethumps
|
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: Zlib
|
; 2023, Rumbledethumps
|
||||||
; SPDX-License-Identifier: BSD-3-Clause
|
;
|
||||||
; SPDX-License-Identifier: Unlicense
|
; Enables the C IRQ tools
|
||||||
|
|
||||||
.export initirq, doneirq
|
.export initirq, doneirq
|
||||||
.import callirq, _exit
|
.import callirq, _exit
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
long __fastcall__ lrand (void)
|
long __fastcall__ lrand (void)
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
; Copyright (c) 2023 Rumbledethumps
|
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: Zlib
|
; 2023, Rumbledethumps
|
||||||
; SPDX-License-Identifier: BSD-3-Clause
|
;
|
||||||
; SPDX-License-Identifier: Unlicense
|
; No arguments
|
||||||
|
|
||||||
.constructor initmainargs, 24
|
.constructor initmainargs, 24
|
||||||
.import __argc, __argv
|
.import __argc, __argv
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -13,12 +5,10 @@
|
||||||
int __cdecl__ open (const char* name, int flags, ...)
|
int __cdecl__ open (const char* name, int flags, ...)
|
||||||
{
|
{
|
||||||
size_t namelen = strlen (name);
|
size_t namelen = strlen (name);
|
||||||
if (namelen > 255)
|
if (namelen > 255) {
|
||||||
{
|
|
||||||
return _mappederrno (EINVAL);
|
return _mappederrno (EINVAL);
|
||||||
}
|
}
|
||||||
while (namelen)
|
while (namelen) {
|
||||||
{
|
|
||||||
ria_push_char (name[--namelen]);
|
ria_push_char (name[--namelen]);
|
||||||
}
|
}
|
||||||
ria_set_ax (flags);
|
ria_set_ax (flags);
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
int __fastcall__ phi2 (void)
|
int __fastcall__ phi2 (void)
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,18 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int __fastcall__ read (int fildes, void* buf, unsigned count)
|
int __fastcall__ read (int fildes, void* buf, unsigned count)
|
||||||
{
|
{
|
||||||
int total = 0;
|
int total = 0;
|
||||||
while (count)
|
while (count) {
|
||||||
{
|
|
||||||
unsigned blockcount = (count > 256) ? 256 : count;
|
unsigned blockcount = (count > 256) ? 256 : count;
|
||||||
int bytes_read = read_xstack (&((char*)buf)[total], blockcount, fildes);
|
int bytes_read = read_xstack (&((char*)buf)[total], blockcount, fildes);
|
||||||
if (bytes_read < 0)
|
if (bytes_read < 0) {
|
||||||
{
|
|
||||||
return bytes_read;
|
return bytes_read;
|
||||||
}
|
}
|
||||||
total += bytes_read;
|
total += bytes_read;
|
||||||
count -= bytes_read;
|
count -= bytes_read;
|
||||||
if (bytes_read < blockcount)
|
if (bytes_read < blockcount) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
int __fastcall__ read_xram (unsigned buf, unsigned count, int fildes)
|
int __fastcall__ read_xram (unsigned buf, unsigned count, int fildes)
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
int __fastcall__ read_xstack (void* buf, unsigned count, int fildes)
|
int __fastcall__ read_xstack (void* buf, unsigned count, int fildes)
|
||||||
|
@ -14,8 +6,7 @@ int __fastcall__ read_xstack(void *buf, unsigned count, int fildes)
|
||||||
ria_push_int (count);
|
ria_push_int (count);
|
||||||
ria_set_ax (fildes);
|
ria_set_ax (fildes);
|
||||||
ax = ria_call_int_errno (RIA_OP_READ_XSTACK);
|
ax = ria_call_int_errno (RIA_OP_READ_XSTACK);
|
||||||
for (i = 0; i < ax; i++)
|
for (i = 0; i < ax; i++) {
|
||||||
{
|
|
||||||
((char*)buf)[i] = ria_pop_char ();
|
((char*)buf)[i] = ria_pop_char ();
|
||||||
}
|
}
|
||||||
return ax;
|
return ax;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
; Copyright (c) 2023 Rumbledethumps
|
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: Zlib
|
; 2023, Rumbledethumps
|
||||||
; SPDX-License-Identifier: BSD-3-Clause
|
;
|
||||||
; SPDX-License-Identifier: Unlicense
|
; Helpers for building API shims
|
||||||
|
|
||||||
.include "rp6502.inc"
|
.include "rp6502.inc"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -14,12 +6,10 @@ unsigned char __fastcall__ _sysremove(const char *name)
|
||||||
{
|
{
|
||||||
size_t namelen;
|
size_t namelen;
|
||||||
namelen = strlen (name);
|
namelen = strlen (name);
|
||||||
if (namelen > 255)
|
if (namelen > 255) {
|
||||||
{
|
|
||||||
return _mappederrno (EINVAL);
|
return _mappederrno (EINVAL);
|
||||||
}
|
}
|
||||||
while (namelen)
|
while (namelen) {
|
||||||
{
|
|
||||||
ria_push_char (name[--namelen]);
|
ria_push_char (name[--namelen]);
|
||||||
}
|
}
|
||||||
return ria_call_int_errno (RIA_OP_UNLINK);
|
return ria_call_int_errno (RIA_OP_UNLINK);
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -15,17 +7,14 @@ unsigned char __fastcall__ _sysrename(const char *oldpath, const char *newpath)
|
||||||
size_t oldpathlen, newpathlen;
|
size_t oldpathlen, newpathlen;
|
||||||
oldpathlen = strlen (oldpath);
|
oldpathlen = strlen (oldpath);
|
||||||
newpathlen = strlen (newpath);
|
newpathlen = strlen (newpath);
|
||||||
if (oldpathlen + newpathlen > 254)
|
if (oldpathlen + newpathlen > 254) {
|
||||||
{
|
|
||||||
return _mappederrno (EINVAL);
|
return _mappederrno (EINVAL);
|
||||||
}
|
}
|
||||||
while (oldpathlen)
|
while (oldpathlen) {
|
||||||
{
|
|
||||||
ria_push_char (oldpath[--oldpathlen]);
|
ria_push_char (oldpath[--oldpathlen]);
|
||||||
}
|
}
|
||||||
ria_push_char (0);
|
ria_push_char (0);
|
||||||
while (newpathlen)
|
while (newpathlen) {
|
||||||
{
|
|
||||||
ria_push_char (newpath[--newpathlen]);
|
ria_push_char (newpath[--newpathlen]);
|
||||||
}
|
}
|
||||||
return ria_call_int_errno (RIA_OP_RENAME);
|
return ria_call_int_errno (RIA_OP_RENAME);
|
||||||
|
|
|
@ -1,29 +1,18 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int __fastcall__ write (int fildes, const void* buf, unsigned count)
|
int __fastcall__ write (int fildes, const void* buf, unsigned count)
|
||||||
{
|
{
|
||||||
int ax, total = 0;
|
int ax, total = 0;
|
||||||
while (count)
|
while (count) {
|
||||||
{
|
|
||||||
int blockcount = (count > 256) ? 256 : count;
|
int blockcount = (count > 256) ? 256 : count;
|
||||||
ax = write_xstack (&((char*)buf)[total], blockcount, fildes);
|
ax = write_xstack (&((char*)buf)[total], blockcount, fildes);
|
||||||
if (ax < 0)
|
if (ax < 0) {
|
||||||
{
|
|
||||||
return ax;
|
return ax;
|
||||||
}
|
}
|
||||||
total += ax;
|
total += ax;
|
||||||
count -= ax;
|
count -= ax;
|
||||||
if (ax < blockcount)
|
if (ax < blockcount) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
int __fastcall__ write_xram (unsigned buf, unsigned count, int fildes)
|
int __fastcall__ write_xram (unsigned buf, unsigned count, int fildes)
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 Rumbledethumps
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Zlib
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
* SPDX-License-Identifier: Unlicense
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
|
|
||||||
int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes)
|
int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = count; i;)
|
for (i = count; i;) {
|
||||||
{
|
|
||||||
ria_push_char (((char*)buf)[--i]);
|
ria_push_char (((char*)buf)[--i]);
|
||||||
}
|
}
|
||||||
ria_set_ax (fildes);
|
ria_set_ax (fildes);
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
; Copyright (c) 2023 Rumbledethumps
|
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: Zlib
|
; 2023, Rumbledethumps
|
||||||
; SPDX-License-Identifier: BSD-3-Clause
|
;
|
||||||
; SPDX-License-Identifier: Unlicense
|
|
||||||
|
|
||||||
; CC65 will promote variadic char arguments to int. It will not demote longs.
|
; CC65 will promote variadic char arguments to int. It will not demote longs.
|
||||||
; int __cdecl__ xreg(char device, char channel, unsigned char address, ...);
|
; int __cdecl__ xreg(char device, char channel, unsigned char address, ...);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user