This commit is contained in:
Xavier59 2016-10-03 15:17:46 +02:00
parent 19ae554d2a
commit 8346e88313
65 changed files with 5893 additions and 0 deletions

1
BTKOM Submodule

@ -0,0 +1 @@
Subproject commit 73ef1c56c82c5df134ad8ca82d7a5cd8ed34613a

BIN
BTKOM.o Normal file

Binary file not shown.

30
SRC/BTKOM.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "BTKOM.h"
Bluetooth bluetooth;
void listen(){
//bluetooth.receptMessage();
}
int main(){
unsigned int key;
int timer;
int err = 156;
char buffer[255] = {"lolilol"};
Message toSend;
err = bluetooth.listen(2000, 0, listen, 1);
toSend.setType("REQ");
toSend.setMessage(buffer);
bluetooth.sendMessage(&toSend);
ML_display_vram();
while(1){
GetKey(&key);
}
return 1;
}

1289
SRC/MonochromeLib.c Normal file

File diff suppressed because it is too large Load Diff

285
SRC/bluetooth.cpp Normal file
View File

@ -0,0 +1,285 @@
#include "bluetooth.h"
#define RETURN Timer_Start(this->timer);return;
/* --------------------------------------------------- */
/* --------------------------------------------------- */
/* ----------------- CLASS BLUETOOTH ----------------- */
/* --------------------------------------------------- */
/* --------------------------------------------------- */
Bluetooth::Bluetooth(){
this->sentPacketsTotalSize = 0;
this->receivedPacketsTotalSize = 0;
this->unread = 0;
this->allowReception = 1;
this->ID = 0;
this->secondTry = 0;
memcpy(this->sender, "HC-06\0", 6);
}
int Bluetooth::listen(int maxSize, int timer, void(*func)(void), int time){
unsigned char conf[6] = {0, 5, 0, 0, 0, 0};
max = maxSize;
this->ptr = (char*)malloc(maxSize);
this->ptr1ko = (char*)malloc(1000);
if(this->ptr == NULL || this->ptr1ko == NULL) return NOT_ENOUGH_RAM;
this->timer = Timer_Install(timer, func, time);
if(Serial_Open(conf) == 3) return SERIAL_ALREADY_OPEN;
Timer_Start(this->timer);
return 0;
}
int Bluetooth::setSender(char *senderName){
if(strlen(senderName)+1 <= 10){
if(strlen(senderName) >= 0){
memcpy(this->sender, senderName, strlen(senderName)+1);
}else{
return SENDER_EMPTY;
}
}else{
return SENDER_TOO_BIG;
}
return 0;
}
int Bluetooth::sendMessage(Message *message){
int split, RTCTime, temp;
char *ptr2;
unsigned char dateEx[] = "YYYY-MM-DD-HH-MM-SS";
split = (int)((message->getLength())/208) + (message->getLength()%208) == 0 ? 0:1;
if((ptr2 = (char*)malloc(256)) == NULL) return NOT_ENOUGH_RAM;
this->ID++;
PrintMini(1,1,(const unsigned char*)itoa(split),MINI_OR);
for(int i=0; i<split; i++){
memcpy(ptr2,dateEx, 19);
if(message->getType() == NULL){
memcpy(ptr2+19,"RQT",3);
}else{
memcpy(ptr2+19, message->getType(), 3);
}
if(message->isHeader){
memcpy(ptr+22, message->msg+22, sizeof(int));
memcpy(ptr+26, message->msg+26, 10);
}else{
memcpy(ptr+22, (int*)this->ID, sizeof(int));
memcpy(ptr+26, this->sender, 10);
}
memcpy(ptr2+36, (int*)message->getLength(), sizeof(int));
memcpy(ptr2+40, (int*)(((i+1)*208 > message->getLength()) ? (message->getLength() - i*208) : 208), sizeof(int));
memcpy(ptr2+44, (unsigned short*)(i+1), sizeof(unsigned short));
memcpy(ptr2+46, (unsigned short*)split, sizeof(unsigned short));
memcpy(ptr2+48, (int*)(message->getMessage()+i*208, ((i+1)*208 > message->getLength()) ? (message->getLength() - i*208) : 208), sizeof(int));
Serial_WriteBytes((unsigned char*)ptr2,50);
RTCTime = RTC_GetTicks();
while(Serial_GetTxBufferFreeCapacity() != 0){
if((RTC_GetTicks() - RTCTime)/RTC > 300){
free(ptr2);
this->ID--;
return UNKNOWN_ERROR;
}
}
}
free(ptr2);
return 0;
}
Message& Bluetooth::getLastMessage(){
return msg;
}
void Bluetooth::receptMessage(){
int size, errorID;
int RTCTime;
int messageLength = 48;
int typeCase;
char buffer[50];
int lengthPackets[2];
unsigned short partsNumber[2] = {(unsigned short)0,(unsigned short)1};
const char type[7][4] = {"RQT","ASW","ACK","MIS","FUL","ERR","END"};
const char err[1][4] = {"ERR"};
char ptr2[3];
unsigned int messageID;
Message sendBack;
if((this->secondTry = Serial_GetRxBufferSize()) == 1000 || this->secondTry==Serial_GetRxBufferSize()){
// if allowReception. else, send back a FUL packet to the device
if(this->allowReception){
Serial_ReadBytes((unsigned char*)this->ptr1ko, 1000,(short*)&size);
memcpy(ptr2, this->ptr1ko+19, 3);
typeCase = tabcmp((const char**)type, 7, ptr2);
switch(typeCase){
case RQT:
case END:
case ASW:
memcpy(&this->ID, (unsigned int*)this->ptr1ko+22, sizeof(unsigned int));
if(size < 48){
sendBack.init("HED", this->ID, this->sender, "");
sendMessage(&sendBack);
RETURN
}
memcpy(this->sender, this->ptr1ko+26, 10);
for(unsigned short i=0; i<partsNumber[1]; i++){
memcpy(&messageID, (unsigned int*)this->ptr1ko+22, sizeof(unsigned int));
if(messageID != this->ID){
sendBack.init("ERR", messageID, this->sender, "INCORRECT ID");
sendMessage(&sendBack);
RETURN }
memcpy(lengthPackets, this->ptr1ko+36, sizeof(lengthPackets));
sprintf(buffer,"%d", i+1);
if(partsNumber[0] != i+1){
if(partsNumber[0] > i+1){
sendBack.init("MIS", messageID, this->sender, buffer);
sendMessage(&sendBack);
}else{
sendBack.init("ACK", messageID, this->sender, buffer);
sendMessage(&sendBack);
}
}else if(lengthPackets[1] != size-48){
sendBack.init("ERR", messageID, this->sender, "INCOMPLETE PACKET SIZE");
sendMessage(&sendBack);
RETURN
}else{
messageLength+=size-48;
memcpy(this->ptr+48+i*952, this->ptr1ko+48, 952);
sendBack.init("ACK", messageID, this->sender, buffer);
sendMessage(&sendBack);
if(messageLength-48 == lengthPackets[0] && partsNumber[0] == partsNumber[1]){
if(!(errorID = msg.setTotalMessage(this->ptr))){
this->unread = 1;
this->allowReception = 0;
this->ID++;
RETURN
}else{
sendBack.init("ERR", messageID, this->sender, (char*)&err[errorID]);
sendMessage(&sendBack);
RETURN
}
}
}
RTCTime = RTC_GetTicks();
while(Serial_GetRxBufferSize() != (lengthPackets[0]-messageLength-48>1000 ? 1000 : lengthPackets[0]-messageLength-48)){
if((RTC_GetTicks() - RTCTime)/RTC > 300){
RETURN
}
}
memcpy(partsNumber, this->ptr1ko+44, sizeof(partsNumber));
}
break;
}
}else{
sendBack.init("FUL", this->ID, this->sender, "");
sendMessage(&sendBack);
RETURN
}
}else if(Serial_GetRxBufferSize()>0){
this->secondTry = Serial_GetRxBufferSize();
RETURN
}
}
/* --------------------------------------------------- */
/* --------------------------------------------------- */
/* ------------------ CLASS MESSAGE ------------------ */
/* --------------------------------------------------- */
/* --------------------------------------------------- */
Message::Message(){
this->isHeader = 0;
this->isType = 0;
this->msg = (char*)NULL;
}
int Message::init(const char* type, int ID, char* sender,const char* message){
if(setType(type)) return INVALID_TYPE;
if(setMessage(message)) return NOT_ENOUGH_RAM;
return 0;
}
int Message::setType(const char *typeH){
memcpy(this->type, typeH, 3);
this->isType = 1;
return 0;
}
int Message::setMessage(const char *message){
int length;
length = strlen(message) + 49;
this->msg = (char*)realloc(this->msg, length);
if(this->msg == NULL) return NOT_ENOUGH_RAM;
memcpy(this->msg+48, message, length-48);
return 0;
}
int Message::setTotalMessage(char *message){
this->msg = message;
this->isHeader = 1;
return 0;
}
char* Message::getTime(){
if(this->isHeader){
return this->msg;
}else{
return (char*)NULL;
}
}
char* Message::getType(){
if(this->isHeader || this->isType){
return this->msg+19;
}else{
return (char*)NULL;
}
}
char* Message::getSender(){
if(this->isHeader){
return this->msg+26;
}else{
return (char*)NULL;
}
}
int Message::getLength(){
if(this->msg == NULL) return -1;
return strlen(this->msg+48)+1;
}
unsigned char* Message::getMessage(){
return (unsigned char*)this->msg+48;
}
int tabcmp(const char *tab[4], int size, char* string){
for(int i=0; i<size; i++){
if(!strncmp(tab[i], string, 4)) return i;
}
return -1;
}
char *itoa(int i){
static char buf[21];
char *p = buf + 20;
if (i >= 0) {
do{
*--p = '0' + (i % 10);
i /= 10;
}while (i != 0);
return p;
}else {
do {
*--p = '0' - (i % 10);
i /= 10;
}while (i != 0);
*--p = '-';
}
return p;
}

106
SRC/syscall.s Normal file
View File

@ -0,0 +1,106 @@
.global _Serial_ReadByte
_Serial_Readbyte:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x40C
.global _Serial_ReadBytes
_Serial_ReadBytes:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x40D
.global _Serial_WriteByte
_Serial_WriteByte:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x40E
.global _Serial_WriteBytes
_Serial_WriteBytes:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x40F
.global _Serial_WriteByteFIFO
_Serial_WriteByteFIFO:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x410
.global _Serial_GetRxBufferSize
_Serial_GetRxBufferSize:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x411
.global _Serial_GetTxBufferFreeCapacity
_Serial_GetTxBufferFreeCapacity:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x412
.global _Serial_Open
_Serial_Open:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x418
.global _Serial_IsOpen
_Serial_IsOpen:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x425
.global _Timer_Install
_Timer_Install:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x118
.global _Timer_Start
_Timer_Start:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x11A
.global _Timer_Stop
_Timer_Stop:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x11B
.global _RTC_GetTicks
_RTC_GetTicks:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x03B
sc_addr: .long 0x80010070

29
SRC/syscall.src Normal file
View File

@ -0,0 +1,29 @@
.SECTION P,CODE,ALIGN=4
.MACRO SYSCALL FUNO, SYSCALLNAME, TAIL=nop
.export \SYSCALLNAME'
\SYSCALLNAME'
mov.l #h'\FUNO, r0
mov.l #H'80010070, r2
jmp @r2
\TAIL'
.ENDM
SYSCALL 040C, _Serial_ReadByte
SYSCALL 040D, _Serial_ReadBytes
SYSCALL 040E, _Serial_WriteByte
SYSCALL 040F, _Serial_WriteBytes
SYSCALL 0410, _Serial_WriteByteFIFO
SYSCALL 0411, _Serial_GetRxBufferSize
SYSCALL 0412, _Serial_GetTxBufferFreeCapacity
SYSCALL 0413, _Serial_ClearReceiveBuffer
SYSCALL 0414, _Serial_ClearTransmitBuffer
SYSCALL 0418, _Serial_Open
SYSCALL 0419, _Serial_Close
SYSCALL 0422, _Serial_Peek
SYSCALL 0425, _Serial_IsOpen
SYSCALL 0118, _Timer_Install
SYSCALL 011A, _Timer_Start
SYSCALL 011B, _Timer_Stop
SYSCALL 003B, _RTC_GetTicks();
.end

BIN
addin.bin Executable file

Binary file not shown.

BIN
addin.elf Executable file

Binary file not shown.

BIN
addin.g1a Normal file

Binary file not shown.

31
addin.ld Normal file
View File

@ -0,0 +1,31 @@
OUTPUT_ARCH(sh3)
ENTRY(initialize)
MEMORY
{
rom : o = 0x00300200, l = 512k
ram : o = 0x08100000, l = 64k /* pretty safe guess */
}
SECTIONS
{
.text : {
*(.pretext) /* init stuff */
*(.text)
} > rom
.rodata : {
*(.rodata)
*(.rodata.str1.4)
_romdata = . ; /* symbol for initialization data */
} > rom
.bss : {
_bbss = . ;
_bssdatasize = . ;
LONG(0); /* bssdatasize */
*(.bss) *(COMMON);
_ebss = . ;
} > ram
.data BLOCK(4) : AT(_romdata) {
_bdata = . ;
*(.data);
_edata = . ;
} > ram
}

BIN
bluetooth.o Normal file

Binary file not shown.

1
compi Executable file
View File

@ -0,0 +1 @@
sh3eb-elf-gcc -m3 -mb -ffreestanding -nostdlib -T addin.ld crt0.s SRC/BTKOM.cpp SRC/bluetooth.cpp SRC/syscall.s -o addin.elf -Iinclude -Iinclude/libfx -lgcc -lmonochrome -L . -lfx -O2 -fno-exceptions

BIN
crt0.o Normal file

Binary file not shown.

172
crt0.s Normal file
View File

@ -0,0 +1,172 @@
.section .pretext
.global initialize
initialize:
sts.l pr, @-r15
! set up TLB
mov.l Hmem_SetMMU, r3
mov.l address_one, r4 ! 0x8102000
mov.l address_two, r5 ! 0x8801E000
jsr @r3 ! _Hmem_SetMMU
mov #108, r6
! clear the BSS
mov.l bbss, r4 ! start
mov.l ebss, r5 ! end
bra L_check_bss
mov #0, r6
L_zero_bss:
mov.l r6, @r4 ! zero and advance
add #4, r4
L_check_bss:
cmp/hs r5, r4
bf L_zero_bss
! Copy the .data
mov.l bdata, r4 ! dest
mov.l edata, r5 ! dest limit
mov.l romdata, r6 ! source
bra L_check_data
nop
L_copy_data:
mov.l @r6+, r3
mov.l r3, @r4
add #4, r4
L_check_data:
cmp/hs r5, r4
bf L_copy_data
mov.l bbss, r4
mov.l edata, r5
sub r4, r5 ! size of .bss and .data sections
add #4, r5
mov.l bssdatasize, r4
mov.l r5, @r4
mov.l GLibAddinAplExecutionCheck, r2
mov #0, r4
mov #1, r5
jsr @r2 ! _GLibAddinAplExecutionCheck(0,1,1);
mov r5, r6
mov.l CallbackAtQuitMainFunction, r3
mov.l exit_handler, r4
jsr @r3 ! _CallbackAtQuitMainFunction(&exit_handler)
nop
mov.l main, r3
jmp @r3 ! _main()
lds.l @r15+, pr
_exit_handler:
mov.l r14, @-r15
mov.l r13, @-r15
mov.l r12, @-r15
sts.l pr, @-r15
mov.l Bdel_cychdr, r14
jsr @r14 ! _Bdel_cychdr
mov #6, r4
jsr @r14 ! _Bdel_cychdr
mov #7, r4
jsr @r14 ! _Bdel_cychdr
mov #8, r4
jsr @r14 ! _Bdel_cychdr
mov #9, r4
jsr @r14 ! _Bdel_cychdr
mov #10, r4
mov.l BfileFLS_CloseFile, r12
mov #4, r14
mov #0, r13
L_close_files:
jsr @r12 ! _BfileFLS_CloseFile
mov r13, r4
add #1, r13
cmp/ge r14, r13
bf L_close_files
mov.l flsFindClose, r12
mov #0, r13
L_close_finds:
jsr @r12 ! _flsFindClose
mov r13, r4
add #1, r13
cmp/ge r14, r13
bf L_close_finds
lds.l @r15+, pr
mov.l @r15+, r12
mov.l @r15+, r13
mov.l Bkey_Set_RepeatTime_Default, r2
jmp @r2 ! _Bkey_Set_RepeatTime_Default
mov.l @r15+, r14
.align 4
address_two: .long 0x8801E000
address_one: .long 0x8102000
Hmem_SetMMU: .long _Hmem_SetMMU
GLibAddinAplExecutionCheck: .long _GLibAddinAplExecutionCheck
CallbackAtQuitMainFunction: .long _CallbackAtQuitMainFunction
Bdel_cychdr: .long _Bdel_cychdr
BfileFLS_CloseFile: .long _BfileFLS_CloseFile
flsFindClose: .long _flsFindClose
Bkey_Set_RepeatTime_Default: .long _Bkey_Set_RepeatTime_Default
bbss: .long _bbss
ebss: .long _ebss
edata: .long _edata
bdata: .long _bdata
romdata: .long _romdata
bssdatasize: .long _bssdatasize
exit_handler: .long _exit_handler
main: .long _main
_Hmem_SetMMU:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x3FA
_Bdel_cychdr:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x119
_BfileFLS_CloseFile:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x1E7
_Bkey_Set_RepeatTime_Default:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x244
_CallbackAtQuitMainFunction:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x494
_flsFindClose:
mov.l sc_addr, r2
mov.l 1f, r0
jmp @r2
nop
1: .long 0x218
_GLibAddinAplExecutionCheck:
mov.l sc_addr, r2
mov #0x13, r0
jmp @r2
nop
sc_addr: .long 0x80010070
.end

