This commit is contained in:
flo66 2017-01-07 21:07:10 +01:00
parent cbf4f4a7c1
commit 0f60e60428
27 changed files with 98 additions and 722 deletions

0
.gitignore vendored Normal file → Executable file
View File

BIN
0 Executable file

Binary file not shown.

0
LICENSE.md Normal file → Executable file
View File

8
Makefile Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/make -f
# INCLUDE CONFIGURATION
include $(CURDIR)/Makefile.cfg
include $(CURDIR)/Makefile.config
# DEDUCED VARS
ALLOBJ = $(SRC:%=$(OBJDIR)/%.o)
@ -20,7 +20,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.s
## Make an object file out of a C source file
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(ALLINC)
$(CC) -c -o $@ $< $(CFLAGS)
$(CC) -c -o $@ $< $(CFLAGS)
## Make the ELF file
$(NAME).elf: $(OBJDIR) $(ALLOBJ)
@ -28,7 +28,7 @@ $(NAME).elf: $(OBJDIR) $(ALLOBJ)
## Make the BIN file
$(NAME).bin: $(NAME).elf
$(OBJCPY) -R .comment -R .bss -R '$$iop' -O binary $< $@
$(OBJCPY) -R .comment -R .bss -R '$$iop' -O binary $< $@
## Make the G1A file
$(NAME).g1a: $(NAME).bin
@ -53,7 +53,7 @@ re: fclean all
send:
@if [ ! -f $(NAME).g1a ]; then \
echo "Please make before sending."; \
else $(SENDR) SEND $(NAME).g1a $(NAME).g1a fls0; \
else $(SENDR) send $(NAME).g1a \
fi
## Phuneral phuture ?
.PHONY: all clean fclean mrproper re send

0
Makefile.cfg Normal file → Executable file
View File

40
Makefile.config Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/make -f
# PROJECT INFORMATION
NAME = sound
ICON = ./icon.bmp
LIB = gcc
## DIRECTORIES
SRCDIR = ./src
INCDIR = ./include
OBJDIR = ./obj
LIBDIR = ./lib
SCPTDIR = ./scripts
# TOOLCHAIN
## Directory maker
MD = mkdir -p
## File remover
RM = rm -f
## Assembler
AS = sh3eb-elf-as
## C compiler
CC = sh3eb-elf-gcc
CFLAGS = -m3 -mb -Os -nostdlib -Wall -Wextra -Wno-main -pedantic -std=c11 -I $(INCDIR) `fxsdk --cflags`
## Linker
LD = sh3eb-elf-gcc
LFLAGS = -nostdlib -T $(SCPTDIR)/addin.ld -L $(LIBDIR) $(addprefix -l,$(LIB)) `fxsdk --cflags` `fxsdk --libs`
## Object copier
OBJCPY = sh3eb-elf-objcopy
## G1A Wrapper
WRAPR = g1a-wrapper
## Sender
SENDR = p7
# SOURCES
SRC = crt0 Sound4Calc syscall
# INCLUDES
INC = syscall Sound4Calc addresses\
# END OF FILE

0
README.md Normal file → Executable file
View File

0
icon.bmp Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

5
include/Sound4Calc.h Normal file → Executable file
View File

@ -4,14 +4,9 @@
// SH4 addresses
char is_SH4;
void setup(void); // configure ports to output
void SetPin(void);
void ResetPin(void);
char getMPU(void); //get_MPU to compatibility
unsigned char *itoa(int n, unsigned char* str, int base);
#endif

0
include/addresses.h Normal file → Executable file
View File

View File

