Corrected a few public functions

This commit is contained in:
Peter Weingartner 2024-10-13 16:14:05 -04:00
parent 257f41bd2f
commit cc29260a28
41 changed files with 1818 additions and 1517 deletions

View file

@ -1,12 +1,12 @@
;
; extern SYSTEMCALL void sys_exit(short result);
; extern SYSTEMCALL void sys_proc_exit(short result);
;
; result goes in A[15..0]
;
; 0 bytes needed for the stack parameters
;
sys_exit = $000000
sys_proc_exit = $ffe000
;
@ -393,26 +393,6 @@ sys_fsys_close = $ffe078
sys_fsys_opendir = $ffe07c
;
; extern SYSTEMCALL short sys_fsys_close(short fd);
;
; fd goes in A[15..0]
;
; 0 bytes needed for the stack parameters
;
sys_fsys_close = $000000
;
; extern SYSTEMCALL short sys_fsys_opendir(const char * path);
;
; path goes in X[15..0]:A[15..0]
;
; 0 bytes needed for the stack parameters
;
sys_fsys_opendir = $000000
;
; extern SYSTEMCALL short sys_fsys_closedir(short dir);
;
@ -584,7 +564,7 @@ start .dword ? ; pointer to the long variable to fill with the st
;
sys_fsys_register_loader = $ffe0b0
fsys_register_loader.namespace
fsys_register_loader .namespace
.virtual 1,s
loader .dword ? ; pointer to the file load routine to add
.endv
@ -802,7 +782,7 @@ background .dword ? ; the Text LUT index of the new current background
;
sys_txt_set_cursor_visible = $ffe100
txt_set_cursor_visible.namespace
txt_set_cursor_visible .namespace
.virtual 1,s
is_visible .word ? ; TRUE if the cursor should be visible, FALSE (0) otherwise
.endv
@ -866,7 +846,7 @@ height .word ? ; the vertical size of one side of the border (0 -
;
sys_txt_set_border_color = $ffe110
txt_set_border_color.namespace
txt_set_border_color .namespace
.virtual 1,s
red .byte ? ; the red component of the color (0 - 255)
green .byte ? ; the green component of the color (0 - 255)

View file

@ -181,7 +181,7 @@ class Function:
short_name = self.name()
stack_parameters = self.parameters()[1:]
output.write("{0:<16}.namespace\n".format(short_name))
output.write("{0:<16} .namespace\n".format(short_name))
output.write(" .virtual 1,s\n")
for parameter in stack_parameters:
@ -270,6 +270,8 @@ with open(sys.argv[2], "r") as addresses:
func_name = m.group(1).strip()
func_address = int(m.group(2), 16)
print("Name: {0}, Address: {1}".format(func_name, func_address))
for func in functions:
if func.name() == func_name:
func.set_address(func_address)

View file

@ -26,7 +26,7 @@
*
* @param result the code to return to the kernel
*/
extern SYSTEMCALL void sys_exit(short result);
extern SYSTEMCALL void sys_proc_exit(short result);
/**
* Enable all interrupts
@ -322,24 +322,6 @@ extern SYSTEMCALL short sys_fsys_close(short fd);
*/
extern SYSTEMCALL short sys_fsys_opendir(const char * path);
/**
* Close access to a previously open file.
*
* @param fd the channel ID for the file
*
* @return 0 on success, negative number on failure
*/
extern SYSTEMCALL short sys_fsys_close(short fd);
/**
* Attempt to open a directory for scanning
*
* @param path the path to the directory to open
*
* @return the handle to the directory if >= 0. An error if < 0
*/
extern SYSTEMCALL short sys_fsys_opendir(const char * path);
/**
* Close a previously open directory
*

603
client/src/stubs.lst Normal file
View file

@ -0,0 +1,603 @@
###############################################################################
# #
# Calypsi ISO C compiler for 65816 version 5.5 #
# 24/Sep/2024 17:04:27 #
# Command line: -I. -I./include -DMODEL=17 -DCPU=255 --code-model large #
# --data-model large -l -o stubs.o stubs.c #
# #
###############################################################################
\ 000000 .rtmodel version,"1"
\ 000000 .rtmodel codeModel,"large"
\ 000000 .rtmodel dataModel,"large"
\ 000000 .rtmodel core,"65816"
\ 000000 .rtmodel huge,"0"
\ 000000 .extern _Dp
\ 000000 .extern _Mul16
\ 000000 .extern _Vfp
\ 000000 .extern errno
\ 000000 .extern sys_chan_read
\ 000000 .extern sys_chan_write
\ 000000 .extern sys_fsys_close
\ 000000 .extern sys_fsys_delete
\ 000000 .extern sys_fsys_open
\ 000000 .extern sys_fsys_rename
0001 /**
0002 * @file stubs.c
0003 * @brief Stubs for Calypsi I/O routines
0004 * @version 0.1
0005 * @date 2024-09-02
0006 *
0007 * @copyright Copyright (c) 2024
0008 *
0009 */
0010
0011 #include "include/toolbox.h"
0012
0013 #include <errno.h>
0014 #include <fcntl.h>
0015 #include <stdbool.h>
0016 #include <stdint.h>
0017 #include <stubs.h>
0018
0019 #define MAX_FD 16
0020
0021 struct s_file_descriptor {
0022 bool is_open;
0023 int public_fd;
0024 short toolbox_fd;
0025 };
0026
0027 static bool is_inited = false;
\ 000000 .section zfar,bss
\ 000000 is_inited: .space 2
0028 static struct s_file_descriptor file_descriptor[MAX_FD];
\ 000000 .section zfar,bss
\ 000000 file_descriptor:
\ 000000 .space 96
0029
0030 static void init() {
0031 if (!is_inited) {
0032 is_inited = true;
0033
0034 // Define stdin
0035 file_descriptor[0].is_open = true;
0036 file_descriptor[0].public_fd = 0;
0037 file_descriptor[0].toolbox_fd = 0;
0038
0039 // Define stdout
0040 file_descriptor[1].is_open = true;
0041 file_descriptor[1].public_fd = 0;
0042 file_descriptor[1].toolbox_fd = 0;
0043
0044 // Define stderr
0045 file_descriptor[2].is_open = true;
0046 file_descriptor[2].public_fd = 0;
0047 file_descriptor[2].toolbox_fd = 0;
0048
0049 for (int i = 3; i < MAX_FD; i++) {
0050 file_descriptor[i].is_open = false;
0051 file_descriptor[i].public_fd = 0;
0052 file_descriptor[i].toolbox_fd = 0;
0053 }
0054 }
0055 }
0056
0057 /**
0058 * @brief Find a free file descriptor
0059 *
0060 * @return int the index of the available (closed) file descriptor (-1 for error)
0061 */
0062 static int find_fd() {
\ 000000 .section farcode,text
\ 000000 5a find_fd: phy
0063 for (int i = 3; i < MAX_FD; i++) {
\ 000001 a90300 lda ##3
\ 000004 8301 sta 1,s
\ 000006 a301 lda 1,s
\ 000008 8301 sta 1,s
\ 00000a a301 `?L15`: lda 1,s
\ 00000c 38 sec
\ 00000d e91000 sbc ##16
\ 000010 5003 bvc `?L82`
\ 000012 490080 eor ##-32768
\ 000015 3005 `?L82`: bmi `?L14`
0064 if (!file_descriptor[i].is_open) {
0065 // Found one that is closed... return it's public ID
0066 return file_descriptor[i].public_fd;
0067 }
0068 }
0069
0070 // Return an error
0071 return -1;
\ 000017 a9ffff lda ##-1
\ 00001a 8031 bra `?L13`
\ 00001c a301 `?L14`: lda 1,s
\ 00001e a20600 ldx ##6
\ 000021 22...... jsl long:_Mul16
\ 000025 aa tax
\ 000026 bf...... lda long:file_descriptor,x
\ 00002a d023 bne `?L18`
\ 00002c a9.... lda ##.word0 file_descriptor
\ 00002f 85.. sta dp:.tiny _Dp
\ 000031 a9.... lda ##.word2 file_descriptor
\ 000034 85.. sta dp:.tiny (_Dp+2)
\ 000036 a301 lda 1,s
\ 000038 a20600 ldx ##6
\ 00003b 22...... jsl long:_Mul16
\ 00003f 85.. sta dp:.tiny (_Dp+4)
\ 000041 18 clc
\ 000042 a5.. lda dp:.tiny _Dp
\ 000044 65.. adc dp:.tiny (_Dp+4)
\ 000046 85.. sta dp:.tiny _Dp
\ 000048 a00200 ldy ##2
\ 00004b b7.. lda [.tiny _Dp],y
\ 00004d `?L13`:
0072 }
\ 00004d 7a ply
\ 00004e 6b rtl
\ 00004f a301 `?L18`: lda 1,s
\ 000051 1a inc a
\ 000052 8301 sta 1,s
\ 000054 80b4 bra `?L15`
0073
0074 /****************************************************************************
0075 * Name: _Stub_open
0076 *
0077 * Description:
0078 * Open a file.
0079 * The oflag argument are POSIX style mode flags, e.g O_RDONLY which
0080 * are defined in fcntl.h.
0081 * This function is variadic as it optionally can take a mode_t that
0082 * are permissions, e.g 0666. If the file system does not handle
0083 * permissions you can ignore that this function is variadic.
0084 * The return file descriptor shall be a positive number, larger
0085 * than 2 (as 0-2 are used for stdin, stdout and stderr).
0086 * The actual number does not matter and they need not to be
0087 * consequtive, multiple numeric series with gaps between can be used.
0088 *
0089 * Return the obtained file descriptor or EOF (-1) on failure and set
0090 * errno according to the error.
0091 *
0092 ****************************************************************************/
0093
0094 int _Stub_open(const char *path, int oflag, ...) {
\ 000000 .section farcode,text
\ 000000 .public _Stub_open
\ 000000 _Stub_open:
\ 000000 d4.. pei dp:.tiny (_Dp+8)
\ 000002 d4.. pei dp:.tiny (_Dp+10)
\ 000004 5a phy
\ 000005 5a phy
\ 000006 5a phy
\ 000007 8303 sta 3,s
\ 000009 a5.. lda dp:.tiny _Dp
\ 00000b 85.. sta dp:.tiny (_Dp+8)
\ 00000d a5.. lda dp:.tiny (_Dp+2)
\ 00000f 85.. sta dp:.tiny (_Dp+10)
0095 int fd = find_fd();
\ 000011 22...... jsl long:find_fd
\ 000015 8305 sta 5,s
0096 if (fd >= 0) {
\ 000017 a305 lda 5,s
\ 000019 1003 bpl `?L103`
\ 00001b 4c.... jmp .kbank `?L26`
\ 00001e `?L103`:
0097 int mode = 0;
\ 00001e a90000 lda ##0
\ 000021 8301 sta 1,s
0098
0099 if ((oflag & O_RDONLY) == O_RDONLY) {
\ 000023 a90100 lda ##1
\ 000026 2303 and 3,s
\ 000028 c90100 cmp ##1
\ 00002b d00b bne `?L29`
0100 mode = FSYS_READ | FSYS_OPEN_EXISTING;
\ 00002d a90100 lda ##1
\ 000030 8301 sta 1,s
\ 000032 a301 lda 1,s
\ 000034 8301 sta 1,s
\ 000036 8004 bra `?L30`
\ 000038 a301 `?L29`: lda 1,s
\ 00003a 8301 sta 1,s
\ 00003c `?L30`:
0101 }
0102
0103 if ((oflag & O_WRONLY) == O_WRONLY) {
\ 00003c a90200 lda ##2
\ 00003f 2303 and 3,s
\ 000041 c90200 cmp ##2
\ 000044 d00b bne `?L32`
0104 mode = FSYS_WRITE;
\ 000046 a90200 lda ##2
\ 000049 8301 sta 1,s
\ 00004b a301 lda 1,s
\ 00004d 8301 sta 1,s
\ 00004f 8004 bra `?L33`
\ 000051 a301 `?L32`: lda 1,s
\ 000053 8301 sta 1,s
\ 000055 `?L33`:
0105 }
0106
0107 if ((oflag & O_RDWR) == O_RDWR) {
\ 000055 a90300 lda ##3
\ 000058 2303 and 3,s
\ 00005a c90300 cmp ##3
\ 00005d d00b bne `?L35`
0108 mode = FSYS_READ | FSYS_WRITE;
\ 00005f a90300 lda ##3
\ 000062 8301 sta 1,s
\ 000064 a301 lda 1,s
\ 000066 8301 sta 1,s
\ 000068 8004 bra `?L36`
\ 00006a a301 `?L35`: lda 1,s
\ 00006c 8301 sta 1,s
\ 00006e `?L36`:
0109 }
0110
0111 if ((oflag & O_CREAT) == O_CREAT) {
\ 00006e a90400 lda ##4
\ 000071 2303 and 3,s
\ 000073 c90400 cmp ##4
\ 000076 d00d bne `?L38`
0112 mode |= FSYS_CREATE_NEW | FSYS_CREATE_ALWAYS;
\ 000078 a90c00 lda ##12
\ 00007b 0301 ora 1,s
\ 00007d 8301 sta 1,s
\ 00007f a301 lda 1,s
\ 000081 8301 sta 1,s
\ 000083 8004 bra `?L39`
\ 000085 a301 `?L38`: lda 1,s
\ 000087 8301 sta 1,s
\ 000089 `?L39`:
0113 }
0114
0115 short toolbox_fd = sys_fsys_open(path, mode);
\ 000089 a301 lda 1,s
\ 00008b 48 pha
\ 00008c a6.. ldx dp:.tiny (_Dp+10)
\ 00008e a5.. lda dp:.tiny (_Dp+8)
\ 000090 22...... jsl long:sys_fsys_open
\ 000094 aa tax
\ 000095 68 pla
\ 000096 8a txa
\ 000097 8301 sta 1,s
0116 if (toolbox_fd >= 0) {
\ 000099 a301 lda 1,s
\ 00009b 3038 bmi `?L41`
0117 file_descriptor[fd].is_open = true;
\ 00009d a305 lda 5,s
\ 00009f a20600 ldx ##6
\ 0000a2 22...... jsl long:_Mul16
\ 0000a6 aa tax
\ 0000a7 a90100 lda ##1
\ 0000aa 9f...... sta long:file_descriptor,x
0118 file_descriptor[fd].toolbox_fd = toolbox_fd;
\ 0000ae a2.... ldx ##.word0 file_descriptor
\ 0000b1 86.. stx dp:.tiny _Dp
\ 0000b3 a2.... ldx ##.word2 file_descriptor
\ 0000b6 86.. stx dp:.tiny (_Dp+2)
\ 0000b8 a305 lda 5,s
\ 0000ba a20600 ldx ##6
\ 0000bd 22...... jsl long:_Mul16
\ 0000c1 85.. sta dp:.tiny (_Dp+4)
\ 0000c3 18 clc
\ 0000c4 a5.. lda dp:.tiny _Dp
\ 0000c6 65.. adc dp:.tiny (_Dp+4)
\ 0000c8 85.. sta dp:.tiny _Dp
\ 0000ca a301 lda 1,s
\ 0000cc a00400 ldy ##4
\ 0000cf 97.. sta [.tiny _Dp],y
0119
0120 return fd;
\ 0000d1 a305 lda 5,s
\ 0000d3 800f bra `?L25`
\ 0000d5 `?L41`:
0121 } else {
0122 return -1;
\ 0000d5 a9ffff lda ##-1
\ 0000d8 800a bra `?L25`
\ 0000da `?L26`:
0123 }
0124
0125 } else {
0126 errno = ENFILE;
\ 0000da a91700 lda ##23
\ 0000dd 8f...... sta long:errno
0127 return -1;
\ 0000e1 a9ffff lda ##-1
\ 0000e4 `?L25`:
0128 }
0129 }
\ 0000e4 7a ply
\ 0000e5 7a ply
\ 0000e6 7a ply
\ 0000e7 7a ply
\ 0000e8 84.. sty dp:.tiny (_Dp+10)
\ 0000ea 7a ply
\ 0000eb 84.. sty dp:.tiny (_Dp+8)
\ 0000ed 6b rtl
0130
0131 /****************************************************************************
0132 * Name: _Stub_close
0133 *
0134 * Description:
0135 * Close a file
0136 *
0137 * Return 0 if operation was OK, EOF otherwise and set errno according to
0138 * the error.
0139 * Note: This will only be invoked for streams opened by _Stub_open(),
0140 * there is no need to check for the standard descriptor 0-2.
0141 *
0142 ****************************************************************************/
0143
0144 int _Stub_close(int fd) {
\ 000000 .section farcode,text
\ 000000 .public _Stub_close
\ 000000 _Stub_close:
\ 000000 5a phy
\ 000001 8301 sta 1,s
0145 if (file_descriptor[fd].is_open) {
\ 000003 a301 lda 1,s
\ 000005 a20600 ldx ##6
\ 000008 22...... jsl long:_Mul16
\ 00000c aa tax
\ 00000d bf...... lda long:file_descriptor,x
\ 000011 f05a beq `?L50`
0146 sys_fsys_close(file_descriptor[fd].toolbox_fd);
\ 000013 a9.... lda ##.word0 file_descriptor
\ 000016 85.. sta dp:.tiny _Dp
\ 000018 a9.... lda ##.word2 file_descriptor
\ 00001b 85.. sta dp:.tiny (_Dp+2)
\ 00001d a301 lda 1,s
\ 00001f a20600 ldx ##6
\ 000022 22...... jsl long:_Mul16
\ 000026 85.. sta dp:.tiny (_Dp+4)
\ 000028 18 clc
\ 000029 a5.. lda dp:.tiny _Dp
\ 00002b 65.. adc dp:.tiny (_Dp+4)
\ 00002d 85.. sta dp:.tiny _Dp
\ 00002f a00400 ldy ##4
\ 000032 b7.. lda [.tiny _Dp],y
\ 000034 22...... jsl long:sys_fsys_close
0147 file_descriptor[fd].toolbox_fd = 0;
\ 000038 a2.... ldx ##.word0 file_descriptor
\ 00003b 86.. stx dp:.tiny _Dp
\ 00003d a2.... ldx ##.word2 file_descriptor
\ 000040 86.. stx dp:.tiny (_Dp+2)
\ 000042 a301 lda 1,s
\ 000044 a20600 ldx ##6
\ 000047 22...... jsl long:_Mul16
\ 00004b 85.. sta dp:.tiny (_Dp+4)
\ 00004d 18 clc
\ 00004e a5.. lda dp:.tiny _Dp
\ 000050 65.. adc dp:.tiny (_Dp+4)
\ 000052 85.. sta dp:.tiny _Dp
\ 000054 a90000 lda ##0
\ 000057 a00400 ldy ##4
\ 00005a 97.. sta [.tiny _Dp],y
0148 file_descriptor[fd].is_open = false;
\ 00005c a301 lda 1,s
\ 00005e a20600 ldx ##6
\ 000061 22...... jsl long:_Mul16
\ 000065 aa tax
\ 000066 a90000 lda ##0
\ 000069 9f...... sta long:file_descriptor,x
\ 00006d `?L50`:
\ 00006d `?L51`:
0149 }
0150
0151 return 0;
\ 00006d a90000 lda ##0
0152 }
\ 000070 7a ply
\ 000071 6b rtl
0153
0154 /****************************************************************************
0155 * Name: _Stub_lseek
0156 *
0157 * Description:
0158 * Change position in a file
0159 *
0160 * Returns the new position in the file in bytes from the beginning of the
0161 * file, or -1 on failure.
0162 *
0163 ****************************************************************************/
0164
0165 long _Stub_lseek(int fd, long offset, int whence) {
\ 000000 .section farcode,text
\ 000000 .public _Stub_lseek
\ 000000 _Stub_lseek:
0166 return 0;
\ 000000 a90000 lda ##0
\ 000003 a20000 ldx ##0
0167 }
\ 000006 6b rtl
0168
0169 /****************************************************************************
0170 * Name: _Stub_read
0171 *
0172 * Description:
0173 * Read from a file
0174 *
0175 * Returns the number of characters read. Return -1 on failure and set
0176 * errno according to the error.
0177 *
0178 ****************************************************************************/
0179
0180 size_t _Stub_read(int fd, void *buf, size_t count) {
\ 000000 .section farcode,text
\ 000000 .public _Stub_read
\ 000000 5a _Stub_read: phy
\ 000001 8301 sta 1,s
0181 if (file_descriptor[fd].is_open) {
\ 000003 a301 lda 1,s
\ 000005 a20600 ldx ##6
\ 000008 22...... jsl long:_Mul16
\ 00000c aa tax
\ 00000d bf...... lda long:file_descriptor,x
\ 000011 f035 beq `?L61`
0182 short n = sys_chan_read(file_descriptor[fd].toolbox_fd, (unsigned char *)buf, (short)count);
\ 000013 a5.. lda dp:.tiny (_Dp+4)
\ 000015 48 pha
\ 000016 a5.. lda dp:.tiny (_Dp+2)
\ 000018 48 pha
\ 000019 a5.. lda dp:.tiny _Dp
\ 00001b 48 pha
\ 00001c a9.... lda ##.word0 file_descriptor
\ 00001f 85.. sta dp:.tiny _Dp
\ 000021 a9.... lda ##.word2 file_descriptor
\ 000024 85.. sta dp:.tiny (_Dp+2)
\ 000026 a307 lda 7,s
\ 000028 a20600 ldx ##6
\ 00002b 22...... jsl long:_Mul16
\ 00002f 85.. sta dp:.tiny (_Dp+4)
\ 000031 18 clc
\ 000032 a5.. lda dp:.tiny _Dp
\ 000034 65.. adc dp:.tiny (_Dp+4)
\ 000036 85.. sta dp:.tiny _Dp
\ 000038 a00400 ldy ##4
\ 00003b b7.. lda [.tiny _Dp],y
\ 00003d 22...... jsl long:sys_chan_read
\ 000041 aa tax
\ 000042 68 pla
\ 000043 68 pla
\ 000044 68 pla
0183 return n;
\ 000045 8a txa
\ 000046 8003 bra `?L60`
\ 000048 `?L61`:
0184 } else {
0185 return -1;
\ 000048 a9ffff lda ##-1
\ 00004b `?L60`:
0186 }
0187 }
\ 00004b 7a ply
\ 00004c 6b rtl
0188
0189 /****************************************************************************
0190 * Name: _Stub_write
0191 *
0192 * Description:
0193 * Write to a file
0194 *
0195 * Returns the number of characters actually written. Return -1 on failure and
0196 * set errno according to the error.
0197 *
0198 ****************************************************************************/
0199
0200 size_t _Stub_write(int fd, const void *buf, size_t count) {
\ 000000 .section farcode,text
\ 000000 .public _Stub_write
\ 000000 _Stub_write:
\ 000000 5a phy
\ 000001 8301 sta 1,s
0201 if (file_descriptor[fd].is_open) {
\ 000003 a301 lda 1,s
\ 000005 a20600 ldx ##6
\ 000008 22...... jsl long:_Mul16
\ 00000c aa tax
\ 00000d bf...... lda long:file_descriptor,x
\ 000011 f035 beq `?L69`
0202 short n = sys_chan_write(file_descriptor[fd].toolbox_fd, (unsigned char *)buf, (short)count);
\ 000013 a5.. lda dp:.tiny (_Dp+4)
\ 000015 48 pha
\ 000016 a5.. lda dp:.tiny (_Dp+2)
\ 000018 48 pha
\ 000019 a5.. lda dp:.tiny _Dp
\ 00001b 48 pha
\ 00001c a9.... lda ##.word0 file_descriptor
\ 00001f 85.. sta dp:.tiny _Dp
\ 000021 a9.... lda ##.word2 file_descriptor
\ 000024 85.. sta dp:.tiny (_Dp+2)
\ 000026 a307 lda 7,s
\ 000028 a20600 ldx ##6
\ 00002b 22...... jsl long:_Mul16
\ 00002f 85.. sta dp:.tiny (_Dp+4)
\ 000031 18 clc
\ 000032 a5.. lda dp:.tiny _Dp
\ 000034 65.. adc dp:.tiny (_Dp+4)
\ 000036 85.. sta dp:.tiny _Dp
\ 000038 a00400 ldy ##4
\ 00003b b7.. lda [.tiny _Dp],y
\ 00003d 22...... jsl long:sys_chan_write
\ 000041 aa tax
\ 000042 68 pla
\ 000043 68 pla
\ 000044 68 pla
0203 return n;
\ 000045 8a txa
\ 000046 8003 bra `?L68`
\ 000048 `?L69`:
0204 } else {
0205 return -1;
\ 000048 a9ffff lda ##-1
\ 00004b `?L68`:
0206 }
0207 }
\ 00004b 7a ply
\ 00004c 6b rtl
0208
0209 /****************************************************************************
0210 * Name: _Stub_rename
0211 *
0212 * Description:
0213 * Rename a file or directory
0214 *
0215 * Return 0 on success, -1 otherwise and set errno according to the
0216 * error.
0217 *
0218 ****************************************************************************/
0219
0220 int _Stub_rename(const char *oldpath, const char *newpath) {
\ 000000 .section farcode,text
\ 000000 .public _Stub_rename
\ 000000 _Stub_rename:
0221 short result = sys_fsys_rename(oldpath, newpath);
\ 000000 a5.. lda dp:.tiny (_Dp+6)
\ 000002 48 pha
\ 000003 a5.. lda dp:.tiny (_Dp+4)
\ 000005 48 pha
\ 000006 a6.. ldx dp:.tiny (_Dp+2)
\ 000008 a5.. lda dp:.tiny _Dp
\ 00000a 22...... jsl long:sys_fsys_rename
\ 00000e aa tax
\ 00000f 68 pla
\ 000010 68 pla
0222 return result;
\ 000011 8a txa
0223 }
\ 000012 6b rtl
0224
0225 /****************************************************************************
0226 * Name: _Stub_remove
0227 *
0228 * Description:
0229 * Remove a file or directory
0230 *
0231 * Return 0 on success, -1 otherwise and set errno according to the
0232 * error.
0233 *
0234 ****************************************************************************/
0235
0236 int _Stub_remove(const char *path) {
\ 000000 .section farcode,text
\ 000000 .public _Stub_remove
\ 000000 _Stub_remove:
0237 short result = sys_fsys_delete(path);
\ 000000 a6.. ldx dp:.tiny (_Dp+2)
\ 000002 a5.. lda dp:.tiny _Dp
\ 000004 22...... jsl long:sys_fsys_delete
0238 return result;
0239 }
\ 000008 6b rtl
##########################
# #
# Memory sizes (decimal) #
# #
##########################
Executable (Text): 627 bytes
Zero initialized __far (BSS): 98 bytes

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -1,68 +0,0 @@
# VPATH=.:../../module/Calypsi-remote-debug/src
DEBUGGER=../module/Calypsi-remote-debug/src
UNIT := F256K
MEMORY := RAM
# Define OS-dependent variables
ifeq ($(OS),Windows_NT)
RM = del /F/Q
else
RM = rm -f
endif
# Define model-specific variables, including tools, source files, compiler flags, etc.
ifeq ($(UNIT),F256K)
CPU=w65816
C_SRCS_DEBUGGER=$(DEBUGGER)/agent.c $(DEBUGGER)/c256-uart.c $(DEBUGGER)/low_level_WDC65816.s
SRCS_FOR_UNIT=
CFLAGS_FOR_UNIT=-DMODEL=17 -DCPU=255 --code-model large --data-model large
ifeq ($(MEMORY),ROM)
LDFLAGS_FOR_UNIT=clib-lc-ld.a --rtattr printf=medium --target=f256 # C256/f256-flash.scm
else
LDFLAGS_FOR_UNIT=f256-plain.scm clib-lc-ld.a --rtattr printf=medium --target=f256
endif
endif
ifeq ($(CPU),w65816)
CC=cc65816
AS=as65816
LD=ln65816
AR=nlib
endif
INCLUDES=-I. -I./include
CFLAGS=$(INCLUDES) $(CFLAGS_FOR_UNIT) -l # -l -D_CALYPSI_MCP_DEBUGGER
ASFLAGS=$(INCLUDES) --data-model large --code-model large
ifeq ($(MEMORY),ROM)
LDFLAGS=--rom-code $(LDFLAGS_FOR_UNIT) --list-file toolbox.map
else
LDFLAGS=$(LDFLAGS_FOR_UNIT) --list-file toolbox.map
endif
SRCS = hello.c header.s $(SRCS_FOR_UNIT) # $(C_SRCS_DEBUGGER) ram-startup.s
OBJS = $(patsubst %.s,%.o,$(patsubst %.c,%.o,$(SRCS)))
OBJS4RM = $(subst /,\\,$(OBJS))
LIBS = ../../client/src/toolbox.a
.PHONY: clean
hello.s37: $(OBJS) $(LIBS)
$(LD) $(LDFLAGS) --output-format s37 -o $@ $^
# Build the object files from C
%.o: %.c
$(CC) $(CFLAGS) -o $@ $^
# Build the object files from assembly
%.o: %.s
$(AS) $(ASFLAGS) -o $@ $^
# Clean up after a build
clean:
$(RM) $(OBJS4RM) *.s37 *.o *.a *.lst

View file

@ -1,19 +0,0 @@
(define memories
'(
(memory LoMem
(address (#xa000 . #xcfff))
(type ANY))
(memory Vector (address (#xffe4 . #xffff)))
(memory Banks
(address (#x10000 . #x7ffff))
(type ANY)
(section (header #x10000)))
(memory DirectPage
(address (#x000100 . #x0001ff))
(section (registers ztiny)))
(block stack (size #x1000))
(block heap (size #x1000))
(base-address _DirectPageStart DirectPage 0)
(base-address _NearBaseAddress LoMem 0)
))

View file

@ -1,10 +0,0 @@
.extern __program_start
.section header
signature: .byte 0xf8, 0x16
version: .byte 0
start: .long __program_start
icon: .long 0
clut: .long 0
name: .asciz "hello"

View file

@ -1,10 +0,0 @@
#include "../../client/src/include/toolbox.h"
#include <string.h>
int main(int c, char * argv[]) {
char * message = "Hello, Foenix Toolbox!\n";
sys_chan_write(0, (uint8_t *)message, strlen(message));
while (1) ;
}

View file

@ -1,86 +0,0 @@
#ifndef __MACROS_H
#define __MACROS_H
#ifdef __CALYPSI_ASSEMBLER__
#ifdef __CALYPSI_CODE_MODEL_SMALL__
#define libcode code
call .macro dest
jsr \dest
.endm
return .macro
rts
.endm
jump .macro dest
jmp \dest
.endm
#elif defined(__CALYPSI_CODE_MODEL_COMPACT__)
#define libcode compactcode
call .macro dest
jsr .kbank \dest
.endm
return .macro
rts
.endm
jump .macro dest
jmp .kbank \dest
.endm
#else
#define libcode farcode
call .macro dest
jsl \dest
.endm
return .macro
rtl
.endm
jump .macro dest
jmp long:\dest
.endm
#endif // __CALYPSI_CODE_MODEL_SMALL__
// ----------------------------------------------------------------------
//
// Define code and data model used. This is to add a bit of safety in
// case the way a file is assembled is combined with the wrong run-time.
//
// ----------------------------------------------------------------------
#if defined(__CALYPSI_DATA_MODEL_SMALL__)
.rtmodel dataModel,"small"
#elif defined (__CALYPSI_DATA_MODEL_MEDIUM__)
.rtmodel dataModel,"medium"
#elif defined(__CALYPSI_DATA_MODEL_LARGE__)
.rtmodel dataModel,"large"
#elif defined(__CALYPSI_DATA_MODEL_HUGE__)
.rtmodel dataModel,"huge"
#else
#pragma GCC error "unexpected data model"
#endif
#if defined(__CALYPSI_CODE_MODEL_SMALL__)
.rtmodel codeModel,"small"
#elif defined(__CALYPSI_CODE_MODEL_COMPACT__)
.rtmodel codeModel,"compact"
#elif defined(__CALYPSI_CODE_MODEL_LARGE__)
.rtmodel codeModel,"large"
#else
#pragma GCC error "unexpected code model"
#endif
#endif // __CALYPSI_ASSEMBLER__
#endif // __MACROS_H

View file

@ -1,134 +0,0 @@
;;; Startup variant, change attribute value if you make your own
.rtmodel cstartup,"sample"
.rtmodel version, "1"
.rtmodel core, "*"
.section stack
.section cstack
.section heap
.section data_init_table
.extern main, exit
.extern _Dp, _Vfp
.extern _DirectPageStart
#ifndef __CALYPSI_DATA_MODEL_SMALL__
.extern _NearBaseAddress
#endif
#include "macros.h"
;;; ***************************************************************************
;;;
;;; __program_start - actual start point of the program
;;;
;;; Set up CPU stack, initialize sections and call main().
;;; You can override this with your own routine, or tailor it as needed.
;;; The easiest way to make custom initialization is to provide your own
;;; __low_level_init which gets called after stacks have been initialized.
;;;
;;; ***************************************************************************
#ifdef __CALYPSI_CODE_MODEL_COMPACT__
.section code
#elif __CALYPSI_CODE_MODEL_LARGE__
.section farcode, noreorder
#else
.section code, noreorder
#endif
.pubweak __program_start
__program_start:
clc
xce ; native 16-bit mode
rep #0x38 ; 16-bit registers, no decimal mode
ldx ##.sectionEnd stack
txs ; set stack
lda ##_DirectPageStart
tcd ; set direct page
#ifdef __CALYPSI_DATA_MODEL_SMALL__
lda ##0
#else
lda ##.word2 _NearBaseAddress
#endif
stz dp:.tiny(_Vfp+2)
xba ; A upper half = data bank
pha
plb ; pop 8 dummy
plb ; set data bank
#ifdef __CALYPSI_CODE_MODEL_COMPACT__
jmp long:_Trampoline_program_start
.section compactcode, noreorder
_Trampoline_program_start:
#define CODE compactcode
#else
#define CODE code
#endif
call __low_level_init
;;; **** Initialize data sections if needed.
.section CODE, noroot, noreorder
.pubweak __data_initialization_needed
.extern __initialize_sections
__data_initialization_needed:
lda ##.word2 (.sectionEnd data_init_table)
sta dp:.tiny(_Dp+6)
lda ##.word0 (.sectionEnd data_init_table)
sta dp:.tiny(_Dp+4)
lda ##.word2 (.sectionStart data_init_table)
sta dp:.tiny(_Dp+2)
lda ##.word0 (.sectionStart data_init_table)
sta dp:.tiny(_Dp+0)
call __initialize_sections
;;; **** Initialize streams if needed.
.section CODE, noroot, noreorder
.pubweak __call_initialize_global_streams
.extern __initialize_global_streams
__call_initialize_global_streams:
call __initialize_global_streams
;;; **** Initialize heap if needed.
.section CODE, noroot, noreorder
.pubweak __call_heap_initialize
.extern __heap_initialize, __default_heap
__call_heap_initialize:
#ifdef __CALYPSI_DATA_MODEL_SMALL__
lda ##.sectionSize heap
sta dp:.tiny(_Dp+2)
lda ##.sectionStart heap
sta dp:.tiny(_Dp+0)
lda ##__default_heap
#else
lda ##.word2 (.sectionStart heap)
sta dp:.tiny(_Dp+6)
lda ##.word0 (.sectionStart heap)
sta dp:.tiny(_Dp+4)
lda ##.word2 __default_heap
sta dp:.tiny(_Dp+2)
lda ##.word0 __default_heap
sta dp:.tiny(_Dp+0)
ldx ##.word2 (.sectionSize heap)
lda ##.word0 (.sectionSize heap)
#endif
call __heap_initialize
.section CODE, root, noreorder
lda ##0 ; argc = 0
call main
jump exit
;;; ***************************************************************************
;;;
;;; __low_level_init - custom low level initialization
;;;
;;; This default routine just returns doing nothing. You can provide your own
;;; routine, either in C or assembly for doing custom low leve initialization.
;;;
;;; ***************************************************************************
.section libcode
.pubweak __low_level_init
__low_level_init:
return

View file

@ -1,55 +1,74 @@
"sys_proc_exit","FFE000"
"sys_chan_read_b","FFE004"
"sys_chan_read","FFE008"
"sys_chan_readline","FFE00C"
"sys_chan_write_b","FFE010"
"sys_chan_write","FFE014"
"sys_chan_status","FFE018"
"sys_chan_flush","FFE01C"
"sys_chan_seek","FFE020"
"sys_chan_ioctrl","FFE024"
"sys_chan_open","FFE028"
"sys_chan_close","FFE02C"
"sys_chan_swap","FFE030"
"sys_chan_device","FFE034"
"sys_bdev_register","FFE038"
"sys_bdev_read","FFE03C"
"sys_bdev_write","FFE040"
"sys_bdev_status","FFE044"
"sys_bdev_flush","FFE048"
"sys_bdev_ioctrl","FFE04C"
"sys_fsys_open","FFE050"
"sys_fsys_close","FFE054"
"sys_fsys_opendir","FFE058"
"sys_fsys_closedir","FFE05C"
"sys_fsys_readdir","FFE060"
"sys_fsys_findfirst","FFE064"
"sys_fsys_findnext","FFE068"
"sys_fsys_mkdir","FFE06C"
"sys_fsys_delete","FFE070"
"sys_fsys_rename","FFE074"
"sys_fsys_set_cwd","FFE078"
"sys_fsys_get_cwd","FFE07C"
"sys_fsys_load","FFE080"
"sys_fsys_register_loader","FFE084"
"sys_fsys_stat","FFE088"
"sys_mem_get_ramtop","FFE08C"
"sys_mem_reserve","FFE090"
"sys_err_message","FFE094"
"sys_proc_run","FFE098"
"sys_txt_get_capabilities","FFE09C"
"sys_txt_set_mode","FFE0A0"
"sys_txt_setsizes","FFE0A4"
"sys_txt_set_xy","FFE0A8"
"sys_txt_get_xy","FFE0AC"
"sys_txt_get_region","FFE0B0"
"sys_txt_set_region","FFE0B4"
"sys_txt_set_color","FFE0B8"
"sys_txt_get_color","FFE0BC"
"sys_txt_set_cursor_visible","FFE0C0"
"sys_txt_set_font","FFE0C4"
"sys_txt_get_sizes","FFE0C8"
"sys_txt_set_border","FFE0CC"
"sys_txt_set_border_color","FFE0D0"
"sys_txt_put","FFE0D4"
"sys_txt_print","FFE0D8"
"sys_int_enable_all","FFE004"
"sys_int_disable_all","FFE008"
"sys_int_restore_all","FFE00C"
"sys_int_disable","FFE010"
"sys_int_enable","FFE014"
"sys_int_register","FFE018"
"sys_int_pending","FFE01C"
"sys_get_info","FFE020"
"sys_int_clear","FFE024"
"sys_chan_read_b","FFE028"
"sys_chan_read","FFE02C"
"sys_chan_readline","FFE030"
"sys_chan_write_b","FFE034"
"sys_chan_write","FFE038"
"sys_chan_status","FFE03C"
"sys_chan_flush","FFE040"
"sys_chan_seek","FFE044"
"sys_chan_ioctrl","FFE048"
"sys_chan_open","FFE04C"
"sys_chan_close","FFE050"
"sys_chan_swap","FFE054"
"sys_chan_device","FFE058"
"sys_cdev_register","FFE05C"
"sys_bdev_register","FFE060"
"sys_bdev_read","FFE064"
"sys_bdev_write","FFE068"
"sys_bdev_status","FFE06C"
"sys_bdev_flush","FFE070"
"sys_bdev_ioctrl","FFE074"
"sys_fsys_open","FFE078"
"sys_fsys_close","FFE07C"
"sys_fsys_opendir","FFE080"
"sys_fsys_closedir","FFE084"
"sys_fsys_readdir","FFE088"
"sys_fsys_findfirst","FFE08C"
"sys_fsys_findnext","FFE090"
"sys_fsys_get_label","FFE094"
"sys_fsys_set_label","FFE098"
"sys_fsys_mkdir","FFE09C"
"sys_fsys_delete","FFE0A0"
"sys_fsys_rename","FFE0A4"
"sys_fsys_set_cwd","FFE0A8"
"sys_fsys_get_cwd","FFE0AC"
"sys_fsys_load","FFE0B0"
"sys_fsys_register_loader","FFE0B4"
"sys_fsys_stat","FFE0B8"
"sys_mem_get_ramtop","FFE0BC"
"sys_mem_reserve","FFE0C0"
"sys_time_jiffies","FFE0C4"
"sys_rtc_set_time","FFE0C8"
"sys_rtc_get_time","FFE0CC"
"sys_kbd_scancode","FFE0D0"
"sys_err_message","FFE0D4"
"sys_kbd_layout","FFE0D8"
"sys_proc_run","FFE0DC"
"sys_txt_get_capabilities","FFE0E0"
"sys_txt_set_mode","FFE0E4"
"sys_txt_set_resolution","FFE0E8"
"sys_txt_setsizes","FFE0EC"
"sys_txt_set_xy","FFE0F0"
"sys_txt_get_xy","FFE0F4"
"sys_txt_get_region","FFE0F8"
"sys_txt_set_region","FFE0FC"
"sys_txt_set_color","FFE100"
"sys_txt_get_color","FFE104"
"sys_txt_set_cursor","FFE108"
"sys_txt_set_cursor_visible","FFE10C"
"sys_txt_set_font","FFE110"
"sys_txt_get_sizes","FFE114"
"sys_txt_set_border","FFE118"
"sys_txt_set_border_color","FFE11C"
"sys_txt_put","FFE120"
"sys_txt_print","FFE124"

1 sys_proc_exit FFE000
2 sys_chan_read_b sys_int_enable_all FFE004
3 sys_chan_read sys_int_disable_all FFE008
4 sys_chan_readline sys_int_restore_all FFE00C
5 sys_chan_write_b sys_int_disable FFE010
6 sys_chan_write sys_int_enable FFE014
7 sys_chan_status sys_int_register FFE018
8 sys_chan_flush sys_int_pending FFE01C
9 sys_chan_seek sys_get_info FFE020
10 sys_chan_ioctrl sys_int_clear FFE024
11 sys_chan_open sys_chan_read_b FFE028
12 sys_chan_close sys_chan_read FFE02C
13 sys_chan_swap sys_chan_readline FFE030
14 sys_chan_device sys_chan_write_b FFE034
15 sys_bdev_register sys_chan_write FFE038
16 sys_bdev_read sys_chan_status FFE03C
17 sys_bdev_write sys_chan_flush FFE040
18 sys_bdev_status sys_chan_seek FFE044
19 sys_bdev_flush sys_chan_ioctrl FFE048
20 sys_bdev_ioctrl sys_chan_open FFE04C
21 sys_fsys_open sys_chan_close FFE050
22 sys_fsys_close sys_chan_swap FFE054
23 sys_fsys_opendir sys_chan_device FFE058
24 sys_fsys_closedir sys_cdev_register FFE05C
25 sys_fsys_readdir sys_bdev_register FFE060
26 sys_fsys_findfirst sys_bdev_read FFE064
27 sys_fsys_findnext sys_bdev_write FFE068
28 sys_fsys_mkdir sys_bdev_status FFE06C
29 sys_fsys_delete sys_bdev_flush FFE070
30 sys_fsys_rename sys_bdev_ioctrl FFE074
31 sys_fsys_set_cwd sys_fsys_open FFE078
32 sys_fsys_get_cwd sys_fsys_close FFE07C
33 sys_fsys_load sys_fsys_opendir FFE080
34 sys_fsys_register_loader sys_fsys_closedir FFE084
35 sys_fsys_stat sys_fsys_readdir FFE088
36 sys_mem_get_ramtop sys_fsys_findfirst FFE08C
37 sys_mem_reserve sys_fsys_findnext FFE090
38 sys_err_message sys_fsys_get_label FFE094
39 sys_proc_run sys_fsys_set_label FFE098
40 sys_txt_get_capabilities sys_fsys_mkdir FFE09C
41 sys_txt_set_mode sys_fsys_delete FFE0A0
42 sys_txt_setsizes sys_fsys_rename FFE0A4
43 sys_txt_set_xy sys_fsys_set_cwd FFE0A8
44 sys_txt_get_xy sys_fsys_get_cwd FFE0AC
45 sys_txt_get_region sys_fsys_load FFE0B0
46 sys_txt_set_region sys_fsys_register_loader FFE0B4
47 sys_txt_set_color sys_fsys_stat FFE0B8
48 sys_txt_get_color sys_mem_get_ramtop FFE0BC
49 sys_txt_set_cursor_visible sys_mem_reserve FFE0C0
50 sys_txt_set_font sys_time_jiffies FFE0C4
51 sys_txt_get_sizes sys_rtc_set_time FFE0C8
52 sys_txt_set_border sys_rtc_get_time FFE0CC
53 sys_txt_set_border_color sys_kbd_scancode FFE0D0
54 sys_txt_put sys_err_message FFE0D4
55 sys_txt_print sys_kbd_layout FFE0D8
56 sys_proc_run FFE0DC
57 sys_txt_get_capabilities FFE0E0
58 sys_txt_set_mode FFE0E4
59 sys_txt_set_resolution FFE0E8
60 sys_txt_setsizes FFE0EC
61 sys_txt_set_xy FFE0F0
62 sys_txt_get_xy FFE0F4
63 sys_txt_get_region FFE0F8
64 sys_txt_set_region FFE0FC
65 sys_txt_set_color FFE100
66 sys_txt_get_color FFE104
67 sys_txt_set_cursor FFE108
68 sys_txt_set_cursor_visible FFE10C
69 sys_txt_set_font FFE110
70 sys_txt_get_sizes FFE114
71 sys_txt_set_border FFE118
72 sys_txt_set_border_color FFE11C
73 sys_txt_put FFE120
74 sys_txt_print FFE124

View file

@ -12,6 +12,9 @@ with open("addresses.csv", "w") as addresses:
line = line[index - 1:]
line = line.strip()
elements = line.split(",")
if len(elements) > 1:
line = elements[0].strip()
# Process only actual names
if len(line) > 0:

View file

@ -3,6 +3,7 @@
#
sys_call_names = []
internal_names = []
# Read in the list of system calls ("sys_")
with open("syscalls.txt", "r") as call_names:
@ -18,7 +19,13 @@ with open("syscalls.txt", "r") as call_names:
# Skip blank lines
if len(line) > 0:
elements = line.split(",")
if len(elements) == 1:
sys_call_names.append(line)
internal_names.append(line)
else:
sys_call_names.append(elements[0].strip())
internal_names.append(elements[1].strip())
# # Create the system call table, which is used to call into the kernel jump table
@ -44,10 +51,12 @@ with open("jumptable.s", "w") as f:
f.write("\n")
for call_name in sys_call_names:
f.write("\t.extern {}\n".format(call_name))
for internal_name in internal_names:
f.write("\t.extern {}\n".format(internal_name))
f.write("\n\t.section jumptable\n\n");
for call_name in sys_call_names:
f.write("sys_{:26}\tjmp long:{}\n".format(call_name + ": ", call_name))
for i in range(len(sys_call_names)):
external_name = sys_call_names[i]
internal_name = internal_names[i]
f.write("sys_{:26}\tjmp long:{}\n".format(external_name + ": ", internal_name))

View file

@ -1,6 +1,7 @@
.public sys_proc_exit
.public sys_int_enable_all
.public sys_int_disable_all
.public sys_int_restore_all
.public sys_int_disable
.public sys_int_enable
.public sys_int_register
@ -20,7 +21,7 @@
.public sys_chan_close
.public sys_chan_swap
.public sys_chan_device
.public sys_chan_register
.public sys_cdev_register
.public sys_bdev_register
.public sys_bdev_read
.public sys_bdev_write
@ -55,6 +56,7 @@
.public sys_proc_run
.public sys_txt_get_capabilities
.public sys_txt_set_mode
.public sys_txt_set_resolution
.public sys_txt_setsizes
.public sys_txt_set_xy
.public sys_txt_get_xy
@ -62,6 +64,7 @@
.public sys_txt_set_region
.public sys_txt_set_color
.public sys_txt_get_color
.public sys_txt_set_cursor
.public sys_txt_set_cursor_visible
.public sys_txt_set_font
.public sys_txt_get_sizes
@ -73,6 +76,7 @@
.extern proc_exit
.extern int_enable_all
.extern int_disable_all
.extern int_restore_all
.extern int_disable
.extern int_enable
.extern int_register
@ -127,6 +131,7 @@
.extern proc_run
.extern txt_get_capabilities
.extern txt_set_mode
.extern txt_set_resolution
.extern txt_setsizes
.extern txt_set_xy
.extern txt_get_xy
@ -134,6 +139,7 @@
.extern txt_set_region
.extern txt_set_color
.extern txt_get_color
.extern txt_set_cursor
.extern txt_set_cursor_visible
.extern txt_set_font
.extern txt_get_sizes
@ -147,6 +153,7 @@
sys_proc_exit: jmp long:proc_exit
sys_int_enable_all: jmp long:int_enable_all
sys_int_disable_all: jmp long:int_disable_all
sys_int_restore_all: jmp long:int_restore_all
sys_int_disable: jmp long:int_disable
sys_int_enable: jmp long:int_enable
sys_int_register: jmp long:int_register
@ -166,7 +173,7 @@ sys_chan_open: jmp long:chan_open
sys_chan_close: jmp long:chan_close
sys_chan_swap: jmp long:chan_swap
sys_chan_device: jmp long:chan_device
sys_chan_register: jmp long:cdev_register
sys_cdev_register: jmp long:cdev_register
sys_bdev_register: jmp long:bdev_register
sys_bdev_read: jmp long:bdev_read
sys_bdev_write: jmp long:bdev_write
@ -201,6 +208,7 @@ sys_kbd_layout: jmp long:kbd_layout
sys_proc_run: jmp long:proc_run
sys_txt_get_capabilities: jmp long:txt_get_capabilities
sys_txt_set_mode: jmp long:txt_set_mode
sys_txt_set_resolution: jmp long:txt_set_resolution
sys_txt_setsizes: jmp long:txt_setsizes
sys_txt_set_xy: jmp long:txt_set_xy
sys_txt_get_xy: jmp long:txt_get_xy
@ -208,6 +216,7 @@ sys_txt_get_region: jmp long:txt_get_region
sys_txt_set_region: jmp long:txt_set_region
sys_txt_set_color: jmp long:txt_set_color
sys_txt_get_color: jmp long:txt_get_color
sys_txt_set_cursor: jmp long:txt_set_cursor
sys_txt_set_cursor_visible: jmp long:txt_set_cursor_visible
sys_txt_set_font: jmp long:txt_set_font
sys_txt_get_sizes: jmp long:txt_get_sizes

View file

@ -1,14 +1,15 @@
# A list of system calls to be used to autogenerate the various jump tables and sys calls stubs\
# A list of system calls to be used to autogenerate the various jump tables and sys calls stubs
proc_exit
int_enable_all
int_disable_all
int_restore_all
int_disable
int_enable
int_register
int_pending
get_info
int_clear
get_info,sys_get_information
chan_read_b
chan_read
@ -23,7 +24,7 @@ chan_open
chan_close
chan_swap
chan_device
chan_register
cdev_register
bdev_register
bdev_read
@ -44,24 +45,23 @@ fsys_set_label
fsys_mkdir
fsys_delete
fsys_rename
fsys_set_cwd
fsys_get_cwd
fsys_load
fsys_register_loader
fsys_stat
mem_get_ramtop
mem_reserve
time_jiffies
time_jiffies,timers_jiffies
rtc_set_time
rtc_get_time
kbd_scancode
kbd_scancode,kbd_get_scancode
err_message
kbd_layout
proc_run
txt_get_capabilities
txt_set_mode
txt_set_resolution
txt_setsizes
txt_set_xy
txt_get_xy
@ -69,6 +69,7 @@ txt_get_region
txt_set_region
txt_set_color
txt_get_color
txt_set_cursor
txt_set_cursor_visible
txt_set_font
txt_get_sizes

View file

@ -34,44 +34,6 @@
#define CDEV_SEEK_RELATIVE 1 /* Seek from the current position */
#define CDEV_SEEK_END 2 /* Seek from teh end of the file */
/*
* Structure defining a channel
*/
typedef struct s_channel {
short number; // The number of the channel
short dev; // The number of the channel's device
uint8_t data[CHAN_DATA_SIZE]; // A block of state data that the channel code can use for its own purposes
} t_channel, *p_channel;
typedef short (*FUNC_CBS_2_S)(p_channel, uint8_t *, short);
typedef short (*FUNC_C_2_S)(p_channel);
typedef short (*FUNC_CcBS_2_S)(p_channel, const uint8_t *, short);
typedef short (*FUNC_CB_2_S)(p_channel, uint8_t);
typedef short (*FUNC_CLS_2_S)(p_channel, long, short);
typedef short (*FUNC_CSBS_2_S)(p_channel, short, uint8_t *, short);
/*
* Structure defining a channel device's functions
*/
typedef struct s_dev_chan {
short number; // The number of the device (assigned by registration)
char * name; // The name of the device
FUNC_V_2_S init; // short init() -- Initialize the device
FUNC_CcBS_2_S open; // short open(t_channel * chan, const uint8_t * path, short mode) -- open a channel for the device
FUNC_V_2_S close; // short close(t_channel * chan) -- called when a channel is closed
FUNC_CBS_2_S read; // short read(t_channel *, uint8_t * buffer, short size) -- Read a a buffer from the device
FUNC_CBS_2_S readline; // short readline(t_channel *, uint8_t * buffer, short size) -- Read a line of text from the device
FUNC_C_2_S read_b; // short read_b(t_channel *) -- read a single uint8_t from the device
FUNC_CcBS_2_S write; // short write(t_channel *, const uint8_t * buffer, short size) -- Write a buffer to the device
FUNC_CB_2_S write_b; // short write_b(t_channel *, const uint8_t b) -- Write a single uint8_t to the device
FUNC_C_2_S status; // short status(t_channel *) -- Get the status of the device
FUNC_C_2_S flush; // short flush(t_channel *) -- Ensure that any pending writes to teh device have been completed
FUNC_CLS_2_S seek; // short cdev_seek(t_channel *, long position, short base) -- attempt to move the "cursor" position in the channel
FUNC_CSBS_2_S ioctrl; // short ioctrl(t_channel *, short command, uint8_t * buffer, short size)) -- Issue a control command to the device
} t_dev_chan, *p_dev_chan;
/*
* Initialize the channel driver system
*/

View file

@ -199,6 +199,21 @@ SYSTEMCALL short int_disable_all() {
return status;
}
/*
* Restore interrupt masking state returned by a previous call to int_enable/int_disable
*
* NOTE: this is actually provided in the low level assembly
*
* Inputs:
* state = a machine dependent representation of the interrupt masking to restore
*/
SYSTEMCALL void int_restore_all(short state) {
// NOTE: this code uses Calypsi specific intrinsic functions
// and does a cast that may not be valid
__restore_interrupt_state((__interrupt_state_t)state);
}
/*
* Disable an interrupt by masking it
*

View file

@ -194,6 +194,21 @@ SYSTEMCALL short int_disable_all() {
return status;
}
/*
* Restore interrupt masking state returned by a previous call to int_enable/int_disable
*
* NOTE: this is actually provided in the low level assembly
*
* Inputs:
* state = a machine dependent representation of the interrupt masking to restore
*/
SYSTEMCALL void int_restore_all(short state) {
// NOTE: this code uses Calypsi specific intrinsic functions
// and does a cast that may not be valid
__restore_interrupt_state((__interrupt_state_t)state);
}
/*
* Disable an interrupt by masking it
*

View file

@ -209,7 +209,7 @@ static void kbd_process_key(short column, short row, bool is_pressed) {
* Returns:
* The next scancode to be processed, 0 if nothing.
*/
unsigned short kbd_get_scancode() {
SYSTEMCALL unsigned short kbd_get_scancode() {
if (rb_word_empty(&scan_code_buffer)) {
return 0;
} else {

View file

@ -27,7 +27,7 @@ extern void kbd_handle_irq();
* Returns:
* The next scancode to be processed, 0 if nothing.
*/
extern unsigned short kbd_get_scancode();
extern SYSTEMCALL unsigned short kbd_get_scancode();
/*
* Check to see if a BREAK code has been pressed recently

View file

@ -63,15 +63,6 @@ typedef struct s_color4 {
*/
typedef void (*FUNC_V_2_V)();
typedef short (*FUNC_V_2_S)();
typedef short (*FUNC_S_2_S)(char *);
typedef short (*FUNC_BS_2_S)(unsigned char *, short);
typedef short (*FUNC_cBS_2_S)(const unsigned char *, short);
typedef short (*FUNC_B_2_S)(const unsigned short);
typedef short (*FUNC_LBS_2_S)(long, unsigned char *, short);
typedef short (*FUNC_LcBS_2_S)(long, const unsigned char *, short);
typedef short (*FUNC_SBS_2_S)(short, unsigned char *, short);
typedef short (*FUNC_LB_2_S)(long, short);
/*
* Type declaration for an interrupt handler
@ -105,6 +96,38 @@ typedef struct s_sys_info {
uint16_t screens; /* How many screens are on this computer */
} t_sys_info, *p_sys_info;
/*
* Structure defining a channel device's functions
*/
/*
* Structure defining a channel
*/
typedef struct s_channel {
short number; // The number of the channel
short dev; // The number of the channel's device
uint8_t data[32]; // A block of state data that the channel code can use for its own purposes
} t_channel, *p_channel;
typedef struct s_dev_chan {
short number; // The number of the device (assigned by registration)
char * name; // The name of the device
short (*init)(); // Initialize the device
short (*open)(t_channel * chan, const uint8_t * path, short mode); // -- open a channel for the device
short (*close)(t_channel * chan); // Called when a channel is closed
short (*read)(t_channel * chan, uint8_t * buffer, short size); // Read a a buffer from the device
short (*readline)(t_channel * chan, uint8_t * buffer, short size); // Read a line of text from the device
short (*read_b)(t_channel * chan); // -- read a single uint8_t from the device
short (*write)(t_channel * chan, const uint8_t * buffer, short size); // Write a buffer to the device
short (*write_b)(t_channel * chan, const uint8_t b) ; // Write a single uint8_t to the device
short (*status)(t_channel * chan); // Get the status of the device
short (*flush)(t_channel * chan); // Ensure that any pending writes to teh device have been completed
short (*seek)(t_channel * chan, long position, short base); // Attempt to move the "cursor" position in the channel
short (*ioctrl)(t_channel * chan, short command, uint8_t * buffer, short size); // Issue a control command to the device
} t_dev_chan, *p_dev_chan;
/*
* Structure defining a block device's functions
*/

View file

@ -258,9 +258,9 @@ extern SYSTEMCALL short int_disable_all();
* NOTE: this is actually provided in the low level assembly
*
* Inputs:
* int_mask = machine dependent representation of the interrupt masking
* state = a machine dependent representation of the interrupt masking to restore
*/
extern SYSTEMCALL void int_restore(short int_mask);
extern SYSTEMCALL void int_restore_all(short state);
/*
* Disable an interrupt by masking it

View file

@ -7,6 +7,6 @@
#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_BUILD 24
#define VER_BUILD 25
#endif