BIN
icon.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

11
include/BTKOM.h Normal file
View File

@ -0,0 +1,11 @@
extern "C"{
#include <stdio.h>
#include <stdlib.h>
#include "MonochromeLib.h"
#include "syscall.h"
#include "libfx.h"
}
#include "bluetooth.h"

151
include/MonochromeLib.h Normal file
View File

@ -0,0 +1,151 @@
/*************************************************************/
/** MonochromeLib - monochrome graphic library for fx-9860G **/
/** MonochromeLib is free software **/
/** **/
/** @author Pierre "PierrotLL" Le Gall **/
/** @contact legallpierre89@gmail.com **/
/** **/
/** @file MonochromeLib.h **/
/** Include header for MonochromeLib **/
/** **/
/** @date 11-22-2011 **/
/*************************************************************/
#ifndef MONOCHROMELIB
#define MONOCHROMELIB
/****************************************************/
/** uncomment #define of functions you want to use **/
/****************************************************/
// #define ML_ALL //Auto define all functions
#define ML_CLEAR_VRAM
#define ML_CLEAR_SCREEN
#define ML_DISPLAY_VRAM
// #define ML_SET_CONTRAST
// #define ML_GET_CONTRAST
// #define ML_PIXEL
// #define ML_POINT
// #define ML_PIXEL_TEST
// #define ML_LINE
// #define ML_HORIZONTAL_LINE
// #define ML_VERTICAL_LINE
// #define ML_RECTANGLE
// #define ML_POLYGON
// #define ML_FILLED_POLYGON
// #define ML_CIRCLE
// #define ML_FILLED_CIRCLE
// #define ML_ELLIPSE
// #define ML_ELLIPSE_IN_RECT
// #define ML_FILLED_ELLIPSE
// #define ML_FILLED_ELLIPSE_IN_RECT
// #define ML_HORIZONTAL_SCROLL
// #define ML_VERTICAL_SCROLL
// #define ML_BMP_OR
// #define ML_BMP_AND
// #define ML_BMP_XOR
// #define ML_BMP_OR_CL
// #define ML_BMP_AND_CL
// #define ML_BMP_XOR_CL
// #define ML_BMP_8_OR
// #define ML_BMP_8_AND
// #define ML_BMP_8_XOR
// #define ML_BMP_8_OR_CL
// #define ML_BMP_8_AND_CL
// #define ML_BMP_8_XOR_CL
// #define ML_BMP_16_OR
// #define ML_BMP_16_AND
// #define ML_BMP_16_XOR
// #define ML_BMP_16_OR_CL
// #define ML_BMP_16_AND_CL
// #define ML_BMP_16_XOR_CL
/**************************/
/** Functions prototypes **/
/**************************/
#ifdef __cplusplus
extern "C" {
#endif
#define ML_SCREEN_WIDTH 128
#define ML_SCREEN_HEIGHT 64
#define ML_CONTRAST_MIN 130
#define ML_CONTRAST_NORMAL 168
#define ML_CONTRAST_MAX 190
typedef enum {ML_TRANSPARENT=-1, ML_WHITE, ML_BLACK, ML_XOR, ML_CHECKER} ML_Color;
char* ML_vram_adress();
void ML_clear_vram();
void ML_clear_screen();
void ML_display_vram();
void ML_set_contrast(unsigned char contrast);
unsigned char ML_get_contrast();
void ML_pixel(int x, int y, ML_Color color);
void ML_point(int x, int y, int width, ML_Color color);
ML_Color ML_pixel_test(int x, int y);
void ML_line(int x1, int y1, int x2, int y2, ML_Color color);
void ML_horizontal_line(int y, int x1, int x2, ML_Color color);
void ML_vertical_line(int x, int y1, int y2, ML_Color color);
void ML_rectangle(int x1, int y1, int x2, int y2, int border_width, ML_Color border_color, ML_Color fill_color);
void ML_polygon(const int *x, const int *y, int nb_vertices, ML_Color color);
void ML_filled_polygon(const int *x, const int *y, int nb_vertices, ML_Color color);
void ML_circle(int x, int y, int radius, ML_Color color);
void ML_filled_circle(int x, int y, int radius, ML_Color color);
void ML_ellipse(int x, int y, int radius1, int radius2, ML_Color color);
void ML_ellipse_in_rect(int x1, int y1, int x2, int y2, ML_Color color);
void ML_filled_ellipse(int x, int y, int radius1, int radius2, ML_Color color);
void ML_filled_ellipse_in_rect(int x, int y, int radius1, int radius2, ML_Color color);
void ML_horizontal_scroll(int scroll);
void ML_vertical_scroll(int scroll);
void ML_bmp_or(const unsigned char *bmp, int x, int y, int width, int height);
void ML_bmp_and(const unsigned char *bmp, int x, int y, int width, int height);
void ML_bmp_xor(const unsigned char *bmp, int x, int y, int width, int height);
void ML_bmp_or_cl(const unsigned char *bmp, int x, int y, int width, int height);
void ML_bmp_and_cl(const unsigned char *bmp, int x, int y, int width, int height);
void ML_bmp_xor_cl(const unsigned char *bmp, int x, int y, int width, int height);
void ML_bmp_8_or(const unsigned char *bmp, int x, int y);
void ML_bmp_8_and(const unsigned char *bmp, int x, int y);
void ML_bmp_8_xor(const unsigned char *bmp, int x, int y);
void ML_bmp_8_or_cl(const unsigned char *bmp, int x, int y);
void ML_bmp_8_and_cl(const unsigned char *bmp, int x, int y);
void ML_bmp_8_xor_cl(const unsigned char *bmp, int x, int y);
void ML_bmp_16_or(const unsigned short *bmp, int x, int y);
void ML_bmp_16_and(const unsigned short *bmp, int x, int y);
void ML_bmp_16_xor(const unsigned short *bmp, int x, int y);
void ML_bmp_16_or_cl(const unsigned short *bmp, int x, int y);
void ML_bmp_16_and_cl(const unsigned short *bmp, int x, int y);
void ML_bmp_16_xor_cl(const unsigned short *bmp, int x, int y);
#ifdef __cplusplus
}
#endif
#endif //MONOCHROMELIB

29
include/_h_c_lib.h Normal file
View File

@ -0,0 +1,29 @@
/*------------------------------------------------------*/
/* SH SERIES C/C++ Compiler Ver. 6.0 */
/* Copyright (c) 1992,2000 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = _h_c_lib.h : */
/* */
/* FUNC = Include file for SH SERIES C/C++ Compiler environment */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _H_C_LIB
#define _H_C_LIB
#ifdef __cplusplus
extern "C"{
#endif
extern void _CALL_INIT(void); /* for global class object initial processing */
extern void _CALL_END(void); /* for global class object post-processing */
#ifdef __cplusplus
}
#endif /* #ifdef __cplusplus */
#endif /* #ifndef _H_C_LIB */

39
include/assert.h Normal file
View File

@ -0,0 +1,39 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = assert.h : debug macro define ; */
/* */
/* FUNC = this module do the following functions; */
/* (1) if NDEBUG defined assert(x) = (void)0; */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _ASSERT
#define _ASSERT
#include <stdio.h>
#ifdef NDEBUG
#ifdef assert
#undef assert
#endif
#define assert(x) ((void)0)
#else
#ifdef assert
#undef assert
#endif
#define assert(x) ( x ? (void) 0 : (fprintf(stderr,\
"ASSERTION FAILED: "#x" FILE %s,LINE %d \n", \
__FILE__,__LINE__),abort(),(void)0))
#endif
#ifdef __cplusplus
extern "C" {
void abort(void);
}
#endif
#endif

185
include/bluetooth.h Normal file
View File

@ -0,0 +1,185 @@
/*
* AUTHOR : Xavier Bruni
*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* As long as you retain this notice you can do whatever you want with this
* stuff. If we meet some day, and you think this stuff is worth it, you can
* buy me a beer in return.
* ----------------------------------------------------------------------------
*/
extern "C"{
#include "MonochromeLib.h"
#include "syscall.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libfx.h"
}
/*
This bluetooth library is working with the 3-pin port of your calculator.
This library is compatible with SuperH-3 and SuperH-4 processor :
This include : Graph 35+, 75, 85 & 95.
This library has been written for the following bluetooth module : HC-05, HC-06
RAM can contain approximately 50KO of data. Each message can't do more than 32KO
You can't send more than 1ko -including header- from your smartphone to the calculator. In fact, the reception buffer has a size of 1ko max.
Without the header : 1000 - 48 = 952o
for sending : 256-48 = 208
If the 32 ko buffer is full, it will return a FUL packet.
*/
/*
How does Bluetooth header have to look like in a Message:
- (1) time : 19 bytes (YYYY-MM-DD-HH-MM-SS)
- (2) type : 3 bytes (3*char)
- (3) ID : 4 bytes (unsigned int)
- (4) sender : 10 bytes (10*char)
- (5) total length of the message (in bytes), headers not included : 4 bytes (unsigned int)
- (6) total length of this packet (in bytes), headers not included : 4 bytes (unsigned int)
- (7) part of the message / number of part : 2 bytes (short unsigned int) / 2 bytes (short unsigned int)
Total : 48 bytes.
Length must contain the null byte ! Null byte must be at the end of the message.
(2) type can be :
- RQT : request
- ASW : answer to a request
- ACK : acknowledgment. packet received.
- MIS : missing packet
- FUL : full reception buffer or RAM buffer or precedent message unread. It sends the ID of last message read.
- ERR : error. see error code in message content.
- HED : incorrect header
- END : terminate the connection.
Those are classic types. You can also set your own type (3 characters).
Practical informations and example :
This library has been build to save as much as memory as it can. To do that, Bluetooth class is sharing the same message ptr as the Message class.
The fact is that it will delete your precedent message on new message reception. If you want to avoid that, you can copy the message to another location before accepting new message.
- To read message : ptr = Obj.getMessage();
- To save message : length = Obj.getLength()+48\
ptr = malloc(length);\
memcpy(ptr, Obj.msg, length);\
Message Obj2;\
Obj2.setTotalMessage(ptr);
*/
class Message{
public:
Message();
// init message attribute. opt=1 to send the message directly (if possible)
int init(const char* type, int ID, char* sender,const char* message);
// set the type of the message. You have not to worry about other things to set in the header. It is automatic.
int setType(const char *typeH);
// set message content.
int setMessage(const char *message);
int setTotalMessage(char *message);
// get message content. (ptr + 48)
unsigned char* getMessage();
// header informations :
char* getTime();
char* getType();
char* getSender();
int getLength();
// this is message address (with header)
char *msg;
int isHeader;
private:
char type[3];
int isType;
};
class Bluetooth{
public:
Bluetooth();
// listen for new message. This function is non blocking. maxSize is the maximum length of message to receive.
// it will return NOT_ENOUG_RAM if it can not allocate that much. call this function early in your code, you'll have more chance to have enough ram.
// There is no maximum restriction, but RAM is about 50KO. 32KO should be the maximum.
int listen(int maxSize, int timer, void(*)(void), int time);
// Send a message. There is no maximum size. Indead, you will be limited by the RAM size (approx. 50ko)
int sendMessage(Message *message);
// get last message.
Message& getLastMessage();
// set the sender name (for header)
int setSender(char *senderName);
// set it to 1 if you want to allow message reception. it will delete previous message on new reception !! save it if you would like to keep it !!
unsigned int allowReception;
unsigned int unread;
// point on the 32ko of data.
char* ptr;
// point to the 1ko to receive
char* ptr1ko;
// call by a timber every 25ms. It CAN NOT recept more than 1 ko in a row.
// use (3) and (4) to send bigger message from your device.
void receptMessage();
int timer;
private:
// total size of all send packet
int sentPacketsTotalSize;
// total szie of all received packets
int receivedPacketsTotalSize;
int max;
char sender[10];
unsigned int ID;
unsigned int secondTry;
// Keep the last message in memory
Message msg;
};
int tabcmp(const char *tab[], int size, char *string);
char *itoa(int integer);
#define RTC 15.625
#define RQT 0
#define ASW 1
#define ACK 2
#define MIS 3
#define FUL 4
#define ERR 5
#define END 6
// Error code :
#define TIMER_ERROR_INSTALL 1
#define SENDER_TOO_BIG 2
#define SENDER_EMPTY 3
#define SERIAL_ALREADY_OPEN 4
#define NOT_ENOUGH_RAM 5
#define MISSING_ACK 6
#define UNKNOWN_ERROR 7
#define INVALID_TYPE 8
#define END_OF_COMMUNICATION 9

84
include/builtin.h Normal file
View File

@ -0,0 +1,84 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 6.0 */
/* Copyright (c) 1992, 2000 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = builtin : */
/* */
/* FUNC = this header file do the following functions; */
/* (1)builtin function prototype define; */
/* */
/* CLAS = UNIT ; */
/* */
/* END ; */
/*****************************************************************/
#ifndef _BUILTIN
#define _BUILTIN
#ifdef __cplusplus
extern "C" {
/* follow math.h & mathf.h */
extern float _builtin_fabsf(float);
extern double _builtin_fabs(double);
extern float _builtin_sqrtf(float);
extern double _builtin_sqrt(double);
/* follow private.h */
extern void _builtin_fsca(long ,float *,float *);
extern float _builtin_fsrra(float);
/* follow smachine.h */
extern void _builtin_set_imask(int);
extern int _builtin_get_imask(void);
extern void _builtin_set_cr(int);
extern int _builtin_get_cr(void);
extern void _builtin_set_vbr(void *);
extern void *_builtin_get_vbr(void);
extern void _builtin_sleep(void);
/* follow string.h */
extern char *_builtin_strcpy(char *, const char *);
extern int _builtin_strcmp(const char *, const char *);
/* follow umachine.h */
extern void _builtin_set_gbr(void *);
extern void *_builtin_get_gbr(void);
extern unsigned char _builtin_gbr_read_byte(int);
extern unsigned short _builtin_gbr_read_word(int);
extern unsigned long _builtin_gbr_read_long(int);
extern void _builtin_gbr_write_byte(int, unsigned char);
extern void _builtin_gbr_write_word(int, unsigned short);
extern void _builtin_gbr_write_long(int, unsigned long);
extern void _builtin_gbr_and_byte(int, unsigned char);
extern void _builtin_gbr_or_byte(int, unsigned char);
extern void _builtin_gbr_xor_byte(int, unsigned char);
extern int _builtin_gbr_tst_byte(int, unsigned char);
extern int _builtin_tas(char *);
extern int _builtin_trapa(int);
extern int _builtin_macw(short *, short *, unsigned int);
extern int _builtin_macwl(short *, short *, unsigned int, unsigned int);
extern int _builtin_macl(int *, int *, unsigned int);
extern int _builtin_macll(int *, int *, unsigned int, unsigned int);
extern int _builtin_trapa_svc(...);
extern void _builtin_prefetch(void *);
extern void _builtin_set_fpscr(int);
extern int _builtin_get_fpscr(void);
extern float _builtin_fipr(float a1[], float b1[]);
extern void _builtin_ftrv(float a1[], float b1[]);
extern void _builtin_ftrvadd(float a1[], float b1[], float c1[]);
extern void _builtin_ftrvsub(float a1[], float b1[], float c1[]);
extern void _builtin_mtrx4mul(float [][4], float [][4]);
extern void _builtin_mtrx4muladd(float [][4], float [][4], float [][4]);
extern void _builtin_mtrx4mulsub(float [][4], float [][4], float [][4]);
extern void _builtin_ld_ext(float [][4]);
extern void _builtin_st_ext(float [][4]);
extern void _builtin_add4(float a1[], float b1[], float c1[]);
extern void _builtin_sub4(float a1[], float b1[], float c1[]);
extern void _builtin_trace(int);
}
#endif /* #ifdef __cplusplus */
#endif /* #ifndef _BUILTIN */

189
include/complex Normal file
View File