@ -1,88 +0,0 @@
/*****************************************************************/
/* */
/* 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
// 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;
#endif

View File

@ -1,22 +0,0 @@
/*****************************************************************/
/* */
/* 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

View File

@ -1,107 +0,0 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : filebios.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __FILEBIOS_H__
#define __FILEBIOS_H__
// 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;
#endif

View File

@ -1,91 +0,0 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : fxlib.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __FXLIB_H__
#define __FXLIB_H__
#include "dispbios.h"
#include "filebios.h"
#include "keybios.h"
// 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);
#endif

View File

@ -1,149 +0,0 @@
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : keybios.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __KEYBIOS_H__
#define __KEYBIOS_H__
// 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
#endif

View File

@ -1,127 +0,0 @@
/*------------------------------------------------------*/
/* 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

0
include/syscall.h Normal file → Executable file
View File

View File

@ -1,23 +0,0 @@
/*****************************************************************/
/* */
/* 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

BIN
lib/libc.a Executable file

Binary file not shown.

Binary file not shown.

BIN
lib/libgint.a Executable file

Binary file not shown.

0
misc/logo/32x32.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

0
misc/logo/512x512.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
scripts/addin.ld Normal file → Executable file
View File

160
src/Sound4Calc.c Normal file → Executable file
View File

@ -1,82 +1,53 @@
#include <fxlib.h>
#include <stdlib.h>
#include "addresses.h"
#include "Sound4Calc.h"
#include "syscall.h"
#include <addresses.h>
#include <Sound4Calc.h>
#include <syscall.h>
#include <timer.h> // add timer's fonction
#include <display.h> // add display's fonction
#include <keyboard.h>
#include <mpu.h>
//#define DEBUG
//#define PI 3.14159265358
unsigned char *itoa(int n, unsigned char* str, int base)
{
int i=1, j=0, x;
if(n<0) str[j++] = '-', n = -n;
for(x=n;x;x/=base) j++;
for(x=n;x;x/=base) str[j-i++] = x%base + '0' + 39*(x%base>9);
str[j] = 0;
return str;
}
int main(void)
{
unsigned int key;
// char buffer[50];
unsigned char str[20];
//unsigned int key=0;
int sleep = 2000;
int i;
#ifdef DEBUG
char before = 0, during = 0, after = 0;
#endif
int sleep = 200;
//unsigned int i=0,j=0;
setup();
//ResetPin();
while(1)
{
Bdisp_AllClr_VRAM();
PrintMini(1, 1, itoa(sleep, str, 10), 0);
//dclear();
dprint(1, 1, "%d", sleep);
PrintMini(1, 10, itoa(is_SH4, str, 10), 0);
// PrintMini(1, 1, itoa(sleep, str, 10), 0);
dprint(1, 10, "%d", !isSH3());
#ifdef DEBUG
PrintMini(1, 20, itoa(before, str, 16), 0);
PrintMini(1, 28, itoa(during, str, 16), 0);
PrintMini(1, 36, itoa(after, str, 16), 0);
#endif
//PrintMini(1, 10, itoa(is_SH4, str, 10), 0);
// dupdate();
GetKey(&key);
switch(key)
switch(getkey())
{
case KEY_CTRL_RIGHT : sleep+=50; break;
case KEY_CTRL_LEFT : sleep-=50; break;
case KEY_CTRL_EXE :
case KEY_RIGHT : sleep+=5; break;
case KEY_LEFT : sleep-=5; break;
case KEY_EXE :
while(Keyboard_KeyDown())
{
#ifdef DEBUG
before=*(volatile unsigned char*)SH7305_PJDR;
ResetPin();
during=*(volatile unsigned char*)SH7305_PJDR;
for(i=0;i<sleep;i++);
SetPin();
after=*(volatile unsigned char*)SH7305_PJDR;
ResetPin();
timer_start(TIMER_USER, sleep, Clock_Hz, SetPin, 1000);
#else
ResetPin();
for(i=0;i<sleep;i++);
SetPin();
#endif
}
//timer_stop(1);
break;
case KEY_CTRL_EXIT :
case KEY_EXIT :
return 1;
}
}
@ -85,9 +56,23 @@ return 1; // this point is never reached
void setup()
{
is_SH4 = getMPU();
if(is_SH4)
if(isSH3())
{
// SCIF2 clock on (STBCR3.MSTP31)
*(volatile unsigned char*)SH7337_STBCR3 &= ~0x02;
// switch off SCSMR_2.TE and SCSMR_2.RE
*(volatile unsigned short*)SH7337_SCSCR2 &= ~0x0030;
// SCIF2 clock off (STBCR3.MSTP31)
*(volatile unsigned char*)SH7337_STBCR3 |= 0x02;
// set bit 6 of port G to output mode
*(volatile unsigned short*)SH7337_PGCR = ( *(volatile unsigned short*)SH7337_PGCR & ~0x3000 ) | 0x1000;
// set bit 5 and 6 of port G
*(volatile unsigned char*)SH7337_PGDR |= 0x60;
// set port SC bit 0 to output
*(volatile unsigned short*)SH7337_SCPCR = ( *(volatile unsigned short*)SH7337_SCPCR & ~0x0003 ) | 0x0001;
}
else
{
// SCIF2 clock on (MSTPCR0.MSTP007)
*(volatile unsigned int*)SH7305_MSTPCR0 &= ~0x00000080;
@ -106,21 +91,6 @@ void setup()
// set port J bit 3 to output mode
*(volatile unsigned short*)SH7305_PJCR = ( *(volatile unsigned short*)SH7305_PJCR & ~0x00C0 ) | 0x0040;
}
else
{
// SCIF2 clock on (STBCR3.MSTP31)
*(volatile unsigned char*)SH7337_STBCR3 &= ~0x02;
// switch off SCSMR_2.TE and SCSMR_2.RE
*(volatile unsigned short*)SH7337_SCSCR2 &= ~0x0030;
// SCIF2 clock off (STBCR3.MSTP31)
*(volatile unsigned char*)SH7337_STBCR3 |= 0x02;
// set bit 6 of port G to output mode
*(volatile unsigned short*)SH7337_PGCR = ( *(volatile unsigned short*)SH7337_PGCR & ~0x3000 ) | 0x1000;
// set bit 5 and 6 of port G
*(volatile unsigned char*)SH7337_PGDR |= 0x60;
// set port SC bit 0 to output
*(volatile unsigned short*)SH7337_SCPCR = ( *(volatile unsigned short*)SH7337_SCPCR & ~0x0003 ) | 0x0001;
}
/*
// set port J bit 2 to output
*(unsigned short*)0xA4050110 = ( *(unsigned short*)0xA4050110 & ~0x0030 ) | 0x0010;
@ -130,51 +100,29 @@ void setup()
void SetPin()
{
if(is_SH4)
if(isSH3())
{
*(volatile unsigned char*)SH7305_PJDR |= 0x04;
*(volatile unsigned char*)SH7305_PJDR &= ~0x08;
//set pin to 0x4B
*(volatile unsigned char*)SH7337_SCPDR |= 0x01;
}
else
{
*(volatile unsigned char*)SH7337_SCPDR |= 0x01;
*(volatile unsigned char*)SH7305_PJDR |= 0x04;
//*(volatile unsigned char*)SH7305_PJDR &= ~0x08;
//set pin to 0x4B
}
}
void ResetPin()
{
if(is_SH4)
if(isSH3())
{
*(volatile unsigned char*)SH7305_PJDR &= ~0x04;
*(volatile unsigned char*)SH7305_PJDR |= 0x08;
// set the pin to 0x47
*(volatile unsigned char*)SH7337_SCPDR &= ~0x01;
}
else
{
*(volatile unsigned char*)SH7337_SCPDR &= ~0x01;
*(volatile unsigned char*)SH7305_PJDR &= ~0x04;
//*(volatile unsigned char*)SH7305_PJDR |= 0x08;
// set the pin to 0x47
}
}
char getMPU(void)
{
// Port L control register.
volatile unsigned short *plcr = (unsigned short *)0xA4000114;
// Saved value for PLCR.
unsigned short saved_plcr;
unsigned int tested_plcr;
saved_plcr = *plcr;
*plcr = 0xffff;
tested_plcr = *plcr;
*plcr = saved_plcr;
if(tested_plcr == 0x00ff || tested_plcr == 0x0fff)
{
return 0; // MPU_SH3
}
return 1; // MPU_SH4
}
}

0
src/crt0.s Normal file → Executable file
View File

0
src/syscall.s Normal file → Executable file
View File