commit d5efb858613e7b45f1e4d6b9cda7691595366daf Author: Lailouezzz Date: Sun Dec 29 22:50:52 2019 +0100 First commit diff --git a/docs/files/code/do_syscall.S b/docs/files/code/do_syscall.S new file mode 100644 index 0000000..571de3f --- /dev/null +++ b/docs/files/code/do_syscall.S @@ -0,0 +1,6 @@ + mov.l syscall_number, r0 # Store the syscall ID in r0 + mov.l do_syscall, r2 # Set r2 to the syscall function + jmp @r2 # jump to r2 (syscall) + nop # delayed jump so do nothing +.align 4 # do_syscall is already aligned but I prefered +do_syscall: .long 0x80010070 \ No newline at end of file diff --git a/docs/files/osrecover.sh4 b/docs/files/osrecover.sh4 new file mode 100644 index 0000000..f9e16a2 Binary files /dev/null and b/docs/files/osrecover.sh4 differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..73953cc --- /dev/null +++ b/docs/index.md @@ -0,0 +1,31 @@ +# Index + +`main.c :` +```c +int main(void) +{ + printf("Hello welcome to Lailouezzz CASIO documentation ! :)"); + return; +} +``` + +##################################### + +`gcc main.cpp -o welcome` + +`./welcome` + +------------------------------------- + +## Hello welcome to Lailouezzz CASIO documentation ! :) + +- [All files (ressources)](files/) +- (Section being written) : [OSRECOVER Protocol](osrecover.md) +- (Section being written) : [Syscalls (FX-9860g)](syscalls_fx9860g.md) + +------------------------------------- + +### Download document as pdf + +- Download link here. + diff --git a/docs/osrecover.md b/docs/osrecover.md new file mode 100644 index 0000000..4b9fed4 --- /dev/null +++ b/docs/osrecover.md @@ -0,0 +1,9 @@ +# OSRECOVER.sh4 ([simlo](/simlo/)) Documentation + +In this section I describe the best that I can the osrecover.sh4 protocol. + +------------------------------------- + +## Downloads + +You can download osrecover.sh4 {{downloadlink("here", "files/osrecover.sh4")}}. \ No newline at end of file diff --git a/docs/syscalls/example/getproductid_example.c b/docs/syscalls/example/getproductid_example.c new file mode 100644 index 0000000..e69de29 diff --git a/docs/syscalls/system_info.md b/docs/syscalls/system_info.md new file mode 100644 index 0000000..155e4ff --- /dev/null +++ b/docs/syscalls/system_info.md @@ -0,0 +1,20 @@ +# System info syscalls + +Description explaination of some system info syscalls. + +## Syscall 0x0178‬ : char * GetProductID() + +### Return + +return the product ID serie (pointer to a string of 8 `char` ended by `0xFF`) + +0 if the product ID is not found. + +### Example + +TODO + +---------- + +## Syscall 0x02ED : void GetProtocolVersion(char * out_str) + diff --git a/docs/syscalls_fx9860g.md b/docs/syscalls_fx9860g.md new file mode 100644 index 0000000..fb5ef64 --- /dev/null +++ b/docs/syscalls_fx9860g.md @@ -0,0 +1,22 @@ +# Some FX-9860g syscalls + +## How to call a syscall ? + +The calling convention to access the system calls (syscall), is to +jump to 0x80010070 with the syscall number in r0 : + +{{includecode("files/code/do_syscall.S", "asm")}} + +------------------------------------------------- + +## Syscalls table + +| Name | | | | ID | +| :------------------------------------------------------------------------------------------- | --- | --- | --- | ------ | +| [char * GetProductID()](syscalls/system_info.md) | | | | 0x0178 | +| [void GetProtocolVersion(char * out_str)](syscalls/system_info.md) | | | | 0x02ED | +| [void System_GetOSVersion(char * version) (simlo)](../../simlo/chm/v20/fx_legacy_System.HTM) | | | | 0x02EE | +| [void GetSystemInfo(char * out_str)](syscalls/system_info.md) | | | | 0x02EF | +| [void GetEnvironmentID(char * out_str)](syscalls/system_info.md) | | | | 0x02F5 | +| [void GetCpuID(char * out_str)](syscalls/system_info.md) | | | | 0x02F6 | +| void PrintFull(ID1, ID2, ID3) | | | | 0x0A51 | \ No newline at end of file diff --git a/macros_def.py b/macros_def.py new file mode 100644 index 0000000..ece07be --- /dev/null +++ b/macros_def.py @@ -0,0 +1,50 @@ +import html +import os + + +def declare_variables(variables, macro): + @macro + def includecode(fn: str, flavor: str = ""): + """ + Load code from a file and save as a preformatted code block. + If a flavor is specified, it's passed in as a hint for syntax highlighters. + + Example usage in markdown: + + {{includecode("code/myfile.py", "python")}} + + """ + docs_dir = variables.get("docs_dir", "docs") + fn = os.path.abspath(os.path.join(docs_dir, fn)) + if not os.path.exists(fn): + return f"""File not found: {fn}""" + with open(fn, "r") as f: + return ( + f"""```{flavor}\n{f.read()}\n```""" + ) + + @macro + def includemd(fn: str): + """ + Load markdown from files external to the mkdocs root path. + Example usage in markdown: + + {{includemd("../../README.md")}} + + """ + docs_dir = variables.get("docs_dir", "docs") + fn = os.path.abspath(os.path.join(docs_dir, fn)) + if not os.path.exists(fn): + return f"""File not found: {fn}""" + with open(fn, "r") as f: + return f.read() + + @macro + def downloadlink(contain: str, url: str): + """ + Create a download link example : + + {{downloadlink("Download readme", "../../README.md")}} + + """ + return f"""{contain}""" \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..a626110 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,22 @@ +site_name: Lailouezzz CASIO documentation +nav: + - Index: index.md + - OSRECOVER Protocol: osrecover.md + - Syscalls (FX-9860g): + - syscalls_fx9860g.md + - syscalls/system_info.md + +theme: + name: 'material' +markdown_extensions: + - codehilite + + +plugins: + - search + - pdf-export: + media_type: print + combined: true + combined_output_path: files/doc.pdf + - macros: + module_name: macros_def