@ -0,0 +1,189 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//====================================================================
// File: complex
// Purpose: Numerics library / Complex numbers
// Header <complex>
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _COMPLEX_
#define _COMPLEX_
#include <istream>
#include <ostream>
class float_complex; // based on float
class double_complex; // based on double
// complex specialization
class float_complex {
public:
typedef float value_type;
float_complex(float re = 0.0f, float im = 0.0f){
_re = re; _im = im; return; }
float_complex(const double_complex&);
float real() const{ return (_re);}
float imag() const{ return (_im);}
float_complex& operator= (float rhs){
_re = rhs; _im = 0.0; return *this; }
float_complex& operator+=(float rhs){ _re += rhs; return *this; }
float_complex& operator-=(float rhs){ _re -= rhs; return *this; }
float_complex& operator*=(float rhs){
_re *= rhs; _im *= rhs; return *this; }
float_complex& operator/=(float rhs){
_re /= rhs; _im /= rhs; return *this; }
float_complex& operator=(const float_complex&rhs){
_re = rhs.real(); _im = rhs.imag(); return *this; }
float_complex& operator+=(const float_complex&rhs){
_re += rhs.real(); _im += rhs.imag(); return *this; }
float_complex& operator-=(const float_complex&rhs){
_re -= rhs.real(); _im -= rhs.imag(); return *this; }
float_complex& operator*=(const float_complex&);
float_complex& operator/=(const float_complex&);
private:
float _re, _im;
};
class double_complex {
public:
typedef double value_type;
double_complex(double re = 0.0, double im = 0.0){
_re = re; _im = im; return; }
double_complex(const float_complex&rhs){
_re = (double)rhs.real(); _im = (double)rhs.imag(); return; }
double real() const{ return (_re);}
double imag() const{ return (_im);}
double_complex& operator= (double rhs){
_re = rhs; _im = 0.0; return *this; }
double_complex& operator+=(double rhs){ _re += rhs; return *this; }
double_complex& operator-=(double rhs){ _re -= rhs; return *this; }
double_complex& operator*=(double rhs){
_re *= rhs; _im *= rhs; return *this; }
double_complex& operator/=(double rhs){
_re /= rhs; _im /= rhs; return *this; }
double_complex& operator=(const double_complex&rhs){
_re = rhs.real(); _im = rhs.imag(); return *this; }
double_complex& operator+=(const double_complex&rhs){
_re += rhs.real(); _im += rhs.imag(); return *this; }
double_complex& operator-=(const double_complex&rhs){
_re -= rhs.real(); _im -= rhs.imag(); return *this; }
double_complex& operator*=(const double_complex&);
double_complex& operator/=(const double_complex&);
private:
double _re, _im;
};
// complex non-member functions
float_complex operator+(const float_complex&);
float_complex operator-(const float_complex&);
float_complex operator+(const float_complex&, const float_complex&);
float_complex operator+(const float_complex&, const float&);
float_complex operator+(const float&, const float_complex&);
float_complex operator-(const float_complex&, const float_complex&);
float_complex operator-(const float_complex&, const float&);
float_complex operator-(const float&, const float_complex&);
float_complex operator*(const float_complex&, const float_complex&);
float_complex operator*(const float_complex&, const float&);
float_complex operator*(const float&, const float_complex&);
float_complex operator/(const float_complex&, const float_complex&);
float_complex operator/(const float_complex&, const float&);
float_complex operator/(const float&, const float_complex&);
bool operator==(const float_complex&, const float_complex&);
bool operator==(const float_complex&, const float&);
bool operator==(const float&, const float_complex&);
bool operator!=(const float_complex&, const float_complex&);
bool operator!=(const float_complex&, const float&);
bool operator!=(const float&, const float_complex&);
istream& operator>>(istream&, float_complex&);
ostream& operator<<(ostream&, const float_complex&);
double_complex operator+(const double_complex&);
double_complex operator-(const double_complex&);
double_complex operator+(const double_complex&, const double_complex&);
double_complex operator+(const double_complex&, const double&);
double_complex operator+(const double&, const double_complex&);
double_complex operator-(const double_complex&, const double_complex&);
double_complex operator-(const double_complex&, const double&);
double_complex operator-(const double&, const double_complex&);
double_complex operator*(const double_complex&, const double_complex&);
double_complex operator*(const double_complex&, const double&);
double_complex operator*(const double&, const double_complex&);
double_complex operator/(const double_complex&, const double_complex&);
double_complex operator/(const double_complex&, const double&);
double_complex operator/(const double&, const double_complex&);
bool operator==(const double_complex&, const double_complex&);
bool operator==(const double_complex&, const double&);
bool operator==(const double&, const double_complex&);
bool operator!=(const double_complex&, const double_complex&);
bool operator!=(const double_complex&, const double&);
bool operator!=(const double&, const double_complex&);
istream& operator>>(istream&, double_complex&);
ostream& operator<<(ostream&, const double_complex&);
// complex value operations
float real(const float_complex&);
float imag(const float_complex&);
float abs(const float_complex&);
float arg(const float_complex&);
float norm(const float_complex&);
float_complex conj(const float_complex&);
float_complex polar(const float&, const float&);
double real(const double_complex&);
double imag(const double_complex&);
double abs(const double_complex&);
double arg(const double_complex&);
double norm(const double_complex&);
double_complex conj(const double_complex&);
double_complex polar(const double&, const double&);
// complex transcendentals
#ifdef sqrt
#undef sqrt
extern "C" double sqrt(double);
#endif
float_complex cos (const float_complex&);
float_complex cosh (const float_complex&);
float_complex exp (const float_complex&);
float_complex log (const float_complex&);
float_complex log10(const float_complex&);
float_complex pow(const float_complex&, int);
float_complex pow(const float_complex&, const float&);
float_complex pow(const float_complex&, const float_complex&);
float_complex pow(const float&, const float_complex&);
float_complex sin (const float_complex&);
float_complex sinh (const float_complex&);
float_complex sqrt (const float_complex&);
float_complex tan (const float_complex&);
float_complex tanh (const float_complex&);
double_complex cos (const double_complex&);
double_complex cosh (const double_complex&);
double_complex exp (const double_complex&);
double_complex log (const double_complex&);
double_complex log10(const double_complex&);
double_complex pow(const double_complex&, int);
double_complex pow(const double_complex&, const double&);
double_complex pow(const double_complex&, const double_complex&);
double_complex pow(const double&, const double_complex&);
double_complex sin (const double_complex&);
double_complex sinh (const double_complex&);
double_complex sqrt (const double_complex&);
double_complex tan (const double_complex&);
double_complex tanh (const double_complex&);
#endif

66
include/ctype.h Normal file
View File

@ -0,0 +1,66 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = ctype : */
/* FUNC = */
/* ; */
/* */
/* */
/* */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _CTYPE
#define _CTYPE
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned char _ctype[];
extern int isalnum(int);
extern int isalpha(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
extern int islower(int);
extern int isprint(int);
extern int ispunct(int);
extern int isspace(int);
extern int isupper(int);
extern int isxdigit(int);
extern int tolower(int);
extern int toupper(int);
#ifdef __cplusplus
}
#endif
#define _UPPER 0x01
#define _LOWER 0x02
#define _DIGIT 0x04
#define _SPACE 0x08
#define _PUNCT 0x10
#define _CNTRL 0x20
#define _WHITE 0x40
#define _HEX 0x80
#define isalnum(c) (_ctype[(c) & 0xff] & (_UPPER | _LOWER | _DIGIT))
#define isalpha(c) (_ctype[(c) & 0xff] & (_UPPER | _LOWER))
#define iscntrl(c) (_ctype[(c) & 0xff] & _CNTRL)
#define isdigit(c) (_ctype[(c) & 0xff] & _DIGIT)
#define isgraph(c) (_ctype[(c) & 0xff] & (_UPPER | _LOWER | _DIGIT | _PUNCT))
#define islower(c) (_ctype[(c) & 0xff] & _LOWER)
#define isprint(c) (_ctype[(c) & 0xff] & (_UPPER|_LOWER|_DIGIT|_PUNCT|_SPACE))
#define ispunct(c) (_ctype[(c) & 0xff] & _PUNCT)
#define isspace(c) (_ctype[(c) & 0xff] & _WHITE)
#define isupper(c) (_ctype[(c) & 0xff] & _UPPER)
#define isxdigit(c) (_ctype[(c) & 0xff] & _HEX)
#define tolower(c) (isupper(c) ? ((c)-'A'+'a') : (c))
#define toupper(c) (islower(c) ? ((c)-'a'+'A') : (c))
#endif

257
include/ensigdsp.h Normal file
View File

@ -0,0 +1,257 @@
/*
*SHDSP Library
*Copyright (c) Hitachi,Ltd. 1998
*Licensed material of Hitachi,Ltd
*/
/***********************************************************
* File: ensigdsp.h
* Purpose: Common
* Create: 1998.03.20 Rev. 1.0
***********************************************************/
/*
** Copyright Ensigma Ltd. 1995
**
** Unauthorised copying or distribution of this software is prohibited.
**
** Version 1.0.
**
*/
/*
** ENSIGMA DSP Library
*/
/* Constants */
#ifndef _ENSIGDSP
#define _ENSIGDSP
#define BIQUAD_SIZE 6 /* no. coefficients in an IIR biquad */
#define EDSP_OK 0
#define EDSP_BAD_ARG 1
#define EDSP_NO_HEAP 2
#define EFFTALLSCALE (-1L)
#define EFFTMIDSCALE 0x55555555L
#define EFFTNOSCALE 0x00000000L
#ifdef __cplusplus /*A-10-014-01*/
extern"C"{ /*A-10-014-01*/
#endif /*A-10-014-01*/
/*
** Fourier transforms
*/
int FftComplex(short op_x[],
short op_y[],
const short ip_x[],
const short ip_y[],
long size,
long scale);
int FftInComplex(short data_x[],
short data_y[],
long size,
long scale);
int FftReal(short op_x[],
short op_y[],
const short ip[],
long size,
long scale);
/* int ip_is_x);*/
int FftInReal(short data_x[],
short data_y[],
long size,
long scale,
int not_sure_about_ip_format);
int IfftComplex(short op_x[],
short op_y[],
const short ip_x[],
const short ip_y[],
long size,
long scale);
int IfftInComplex(short data_x[],
short data_y[],
long size,
long scale);
int IfftReal(short op_x[],
short op_y[],
const short ip_x[],
const short ip_y[],
long size,
long scale,
int op_is_x_scratch_is_y);
int IfftInReal(short data_x[],
short data_y[],
long size,
long scale,
int not_sure_about_op_format);
int InitFft(long max_size);
void FreeFft(void); /*A-10-015-01*/
int LogMagnitude(short output[],
const short ip_x[],
const short ip_y[],
long no_elements,
float fscale);
/*
** These three variables are for the internal use of the library FFT
** functions only. They should not be accessed by user programs.
*/
extern long max_fft_size;
extern short *twtble;
/*
** Window functions
*/
int GenBlackman(short data[], long N);
int GenHamming(short data[], long N);
int GenHanning(short data[], long N);
int GenTriangle(short data[], long N);
/*
** Filters. The coefficients must be supplied in X and the workspace in Y.
** If it is straightforward we can support the opposite, ie Xworkspace and
** Ycoeff.
*/
int FreeFir(short **Yworkspace, long order);
int InitFir(short **Yworkspace, long order);
int InitIir(short **Yworkspace, long no_sections);
int FreeIir(short **Yworkspace, long no_sections); /*A-10-015-01*/
int InitDIir(long **Yworkspace, long no_sections);
int FreeDIir(long **Yworkspace, long no_sections); /*A-10-015-01*/
int InitLms(short **Yworkspace, long order);
int FreeLms(short **Yworkspace, long order); /*A-10-015-01*/
int Fir(short op[],
const short ip[],
long no_samples,
const short Xcoeff[],
long order,
int res_shift,
short *Yworkspace);
int Fir1(short *op_ptr,
short input,
const short Xcoeff[],
long order,
int res_shift,
short *Yworkspace);
int Iir(short op[],
const short ip[],
long no_samples,
const short Xcoeff[],
long no_sections,
short *Yworkspace);
int Iir1(short *op_ptr,
short input,
const short Xcoeff[],
long no_sections,
short *Yworkspace);
int DIir(short op[],
const short ip[],
long no_samples,
const long Xcoeff[],
long no_sections,
long *Yworkspace);
int DIir1(short *op_ptr,
const short input, /*98.01.09 C-10-005-01 */
/* short input, 98.01.09 D-10-005-01 */
const long Xcoeff[],
long no_sections,
long *Yworkspace);
int Lms(short op[],
const short ip[],
const short ref[],
long no_samples,
short Xcoeff[],
long order,
int res_shift,
short mu,
short *Yworkspace);
int Lms1(short *op_ptr,
short input,
short ref_op,
short Xcoeff[],
long order,
int res_shift,
short mu,
short *Yworkspace);
/*
** Convolution and Correlation
*/
int ConvComplete(short op[],
const short ix[],
const short iy[],
long ix_size,
long iy_size,
int res_shift);
int ConvCyclic(short op[],
const short ix[],
const short iy[],
long size,
int res_shift);
int ConvPartial(short op[],
const short ix[],
const short iy[],
long ix_size,
long iy_size,
int res_shift);
int Correlate(short op[],
const short ix[],
const short iy[],
long ix_size,
long iy_size,
long no_corr,
int x_is_larger,
int res_shift);
int CorrCyclic(short op[],
const short ix[],
const short iy[],
long size,
int reverse,
int res_shift);
/*
** Miscellaneous
*/
int GenGWnoise(short output[], long no_samples, float variance);
int MinI(short **min_ptr, short buffer[], long buff_len, int src_is_x);
int MaxI(short **max_ptr, short buffer[], long buff_len, int src_is_x);
int PeakI(short **peak_ptr, short buffer[], long buff_len, int src_is_x);
int Mean(short *mean_ptr, const short buffer[], long buff_len, int src_is_x);
int Variance(long *variance_ptr,
short *mean_ptr,
const short buffer[],
long buff_len, int src_is_x);
int VectorMult(short dest[],
const short matrixX[],
const short matrixY[],
long length,
int res_shift);
int MatrixMult(void *matrix3,
const void *matrixX,
const void *matrixY,
long m,
long n,
long p,
int res_shift, int dest_is_x);
int MsPower(long *pow_ptr, const short input[], long buff_size, int src_is_x);
int CopyXtoY(short y[], const short x[], long n);
int CopyYtoX(short x[], const short y[], long n);
int CopyToX(short x[], const short src[], long n);
int CopyToY(short y[], const short src[], long n);
int CopyFromX(short src[], const short x[], long n);
int CopyFromY(short src[], const short y[], long n);
int Limit(short data[], long no_elements, int data_is_x);
#ifdef __cplusplus /*A-10-014-01*/
} /*A-10-014-01*/
#endif /*A-10-014-01*/
#endif

114
include/errno.h Normal file
View File

@ -0,0 +1,114 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = errno : */
/* FUNC = */
/* ; */
/* */
/* */
/* */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _ERRNO
#define _ERRNO
#ifndef ERANGE
#define ERANGE 1100
#endif
#ifndef EDOM
#define EDOM 1101
#endif
#ifndef EDIV
#define EDIV 1102
#endif
#ifndef ESTRN
#define ESTRN 1104
#endif
#ifndef PTRERR
#define PTRERR 1106
#endif
#ifndef SEQERR
#define SEQERR 1108
#endif
#ifndef ECBASE
#define ECBASE 1200
#endif
#ifndef ETLN
#define ETLN 1202
#endif
#ifndef EEXP
#define EEXP 1204
#endif
#ifndef EEXPN
#define EEXPN 1206
#endif
#ifndef ENUM
#define ENUM 1208
#endif
#ifndef EFLOATO
#define EFLOATO 1210
#endif
#ifndef EFLOATU
#define EFLOATU 1220
#endif
#ifndef EDBLO
#define EDBLO 1250
#endif
#ifndef EDBLU
#define EDBLU 1260
#endif
#ifndef ELDBLO
#define ELDBLO 1270
#endif
#ifndef ELDBLU
#define ELDBLU 1280
#endif
#ifndef NOTOPN
#define NOTOPN 1300
#endif
#ifndef EBADF
#define EBADF 1302
#endif
#ifndef ECSPEC
#define ECSPEC 1304
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern volatile int _errno;
#ifdef __cplusplus
}
#endif
#ifndef errno
#define errno _errno
#endif
#endif

74
include/exception.h Normal file
View File

