diff --git a/AddinInfo.txt b/AddinInfo.txt new file mode 100644 index 0000000..26f42cb --- /dev/null +++ b/AddinInfo.txt @@ -0,0 +1,12 @@ +//------------------------------------------------------------------ +// Addin-Application header control file, created with the CASIO SDK +//------------------------------------------------------------------ +[OUTPUT] : "MARIOBRS.G1A" +[BINDATA] : "FXADDINror.bin" +[DISPNAME] : "MARIOBRS" +[APPNAME] : "@MARIOBR" +[VERSION] : "00.00.0000" +[APL_ICON] : "MainIcon.bmp" +[MODULE_NUM] : 0 +[MOD1_TITLE] : "MARIOBR" +[MOD1_ICON] : "eActivityIcon.bmp" diff --git a/Debug/Addin.mak b/Debug/Addin.mak new file mode 100644 index 0000000..1958d3a --- /dev/null +++ b/Debug/Addin.mak @@ -0,0 +1,100 @@ +################################################ +# Make file for CASIO fx-9860G SDK Addin +# +############################ +# Directory defines +TCDIR = C:\CASIO\fx-9860G SDK\OS\SH +OSDIR = C:\CASIO\fx-9860G SDK\OS +APPDIR = Z:\home\gmilan\dev\c\supercasiobros +OUTDIR = Z:\home\gmilan\dev\c\supercasiobros\Debug + +################ +# Main Defines +SH_EXEDIR=$(TCDIR)\bin + +# Hitachi SH C/C++ Compiler02 phase +SHCC02_EXE=shc.exe +SHCC02_DEP="$(OSDIR)\FX\include\fxlib.h" + +# Hitachi SH Assembler03 phase +SHASM03_EXE=asmsh.exe + +# Hitachi OptLinker04 phase +SHLINK04_EXE=Optlnk.exe +SHLINK04_DEP="$(OSDIR)\FX\lib\fx9860G_library.lib" +SHLINK04_DEP2="$(OSDIR)\FX\lib\setup.obj" + +####################### +# Files to build +FILE0=MARIOBR +FILESRC0="$(APPDIR)\$(FILE0).c" +FILEOBJ0="$(OUTDIR)\$(FILE0).obj" +RFILE=FXADDINror +USERALLOBJ=$(FILEOBJ0) + +####################### +# nmake "all" statement + +ALL: SH_ENV \ + $(USERALLOBJ) \ + $(OUTDIR)\$(RFILE).bin \ + +#################### +# Description blocks + +!MESSAGE %3#C$z`&'0? +!MESSAGE +!MESSAGE Executing Hitachi SH C/C++ Compiler/Assembler phase +!MESSAGE + +SH_ENV : + set SHC_INC=$(TCDIR)\include + set PATH=$(TCDIR)\bin + set SHC_LIB=$(TCDIR)\bin + set SHC_TMP=$(OUTDIR) + +$(FILEOBJ0) : $(FILESRC0) $(SHCC02_DEP) + "$(SH_EXEDIR)\$(SHCC02_EXE)" -subcommand=<< +-cpu=sh3 +-include="$(OSDIR)\FX\include","$(APPDIR)" +-objectfile=$(FILEOBJ0) +-show=source +-listfile="$(OUTDIR)\$(FILE0).lst" +-size +-noinline +-chgincpath +-errorpath +$(FILESRC0) +-lang=c +-nologo +-debug +<< + +!MESSAGE +!MESSAGE Executing Hitachi OptLinker04 phase +!MESSAGE + +"$(OUTDIR)\$(RFILE).bin" : $(USERALLOBJ) $(SHLINK04_DEP2) $(SHLINK04_DEP) + "$(SH_EXEDIR)\$(SHLINK04_EXE)" -subcommand=<< +noprelink +sdebug +rom D=R +nomessage +list "$(OUTDIR)\$(RFILE).map" +show symbol +nooptimize +start P_TOP,P,C,D,C$VTBL,C$INIT/0300200,B_BR_Size,B,R/08100000 +fsymbol P +nologo +input $(USERALLOBJ) +input $(SHLINK04_DEP2) +library $(SHLINK04_DEP) +output "$(OUTDIR)\$(RFILE).abs" +-nomessage=1100 +end +input "$(OUTDIR)\$(RFILE).abs" +form binary +output "$(OUTDIR)\$(RFILE).bin" +exit +<< + diff --git a/Debug/FXADDINror.abs b/Debug/FXADDINror.abs new file mode 100644 index 0000000..0e28a5b Binary files /dev/null and b/Debug/FXADDINror.abs differ diff --git a/Debug/FXADDINror.bin b/Debug/FXADDINror.bin new file mode 100644 index 0000000..6efc410 Binary files /dev/null and b/Debug/FXADDINror.bin differ diff --git a/Debug/FXADDINror.dbg b/Debug/FXADDINror.dbg new file mode 100644 index 0000000..11314c1 Binary files /dev/null and b/Debug/FXADDINror.dbg differ diff --git a/Debug/FXADDINror.fsy b/Debug/FXADDINror.fsy new file mode 100644 index 0000000..eb13052 --- /dev/null +++ b/Debug/FXADDINror.fsy @@ -0,0 +1,51 @@ +;HITACHI OPTIMIZING LINKAGE EDITOR GENERATED FILE 2019.11.17 +;fsymbol = P + +;SECTION NAME = P + .export _AddIn_main +_AddIn_main: .equ h'0030020c + .export ___LINK_PROTECT +___LINK_PROTECT: .equ h'00300258 + .export _SetQuitHandler +_SetQuitHandler: .equ h'0030025c + .export _OnAppCloseDefault +_OnAppCloseDefault: .equ h'00300262 + .export __INITSCT_ADDIN +__INITSCT_ADDIN: .equ h'003002b6 + .export _INIT_ADDIN_APPLICATION +_INIT_ADDIN_APPLICATION: .equ h'003002fe + .export _Bdel_cychdr +_Bdel_cychdr: .equ h'00300374 + .export _Bdisp_AllClr_DDVRAM +_Bdisp_AllClr_DDVRAM: .equ h'00300384 + .export _BfileFLS_CloseFile +_BfileFLS_CloseFile: .equ h'00300394 + .export _Bkey_Set_RepeatTime_Default +_Bkey_Set_RepeatTime_Default: .equ h'003003a4 + .export _CallbackAtQuitMainFunction +_CallbackAtQuitMainFunction: .equ h'003003b4 + .export _flsFindClose +_flsFindClose: .equ h'003003c4 + .export _GetKey +_GetKey: .equ h'003003d4 + .export _GLibAddinAplExecutionCheck +_GLibAddinAplExecutionCheck: .equ h'003003e4 + .export _Hmem_SetMMU +_Hmem_SetMMU: .equ h'003003f4 + .export _Print +_Print: .equ h'00300404 + .export _PrintMini +_PrintMini: .equ h'00300414 + .export _locate +_locate: .equ h'00300430 + .export _Bdisp_ReadArea_DD +_Bdisp_ReadArea_DD: .equ h'00300458 + .export __divls +__divls: .equ h'0030058c + .export _DD_GET +_DD_GET: .equ h'00300640 + .export _locate_OS +_locate_OS: .equ h'00300650 + .export _PrintMiniSd +_PrintMiniSd: .equ h'00300660 + .end diff --git a/Debug/FXADDINror.map b/Debug/FXADDINror.map new file mode 100644 index 0000000..19a7036 --- /dev/null +++ b/Debug/FXADDINror.map @@ -0,0 +1,234 @@ +Hitachi Optimizing Linkage Editor (Ver. 7.1.03.000)17-Nov-2019 15:42:13 + +*** Options *** + +-subcommand=C:\users\gmilan\Temp\hmkaf9b.tmp +noprelink +sdebug +rom D=R +nomessage +list "Z:\home\gmilan\dev\c\supercasiobros\Debug\FXADDINror.map" +show symbol +nooptimize +start P_TOP,P,C,D,C$VTBL,C$INIT/0300200,B_BR_Size,B,R/08100000 +fsymbol P +nologo +input "Z:\home\gmilan\dev\c\supercasiobros\Debug\MARIOBR.obj" +input "C:\CASIO\fx-9860G SDK\OS\FX\lib\setup.obj" +library "C:\CASIO\fx-9860G SDK\OS\FX\lib\fx9860G_library.lib" +output "Z:\home\gmilan\dev\c\supercasiobros\Debug\FXADDINror.abs" +-nomessage=1100 +end + +*** Error information *** + +*** Mapping List *** + +SECTION START END SIZE ALIGN + +P_TOP + 00300200 0030020b c 4 +P + 0030020c 0030066f 464 4 +C + 00300670 003006a7 38 4 +D + 003006a8 003006ab 4 4 +B_BR_Size + 08100000 08100003 4 4 +B + 08100004 08100007 4 4 +R + 08100008 0810000b 4 4 + +*** Symbol List *** + +SECTION= +FILE= START END SIZE + SYMBOL ADDR SIZE INFO COUNTS OPT + +SECTION=P_TOP +FILE=Z:\home\gmilan\dev\c\supercasiobros\Debug\MARIOBR.obj + 00300200 0030020b c + _InitializeSystem + 00300200 c func ,g * + +SECTION=P +FILE=Z:\home\gmilan\dev\c\supercasiobros\Debug\MARIOBR.obj + 0030020c 00300257 4c + _AddIn_main + 0030020c 4c func ,g * +FILE=C:\CASIO\fx-9860G SDK\OS\FX\lib\setup.obj + 00300258 00300373 11c + ___LINK_PROTECT + 00300258 4 func ,g * + _SetQuitHandler + 0030025c 6 func ,g * + _OnAppCloseDefault + 00300262 54 func ,g * + __INITSCT_ADDIN + 003002b6 48 func ,g * + _INIT_ADDIN_APPLICATION + 003002fe 76 func ,g * +FILE=_Bdel_cychdr + 00300374 00300383 10 + _Bdel_cychdr + 00300374 0 none ,g * +FILE=_Bdisp_AllClr_DDVRAM + 00300384 00300393 10 + _Bdisp_AllClr_DDVRAM + 00300384 0 none ,g * +FILE=_BfileFLS_CloseFile + 00300394 003003a3 10 + _BfileFLS_CloseFile + 00300394 0 none ,g * +FILE=_Bkey_Set_RepeatTime_Default + 003003a4 003003b3 10 + _Bkey_Set_RepeatTime_Default + 003003a4 0 none ,g * +FILE=_CallbackAtQuitMainFunction + 003003b4 003003c3 10 + _CallbackAtQuitMainFunction + 003003b4 0 none ,g * +FILE=_flsFindClose + 003003c4 003003d3 10 + _flsFindClose + 003003c4 0 none ,g * +FILE=_getkey + 003003d4 003003e3 10 + _GetKey + 003003d4 0 none ,g * +FILE=_GLibAddinAplExecutionCheck + 003003e4 003003f3 10 + _GLibAddinAplExecutionCheck + 003003e4 0 none ,g * +FILE=_Hmem_SetMMU + 003003f4 00300403 10 + _Hmem_SetMMU + 003003f4 0 none ,g * +FILE=_Print + 00300404 00300413 10 + _Print + 00300404 0 none ,g * +FILE=dispbios + 00300414 00300589 176 + _PrintMini + 00300414 1c func ,g * + _locate + 00300430 28 func ,g * + _Bdisp_ReadArea_DD + 00300458 132 func ,g * +FILE=__divls + 0030058c 0030063f b4 + __divls + 0030058c 0 none ,g * + divls_zero + 0030062a 0 none ,l * + A_errno + 00300638 0 none ,l * + n_zerono + 0030063c 0 none ,l * +FILE=_DD_GET + 00300640 0030064f 10 + _DD_GET + 00300640 0 none ,g * +FILE=_locate + 00300650 0030065f 10 + _locate_OS + 00300650 0 none ,g * +FILE=_PrintMiniSd + 00300660 0030066f 10 + _PrintMiniSd + 00300660 0 none ,g * + +SECTION=C +FILE=addin_sct + 00300694 003006a7 14 + _B_BGN + 00300694 0 none ,g * + _B_END + 00300698 0 none ,g * + _R_BGN + 0030069c 0 none ,g * + _R_END + 003006a0 0 none ,g * + _D_ROM + 003006a4 0 none ,g * + +SECTION=B_BR_Size +FILE=Z:\home\gmilan\dev\c\supercasiobros\Debug\MARIOBR.obj + 08100000 08100003 4 + _BR_Size + 08100000 4 data ,g * + +SECTION=B +FILE=_errno + 08100004 08100007 4 + __errno + 08100004 4 data ,g * + +SECTION=R +FILE=C:\CASIO\fx-9860G SDK\OS\FX\lib\setup.obj + 08100008 0810000b 4 + _gb_OnAppClose + 08100008 4 data ,g * + +Absolute value symbols +FILE=_Bdel_cychdr + __JumpTableTOP + 80010070 0 none ,l * +FILE=_Bdisp_AllClr_DDVRAM + __JumpTableTOP + 80010070 0 none ,l * +FILE=_BfileFLS_CloseFile + __JumpTableTOP + 80010070 0 none ,l * +FILE=_Bkey_Set_RepeatTime_Default + __JumpTableTOP + 80010070 0 none ,l * +FILE=_CallbackAtQuitMainFunction + __JumpTableTOP + 80010070 0 none ,l * +FILE=_flsFindClose + __JumpTableTOP + 80010070 0 none ,l * +FILE=_getkey + __JumpTableTOP + 80010070 0 none ,l * +FILE=_GLibAddinAplExecutionCheck + __JumpTableTOP + 80010070 0 none ,l * +FILE=_Hmem_SetMMU + __JumpTableTOP + 80010070 0 none ,l * +FILE=_Print + __JumpTableTOP + 80010070 0 none ,l * +FILE=__divls + zerodiv + 0000044e 0 none ,l * +FILE=_DD_GET + __JumpTableTOP + 80010070 0 none ,l * +FILE=_locate + __JumpTableTOP + 80010070 0 none ,l * +FILE=_PrintMiniSd + __JumpTableTOP + 80010070 0 none ,l * + +*** Delete Symbols *** + +SYMBOL SIZE INFO + +*** Variable Accessible with Abs8 *** + +SYMBOL SIZE COUNTS OPTIMIZE + +*** Variable Accessible with Abs16 *** + +SYMBOL SIZE COUNTS OPTIMIZE + +*** Function Call *** + +SYMBOL COUNTS OPTIMIZE diff --git a/Debug/MARIOBR.lst b/Debug/MARIOBR.lst new file mode 100644 index 0000000..9dd3808 --- /dev/null +++ b/Debug/MARIOBR.lst @@ -0,0 +1,269 @@ +SH SERIES C/C++ Compiler (Ver. 6.0C) 17-Nov-2019 15:42:12 PAGE 1 + +************ OBJECT LISTING ************ + +FILE NAME: Z:\home\gmilan\dev\c\supercasiobros\MARIOBR.c + +SCT OFFSET CODE C LABEL INSTRUCTION OPERAND COMMENT + + MARIOBR.c 1 /*****************************************************************/ + MARIOBR.c 2 /* */ + MARIOBR.c 3 /* CASIO fx-9860G SDK Library */ + MARIOBR.c 4 /* */ + MARIOBR.c 5 /* File name : [ProjectName].c */ + MARIOBR.c 6 /* */ + MARIOBR.c 7 /* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ + MARIOBR.c 8 /* */ + MARIOBR.c 9 /*****************************************************************/ + MARIOBR.c 10 #include "fxlib.h" + MARIOBR.c 11 + MARIOBR.c 12 + MARIOBR.c 13 //**************************************************************************** + MARIOBR.c 14 // AddIn_main (Sample program main function) + MARIOBR.c 15 // + MARIOBR.c 16 // param : isAppli : 1 = This application is launched by MAIN MENU. + MARIOBR.c 17 // : 0 = This application is launched by a strip in eACT application. + MARIOBR.c 18 // + MARIOBR.c 19 // OptionNum : Strip number (0~3) + MARIOBR.c 20 // (This parameter is only used when isAppli parameter is 0.) + MARIOBR.c 21 // + MARIOBR.c 22 // retval : 1 = No error / 0 = Error + MARIOBR.c 23 // + MARIOBR.c 24 //**************************************************************************** + MARIOBR.c 25 int AddIn_main(int isAppli, unsigned short OptionNum) +P 00000000 _AddIn_main: ; function: AddIn_main + ; frame size=4 + MARIOBR.c 26 { + MARIOBR.c 27 unsigned int key; + MARIOBR.c 28 + MARIOBR.c 29 Bdisp_AllClr_DDVRAM(); + 00000000 D30C MOV.L L316+2,R3 ; _Bdisp_AllClr_DDVRAM + 00000002 7FFC ADD #-4,R15 + 00000004 430B JSR @R3 + 00000006 0009 NOP + MARIOBR.c 30 + MARIOBR.c 31 locate(1,4); + 00000008 D20B MOV.L L316+6,R2 ; _locate + 0000000A E504 MOV #4,R5 + 0000000C 420B JSR @R2 + 0000000E E401 MOV #1,R4 + MARIOBR.c 32 Print((unsigned char*)"This application is"); + 00000010 D40A MOV.L L316+10,R4 ; L302 + 00000012 D30B MOV.L L316+14,R3 ; _Print + 00000014 430B JSR @R3 + 00000016 0009 NOP + MARIOBR.c 33 locate(1,5); + 00000018 D207 MOV.L L316+6,R2 ; _locate + 0000001A E505 MOV #5,R5 + 0000001C 420B JSR @R2 + 0000001E E401 MOV #1,R4 + MARIOBR.c 34 Print((unsigned char*)" sample Add-In."); + 00000020 D408 MOV.L L316+18,R4 ; L303 + 00000022 D307 MOV.L L316+14,R3 ; _Print + + + + +SH SERIES C/C++ Compiler (Ver. 6.0C) 17-Nov-2019 15:42:12 PAGE 2 + + +SCT OFFSET CODE C LABEL INSTRUCTION OPERAND COMMENT + + 00000024 430B JSR @R3 + 00000026 0009 NOP + 00000028 DE07 MOV.L L316+22,R14; _GetKey + MARIOBR.c 35 + MARIOBR.c 36 while(1){ + 0000002A L313: + MARIOBR.c 37 GetKey(&key); + 0000002A 4E0B JSR @R14 + 0000002C 64F3 MOV R15,R4 + 0000002E AFFC BRA L313 + 00000030 0009 NOP + 00000032 L316: + 00000032 0000 .DATA.W 0 + 00000034 <00000000> .DATA.L _Bdisp_AllClr_DDVRAM + 00000038 <00000000> .DATA.L _locate + 0000003C <00000000> .DATA.L L302 + 00000040 <00000000> .DATA.L _Print + 00000044 <00000000> .DATA.L L303 + 00000048 <00000000> .DATA.L _GetKey + MARIOBR.c 38 } + MARIOBR.c 39 + MARIOBR.c 40 return 1; + MARIOBR.c 41 } + MARIOBR.c 42 + MARIOBR.c 43 + MARIOBR.c 44 + MARIOBR.c 45 + MARIOBR.c 46 //**************************************************************************** + MARIOBR.c 47 //************** **************** + MARIOBR.c 48 //************** Notice! **************** + MARIOBR.c 49 //************** **************** + MARIOBR.c 50 //************** Please do not change the following source. **************** + MARIOBR.c 51 //************** **************** + MARIOBR.c 52 //**************************************************************************** + MARIOBR.c 53 + MARIOBR.c 54 + MARIOBR.c 55 #pragma section _BR_Size + MARIOBR.c 56 unsigned long BR_Size; + MARIOBR.c 57 #pragma section + MARIOBR.c 58 + MARIOBR.c 59 + MARIOBR.c 60 #pragma section _TOP + MARIOBR.c 61 + MARIOBR.c 62 //**************************************************************************** + MARIOBR.c 63 // InitializeSystem + MARIOBR.c 64 // + MARIOBR.c 65 // param : isAppli : 1 = Application / 0 = eActivity + MARIOBR.c 66 // OptionNum : Option Number (only eActivity) + MARIOBR.c 67 // + MARIOBR.c 68 // retval : 1 = No error / 0 = Error + MARIOBR.c 69 // + MARIOBR.c 70 //**************************************************************************** + MARIOBR.c 71 int InitializeSystem(int isAppli, unsigned short OptionNum) +P_T 00000000 _InitializeSystem: ; function: InitializeSystem + ; frame size=0 + MARIOBR.c 72 { + MARIOBR.c 73 return INIT_ADDIN_APPLICATION(isAppli, OptionNum); + + + + +SH SERIES C/C++ Compiler (Ver. 6.0C) 17-Nov-2019 15:42:12 PAGE 3 + + +SCT OFFSET CODE C LABEL INSTRUCTION OPERAND COMMENT + + 00000000 D301 MOV.L L317+2,R3 ; _INIT_ADDIN_APPLICATION + 00000002 432B JMP @R3 + 00000004 0009 NOP + 00000006 L317: + 00000006 0000 .DATA.W 0 + 00000008 <00000000> .DATA.L _INIT_ADDIN_APPLICATION + MARIOBR.c 74 } + MARIOBR.c 75 + MARIOBR.c 76 #pragma section + MARIOBR.c 77 +C 00000000 L302: + 00000000 5468697320 .SDATA "This application is" + 6170706C69 + 636174696F + 6E206973 + 00000013 00 .DATA.B H'00 + 00000014 L303: + 00000014 2073616D70 .SDATA " sample Add-In." + 6C65204164 + 642D496E2E + 00000023 00 .DATA.B H'00 +B_B 00000000 _BR_Size: ; static: BR_Size + 00000000 00000004 .RES.L 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SH SERIES C/C++ Compiler (Ver. 6.0C) 17-Nov-2019 15:42:12 PAGE 1 + + +******** STATISTICS INFORMATION ******** + + +********** ERROR INFORMATION *********** + +NUMBER OF ERRORS: 0 +NUMBER OF WARNINGS: 0 + + + + +******* SOURCE LINE INFORMATION ******** + +COMPILED SOURCE LINE: 77 + + + +******* SECTION SIZE INFORMATION ******* + +PROGRAM SECTION (P): 0000004C Byte(s) +PROGRAM SECTION (P_BR_Size): 00000000 Byte(s) +PROGRAM SECTION (P_TOP): 0000000C Byte(s) +CONSTANT SECTION (C): 00000024 Byte(s) +CONSTANT SECTION (C_BR_Size): 00000000 Byte(s) +CONSTANT SECTION (C_TOP): 00000000 Byte(s) +DATA SECTION (D): 00000000 Byte(s) +DATA SECTION (D_BR_Size): 00000000 Byte(s) +DATA SECTION (D_TOP): 00000000 Byte(s) +BSS SECTION (B): 00000000 Byte(s) +BSS SECTION (B_BR_Size): 00000004 Byte(s) +BSS SECTION (B_TOP): 00000000 Byte(s) + + TOTAL PROGRAM SIZE: 00000080 Byte(s) + + + +********** LABEL INFORMATION *********** + +NUMBER OF EXTERNAL REFERENCE SYMBOLS: 5 +NUMBER OF EXTERNAL DEFINITION SYMBOLS: 3 +NUMBER OF INTERNAL/EXTERNAL SYMBOLS: 13 + + + + + + + + + + + + + + + + + + + + + + +*** COMMAND PARAMETER *** + + + -subcommand=C:\users\gmilan\Temp\hmkab6e.tmp + diff --git a/Debug/MARIOBR.obj b/Debug/MARIOBR.obj new file mode 100644 index 0000000..407d0c8 Binary files /dev/null and b/Debug/MARIOBR.obj differ diff --git a/INIT/CasioRAM.mem b/INIT/CasioRAM.mem new file mode 100644 index 0000000..c61ea28 Binary files /dev/null and b/INIT/CasioRAM.mem differ diff --git a/INIT/CasioRAMCPU.mem b/INIT/CasioRAMCPU.mem new file mode 100644 index 0000000..fd09ac7 Binary files /dev/null and b/INIT/CasioRAMCPU.mem differ diff --git a/MARIOBRS.dlr b/MARIOBRS.dlr new file mode 100644 index 0000000..6b419a0 --- /dev/null +++ b/MARIOBRS.dlr @@ -0,0 +1 @@ +[DLSimRunSpace] diff --git a/MARIOBRS.dlw b/MARIOBRS.dlw new file mode 100644 index 0000000..b0d02c5 --- /dev/null +++ b/MARIOBRS.dlw @@ -0,0 +1,112 @@ +[DLSimWorkSpace] + +[_1] +Type=5 +Order=2 +Top=15 +Left=2235 +Height=4740 +Width=5565 +State=0 +Flags=00000020 +OptionA=0 + +[_2] +Type=1 +Order=0 +Top=15 +Left=7800 +Height=4740 +Width=5535 +State=0 +Flags=00000001 +OptionA=15 +OptionB=15 + +[_3] +Type=6 +Order=4 +Top=4740 +Left=7800 +Height=6390 +Width=5535 +State=0 +Flags=00000001 +OptionA=0 + +[_4] +Type=7 +Order=3 +Top=4740 +Left=2220 +Height=3165 +Width=5565 +State=0 +Flags=00000000 +OptionA=0 + +[_5] +Type=8 +Order=1 +Top=7905 +Left=2220 +Height=3225 +Width=5580 +State=0 +Flags=00000000 +OptionA=0 + +[_6] +Type=3 +Order=9 +Top=0 +Left=10788 +Height=6348 +Width=2232 +State=16 +Flags=00000000 +OptionA=0 + +[_7] +Type=2 +Order=8 +Top=6348 +Left=7800 +Height=3588 +Width=5220 +State=16 +Flags=00000000 +OptionA=0 + +[_8] +Type=17 +Order=5 +Top=15 +Left=-15 +Height=11115 +Width=2235 +State=0 +Flags=00000000 +OptionA=0 + +[_9] +Type=15 +Order=6 +Top=4740 +Left=2232 +Height=6348 +Width=5592 +State=16 +Flags=00000000 +OptionA=0 + +[_32] +Type=16 +Order=7 +Top=0 +Left=2208 +Height=4584 +Width=5592 +State=16 +Flags=00000020 +OptionA=0 diff --git a/MARIOBRS.g1w b/MARIOBRS.g1w new file mode 100644 index 0000000..c352a56 --- /dev/null +++ b/MARIOBRS.g1w @@ -0,0 +1,15 @@ +[DLSimProject] +Name=MARIOBRS +Version=00.00.0000 +Model=:fx-9860G.dlm +SourcePath=SRC +MemoryPath=INIT +MemCardPath=SDCard + +[Program1] +Program=MARIOBRS.G1A +Debug=Debug\FXADDINror.dbg +LoadAddress=80000000:90100000 + +[Files] +SourceFile=:MARIOBR.c diff --git a/assets-fx/img/brick.png b/assets-fx/img/brick.png new file mode 100644 index 0000000..c5b34c8 Binary files /dev/null and b/assets-fx/img/brick.png differ diff --git a/assets-fx/img/coin.png b/assets-fx/img/coin.png new file mode 100644 index 0000000..998eff9 Binary files /dev/null and b/assets-fx/img/coin.png differ diff --git a/assets-fx/img/death.png b/assets-fx/img/death.png new file mode 100644 index 0000000..bf723b8 Binary files /dev/null and b/assets-fx/img/death.png differ diff --git a/assets-fx/img/error.png b/assets-fx/img/error.png new file mode 100644 index 0000000..8cfb2e4 Binary files /dev/null and b/assets-fx/img/error.png differ diff --git a/assets-fx/img/gift.png b/assets-fx/img/gift.png new file mode 100644 index 0000000..396e92e Binary files /dev/null and b/assets-fx/img/gift.png differ diff --git a/assets-fx/img/mariosmall.png b/assets-fx/img/mariosmall.png new file mode 100644 index 0000000..09ff407 Binary files /dev/null and b/assets-fx/img/mariosmall.png differ diff --git a/assets-fx/img/stone.png b/assets-fx/img/stone.png new file mode 100644 index 0000000..efed588 Binary files /dev/null and b/assets-fx/img/stone.png differ diff --git a/build-fx/assets/img/brick.png.o b/build-fx/assets/img/brick.png.o new file mode 100644 index 0000000..42731c3 Binary files /dev/null and b/build-fx/assets/img/brick.png.o differ diff --git a/build-fx/assets/img/coin.png.o b/build-fx/assets/img/coin.png.o new file mode 100644 index 0000000..440988c Binary files /dev/null and b/build-fx/assets/img/coin.png.o differ diff --git a/build-fx/assets/img/death.png.o b/build-fx/assets/img/death.png.o new file mode 100644 index 0000000..2e1710e Binary files /dev/null and b/build-fx/assets/img/death.png.o differ diff --git a/build-fx/assets/img/error.png.o b/build-fx/assets/img/error.png.o new file mode 100644 index 0000000..a8fd8b5 Binary files /dev/null and b/build-fx/assets/img/error.png.o differ diff --git a/build-fx/assets/img/gift.png.o b/build-fx/assets/img/gift.png.o new file mode 100644 index 0000000..030a6ce Binary files /dev/null and b/build-fx/assets/img/gift.png.o differ diff --git a/build-fx/assets/img/mariosmall.png.o b/build-fx/assets/img/mariosmall.png.o new file mode 100644 index 0000000..a1c2e83 Binary files /dev/null and b/build-fx/assets/img/mariosmall.png.o differ diff --git a/build-fx/assets/img/stone.png.o b/build-fx/assets/img/stone.png.o new file mode 100644 index 0000000..204d51a Binary files /dev/null and b/build-fx/assets/img/stone.png.o differ diff --git a/build-fx/src/MARIOBRS.elf b/build-fx/src/MARIOBRS.elf new file mode 100755 index 0000000..bd287b1 Binary files /dev/null and b/build-fx/src/MARIOBRS.elf differ diff --git a/build-fx/src/box.d b/build-fx/src/box.d new file mode 100644 index 0000000..809537d --- /dev/null +++ b/build-fx/src/box.d @@ -0,0 +1,5 @@ +build-fx/src/box.o: src/box.c src/box.h src/world.h + +src/box.h: + +src/world.h: diff --git a/build-fx/src/box.o b/build-fx/src/box.o new file mode 100644 index 0000000..ecec763 Binary files /dev/null and b/build-fx/src/box.o differ diff --git a/build-fx/src/keyboard.d b/build-fx/src/keyboard.d new file mode 100644 index 0000000..9bf9bd7 --- /dev/null +++ b/build-fx/src/keyboard.d @@ -0,0 +1,8 @@ +build-fx/src/keyboard.o: src/keyboard.c src/keyboard.h src/mario.h \ + src/box.h + +src/keyboard.h: + +src/mario.h: + +src/box.h: diff --git a/build-fx/src/keyboard.o b/build-fx/src/keyboard.o new file mode 100644 index 0000000..8cdf55c Binary files /dev/null and b/build-fx/src/keyboard.o differ diff --git a/build-fx/src/mario.d b/build-fx/src/mario.d new file mode 100644 index 0000000..576f248 --- /dev/null +++ b/build-fx/src/mario.d @@ -0,0 +1,12 @@ +build-fx/src/mario.o: src/mario.c src/mario.h src/box.h src/tile.h \ + src/world.h src/keyboard.h + +src/mario.h: + +src/box.h: + +src/tile.h: + +src/world.h: + +src/keyboard.h: diff --git a/build-fx/src/mario.o b/build-fx/src/mario.o new file mode 100644 index 0000000..e862c91 Binary files /dev/null and b/build-fx/src/mario.o differ diff --git a/build-fx/src/sprite.d b/build-fx/src/sprite.d new file mode 100644 index 0000000..926cff4 --- /dev/null +++ b/build-fx/src/sprite.d @@ -0,0 +1,5 @@ +build-fx/src/sprite.o: src/sprite.c src/sprite.h src/world.h + +src/sprite.h: + +src/world.h: diff --git a/build-fx/src/sprite.o b/build-fx/src/sprite.o new file mode 100644 index 0000000..8950282 Binary files /dev/null and b/build-fx/src/sprite.o differ diff --git a/src/box.c b/src/box.c new file mode 100644 index 0000000..ad2e9a3 --- /dev/null +++ b/src/box.c @@ -0,0 +1,119 @@ +#include "box.h" +#include "world.h" + +int sgn(int x) +{ + if (x==0) + return 0; + else if (x>0) + return 1; + return -1; +} + +static void move_x(box_t * b) +{ + int sgn_vx=sgn(b->vx); + if (sgn_vx) + { + for (int i=sgn_vx; i<=sgn_vx*b->vx; i++) + { + int previous_tested_y=-545; + int type=CTG_EMPTY; + for (int j=0; jh; j++) + { + int t=(b->y+j)/8; + if (t!=previous_tested_y) + { + previous_tested_y=t; + int typetemp; + if (sgn_vx>0) + typetemp=world_get_ctg(b->x+b->w+i*sgn_vx,b->y+j); + else + typetemp=world_get_ctg(b->x+i*sgn_vx,b->y+j); + if (typetemp==CTG_DEATH || typetemp==CTG_SOIL) + { + b->x+=(i-1)*sgn_vx; + b->vx=0; + return; + } + + } + } + } + b->x+=b->vx; + } +} + +static void move_y(box_t * b) +{ + int sgn_vy=sgn(b->vy); + if (sgn_vy) + { + for (int i=sgn_vy; i<=sgn_vy*b->vy; i++) + { + int previous_tested_x=-545; + for (int j=0; jh; j++) + { + int t=(b->w+j)/8; + if (t!=previous_tested_x) + { + previous_tested_x=t; + int typetemp; + if (sgn_vy>0) + typetemp=world_get_ctg(b->x+j ,b->y+b->h+i*sgn_vy); + else + typetemp=world_get_ctg(b->x+j ,b->y+i*sgn_vy); + if (typetemp==CTG_DEATH || typetemp==CTG_SOIL) + { + b->y+=(i-1)*sgn_vy; + b->vy=0; + return; + } + + } + } + } + b->y+=b->vy; + } + b->vy-=b->gravity; + +} + +int box_move(box_t * b) +{ + //velx + move_x(b); + move_y(b); +} + +int box_jump(box_t * b, int height) +{ + int sgn_vx=-sgn(b->gravity)*sgn(height); + if (sgn_vx) + { + int i=sgn_vx; + int previous_tested_y=-545; + int type=CTG_EMPTY; + for (int j=0; jh; j++) + { + int t=(b->y+j)/8; + if (t!=previous_tested_y) + { + previous_tested_y=t; + int typetemp; + if (sgn_vx>0) + typetemp=world_get_ctg(b->x+b->w+i*sgn_vx,b->y+j); + else + typetemp=world_get_ctg(b->x+i*sgn_vx,b->y+j); + if (typetemp==CTG_DEATH || typetemp==CTG_SOIL) + { + b->x+=(i-1)*sgn_vx; + b->vx=0; + return; + } + + } + } + b->vx=height; + } +} \ No newline at end of file diff --git a/src/box.h b/src/box.h new file mode 100644 index 0000000..abfa177 --- /dev/null +++ b/src/box.h @@ -0,0 +1,21 @@ +#ifndef BOX_H +#define BOX_H + +typedef struct +{ + int x; + int y; + + int w; + int h; + + int vx; + int vy; + + int gravity; +} box_t; + +int box_move(box_t * b); +int box_jump(box_t * b, int height); // hauteur du saut + +#endif \ No newline at end of file diff --git a/src/keyboard.c b/src/keyboard.c new file mode 100644 index 0000000..b6f181a --- /dev/null +++ b/src/keyboard.c @@ -0,0 +1,50 @@ +#include "keyboard.h" +#include "mario.h" +#include + +mkey_t keys[6]={0}; + +void update_keyboard() +{ + key_event_t e; + e=pollevent(); + while(e.type!=KEYEV_NONE) + { + mkey_t k = MK_NONE; + + if(e.key==KEY_LEFT) + k=MK_LEFT; + if(e.key==KEY_RIGHT) + k=MK_RIGHT; + + if(e.key==KEY_SHIFT) + k=MK_JUMP1; + if(e.key==KEY_UP) + k=MK_JUMP2; + + if(e.key==KEY_DOWN) + k=MK_LITTLE; + + if(e.key==KEY_ALPHA) + k=MK_RUN; + + if(keydown(KEY_EXIT)) + { + global_quit=1; + return; + } + + if (k!=MK_NONE) + { + if (e.type==KEYEV_DOWN) + { + keys[k]=1; + } + if (e.type==KEYEV_UP) + { + keys[k]=0; + } + } + e=pollevent(); + } +} \ No newline at end of file diff --git a/src/keyboard.h b/src/keyboard.h new file mode 100644 index 0000000..19ff66f --- /dev/null +++ b/src/keyboard.h @@ -0,0 +1,18 @@ +#ifndef KEYBOARD_CUSTOM_H +#define KEYBOARD_CUSTOM_H + +typedef enum +{ + MK_NONE=-1, + MK_LEFT, + MK_RIGHT, + MK_JUMP1, + MK_JUMP2, + MK_RUN, + MK_LITTLE +} mkey_t; +extern mkey_t keys[6]; + +void update_keyboard(); + +#endif \ No newline at end of file diff --git a/src/mario.c b/src/mario.c new file mode 100644 index 0000000..84270a4 --- /dev/null +++ b/src/mario.c @@ -0,0 +1,76 @@ +#include "mario.h" +#include "tile.h" +#include "world.h" +#include +#include +#include "keyboard.h" +#include "box.h" + +extern image_t img_mariosmall; +int numero_frame=0; +tileset_t mario_small={&img_mariosmall, 8,8, 1}; + +pnj mario= +{ + {26,17,8,8,0,0,1}, + M_SMALL, + M_RIGHT1, M_WALK, + 0 +}; + +void mario_draw() +{ + if (mario.size==M_SMALL) + draw_tile(mario.p.x-world_get_real_x0(mario.p.x), mario.p.y-world_get_real_y0(mario.p.y)+2, &mario_small, mario.type1, mario.type2); +} + +int test_sol_le_plus_proche(int x, int y) +{ + int distance=0; + int t=0; + while (t==0) + { + int type_sol = world_get_ctg(x, y-1); + if (type_sol==CTG_SOIL) + t=1; + if (type_sol==CTG_DEATH) + return distance+1; + type_sol = world_get_ctg(x+7, y-1); + if (type_sol==CTG_SOIL) + t=1; + if (type_sol==CTG_DEATH) + return distance+1; + y--; + distance++; + } + return distance; +} + +int global_quit=0; +void mario_move() +{ + update_keyboard(); + int jump = keys[MK_JUMP1] || keys[MK_JUMP2]; + mario.p.vx = keys[MK_RIGHT] - keys[MK_LEFT]; +/* + if (hitbox(mario.p.x, mario.p.y-1, 8, 8)==CTG_SOIL) + { + if (jump) + { + if (mario.running==1) + mario.vel_y=6; + else + mario.vel_y=5; + } + else + { + mario.vel_y=0; + } + } + else if (mario.vel_y>=-1) + mario.vel_y--; +*/ + + box_move(&mario.p); +} + diff --git a/src/mario.h b/src/mario.h new file mode 100644 index 0000000..9323def --- /dev/null +++ b/src/mario.h @@ -0,0 +1,39 @@ +#ifndef MARIO_H +#define MARIO_H + +#define M_SMALL 0 +#define M_BIG 1 + +#define M_LEFT1 0 +#define M_LEFT2 1 +#define M_RIGHT1 2 +#define M_RIGHT2 3 + +#define M_WALK 0 +#define M_LITTLE 1 +#define M_SWIM 2 + +#include "box.h" + +typedef struct +{ + box_t p; + int size; // small, big + int type1; // left1 left2, right1, right2, + int type2; // jump, down... + int running; +} pnj; +extern pnj mario; +extern int coins; + +void mario_draw(); + +//void mario_physics(); + +void mario_jump(); + +void mario_move(); + +extern int global_quit; +extern int numero_frame; +#endif \ No newline at end of file diff --git a/src/sprite.c b/src/sprite.c new file mode 100644 index 0000000..73f1b85 --- /dev/null +++ b/src/sprite.c @@ -0,0 +1,17 @@ +#include "sprite.h" +#include "world.h" + +int hitbox(int x, int y, int width, int height) +{ + height--; + width--; + int type=CTG_EMPTY; + for (int i=0; i<=height; i++) + { + if (world_get_ctg(x+width, y+i)==CTG_SOIL || world_get_ctg(x, y+i)==CTG_SOIL) + type=CTG_SOIL; + if (world_get_ctg(x+width, y+i)==CTG_DEATH || world_get_ctg(x, y+i)==CTG_DEATH) + return CTG_DEATH; + } + return type; +} \ No newline at end of file diff --git a/src/sprite.h b/src/sprite.h new file mode 100644 index 0000000..2d31a85 --- /dev/null +++ b/src/sprite.h @@ -0,0 +1,7 @@ +#ifndef SPRITE_H +#define SPRITE_H + +int hitbox(int x, int y, int width, int height); + + +#endif \ No newline at end of file