@ -0,0 +1,74 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = exception.h : */
/* */
/* FUNC = Include file for exception handling (see 18.6) */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _EXCEPTION_H
#define _EXCEPTION_H
/* This lets users disable the EDG supplied exception classes. */
#ifndef __NO_EDG_EXCEPTION_CLASSES
#include <stdexcept.h>
#ifdef __EDG_RUNTIME_USES_NAMESPACES
namespace std {
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
/*
If bool is not supported, use a typedef for bool.
*/
#ifdef _BOOL
typedef bool __bool;
#else /* ifndef _BOOL */
typedef int __bool;
#endif /* ifdef _BOOL */
class bad_exception : public exception {
public:
bad_exception() throw();
bad_exception(const bad_exception&) throw();
bad_exception& operator=(const bad_exception&) throw();
virtual ~bad_exception() throw();
virtual const char* what() const throw();
};
typedef void (*terminate_handler)();
extern terminate_handler set_terminate(terminate_handler);
typedef void (*unexpected_handler)();
extern unexpected_handler set_unexpected(unexpected_handler);
/* unexpected and terminate are in the WP definition of exception.h.
It is not clear why. */
void terminate();
void unexpected();
extern __bool uncaught_exception();
#ifdef __EDG_RUNTIME_USES_NAMESPACES
} /* namespace */
#ifdef __EDG_IMPLICIT_USING_STD
/* Implicitly include a using directive for the STD namespace when this
preprocessing flag is TRUE. */
using namespace std;
#endif /* ifdef __EDG_IMPLICIT_USING_STD */
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */
#endif /* _EXCEPTION_H */

26
include/filt_ws.h Normal file
View File

@ -0,0 +1,26 @@
/*
*SHDSP Library
*Copyright (c) Hitachi,Ltd. 1998
*Licensed material of Hitachi,Ltd
*/
/***********************************************************
* File: filt_ws.h
* Purpose: Filter
* Create: 1998.03.20 Rev. 1.0
***********************************************************/
#ifndef FILT_WS
#define FILT_WS
#ifndef WS_SIZE
#define WS_SIZE 1024 /* Set Global workspace buffer size=1024 shorts (2048 bytes) */
#endif
#define MEMSIZE WS_SIZE*sizeof(short)
#pragma section Y /*need to equate DYRAM with link.cmd file*/
short ws_mem[WS_SIZE];
short * ws_ptr=ws_mem;
long ws_left=MEMSIZE;
#pragma section
#endif

208
include/float.h Normal file
View File

@ -0,0 +1,208 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = float : */
/* FUNC = limit about float type and double type ; */
/* */
/* */
/* END ; */
/*****************************************************************/
#ifndef _FLOAT
#define _FLOAT
extern const float _FLT_MAX_VAL;
extern const float _FLT_MIN_VAL;
extern const double _DBL_MAX_VAL;
extern const double _DBL_MIN_VAL;
extern const long double _LDBL_MAX_VAL;
extern const long double _LDBL_MIN_VAL;
#ifndef _FPD
#define FLT_RADIX 2
#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_RON))
#define FLT_ROUNDS 0
#define FLT_GUARD 0
#else
#define FLT_ROUNDS 1
#define FLT_GUARD 1
#endif
#define FLT_NORMALIZE 1
#define FLT_MAX _FLT_MAX_VAL
#define FLT_MIN _FLT_MIN_VAL
#define FLT_MAX_EXP 127
#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_DON))
#define FLT_MIN_EXP (-126)
#else
#define FLT_MIN_EXP (-149)
#endif
#define FLT_MAX_10_EXP 38
#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_DON))
#define FLT_MIN_10_EXP (-38)
#else
#define FLT_MIN_10_EXP (-44)
#endif
#define FLT_DIG 6
#define FLT_MANT_DIG 24
#define FLT_EXP_DIG 8
#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_RON))
#define FLT_POS_EPS 1.1920928955078125e-7f
#if defined(_DON)
#define FLT_NEG_EPS 1.4012984643248171e-45f
#else
#define FLT_NEG_EPS 1.1754943508222876e-38f
#endif
#else
#define FLT_POS_EPS 5.9604648328104311e-8f
#define FLT_NEG_EPS 2.9802324164052156e-8f
#endif
#define FLT_POS_EPS_EXP (-23)
#if defined(_SH2E)|defined(_SH3E)|defined(_SH4)
#define FLT_NEG_EPS_EXP (-126)
#else
#define FLT_NEG_EPS_EXP (-24)
#endif
#endif
#if defined(_FLT)|defined(_FPS)
#define DBL_RADIX FLT_RADIX
#define DBL_ROUNDS FLT_ROUNDS
#define DBL_GUARD FLT_GUARD
#define DBL_NORMALIZE FLT_NORMALIZE
#define DBL_MAX _FLT_MAX_VAL
#define DBL_MIN _FLT_MIN_VAL
#define DBL_MAX_EXP FLT_MAX_EXP
#define DBL_MIN_EXP FLT_MIN_EXP
#define DBL_MAX_10_EXP FLT_MAX_10_EXP
#define DBL_MIN_10_EXP FLT_MIN_10_EXP
#define DBL_DIG FLT_DIG
#define DBL_MANT_DIG FLT_MANT_DIG
#define DBL_EXP_DIG FLT_EXP_DIG
#define DBL_POS_EPS FLT_POS_EPS
#define DBL_NEG_EPS FLT_NEG_EPS
#define DBL_POS_EPS_EXP FLT_POS_EPS_EXP
#define DBL_NEG_EPS_EXP FLT_NEG_EPS_EXP
#else
#define DBL_RADIX 2
#if defined(_SH4)&!defined(_RON)
#define DBL_ROUNDS 0
#define DBL_GUARD 0
#else
#define DBL_ROUNDS 1
#define DBL_GUARD 1
#endif
#define DBL_NORMALIZE 1
#define DBL_MAX _DBL_MAX_VAL
#define DBL_MIN _DBL_MIN_VAL
#define DBL_MAX_EXP 1023
#if defined(_SH4)&!defined(_DON)
#define DBL_MIN_EXP (-1022)
#else
#define DBL_MIN_EXP (-1074)
#endif
#define DBL_MAX_10_EXP 308
#if defined(_SH4)&!defined(_DON)
#define DBL_MIN_10_EXP (-308)
#else
#define DBL_MIN_10_EXP (-323)
#endif
#define DBL_DIG 15
#define DBL_MANT_DIG 53
#define DBL_EXP_DIG 11
#if defined(_SH4)&!defined(_RON)
#define DBL_POS_EPS 2.2204460492503131e-16
#if defined(_DON)
#define DBL_NEG_EPS 4.9406564584124655e-324
#else
#define DBL_NEG_EPS 2.2250738585072014e-308
#endif
#else
#define DBL_POS_EPS 1.1102230246251567e-16
#define DBL_NEG_EPS 5.5511151231257834e-17
#endif
#define DBL_POS_EPS_EXP (-52)
#ifdef _SH4
#ifdef _RON
#define DBL_NEG_EPS_EXP (-53)
#else
#ifdef _DON
#define DBL_NEG_EPS_EXP (-1023)
#else
#define DBL_NEG_EPS_EXP (-1022)
#endif
#endif
#else
#define DBL_NEG_EPS_EXP (-53)
#endif
#ifdef _FPD
#define FLT_RADIX DBL_RADIX
#define FLT_ROUNDS DBL_ROUNDS
#define FLT_GUARD DBL_GUARD
#define FLT_NORMALIZE DBL_NORMALIZE
#define FLT_MAX _DBL_MAX_VAL
#define FLT_MIN _DBL_MIN_VAL
#define FLT_MAX_EXP DBL_MAX_EXP
#define FLT_MIN_EXP DBL_MIN_EXP
#define FLT_MAX_10_EXP DBL_MAX_10_EXP
#define FLT_MIN_10_EXP DBL_MIN_10_EXP
#define FLT_DIG DBL_DIG
#define FLT_MANT_DIG DBL_MANT_DIG
#define FLT_EXP_DIG DBL_EXP_DIG
#define FLT_POS_EPS DBL_POS_EPS
#define FLT_NEG_EPS DBL_NEG_EPS
#define FLT_POS_EPS_EXP DBL_POS_EPS_EXP
#define FLT_NEG_EPS_EXP DBL_NEG_EPS_EXP
#endif
#endif
#ifdef _FLT
#define LDBL_RADIX 2
#define LDBL_ROUNDS 1
#define LDBL_GUARD 1
#define LDBL_NORMALIZE 1
#define LDBL_MAX _LDBL_MAX_VAL
#define LDBL_MIN _LDBL_MIN_VAL
#define LDBL_MAX_EXP 1023
#define LDBL_MIN_EXP (-1074)
#define LDBL_MAX_10_EXP 308
#define LDBL_MIN_10_EXP (-323)
#define LDBL_DIG 15
#define LDBL_MANT_DIG 53
#define LDBL_EXP_DIG 11
#define LDBL_POS_EPS 1.1102230246251567e-16
#define LDBL_NEG_EPS 5.5511151231257834e-17
#define LDBL_POS_EPS_EXP (-52)
#define LDBL_NEG_EPS_EXP (-53)
#else
#define LDBL_RADIX DBL_RADIX
#define LDBL_ROUNDS DBL_ROUNDS
#define LDBL_GUARD DBL_GUARD
#define LDBL_NORMALIZE DBL_NORMALIZE
#define LDBL_MAX DBL_MAX
#define LDBL_MIN DBL_MIN
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_DIG DBL_DIG
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EXP_DIG DBL_EXP_DIG
#define LDBL_POS_EPS DBL_POS_EPS
#define LDBL_NEG_EPS DBL_NEG_EPS
#define LDBL_POS_EPS_EXP DBL_POS_EPS_EXP
#define LDBL_NEG_EPS_EXP DBL_NEG_EPS_EXP
#endif
#endif

60
include/iomanip Normal file
View File

@ -0,0 +1,60 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//
// Embeded C++ Library Header <iomanip>
//
//====================================================================
// File: iomanip
// Purpose: Definition of class iomanip
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _IOMANIP_
#define _IOMANIP_
#include <istream>
#include <ostream>
//Class
class smanip{
private:
union{
int val_i;
char val_c;
ios_base::fmtflags val_f;
};
union{
ios_base& (*pfi)(ios_base&,int);
ios_base& (*pfc)(ios_base&,char);
ios_base& (*pff)(ios_base&,ios_base::fmtflags);
};
enum _ec2p_smanip_t{
_ec2p_smanip_i,_ec2p_smanip_c ,_ec2p_smanip_f
}_ec2p_smanip_data;
public:
smanip(ios_base& (*pf)(ios_base&,int),int arg)
:pfi(pf),val_i(arg),_ec2p_smanip_data(_ec2p_smanip_i){}
smanip(ios_base& (*pf)(ios_base&,char),char arg)
:pfc(pf),val_c(arg),_ec2p_smanip_data(_ec2p_smanip_c){}
smanip(ios_base& (*pf)(ios_base&,ios_base::fmtflags),ios_base::fmtflags arg)
:pff(pf),val_f(arg),_ec2p_smanip_data(_ec2p_smanip_f){}
friend ostream& operator << (ostream&,smanip);
friend istream& operator >> (istream&,smanip);
};
//Manipulators
smanip resetiosflags(ios_base::fmtflags);
smanip setiosflags(ios_base::fmtflags);
smanip setbase(int);
smanip setfill(char);
smanip setprecision(int);
smanip setw(int);
#endif

192
include/ios Normal file
View File

@ -0,0 +1,192 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//
// Embeded C++ Class Library Header <ios>
//
//====================================================================
// File: ios
// Purpose: Definition of class ios
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _IOS_
#define _IOS_
class streambuf;
class ostream;
typedef long POS_T;
typedef long INT_T;
typedef long SZ_T;
typedef long OFF_T;
typedef OFF_T streamoff;
typedef SZ_T streamsize;
typedef INT_T int_type;
typedef POS_T pos_type;
typedef OFF_T off_type;
class ios_base {
public:
typedef long fmtflags;
static const fmtflags boolalpha;
static const fmtflags dec;
static const fmtflags fixed;
static const fmtflags hex;
static const fmtflags internal;
static const fmtflags left;
static const fmtflags oct;
static const fmtflags right;
static const fmtflags scientific;
static const fmtflags showbase;
static const fmtflags showpoint;
static const fmtflags showpos;
static const fmtflags skipws;
static const fmtflags unitbuf;
static const fmtflags uppercase;
static const fmtflags adjustfield;
static const fmtflags basefield;
static const fmtflags floatfield;
typedef int iostate;
static const iostate badbit;
static const iostate eofbit;
static const iostate failbit;
static const iostate goodbit;
typedef int openmode;
static const openmode app;
static const openmode ate;
static const openmode binary;
static const openmode in;
static const openmode out;
static const openmode trunc;
typedef int seekdir;
static const seekdir beg;
static const seekdir cur;
static const seekdir end;
class Init;
fmtflags flags() const {return (fmtflags)fmtfl;}
fmtflags flags(fmtflags);
fmtflags setf(fmtflags) ;
fmtflags setf(fmtflags, fmtflags);
void unsetf(fmtflags);
char fill() const {
return (char)fillch;
}
char fill(char);
int precision() const {
return prec;
}
streamsize precision(streamsize);
streamsize width() const {return wide;}
streamsize width(streamsize);
// static int xalloc() {return index++;} // Not implemented
// long & ipword(int); // Not implemented
// long * &pword(int); // Not implemented
~ios_base(){} // destructor
// callbacks -- exposition only
enum event {
erase_event,
imbue_event,
copyfmt_event
};
typedef void (*event_callback)(event, ios_base&, int index);
void register_callback(event_callback fn, int index);
static bool sync_with_stdio(bool sync = true){ return true; }
class Init{
public:
Init(){init_cnt++;}
~Init(){init_cnt--;}
private:
static int init_cnt;
};
protected:
ios_base(){Init::Init();}
void _ec2p_init_base();
void _ec2p_copy_base(ios_base &);
static const fmtflags _fmtmask;
static const iostate _statemask;
private:
fmtflags fmtfl; // format flag
streamsize prec; // number of after floating point
streamsize wide; // field width
char fillch; // fill charactor
// static int index; // exposition only
// long *iarray; // exposition only
// void **parray; // exposition only
};
class ios : public ios_base {
public:
// Types:
// typedef INT_T int_type;
// typedef POS_T pos_type;
// typedef OFF_T off_type;
operator void*() const {
return (void*)!fail();
}
bool operator!() const{return (bool)fail();}
iostate rdstate () const{return (iostate)state;}
void clear(iostate = goodbit);
void setstate(iostate);
bool good() const {return (bool)(state==goodbit);}
bool eof() const {return (bool)(state&eofbit);}
bool fail() const {return (bool)(state&(badbit|failbit));}
bool bad() const {return (bool)(state&badbit);}
iostate exceptions() const; // exposition only
void exceptions(iostate); // exposition only
ios(streambuf *sbptr){ // Constructor
init(sbptr);
}
virtual ~ios(){}; // Destructor
ostream *tie() const {return tiestr;}
ostream *tie(ostream*);
streambuf *rdbuf() const{return sb;}
streambuf *rdbuf(streambuf*);
ios & copyfmt(const ios &);
ios(){init(0);}
void init(streambuf*);
private:
streambuf *sb; // pointer to streambuf object
ostream *tiestr; // pointer to ostream object
int state; // status
};
//Manipulators
ios_base & boolalpha(ios_base&);
ios_base & noboolalpha(ios_base&);
ios_base & showbase(ios_base&);
ios_base & noshowbase(ios_base&);
ios_base & showpoint(ios_base&);
ios_base & noshowpoint(ios_base&);
ios_base & showpos(ios_base&);
ios_base & noshowpos(ios_base&);
ios_base & skipws(ios_base&);
ios_base & noskipws(ios_base&);
ios_base & uppercase(ios_base&);
ios_base & nouppercase(ios_base&);
//Adjustfield
ios_base & internal(ios_base&);
ios_base & left(ios_base&);
ios_base & right(ios_base&);
//Basefield
ios_base & dec(ios_base&);
ios_base & hex(ios_base&);
ios_base & oct(ios_base&);
//floatfield
ios_base & fixed(ios_base&);
ios_base & scientific(ios_base&);
#endif

27
include/iostream Normal file
View File

@ -0,0 +1,27 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//
// Standard iostream objects
// Embeded C++ Library Header <iostream>
//
//====================================================================
// File: iostream
// Purpose: Definition of class iostream
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _IOSTREAM_
#define _IOSTREAM_
#include <mystrbuf>
#include <istream>
#include <ostream>
extern istream cin;
extern ostream cout;
// extern ostream cerr; // EC++, not implemented
#endif

112
include/istream Normal file
View File

@ -0,0 +1,112 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//====================================================================
// File: istream
// Purpose: Definition of class istream
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _ISTREAM_
#define _ISTREAM_
#include <streambuf>
class istream : public ios {
public:
// Types (inherited from ios):
// typedef INT_T int_type;
// typedef POS_T pos_type;
// typedef OFF_T off_type;
istream(streambuf *sb)
:chcount(0),ios(sb){} // Constructor
virtual ~istream(){} // Destructor
class sentry; // Prefix/Suffix
// Formatted input
istream& operator >>(istream& (*pf)(istream&)){
return ((*pf)(*this)); }
istream& operator >>(ios& (*pf)(ios&)){
(*pf)(* (ios *)this); return (*this); }
istream& operator>> (ios_base& (*pf)(ios_base&)){
(*pf)(* (ios*)this); return (*this); }
istream & operator >>(bool &n);
istream & operator >>(short &n);
istream & operator >>(unsigned short &n);
istream & operator >>(int &n);
istream & operator >>(unsigned int &n);
istream & operator >>(long &n);
istream & operator >>(unsigned long &n);
istream & operator >>(float &f);
istream & operator >>(double &f);
istream & operator >>(long double &f);
istream & operator >>(void * &p);
istream & operator >>(streambuf *sb);
// Unformatted input
streamsize gcount() const{return chcount;}
int_type get();
istream & get( char& c );
istream & get( signed char& c );
istream & get( unsigned char& c );
istream & get( char* s, streamsize n);
istream & get( char* s, streamsize n, char delim );
istream & get( signed char* s, streamsize n);
istream & get( signed char* s, streamsize n, char delim );
istream & get( unsigned char* s, streamsize n);
istream & get( unsigned char* s, streamsize n, char delim );
istream & get( streambuf& sb);
istream & get( streambuf& sb, char delim );
istream & getline( char* s, streamsize n);
istream & getline( char* s, streamsize n, char delim );
istream & getline( signed char* s, streamsize n );
istream & getline( signed char* s, streamsize n, char delim );
istream & getline( unsigned char* s, streamsize n );
istream & getline( unsigned char* s, streamsize n, char delim );
istream & ignore( streamsize n=1, int_type delim=streambuf::eof );
int_type peek();
istream & read( char* s, streamsize n );
istream & read( signed char* s, streamsize n );
istream & read( unsigned char* s, streamsize n );
streamsize readsome( char* s, streamsize n );
streamsize readsome( signed char* s, streamsize n );
streamsize readsome( unsigned char* s, streamsize n );
istream & putback( char c );
istream & unget();
int sync();
pos_type tellg();
istream & seekg( pos_type pos );
istream & seekg( off_type off, ios_base::seekdir dir );
private:
streamsize chcount;
streamsize _ec2p_gets( char* s, streamsize n, char delim, int mode );
int _ec2p_getistr(char* str, unsigned int dig, int mode);
int _ec2p_getfstr(char* str, unsigned int dig);
unsigned long _ec2p_strtoul(char *nptr, char **endptr, int base);
long _ec2p_extlong();
unsigned long _ec2p_extulong();
};
class istream::sentry {
public:
sentry(istream& is, bool noskipws = false);
~sentry(){}
operator bool() { return ok_; }
private:
bool ok_;
};
// character extraction templates:
istream& operator>>(istream&, char&);
istream& operator>>(istream&, unsigned char&);
istream& operator>>(istream&, signed char&);
istream& operator>>(istream&, char*);
istream& operator>>(istream&, unsigned char*);
istream& operator>>(istream&, signed char*);
// Manipulator
istream& ws(istream& is );
#endif

97
include/libfx.h Normal file
View File

@ -0,0 +1,97 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : fxlib.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __FXLIB_H__
#define __FXLIB_H__
#include <libfx/dispbios.h>
#include <libfx/filebios.h>
#include <libfx/keybios.h>
#ifdef __cplusplus
extern "C" {
#endif
// Prototypes
void Bdisp_AllClr_DD(void);
void Bdisp_AllClr_VRAM(void);
void Bdisp_AllClr_DDVRAM(void);
void Bdisp_AreaClr_DD(const DISPBOX *pArea);
void Bdisp_AreaClr_VRAM(const DISPBOX *pArea);
void Bdisp_AreaClr_DDVRAM(const DISPBOX *pArea);
void Bdisp_AreaReverseVRAM(int x1, int y1, int x2, int y2);
void Bdisp_GetDisp_DD(unsigned char *pData);
void Bdisp_GetDisp_VRAM(unsigned char *pData);
void Bdisp_PutDisp_DD(void);
void Bdisp_PutDispArea_DD(const DISPBOX *PutDispArea);
void Bdisp_SetPoint_DD(int x, int y, unsigned char point);
void Bdisp_SetPoint_VRAM(int x, int y, unsigned char point);
void Bdisp_SetPoint_DDVRAM(int x, int y, unsigned char point);
int Bdisp_GetPoint_VRAM(int x, int y);
void Bdisp_WriteGraph_DD(const DISPGRAPH *WriteGraph);
void Bdisp_WriteGraph_VRAM(const DISPGRAPH *WriteGraph);
void Bdisp_WriteGraph_DDVRAM(const DISPGRAPH *WriteGraph);
void Bdisp_ReadArea_DD(const DISPBOX *ReadArea, unsigned char *ReadData);
void Bdisp_ReadArea_VRAM(const DISPBOX *ReadArea, unsigned char *ReadData);
void Bdisp_DrawLineVRAM(int x1, int y1, int x2, int y2);
void Bdisp_ClearLineVRAM(int x1, int y1, int x2, int y2);
void locate(int x, int y);
void Print(const unsigned char *str);
void PrintRev(const unsigned char *str);
void PrintC(const unsigned char *c);
void PrintRevC(const unsigned char *str);
void PrintLine(const unsigned char *str, int max);
void PrintRLine(const unsigned char *str, int max);
void PrintXY(int x, int y, const unsigned char *str, int type);
int PrintMini(int x, int y, const unsigned char *str, int type);
void SaveDisp(unsigned char num);
void RestoreDisp(unsigned char num);
void PopUpWin(int n);
int Bfile_OpenFile(const FONTCHARACTER *filename, int mode);
int Bfile_OpenMainMemory(const unsigned char *name);
int Bfile_ReadFile(int HANDLE, void *buf, int size, int readpos);
int Bfile_WriteFile(int HANDLE, const void *buf, int size);
int Bfile_SeekFile(int HANDLE, int pos);
int Bfile_CloseFile(int HANDLE);
int Bfile_GetMediaFree(enum DEVICE_TYPE devicetype, int *freebytes);
int Bfile_GetFileSize(int HANDLE);
int Bfile_CreateFile(const FONTCHARACTER *filename, int size);
int Bfile_CreateDirectory(const FONTCHARACTER *pathname);
int Bfile_CreateMainMemory(const unsigned char *name);
int Bfile_RenameMainMemory(const unsigned char *oldname, const unsigned char *newname);
int Bfile_DeleteFile(const FONTCHARACTER *filename);
int Bfile_DeleteDirectory(const FONTCHARACTER *pathname);
int Bfile_DeleteMainMemory(const unsigned char *name);
int Bfile_FindFirst(const FONTCHARACTER *pathname, int *FindHandle, FONTCHARACTER *foundfile, FILE_INFO *fileinfo);
int Bfile_FindNext(int FindHandle, FONTCHARACTER *foundfile, FILE_INFO *fileinfo);
int Bfile_FindClose(int FindHandle);
void Bkey_Set_RepeatTime(long FirstCount, long NextCount);
void Bkey_Get_RepeatTime(long *FirstCount, long *NextCount);
void Bkey_Set_RepeatTime_Default(void);
int GetKeyWait(int sel, int time, int menu, unsigned int *keycode);
int IsKeyDown(int keycode);
int IsKeyUp(int keycode);
int GetKey(unsigned int *keycode);
int SetTimer(int ID, int elapse, void (*hander)(void));
int KillTimer(int ID);
void Sleep(int millisecond);
void SetQuitHandler(void (*callback)(void));
int INIT_ADDIN_APPLICATION(int isAppli, unsigned short OptionNum);
# ifdef __cplusplus
}
# endif
#endif

94
include/libfx/dispbios.h Normal file
View File

@ -0,0 +1,94 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : dispbios.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __DISPBIOS_H__
#define __DISPBIOS_H__
// Defines
#define IM_VRAM_WIDTH 128
#define IM_VRAM_HEIGHT 64
#define IM_VRAM_SIZE 1024
#define IM_CHARACTERS_MAX_LINE 21
#define IM_BYTES_MAX_LINE (IM_CHARACTERS_MAX_LINE*2)
#define SAVEDISP_PAGE1 1
#define SAVEDISP_PAGE2 5
#define SAVEDISP_PAGE3 6
#define MINI_OVER 0x10
#define MINI_OR 0x11
#define MINI_REV 0x12
#define MINI_REVOR 0x13
#define IM_BIOS_DD_WIDTH IM_VRAM_WIDTH
#define IM_BIOS_DD_HEIGHT IM_VRAM_HEIGHT
#define WRITEKIND unsigned char
#define IMB_WRITEKIND_OVER 0x01
#define IMB_WRITEKIND_OR 0x02
#define IMB_WRITEKIND_AND 0x03
#define IMB_WRITEKIND_XOR 0x04
#define WRITEMODIFY unsigned char
#define IMB_WRITEMODIFY_NORMAL 0x01
#define IMB_WRITEMODIFY_REVERCE 0x02
#define IMB_WRITEMODIFY_MESH 0x03
#define AREAKIND unsigned char
#define IMB_AREAKIND_OVER 0x01
#define IMB_AREAKIND_MESH 0x02
#define IMB_AREAKIND_CLR 0x03
#define IMB_AREAKIND_REVERSE 0x04
#define EFFECTWIN unsigned char
#define IMB_EFFECTWIN_OK 0x01
#define IMB_EFFECTWIN_NG 0x02
#ifdef __cplusplus
extern "C" {
#endif
// Structs
typedef struct tag_DISPBOX{
int left;
int top;
int right;
int bottom;
} DISPBOX;
typedef struct tag_GRAPHDATA{
int width;
int height;
unsigned char *pBitmap;
} GRAPHDATA;
typedef struct tag_RECTANGLE{
DISPBOX LineArea;
AREAKIND AreaKind;
EFFECTWIN EffectWin;
} RECTANGLE;
typedef struct tag_DISPGRAPH{
int x;
int y;
GRAPHDATA GraphData;
WRITEMODIFY WriteModify;
WRITEKIND WriteKind;
} DISPGRAPH;
# ifdef __cplusplus
}
# endif
#endif

22
include/libfx/endian.h Normal file
View File

@ -0,0 +1,22 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : endian.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __ENDIAN_H__
#define __ENDIAN_H__
// Macros
#define UtlSwapWord(w) (unsigned short)((((w) & 0x00ff) << 8) | (((w) & 0xff00) >> 8))
#define UtlSwapDword(l) (unsigned long)((((l) & 0x000000ff) << 24) | (((l) & 0x0000ff00) << 8) | (((l) & 0xff000000) >> 24) | (((l) & 0x00ff0000) >> 8))
#define UtlSwapInteger(i) UtlSwapDword(i)
#define UtlSwapPointer(p) (void*)((((unsigned long)(p) & 0x000000ff) << 24) | (((unsigned long)(p) & 0x0000ff00) << 8) | (((unsigned long)(p) & 0xff000000) >> 24) | (((unsigned long)(p) & 0x00ff0000) >> 8))
#endif

113
include/libfx/filebios.h Normal file
View File

@ -0,0 +1,113 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : filebios.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __FILEBIOS_H__
#define __FILEBIOS_H__
#ifdef __cplusplus
extern "C" {
#endif
// Defines
#define FONTCHARACTER unsigned short
#define _OPENMODE_READ 0x01
#define _OPENMODE_READ_SHARE 0x80
#define _OPENMODE_WRITE 0x02
#define _OPENMODE_READWRITE 0x03
#define _OPENMODE_READWRITE_SHARE 0x83
#define _CREATEMODE_BINARY 1
#define _CREATEMODE_DIRECTORY 5
enum DEVICE_TYPE{
DEVICE_MAIN_MEMORY,
DEVICE_STORAGE,
DEVICE_SD_CARD, // only fx-9860G SD model
};
// File system standard error code
#define IML_FILEERR_NOERROR 0
#define IML_FILEERR_ENTRYNOTFOUND -1
#define IML_FILEERR_ILLEGALPARAM -2
#define IML_FILEERR_ILLEGALPATH -3
#define IML_FILEERR_DEVICEFULL -4
#define IML_FILEERR_ILLEGALDEVICE -5
#define IML_FILEERR_ILLEGALFILESYS -6
#define IML_FILEERR_ILLEGALSYSTEM -7
#define IML_FILEERR_ACCESSDENYED -8
#define IML_FILEERR_ALREADYLOCKED -9
#define IML_FILEERR_ILLEGALTASKID -10
#define IML_FILEERR_PERMISSIONERROR -11
#define IML_FILEERR_ENTRYFULL -12
#define IML_FILEERR_ALREADYEXISTENTRY -13
#define IML_FILEERR_READONLYFILE -14
#define IML_FILEERR_ILLEGALFILTER -15
#define IML_FILEERR_ENUMRATEEND -16
#define IML_FILEERR_DEVICECHANGED -17
//#define IML_FILEERR_NOTRECORDFILE -18 // Not used
#define IML_FILEERR_ILLEGALSEEKPOS -19
#define IML_FILEERR_ILLEGALBLOCKFILE -20
//#define IML_FILEERR_DEVICENOTEXIST -21 // Not used
//#define IML_FILEERR_ENDOFFILE -22 // Not used
#define IML_FILEERR_NOTMOUNTDEVICE -23
#define IML_FILEERR_NOTUNMOUNTDEVICE -24
#define IML_FILEERR_CANNOTLOCKSYSTEM -25
#define IML_FILEERR_RECORDNOTFOUND -26
//#define IML_FILEERR_NOTDUALRECORDFILE -27 // Not used
#define IML_FILEERR_NOTALARMSUPPORT -28
#define IML_FILEERR_CANNOTADDALARM -29
#define IML_FILEERR_FILEFINDUSED -30
#define IML_FILEERR_DEVICEERROR -31
#define IML_FILEERR_SYSTEMNOTLOCKED -32
#define IML_FILEERR_DEVICENOTFOUND -33
#define IML_FILEERR_FILETYPEMISMATCH -34
#define IML_FILEERR_NOTEMPTY -35
#define IML_FILEERR_BROKENSYSTEMDATA -36
#define IML_FILEERR_MEDIANOTREADY -37
#define IML_FILEERR_TOOMANYALARMITEM -38
#define IML_FILEERR_SAMEALARMEXIST -39
#define IML_FILEERR_ACCESSSWAPAREA -40
#define IML_FILEERR_MULTIMEDIACARD -41
#define IML_FILEERR_COPYPROTECTION -42
#define IML_FILEERR_ILLEGALFILEDATA -43
// FILE_INFO.type
#define DT_DIRECTORY 0x0000 // Directory
#define DT_FILE 0x0001 // File
#define DT_ADDIN_APP 0x0002 // Add-In application
#define DT_EACT 0x0003 // eActivity
#define DT_LANGUAGE 0x0004 // Language
#define DT_BITMAP 0x0005 // Bitmap
#define DT_MAINMEM 0x0006 // Main Memory data
#define DT_TEMP 0x0007 // Temporary data
#define DT_DOT 0x0008 // . (Current directory)
#define DT_DOTDOT 0x0009 // .. (Parent directory)
#define DT_VOLUME 0x000A // Volume label
// Structs
typedef struct tag_FILE_INFO
{
unsigned short id;
unsigned short type;
unsigned long fsize; // File size
unsigned long dsize; // Data size
unsigned int property; // The file has not been completed, except when property is 0.
unsigned long address;
} FILE_INFO;
# ifdef __cplusplus
}
# endif
#endif

155
include/libfx/keybios.h Normal file
View File

@ -0,0 +1,155 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : keybios.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __KEYBIOS_H__
#define __KEYBIOS_H__
#ifdef __cplusplus
extern "C" {
#endif
// Defines
// Character codes
#define KEY_CHAR_0 0x30
#define KEY_CHAR_1 0x31
#define KEY_CHAR_2 0x32
#define KEY_CHAR_3 0x33
#define KEY_CHAR_4 0x34
#define KEY_CHAR_5 0x35
#define KEY_CHAR_6 0x36
#define KEY_CHAR_7 0x37
#define KEY_CHAR_8 0x38
#define KEY_CHAR_9 0x39
#define KEY_CHAR_DP 0x2e
#define KEY_CHAR_EXP 0x0f
#define KEY_CHAR_PMINUS 0x87
#define KEY_CHAR_PLUS 0x89
#define KEY_CHAR_MINUS 0x99
#define KEY_CHAR_MULT 0xa9
#define KEY_CHAR_DIV 0xb9
#define KEY_CHAR_FRAC 0xbb
#define KEY_CHAR_LPAR 0x28
#define KEY_CHAR_RPAR 0x29
#define KEY_CHAR_COMMA 0x2c
#define KEY_CHAR_STORE 0x0e
#define KEY_CHAR_LOG 0x95
#define KEY_CHAR_LN 0x85
#define KEY_CHAR_SIN 0x81
#define KEY_CHAR_COS 0x82
#define KEY_CHAR_TAN 0x83
#define KEY_CHAR_SQUARE 0x8b
#define KEY_CHAR_POW 0xa8
#define KEY_CHAR_IMGNRY 0x7f50
#define KEY_CHAR_LIST 0x7f51
#define KEY_CHAR_MAT 0x7f40
#define KEY_CHAR_EQUAL 0x3d
#define KEY_CHAR_PI 0xd0
#define KEY_CHAR_ANS 0xc0
#define KEY_CHAR_LBRCKT 0x5b
#define KEY_CHAR_RBRCKT 0x5d
#define KEY_CHAR_LBRACE 0x7b
#define KEY_CHAR_RBRACE 0x7d
#define KEY_CHAR_CR 0x0d
#define KEY_CHAR_CUBEROOT 0x96
#define KEY_CHAR_RECIP 0x9b
#define KEY_CHAR_ANGLE 0x7f54
#define KEY_CHAR_EXPN10 0xb5
#define KEY_CHAR_EXPN 0xa5
#define KEY_CHAR_ASIN 0x91
#define KEY_CHAR_ACOS 0x92
#define KEY_CHAR_ATAN 0x93
#define KEY_CHAR_ROOT 0x86
#define KEY_CHAR_POWROOT 0xb8
#define KEY_CHAR_SPACE 0x20
#define KEY_CHAR_DQUATE 0x22
#define KEY_CHAR_VALR 0xcd
#define KEY_CHAR_THETA 0xce
#define KEY_CHAR_A 0x41
#define KEY_CHAR_B 0x42
#define KEY_CHAR_C 0x43
#define KEY_CHAR_D 0x44
#define KEY_CHAR_E 0x45
#define KEY_CHAR_F 0x46
#define KEY_CHAR_G 0x47
#define KEY_CHAR_H 0x48
#define KEY_CHAR_I 0x49
#define KEY_CHAR_J 0x4a
#define KEY_CHAR_K 0x4b
#define KEY_CHAR_L 0x4c
#define KEY_CHAR_M 0x4d
#define KEY_CHAR_N 0x4e
#define KEY_CHAR_O 0x4f
#define KEY_CHAR_P 0x50
#define KEY_CHAR_Q 0x51
#define KEY_CHAR_R 0x52
#define KEY_CHAR_S 0x53
#define KEY_CHAR_T 0x54
#define KEY_CHAR_U 0x55
#define KEY_CHAR_V 0x56
#define KEY_CHAR_W 0x57
#define KEY_CHAR_X 0x58
#define KEY_CHAR_Y 0x59
#define KEY_CHAR_Z 0x5a
// Control codes
#define KEY_CTRL_NOP 0
#define KEY_CTRL_EXE 30004
#define KEY_CTRL_DEL 30025
#define KEY_CTRL_AC 30015
#define KEY_CTRL_FD 30046
#define KEY_CTRL_XTT 30001
#define KEY_CTRL_EXIT 30002
#define KEY_CTRL_SHIFT 30006
#define KEY_CTRL_ALPHA 30007
#define KEY_CTRL_OPTN 30008
#define KEY_CTRL_VARS 30016
#define KEY_CTRL_UP 30018
#define KEY_CTRL_DOWN 30023
#define KEY_CTRL_LEFT 30020
#define KEY_CTRL_RIGHT 30021
#define KEY_CTRL_F1 30009
#define KEY_CTRL_F2 30010
#define KEY_CTRL_F3 30011
#define KEY_CTRL_F4 30012
#define KEY_CTRL_F5 30013
#define KEY_CTRL_F6 30014
#define KEY_CTRL_CATALOG 30100
#define KEY_CTRL_CAPTURE 30055
#define KEY_CTRL_CLIP 30050
#define KEY_CTRL_PASTE 30036
#define KEY_CTRL_INS 30033
#define KEY_CTRL_MIXEDFRAC 30054
#define KEY_CTRL_FRACCNVRT 30026
#define KEY_CTRL_QUIT 30029
#define KEY_CTRL_PRGM 30028
#define KEY_CTRL_SETUP 30037
#define KEY_CTRL_PAGEUP 30052
#define KEY_CTRL_PAGEDOWN 30053
#define KEY_CTRL_MENU 30003
#define KEY_CTRL_RESERVE1 30060
#define KEY_CTRL_RESERVE2 30061
#define KEY_CTRL_RESERVE3 30062
// in Bkey_GetKeyWait function
#define KEYWAIT_HALTON_TIMEROFF 0
#define KEYWAIT_HALTOFF_TIMEROFF 1
#define KEYWAIT_HALTON_TIMERON 2
#define KEYREP_NOEVENT 0
#define KEYREP_KEYEVENT 1
#define KEYREP_TIMEREVENT 2
# ifdef __cplusplus
}
# endif
#endif

23
include/libfx/timer.h Normal file
View File

@ -0,0 +1,23 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : timer.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __TIMER_H__
#define __TIMER_H__
// Defines
#define ID_USER_TIMER1 1
#define ID_USER_TIMER2 2
#define ID_USER_TIMER3 3
#define ID_USER_TIMER4 4
#define ID_USER_TIMER5 5
#endif

35
include/limits.h Normal file
View File

@ -0,0 +1,35 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = limits.h : */
/* */
/* FUNC = this module do the following functions */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _LIMITS
#define _LIMITS
#define CHAR_BIT 8
#define CHAR_MAX 127
#define CHAR_MIN (-128)
#define SCHAR_MAX 127
#define SCHAR_MIN (-128)
#define UCHAR_MAX 255
#define SHRT_MAX 32767
#define SHRT_MIN (-32768)
#define USHRT_MAX 65535
#define INT_MAX 2147483647
#define INT_MIN (-2147483647-1)
#define UINT_MAX 4294967295u
#define LONG_MAX 2147483647
#define LONG_MIN (-2147483647L-1L)
#define ULONG_MAX 4294967295u
#endif

23
include/machine.h Normal file
View File

@ -0,0 +1,23 @@
/*------------------------------------------------------*/
/* SH C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = machine.h : */
/* FUNC = */
/* ; */
/* */
/* */
/* */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _MACHINE
#define _MACHINE
#include <smachine.h>
#include <umachine.h>
#endif

111
include/math.h Normal file
View File

@ -0,0 +1,111 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = math : */
/* FUNC = */
/* ; */
/* */
/* */
/* */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _MATH
#define _MATH
#ifdef __cplusplus
#include <builtin.h>
#endif
#ifndef ERANGE
#define ERANGE 1100
#endif
#ifndef EDOM
#define EDOM 1101
#endif
#ifndef ENUM
#define ENUM 1208
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern volatile int _errno;
extern const double _HUGE_VAL;
#define HUGE_VAL _HUGE_VAL
extern double frexp(double, int *);
extern double ldexp(double, int );
extern double modf(double, double *);
extern double ceil(double);
#ifdef _SH4
#ifdef _FPS
#define fabs _builtin_fabsf
#else
#define fabs _builtin_fabs
#endif
#else
#if defined(_SH2E)|defined(_SH3E)
#ifdef _FLT
#define fabs _builtin_fabsf
#else
extern double fabs(double);
#endif
#else
extern double fabs(double);
#endif
#endif
extern double floor(double);
extern double fmod(double, double);
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double,double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double tanh(double);
extern double sinh(double);
extern double exp(double);
extern double log(double);
extern double log10(double);
extern double pow(double,double);
#ifdef _COMPLEX_
extern double sqrt(double);
#else
#ifdef _SH4
#ifdef _FPS
#define sqrt _builtin_sqrtf
#else
#define sqrt _builtin_sqrt
#endif
#else
#ifdef _SH3E
#ifdef _FLT
#define sqrt _builtin_sqrtf
#else
extern double sqrt(double);
#endif
#else
extern double sqrt(double);
#endif
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif

66
include/mathf.h Normal file
View File

@ -0,0 +1,66 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.1 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = mathf */
/* FUNC = */
/* ; */
/* */
/* */
/* */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _MATHF
#define _MATHF
#ifdef __cplusplus
extern "C" {
#include <builtin.h>
#endif
extern float frexpf(float, int *);
extern float ldexpf(float, int);
extern float modff(float, float *);
extern float ceilf(float);
#if defined(_SH2E)|defined(_SH3E)|defined(_SH4)
#ifdef _FPD
#define fabsf _builtin_fabs
#else
#define fabsf _builtin_fabsf
#endif
#else
extern float fabsf(float);
#endif
extern float floorf(float);
extern float fmodf(float, float);
extern float acosf(float);
extern float asinf(float);
extern float atanf(float);
extern float atan2f(float,float);
extern float cosf(float);
extern float sinf(float);
extern float tanf(float);
extern float coshf(float);
extern float tanhf(float);
extern float sinhf(float);
extern float expf(float);
extern float logf(float);
extern float log10f(float);
extern float powf(float,float);
#if defined(_SH3E)|defined(_SH4)
#ifdef _FPD
#define sqrtf _builtin_sqrt
#else
#define sqrtf _builtin_sqrtf
#endif
#else
extern float sqrtf(float);
#endif
#ifdef __cplusplus
}
#endif
#endif

53
include/mystrbuf Normal file
View File

@ -0,0 +1,53 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//
// Embeded C++ Library <mystrbuf>
//
//====================================================================
// File: mystrbuf
// Purpose: Definition of class mystrbuf
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _MYSTRBUF_
#define _MYSTRBUF_
#ifdef _EC2P_GPP
#define _bufbase _base
#define _bufptr _ptr
#define _bufcnt _cnt
// #define _buflen _bufsiz
#define _ioflag1 _flag
#endif
#include <streambuf>
struct _f_type;
class mystrbuf : public streambuf {
public:
mystrbuf(){_file_Ptr = 0;}
mystrbuf(void *_fp){_Init((_f_type*)_fp);}
virtual ~mystrbuf(){close();}
void *myfptr() const{return _file_Ptr;}
mystrbuf *open(const char *, int);
mystrbuf *close();
protected:
virtual streambuf *setbuf(char *, streamsize);
virtual pos_type seekoff(off_type, ios_base::seekdir,
ios_base::openmode=(ios_base::openmode)(ios_base::in|ios_base::out));
virtual pos_type seekpos(pos_type sp,
ios_base::openmode=(ios_base::openmode)(ios_base::in|ios_base::out));
virtual int sync();
virtual int showmanyc(){return 0;}
virtual int_type underflow();
virtual int_type pbackfail(int_type=streambuf::eof);
virtual int_type overflow(int_type=streambuf::eof);
private:
void _Init(_f_type *);
_f_type *_file_Ptr;
#ifdef _EC2P_GPP
long _buflen_wk;
#endif
};
#endif

31
include/new Normal file
View File

@ -0,0 +1,31 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 6.0 */
/* Copyright (c) 1992, 2000 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = new : */
/* */
/* FUNC = Include file for C++ default operator new . */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef __NEW__
#define __NEW__
#ifdef __embedded_cplusplus
#include <new_ecpp.h> // include Embeded C++ Library Header
#else
#include <new_edg.h> // include ANSI C++ Library Header
#endif /* ifdef __embedded_cplusplus */
#endif /* ifndef __NEW__ */

41
include/new_ecpp.h Normal file
View File

@ -0,0 +1,41 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//
// Dynamic memory management
// Embeded C++ Library Header <new>
//
//====================================================================
// File: new
// Purpose: Definition of class new
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _NEW_
#define _NEW_
#include <stdlib.h>
// Storage allocation and deallocation
void *operator new(size_t);
void *operator new[] (size_t);
void *operator new(size_t,void *);
void *operator new[](size_t,void *);
void operator delete(void *);
void operator delete[](void *);
// void operator delete(void *, void *); // Not implemented
// void operator delete[](void *, void *); // Not implemented
// Type new_handler
typedef void (*new_handler)();
// set_new_handler
new_handler set_new_handler(new_handler new_P);
// new_handler
extern new_handler _ec2p_new_handler;
#endif

122
include/new_edg.h Normal file
View File

@ -0,0 +1,122 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 6.0 */
/* Copyright (c) 1992, 2000 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = new_edg.h : */
/* */
/* FUNC = Include file for C++ default operator new . */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef __NEW_H
#define __NEW_H
#ifndef _STDDEF
#include <stddef.h>
#endif /* ifndef _STDDEF */
#ifndef _EXCEPTION_H
#include <exception.h>
#endif /* _EXCEPTION_H */
#ifndef __EDG_STD_NAMESPACE
/* If not already defined, define a macro that expands to the namespace
containing the standard library. */
#ifdef __EDG_RUNTIME_USES_NAMESPACES
#define __EDG_STD_NAMESPACE std
#else /* ifndef __EDG_RUNTIME_USES_NAMESPACES */
#define __EDG_STD_NAMESPACE /* nothing */
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
#endif /* ifdef __EDG_STD_NAMESPACE */
#ifdef __EDG_RUNTIME_USES_NAMESPACES
namespace std {
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
/* This lets users disable the EDG supplied exception classes. */
#ifndef __NO_EDG_EXCEPTION_CLASSES
class bad_alloc : public exception {
public:
bad_alloc() throw();
bad_alloc(const bad_alloc&) throw();
bad_alloc& operator=(const bad_alloc&) throw();
virtual ~bad_alloc() throw();
virtual const char* what() const throw();
};
#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */
typedef void (*new_handler)();
new_handler set_new_handler(new_handler);
struct nothrow_t { };
// Declaration of object nothrow to permit the use of the placement new
// syntax: new (nothrow) T;
const nothrow_t nothrow = {};
#ifdef __EDG_RUNTIME_USES_NAMESPACES
} /* namespace std */
#ifdef __EDG_IMPLICIT_USING_STD
/* Implicitly include a using directive for the STD namespace when this
preprocessing flag is TRUE. */
using namespace std;
#endif /* ifdef __EDG_IMPLICIT_USING_STD */
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
/* Normal operator new. */
void *operator new(size_t) throw(__EDG_STD_NAMESPACE::bad_alloc);
/* Normal operator delete. */
void operator delete(void*) throw ();
/* Nothrow version of operator new. */
void *operator new(size_t, const __EDG_STD_NAMESPACE::nothrow_t&) throw();
/* Nothrow version of operator delete. */
void operator delete(void*, const __EDG_STD_NAMESPACE::nothrow_t&) throw();
/* Placement new. */
void *operator new(size_t, void*) throw();
/* Placement delete. */
#ifdef __PLACEMENT_DELETE
void operator delete(void*, void*) throw();
#endif /* ifdef __PLACEMENT_DELETE */
#ifdef __ARRAY_OPERATORS
/* Array new. */
void *operator new[](size_t) throw(__EDG_STD_NAMESPACE::bad_alloc);
/* Array delete. */
void operator delete[](void*) throw ();
/* Placement array new. */
void *operator new[](size_t, void*) throw();
/* Placement array delete. */
#ifdef __PLACEMENT_DELETE
void operator delete[](void*, void*) throw();
#endif /* ifdef __PLACEMENT_DELETE */
/* Nothrow version of array new. */
void *operator new[](size_t,
const __EDG_STD_NAMESPACE::nothrow_t&) throw();
/* Nothrow version of array delete. */
void operator delete[](void*,
const __EDG_STD_NAMESPACE::nothrow_t&) throw();
#endif /* __ARRAY_OPERATORS */
// EC++ use new_handler
extern __EDG_STD_NAMESPACE::new_handler _ec2p_new_handler;
#endif /* ifndef __NEW_H */

87
include/ostream Normal file
View File

@ -0,0 +1,87 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//====================================================================
// File: ostream
// Purpose: Definition of class ostream
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _OSTREAM_
#define _OSTREAM_
#include <streambuf>
class ostream : public ios {
public:
// Types (inherited from ios):
// typedef INT_T int_type;
// typedef POS_T pos_type;
// typedef OFF_T off_type;
ostream(streambuf *sbptr) : ios(sbptr){}
virtual ~ostream(){}
class sentry; // Prefix/Suffix
ostream& operator <<(ostream& (*pf)(ostream&)){
return (*pf)(*this); }
ostream& operator <<(ios& (*pf)(ios&)){
(*pf)(*(ios*)this); return *this; }
ostream& operator<< (ios_base& (*pf)(ios_base&)){
(*pf)(*(ios*)this); return *this; }
ostream & operator <<(bool n){
*this<<(int)n; return *this; }
ostream & operator <<(short);
ostream & operator <<(unsigned short);
ostream & operator <<(int);
ostream & operator <<(unsigned int);
ostream & operator <<(long);
ostream & operator <<(unsigned long);
ostream & operator <<(float);
ostream & operator <<(double);
ostream & operator <<(long double);
ostream & operator <<(void *);
ostream & operator <<(streambuf *);
ostream & put(char);
ostream & write(const char *, streamsize);
ostream & write(const signed char *, streamsize);
ostream & write(const unsigned char *, streamsize);
ostream & flush();
pos_type tellp();
ostream& seekp( pos_type );
ostream& seekp( off_type , ios_base::seekdir );
int _ec2p_strput(const char*);
private:
void _ec2p_IntPrint(const char*, short);
void _ec2p_FloatPrint(const char*, short);
void _ec2p_DataPut(const char*, int, int, int, int);
void _ec2p_int_fmtparam(const char*, char*);
void _ec2p_flt_fmtparam(const char*, char*);
};
// Class ostream::sentry
class ostream::sentry {
public:
sentry(ostream& os);
~sentry();
operator bool() { return ok_; }
private:
bool ok_;
ostream* __ec2p_os;
};
// character inserters
ostream& operator<<(ostream&, char);
ostream& operator<<(ostream&, const char*);
// signed and unsigned
ostream& operator<<(ostream&, signed char);
ostream& operator<<(ostream&, unsigned char);
// signed and unsigned
ostream& operator<<(ostream&, const signed char*);
ostream& operator<<(ostream&, const unsigned char*);
ostream & endl( ostream & );
ostream & ends( ostream & );
ostream & flush( ostream & );
#endif

48
include/setjmp.h Normal file
View File

@ -0,0 +1,48 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = setjmp.h : ; */
/* */
/* FUNC = this module do the following functions ; */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _SETJMP
#define _SETJMP
#if defined(_SH2E)|defined(_SH3E)||defined(_SH4)
typedef int jmp_buf[38];
#else
typedef int jmp_buf[20];
#endif
#ifdef _SH4
typedef int jmp_buf_a[54];
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern int setjmp(jmp_buf);
extern void longjmp(jmp_buf, int);
#ifdef _SH4
extern int setjmp_a(jmp_buf);
extern void longjmp_a(jmp_buf, int);
#endif
extern volatile int _errno;
#ifdef __cplusplus
}
#endif
#ifndef SEQERR
#define SEQERR 1108
#endif
#endif

28
include/smachine.h Normal file
View File

@ -0,0 +1,28 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 3.0 */
/* Copyright (c) 1992,1995 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = smachine.h : */
/* FUNC = ; */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _SMACHINE
#define _SMACHINE
#ifdef __cplusplus
#include <builtin.h>
#endif
#define set_imask(mask) _builtin_set_imask(mask)
#define get_imask() _builtin_get_imask()
#define set_cr(cr) _builtin_set_cr(cr)
#define get_cr() _builtin_get_cr()
#define set_vbr(base) _builtin_set_vbr(base)
#define get_vbr() _builtin_get_vbr()
#define sleep() _builtin_sleep()
#endif

36
include/stdarg.h Normal file
View File

@ -0,0 +1,36 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = stdarg : */
/* FUNC = this module do the following finctions ; */
/* */
/* (1) initialize parameter pointer */
/* (2) set parameter pointer to next parameter */
/* */
/* */
/* END ; */
/*****************************************************************/
#ifndef _STDARG
#define _STDARG
typedef char *va_list ;
#define va_start(ap,param) (void)((ap)=(int)\
((char *) &(param)+sizeof(param))%4u?\
(char *) &(param)+sizeof(param)+(4u-(sizeof(param)%4u)):\
(char *) &(param)+sizeof(param))
#define va_arg(ap,type) (*((ap)=((int)((ap)+sizeof(type))%4u?\
(ap)+sizeof(type)+(4u-(sizeof(type)%4u)):\
(ap)+sizeof(type)),\
(type *)((int)((ap)-sizeof(type))%4u?\
(ap)-sizeof(type)-(4u-(sizeof(type)%4u)):\
(ap)-sizeof(type))))
#define va_end(ap)
#endif

46
include/stddef.h Normal file
View File

@ -0,0 +1,46 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = stddef : */
/* */
/* FUNC = this module do the following functions */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _STDDEF
#define _STDDEF
#ifndef _PTRDIFF_T
#define _PTRDIFF_T
typedef int ptrdiff_t;
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned long size_t;
#endif
#ifndef NULL
#ifdef __cplusplus
#define NULL (0)
#else
#define NULL ((void *)0)
#endif
#endif
#ifndef offsetof
#define offsetof(type,id) ((char *)(&(((type *)NULL)->id)) - \
(char *)((type *)NULL))
#endif
#ifndef errno
#define errno _errno
#endif
#endif

47
include/stdexcept.h Normal file
View File

@ -0,0 +1,47 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = stdexcept.h : */
/* */
/* FUNC = Include file for exception handling (see 19.1.1) */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _STDEXCEPT_H
#define _STDEXCEPT_H
/* This lets users disable the EDG supplied exception classes. */
#ifndef __NO_EDG_EXCEPTION_CLASSES
#ifdef __EDG_RUNTIME_USES_NAMESPACES
namespace std {
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
class exception {
public:
exception() throw();
exception& operator=(const exception&) throw();
virtual ~exception() throw();
virtual const char* what() const throw();
};
#ifdef __EDG_RUNTIME_USES_NAMESPACES
} /* namespace std */
#ifdef __EDG_IMPLICIT_USING_STD
/* Implicitly include a using directive for the STD namespace when this
preprocessing flag is TRUE. */
using namespace std;
#endif /* ifdef __EDG_IMPLICIT_USING_STD */
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */
#endif /* _STDEXCEPT_H */

146
include/stdio.h Normal file
View File

@ -0,0 +1,146 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = stdio : header file for standard I/O function ; */
/* */
/* FUNC = this header file do the following functions; */
/* (1) file entry table define; */
/* (2) I/O macro define; */
/* (3) symbol define; */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _STDIO
#define _STDIO
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#define _NFILE 20
#define SYS_OPEN 20
extern struct _iobuf {
unsigned char *_bufptr; /* buffer pointer */
long _bufcnt; /* buffer count */
unsigned char *_bufbase; /* buffer base pointer */
long _buflen; /* buffer length */
char _ioflag1; /* I/O control flag 1 */
char _ioflag2; /* I/O control flag 2 */
char _iofd;
} _iob[_NFILE];
extern volatile int _errno;
typedef struct _iobuf FILE; /* define FILE of file-stream */
/* define function of prototype */
extern int _fillbuf(FILE*);
extern int _flshbuf(int,FILE*);
extern void _putcsub(FILE*);
extern int fclose(FILE *);
extern int fflush(FILE *);
extern FILE *fopen(const char *, const char *);
extern FILE *freopen(const char *, const char *, FILE *);
extern void setbuf(FILE *, char *);
extern int setvbuf(FILE *, char *, int, size_t);
extern int fprintf(FILE *, const char *, ...);
extern int fscanf(FILE *, const char *, ...);
extern int printf(const char * ,...);
extern int scanf(const char * ,...);
extern int sprintf(char *, const char * ,...);
extern int sscanf(const char *, const char * ,...);
extern int vfprintf(FILE *, const char *, char *);
extern int vprintf(const char *, char *);
extern int vsprintf(char *, const char *, char *);
extern int fgetc(FILE *);
extern char *fgets(char *, int, FILE *);
extern int fputc(int , FILE *);
extern int fputs(const char *, FILE *);
extern int getc(FILE *);
extern int getchar(void);
extern char *gets(char *);
extern int putc(int, FILE *);
extern int putchar(int);
extern int puts(const char *);
extern int ungetc(int, FILE *);
extern size_t fread(void *, size_t, size_t, FILE *);
extern size_t fwrite(const void *, size_t, size_t, FILE *);
extern int fseek(FILE *, long int, int);
extern long ftell(FILE *);
extern void rewind(FILE *);
extern void clearerr(FILE *);
extern int feof(FILE *);
extern int ferror(FILE *);
extern void perror(const char *);
#ifdef __cplusplus
}
#endif
#define _IOFBF 1 /* define _IOFBF of full buffering */
#define _IOLBF 2 /* define _IOLBF of line buffering */
#define _IONBF 3 /* define _IONBF of non buffering */
#define SEEK_SET 0 /* allocate top position */
#define SEEK_CUR 1 /* allocate current position */
#define SEEK_END 2 /* allocate bottom position */
#define BUFSIZ 512 /* default buffer size */
/* error number define */
#ifndef EBADF
#define EBADF 1302 /* I/O operation error */
#endif
#ifndef PTRERR
#define PTRERR 1106 /* fp null */
#endif
#ifndef ECSPEC
#define ECSPEC 1304 /* format err */
#endif
#ifndef NOTOPN
#define NOTOPN 1300 /* file not open */
#endif
/* I/O flags for _ioflag1 */
#define _IOREAD 1 /* only read or update read */
#define _IOWRITE 2 /* only write or update write */
#define _IORW 4 /* update file */
#define _IOUNBUF 8 /* unbffering I/O */
#define _IOBGBUF 16 /* automatic buffer allocate */
#define _IOEOF 32 /* end of file */
#define _IOERR 64 /* I/O error */
#define _IOBIN 128 /* binaly file */
#define _UNGTC 1 /* ungetc issued (_ioflag2) */
#define _IOLINBUF 2 /* line buffering */
#define EOF (-1)
#define _EOL (0X0A) /* end of line */
#define stdin (&_iob[0]) /* standard input file */
#define stdout (&_iob[1]) /* standard output file */
#define stderr (&_iob[2]) /* standard error output file */
#define getc(fp) ((fp)->_ioflag2&=~_UNGTC,(((fp)->_ioflag1&(_IORW|_IOWRITE))==\
(_IORW|_IOWRITE))&&(fp)->_bufcnt==(fp)->_buflen?(_fillbuf(fp)):\
--(fp)->_bufcnt>=0 ?((int)*(fp)->_bufptr++):_fillbuf(fp))
#define putc(x,fp) (((((fp)->_ioflag1&_IORW)!=0&&((fp)->_ioflag1&_IOWRITE)==0)\
?_putcsub(fp):(void)0),((((fp)->_bufcnt==0)||((((fp)->_ioflag2&_IOLINBUF)!=0)\
&& ((fp)->_bufbase!=(fp)->_bufptr)&&(*((fp)->_bufptr-1)==_EOL)))\
?_flshbuf((int)(x),(fp)):\
(((fp)->_bufcnt--),((int)(*(fp)->_bufptr++=(unsigned char)(x))))))
#define getchar() getc(stdin)
#define putchar(x) putc(x,stdout)
#define feof(fp) ((fp)->_ioflag1&_IOEOF)
#define ferror(fp) ((fp)->_ioflag1&_IOERR)
#define clearerr(fp) ((void)((fp)->_ioflag1&=~(_IOEOF|_IOERR)))
#endif

127
include/stdlib.h Normal file
View File

@ -0,0 +1,127 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = stdlib : */
/* FUNC = */
/* ; */
/* */
/* */
/* */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _STDLIB
#define _STDLIB
#include <stddef.h>
struct _DIV_T_TAG { /* tag define for div_t */
int quot; /* quotient */
int rem; /* remainder */
}; /* */
struct _LDIV_T_TAG { /* tag define for ldiv_t */
long quot; /* quotient */
long rem; /* remainder */
}; /* */
typedef struct _DIV_T_TAG div_t ;
/* int quot; int rem */
typedef struct _LDIV_T_TAG ldiv_t ;
/* long quot; long rem; */
#ifndef RAND_MAX
#define RAND_MAX 32767
#endif
#ifndef ERANGE
#define ERANGE 1100
#endif
#ifndef EDOM
#define EDOM 1101
#endif
#ifndef EDIV
#define EDIV 1102
#endif
#ifndef ESTRN
#define ESTRN 1104
#endif
#ifndef ECBASE
#define ECBASE 1200
#endif
#ifndef ETLN
#define ETLN 1202
#endif
#ifndef EEXP
#define EEXP 1204
#endif
#ifndef EEXPN
#define EEXPN 1206
#endif
#ifndef EFLOATO
#define EFLOATO 1210
#endif
#ifndef EFLOATU
#define EFLOATU 1220
#endif
#ifndef EDBLO
#define EDBLO 1250
#endif
#ifndef EDBLU
#define EDBLU 1260
#endif
#ifndef ELDBLO
#define ELDBLO 1270
#endif
#ifndef ELDBLU
#define ELDBLU 1280
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern volatile int _errno;
extern const double _HUGE_VAL;
#define HUGE_VAL _HUGE_VAL
extern double atof(const char *) ;
extern int atoi(const char *) ;
extern long int atol(const char *) ;
extern double strtod(const char *, char **) ;
extern long int strtol(const char *, char **, int);
extern int rand(void) ;
extern void srand(unsigned int);
extern void *calloc(size_t, size_t);
extern void free(void *) ;
extern void *malloc(size_t);
extern void *realloc(void *, size_t) ;
extern void *bsearch(const void *, const void *, size_t, size_t,
int(*)(const void*,const void*) ) ;
extern void qsort(void *, size_t, size_t,
int(*)(const void*,const void*) );
extern int abs(int);
extern div_t div(int, int);
extern long int labs(long int);
extern ldiv_t ldiv(long int, long int);
#ifdef __cplusplus
}
#endif
#endif

97
include/streambuf Normal file
View File

@ -0,0 +1,97 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//
// Embeded C++ Library <streambuf>
//
//====================================================================
// File: streambuf
// Purpose: Definition of class streambuf
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _STREAMBUF_
#define _STREAMBUF_
#include <ios>
class streambuf {
public:
virtual ~streambuf(){}
streambuf *pubsetbuf(char *cptr, streamsize nnum){
return setbuf(cptr, nnum);
}
pos_type pubseekoff(off_type off,ios_base::seekdir way,
ios_base::openmode which
=(ios_base::openmode)
(ios_base::in|ios_base::out)){
return seekoff(off, way, which);
}
pos_type pubseekpos(pos_type sp,
ios_base::openmode which
=(ios_base::openmode)
(ios_base::in|ios_base::out)){
return seekpos(sp, which);
}
int pubsync(){
return sync();
}
streamsize in_avail(){
return ((gptr()!=0)&&(gptr()<egptr()) ?
egptr()-gptr(): showmanyc());
}
int_type snextc() {return ((sbumpc()==eof) ? eof:sgetc());}
int_type sbumpc();
int_type sgetc();
int sgetn(char* cptr, streamsize nnum) {return xsgetn( cptr, nnum);}
int_type sputbackc(char);
int sungetc();
int sputc(char);
int_type sputn(const char *cptr, streamsize nnum)
{return xsputn( cptr, nnum);}
enum {eof=-1};
protected:
streambuf();
char *eback() const {return *B_beg_pptr;}
char *gptr() const {return *B_next_pptr;}
char *egptr() const {return (*B_next_pptr+(*_B_cnt_ptr));}
void gbump(int nptr);
void setg(char *gbeg, char *gnext, char *gend)
{*B_beg_pptr = gbeg;*B_next_pptr = gnext;B_end_ptr = gend;
*_B_cnt_ptr=gend-gnext;*_B_len_ptr=gend-gbeg;}
char *pbase() const {return *B_beg_pptr;}
char *pptr() const {return *B_next_pptr;}
char *epptr() const {return (*B_beg_pptr+(*_B_len_ptr));}
char *_ec2p_getflag() const { return ((char*)C_flg_ptr);}
void pbump(int nptr);
void setp(char *pbeg, char *pend)
{*B_beg_pptr = pbeg;*B_next_pptr = pbeg;B_end_ptr = pend;
*_B_cnt_ptr=pend-pbeg;*_B_len_ptr=pend-pbeg;}
virtual streambuf *setbuf(char *, streamsize){ return this; }
virtual pos_type seekoff(off_type, ios_base::seekdir,
ios_base::openmode=(ios_base::openmode)
(ios_base::in|ios_base::out)){ return -1; }
virtual pos_type seekpos(pos_type, ios_base::openmode=
(ios_base::openmode)(ios_base::in|ios_base::out)){
return -1; }
virtual int sync(){ return 0; }
virtual int showmanyc(){ return 0; }
virtual streamsize xsgetn(char *, streamsize);
virtual int_type underflow(){ return eof; }
virtual int_type uflow();
virtual int_type pbackfail(int_type=eof){ return eof; }
virtual streamsize xsputn(const char *, streamsize);
virtual int_type overflow(int_type=eof){ return eof; }
char *& _ec2p_gnptr(){ return (char *&)*B_next_pptr;}
char *& _ec2p_pnptr(){ return (char *&)*B_next_pptr;}
void _ec2p_bcntplus(){(*_B_cnt_ptr)++;}
void _ec2p_bcntminus(){(*_B_cnt_ptr)--;}
void _ec2p_setbPtr(char**, char**, long*, long*,char*);
private:
long *_B_cnt_ptr, *_B_len_ptr;
char *B_beg_ptr, *B_next_ptr, *B_end_ptr;
char **B_beg_pptr, **B_next_pptr;
char *C_flg_ptr;
};
#endif

213
include/string Normal file
View File

@ -0,0 +1,213 @@
//Embedded C++ Library
//Copyright (c) Hitachi,Ltd. 1997
//Licensed material of Hitachi,Ltd
//
// Strings library / String classes
// Embedded C++ Library Header <string>
//
//====================================================================
// File: string
// Purpose: Definition of class string
// Create: 1997.09.20 Rev. 1.0
//====================================================================
#ifndef _STRING_
#define _STRING_
#include <stdlib.h>
#include <string.h>
#include <istream>
#include <ostream>
#include <new>
class string;
string operator + (const string &lhs,const string &rhs);
string operator + (const char *lhs,const string &rhs);
string operator + (char lhs,const string &rhs);
string operator + (const string &lhs,const char *rhs);
string operator + (const string &lhs,char rhs);
bool operator == (const string &lhs,const string &rhs);
bool operator == (const char *lhs,const string &rhs);
bool operator == (const string &lhs,const char *rhs);
bool operator != (const string &lhs,const string &rhs);
bool operator != (const char *lhs,const string &rhs);
bool operator != (const string &lhs,const char *rhs);
bool operator < (const string &lhs,const string &rhs);
bool operator < (const char *lhs,const string &rhs);
bool operator < (const string &lhs,const char *rhs);
bool operator > (const string &lhs,const string &rhs);
bool operator > (const char *lhs,const string &rhs);
bool operator > (const string &lhs,const char *rhs);
bool operator <= (const string &lhs,const string &rhs);
bool operator <= (const char *lhs,const string &rhs);
bool operator <= (const string &lhs,const char *rhs);
bool operator >= (const string &lhs,const string &rhs);
bool operator >= (const char *lhs,const string &rhs);
bool operator >= (const string &lhs,const char *rhs);
void swap(string &lhs, string &rhs);
istream & operator >> (istream &is,string &str);
ostream & operator << (ostream &os,const string &str);
istream & getline (istream &is,string &str,char delim);
istream & getline (istream &is,string &str);
class string {
public:
typedef char* iterator;
typedef const char* const_iterator;
static const size_t npos;
string(void) {
_ec2p_getmem(NULL, 0, NULL, false);
}
string(const string& str, size_t pos = 0, size_t n = npos) {
size_t wkpos = pos > str.size() ? str.size() : pos;
size_t rlen = (n > (str.size() - wkpos)) ? str.size() - wkpos : n;
_ec2p_getmem(&str.c_str()[wkpos], rlen, NULL, false);
}
string(const char* s, size_t n) {
_ec2p_getmem(s, n, NULL, false);
}
string(const char* s) {
_ec2p_getmem(s, strlen(s), NULL, false);
}
string(size_t n, char c) {
_ec2p_getmem(NULL, n, c, true);
}
#ifdef _EC2P_GPP
string(char c) {
_ec2p_getmem(NULL, 1, c, true);
}
#endif
~string() {
if (s_ptr != NULL) {
delete [] s_ptr;
s_ptr = NULL;
}
}
string& operator=(const string& str);
string& operator=(const char* s);
string& operator=(char c);
iterator begin() { return((iterator)s_ptr); }
const_iterator begin() const { return((const_iterator)s_ptr); }
iterator end() { return((iterator)&s_ptr[s_len]); }
const_iterator end() const { return((const_iterator)&s_ptr[s_len]);}
size_t size() const { return(s_len); }
size_t length() const { return(s_len); }
size_t max_size() const { return(s_res); }
void resize(size_t n, char c);
void resize(size_t n);
size_t capacity() const { return(s_res); }
void reserve(size_t res_arg = 0);
void clear();
bool empty() const { return( s_len == 0 ? true : false ); }
const char & operator[](size_t pos) const;
char & operator[](size_t pos);
const char & at(size_t n) const;
char & at(size_t n);
string& operator+=(const string& str);
string& operator+=(const char* s);
string& operator+=(char c);
string& append(const string& str);
string& append(const string& str, size_t pos, size_t n);
string& append(const char* s, size_t n);
string& append(const char* s);
string& append(size_t n, char c);
string& assign(const string&);
string& assign(const string& str, size_t pos, size_t n);
string& assign(const char* s, size_t n);
string& assign(const char* s);
string& assign(size_t n, char c);
string& insert(size_t pos1, const string& str);
string& insert(size_t pos1, const string& str,
size_t pos2, size_t n);
string& insert(size_t pos, const char* s, size_t n);
string& insert(size_t pos, const char* s);
string& insert(size_t pos, size_t n, char c);
iterator insert(iterator p, char c = char());
void insert(iterator p, size_t n, char c);
string& erase(size_t pos = 0, size_t n = npos);
iterator erase(iterator position);
iterator erase(iterator first, iterator last);
string& replace(size_t pos1, size_t n1, const string& str);
string& replace(size_t pos1, size_t n1, const string& str,
size_t pos2, size_t n2);
string& replace(size_t pos, size_t n1, const char* s, size_t n2);
string& replace(size_t pos, size_t n1, const char* s);
string& replace(size_t pos, size_t n1, size_t n2, char c);
string& replace(iterator i1, iterator i2, const string& str);
string& replace(iterator i1, iterator i2, const char* s, size_t n);
string& replace(iterator i1, iterator i2, const char* s);
string& replace(iterator i1, iterator i2, size_t n, char c);
size_t copy(char* s, size_t n, size_t pos = 0) const;
void swap(string&);
const char* c_str() const { return(s_ptr); }
const char* data() const {
if (s_len == 0) {
s_ptr[0] = '\0';
}
return(s_ptr);
}
size_t find (const string& str, size_t pos = 0) const;
size_t find (const char* s, size_t pos, size_t n) const;
size_t find (const char* s, size_t pos = 0) const;
size_t find (char c, size_t pos = 0) const;
size_t rfind(const string& str, size_t pos = npos) const;
size_t rfind(const char* s, size_t pos, size_t n) const;
size_t rfind(const char* s, size_t pos = npos) const;
size_t rfind(char c, size_t pos = npos) const;
size_t find_first_of(const string& str, size_t pos = 0) const;
size_t find_first_of(const char* s, size_t pos, size_t n) const;
size_t find_first_of(const char* s, size_t pos = 0) const;
size_t find_first_of(char c, size_t pos = 0) const;
size_t find_last_of (const string& str, size_t pos = npos) const;
size_t find_last_of (const char* s, size_t pos, size_t n) const;
size_t find_last_of (const char* s, size_t pos = npos) const;
size_t find_last_of (char c, size_t pos = npos) const;
size_t find_first_not_of(const string& str, size_t pos = 0) const;
size_t find_first_not_of(const char* s, size_t pos, size_t n) const;
size_t find_first_not_of(const char* s, size_t pos = 0) const;
size_t find_first_not_of(char c, size_t pos = 0) const;
size_t find_last_not_of (const string& str, size_t pos = npos) const;
size_t find_last_not_of (const char* s, size_t pos, size_t n) const;
size_t find_last_not_of (const char* s, size_t pos = npos) const;
size_t find_last_not_of (char c, size_t pos = npos) const;
string substr(size_t pos = 0, size_t n = npos) const;
int compare(const string& str) const;
int compare(size_t pos1, size_t n1, const string& str) const;
int compare(size_t pos1, size_t n1, const string& str,
size_t pos2, size_t n2) const;
int compare(const char* s) const;
int compare(size_t pos1, size_t n1,
const char* s, size_t n2 = npos) const;
private:
char *s_ptr;
size_t s_len, s_res;
void _ec2p_getmem(const char *s, size_t n, char c, bool flg=false);
char *_ec2p_extmem(size_t n);
static const char _ec2p_at;
};
#endif

57
include/string.h Normal file
View File

@ -0,0 +1,57 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = string : */
/* FUNC = */
/* ; */
/* */
/* */
/* */
/* CLAS = UNIT ; */
/* LINK = */
/* NOTE = */
/* ; */
/* */
/* END ; */
/*****************************************************************/
#ifndef _STRING
#define _STRING
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#include <builtin.h>
#endif
extern void *memcpy(void *, const void *, size_t);
extern void *memmove(void *, const void *, size_t);
extern char *strcpy(char *, const char *);
extern char *strncpy(char *, const char *, size_t);
extern char *strcat(char *, const char *);
extern char *strncat(char *, const char *,size_t);
extern int memcmp(const void *, const void *,size_t);
extern int strcmp(const char *, const char *);
extern int strncmp(const char *, const char *, size_t);
extern void *memchr(const void *, int, size_t);
extern char *strchr(const char *, int);
extern size_t strcspn(const char *, const char *);
extern char *strpbrk(const char *, const char *);
extern char *strrchr(const char *, int);
extern size_t strspn(const char *, const char *);
extern char *strstr(const char *, const char *);
extern char *strtok(char *, const char *);
extern void *memset(void *, int, size_t);
extern char *strerror(int);
extern size_t strlen(const char *);
#ifdef __cplusplus
}
#endif
#define strcpy(s1,s2) _builtin_strcpy(s1,s2)
#define strcmp(s1,s2) _builtin_strcmp(s1,s2)
#endif

68
include/syscall.h Normal file
View File

@ -0,0 +1,68 @@
#ifndef _SYSCALL
#define _SYSCALL
/**********************************************************/
/** Les syscall suivants servent à l'acces au port série **/
/** Le buffer de réception fait 1ko, **/
/** et le buffer d'envoi fait 256 octets. **/
/**********************************************************/
//Lit un caractère du buffer de réception et le copie a l'adresse pointée par 'dest'
//Retourne 0 en cas de succes, 1 si le buffer est vide, 3 si la connexion n'est pas établie
int Serial_ReadByte(unsigned char *dest);
//Lit 'max' octets du buffer de réception et les écrit dans 'dest'
//'size' donne le nombre d'octets lu
//Retourne 0 en cas de succes, 1 si le buffer est vide, 3 si la connexion n'est pas établie
int Serial_ReadBytes(unsigned char *dest, int max, short *size);
//Ecrit 'byte' dans le buffer d'envoi
//Retourne 0
int Serial_WriteByte(unsigned char byte);
//Ecrit 'size' octets dans le buffer d'envoi depuis l'adresse 'scr'
//Retourne 0 en cas de succes, 2 si le buffer est trop plein, 3 si la connexion n'est pas établie
int Serial_WriteBytes(unsigned char *src, int size);
//FIFO = first in first out
int Serial_WriteByteFIFO(unsigned char byte);
//Retourne la taille des données du buffer de réception
int Serial_GetRxBufferSize(void);
//Retourne l'espace disponible dans le buffer d'envoi
int Serial_GetTxBufferFreeCapacity(void);
//Vide le buffer de réception
//Retourne 0 en cas de succes, 3 si la connexion n'est pas établie
int Serial_ClearReceiveBuffer(void);
//Vide le buffer d'envoi
//Retourne 0
int Serial_ClearTransmitBuffer(void);
//Ouvre et prépare l'interface de communication
//Pour plus de détails, consulter fxreverse-doc-1.pdf ci joint
int Serial_Open(unsigned char *conf);
//Ferme l'interface de communication et vide les buffers d'envoi et de réception
//Si 'mode'==1, la communication est coupée sans regarder s'il reste des données a transmettre
//Si 'mode'!=1, la fonction ne ferme pas l'interface de communication s'il reste des données a transmettre
//et retourne 5
//Retourne 0 en cas de succes (communication terminée) et 5 s'il reste des données a transmettre
int Serial_Close(int mode);
//Copie l'octet numéro 'index' du buffer de réception vers 'dest' si 'index' ne dépasse pas les données du buffer
//Retourne 0 en cas de succes, 1 si 'index' dépasse les données du buffer, 3 si la communication n'est pas établie
int Serial_Peek(int index, unsigned char *dest);
//Récupère le statut de la connexion
//Retourne 1 si la connexion est établie, 3 sinon
int Serial_IsOpen(void);
int Timer_Start(int TimerID);
int Timer_Stop(int TimerID);
int Timer_Install(int TimerID, void (*handler)(void), int delay);
int RTC_GetTicks();
#endif

82
include/typeinfo.h Normal file
View File

@ -0,0 +1,82 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 1.0 */
/* Copyright (c) 1992 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/***********************************************************************/
/* SPEC; */
/* NAME = typeinfo.h : */
/* */
/* FUNC = Include file for type information (18.5.1) */
/* */
/* CLAS = UNIT; */
/* */
/* END; */
/***********************************************************************/
#ifndef _TYPEINFO_H
#define _TYPEINFO_H
#include <stdexcept.h>
#ifdef __EDG_RUNTIME_USES_NAMESPACES
namespace std {
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
/*
If bool is not supported, use a typedef for bool.
*/
#ifdef _BOOL
typedef bool __bool;
#else /* ifndef _BOOL */
typedef int __bool;
#endif /* ifdef _BOOL */
/* The following pragma is used so that the compiler knows that this definition
of type_info is the one that corresponds to the type returned by typeid. */
#pragma define_type_info
class type_info {
public:
virtual ~type_info();
__bool operator==(const type_info&) const;
__bool operator!=(const type_info&) const;
__bool before(const type_info&) const;
const char* name() const;
private:
type_info& operator=(const type_info&); // Not actually defined
protected:
// Protected instead of private to suppress the "no accessible
// constructor" warning
type_info(const type_info&); // Not actually defined
};
class bad_cast : public exception {
public:
bad_cast() throw();
bad_cast(const bad_cast&) throw();
bad_cast& operator=(const bad_cast&) throw();
virtual ~bad_cast() throw();
virtual const char* what() const throw();
};
class bad_typeid : public exception {
public:
bad_typeid() throw();
bad_typeid(const bad_typeid&) throw();
bad_typeid& operator=(const bad_typeid&) throw();
virtual ~bad_typeid() throw();
virtual const char* what() const throw();
};
#ifdef __EDG_RUNTIME_USES_NAMESPACES
} /* namespace std */
#ifdef __EDG_IMPLICIT_USING_STD
/* Implicitly include a using directive for the STD namespace when this
preprocessing flag is TRUE. */
using namespace std;
#endif /* ifdef __EDG_IMPLICIT_USING_STD */
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
#endif /* _TYPEINFO_H */

55
include/umachine.h Normal file
View File

@ -0,0 +1,55 @@
/*------------------------------------------------------*/
/* SH SERIES C Compiler Ver. 3.0 */
/* Copyright (c) 1992, 1995 Hitachi,Ltd. */
/* Licensed material of Hitachi,Ltd. */
/*------------------------------------------------------*/
/*****************************************************************/
/* SPEC ; */
/* NAME = umachine.h : */
/* FUNC = ; */
/* CLAS = UNIT ; */
/* END ; */
/*****************************************************************/
#ifndef _UMACHINE
#define _UMACHINE
#ifdef __cplusplus
#include <builtin.h>
#endif
#define set_gbr(base) _builtin_set_gbr(base)
#define get_gbr() _builtin_get_gbr()
#define gbr_read_byte(offset) _builtin_gbr_read_byte(offset)
#define gbr_read_word(offset) _builtin_gbr_read_word(offset)
#define gbr_read_long(offset) _builtin_gbr_read_long(offset)
#define gbr_write_byte(offset,data) _builtin_gbr_write_byte(offset,data)
#define gbr_write_word(offset,data) _builtin_gbr_write_word(offset,data)
#define gbr_write_long(offset,data) _builtin_gbr_write_long(offset,data)
#define gbr_and_byte(offset,mask) _builtin_gbr_and_byte(offset,mask)
#define gbr_or_byte(offset,mask) _builtin_gbr_or_byte(offset,mask)
#define gbr_xor_byte(offset,mask) _builtin_gbr_xor_byte(offset,mask)
#define gbr_tst_byte(offset,mask) _builtin_gbr_tst_byte(offset,mask)
#define tas(addr) _builtin_tas(addr)
#define trapa(trap_no) _builtin_trapa(trap_no)
#define macw(ptr1, ptr2, count) _builtin_macw(ptr1, ptr2, count)
#define macwl(ptr1, ptr2, count, mask) _builtin_macwl(ptr1, ptr2, count, mask)
#define macl(ptr1, ptr2, count) _builtin_macl(ptr1, ptr2, count)
#define macll(ptr1, ptr2, count, mask) _builtin_macll(ptr1, ptr2, count, mask)
#define trapa_svc _builtin_trapa_svc
#define prefetch _builtin_prefetch
#define set_fpscr(cr) _builtin_set_fpscr(cr)
#define get_fpscr() _builtin_get_fpscr()
#define fipr(vec1, vec2) _builtin_fipr(vec1, vec2)
#define ftrv(vec1, vec2) _builtin_ftrv(vec1, vec2)
#define ftrvadd(vec1, vec2, vec3) _builtin_ftrvadd(vec1, vec2, vec3)
#define ftrvsub(vec1, vec2, vec3) _builtin_ftrvsub(vec1, vec2, vec3)
#define mtrx4mul(mx1, mx2) _builtin_mtrx4mul(mx1, mx2)
#define mtrx4muladd(mx1, mx2, mx3) _builtin_mtrx4muladd(mx1, mx2, mx3)
#define mtrx4mulsub(mx1, mx2, mx3) _builtin_mtrx4mulsub(mx1, mx2, mx3)
#define ld_ext(mx) _builtin_ld_ext(mx)
#define st_ext(mx) _builtin_st_ext(mx)
#define add4(vec1, vec2, vec3) _builtin_add4(vec1, vec2, vec3)
#define sub4(vec1, vec2, vec3) _builtin_sub4(vec1, vec2, vec3)
#define trace(tv) _builtin_trace(tv)
#endif

BIN
libfx.a Normal file

Binary file not shown.

BIN
libmonochrome.a Normal file

Binary file not shown.

1
opti Executable file
View File

@ -0,0 +1 @@
sh3eb-elf-objcopy -R .comment -R .bss -O binary addin.elf addin.bin

1
wrapper Executable file
View File

@ -0,0 +1 @@
g1a-wrapper addin.bin -o addin.g1a -i icon.bmp