Skip to content

Commit

Permalink
Support for OS 4.5.4.48 and 5.3.0.564
Browse files Browse the repository at this point in the history
- Improve idc/Readme a bit
- Minor improvements in mkSyscalls.php
- Fix typo in name of OS_cascx2-5.2.0.711.idc
- Change nl_is_cx2 to look at HW regs instead, the version index isn't
  contiguous anymore
- Add support to the OSs to installer-5.2
- Initialize "s" only once
- Don't start the timer from on.paint, but on startup and then each second
- Add a message on install failure
  • Loading branch information
Vogtinator committed Apr 5, 2021
1 parent fe04e49 commit 3e57e9b
Show file tree
Hide file tree
Showing 22 changed files with 5,121 additions and 128 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Ndless r2016 for TI-Nspire OS <= v5.2.0.771
Ndless r2017 for TI-Nspire OS <= v5.3.0.564
===========================================

Installing Ndless on your calculator makes it possible to run assembly programs.
Expand Down Expand Up @@ -30,22 +30,22 @@ For more in-depth info, visit the wiki:
Quick guide
===========

OS 5.2.0.771 <img src="https://i.imgur.com/QB9eogm.png" align="right">
OS 5.2.0.771 + 5.3.0.564 <img src="https://i.imgur.com/kozAxpP.png" align="right">
--------

Prerequisites: OS 5.2.0.771 on CX II, CX II-T or CX II CAS
Prerequisites: OS 5.2.0.771 or 5.3.0.564 on CX II, CX II-T or CX II CAS

* Transfer ndless_installer_5.2.0.tns into a folder named "ndless" (top-level)
* Transfer ndless_installer_5.2.0-5.3.0.tns into a folder named "ndless" (top-level)
* Transfer ndless_resources.tns into the same folder
* Open the installer and wait
* Have fun!

OS 4.5.3 <img src="https://i.imgur.com/4CDztSP.png" align="right">
OS 4.5.3.14 + 4.5.4.48 <img src="https://i.imgur.com/uuO3ue9.png" align="right">
--------

Prerequisites: OS 4.5.3.14 on CX or CX CAS
Prerequisites: OS 4.5.3.14 or 4.5.4.48 on CX or CX CAS

* Transfer ndless_installer_4.5.3.tns into a folder named "ndless" (top-level)
* Transfer ndless_installer_4.5.3-4.5.4.tns into a folder named "ndless" (top-level)
* Transfer ndless_resources.tns into the same folder
* Open the installer and wait
* Have fun!
Expand Down Expand Up @@ -122,7 +122,7 @@ For CX and CX CAS please install 3.9.1.
OS 3.6 <img src="http://www.mirari.fr/NwM1" align="right">
------

Prerequisites: OS 3.6
Prerequisites: OS 3.6

* Transfer ndless_installer.tns and ndless_resources.tns into a folder named "ndless" (top-level)
* Open the installer
Expand Down
10 changes: 5 additions & 5 deletions ndless/src/installer-5.2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GXXFLAGS := $(GCCFLAGS) -std=c++11 -fno-exceptions -fno-rtti
LFLAGS := -nostdlib
DISTDIR := ../../calcbin

all: $(DISTDIR)/ndless_installer_5.2.0.tns $(DISTDIR)/ndless_installer_4.5.3.tns
all: $(DISTDIR)/ndless_installer_5.2.0-5.3.0.tns $(DISTDIR)/ndless_installer_4.5.3-4.5.4.tns

%.o: %.c
$(GCC) $(GCCFLAGS) -c $< -o $@
Expand All @@ -33,15 +33,15 @@ Problem1_mid.xml: ndless_installer.bin
../tools/LuaBin/luabin ndless_installer.bin - installer > $@

# Those can't be built simultaneously due to using "Problem1.xml" as filename
$(DISTDIR)/ndless_installer_5.2.0.tns: $(DISTDIR)/ndless_installer_4.5.3.tns
$(DISTDIR)/ndless_installer_5.2.0-5.3.0.tns: $(DISTDIR)/ndless_installer_4.5.3-4.5.4.tns

$(DISTDIR)/ndless_installer_%.tns: Problem1_top.xml Problem1_mid.xml Problem1_bot_%.xml
$(DISTDIR)/ndless_installer_%.tns: Problem1_top.xml Problem1_mid.xml Problem1_bot.xml
mkdir -p $(DISTDIR)
cat Problem1_top.xml Problem1_mid.xml Problem1_bot_$*.xml > Problem1.xml
cat Problem1_top.xml Problem1_mid.xml Problem1_bot.xml > Problem1.xml
../../../ndless-sdk/tools/luna/luna Problem1.xml $@
rm Problem1.xml

test: $(DISTDIR)/ndless_installer_5.2.0.tns
test: $(DISTDIR)/ndless_installer_5.2.0-5.3.0.tns
firebird-send $^ ndless

clean:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
function on.paint(gc)
gc:setFont(&quot;sansserif&quot;, &quot;b&quot;, 15)
drawXCenteredString(gc, &quot;Ndless for OS 4.5.3.14&quot;, 30)
drawXCenteredString(gc, &quot;Ndless for OS:&quot;, 10)
gc:setFont(&quot;sansserif&quot;, &quot;b&quot;, 12)
drawXCenteredString(gc, &quot;4.5.3.14&quot;, 40)

drawXCenteredString(gc, &quot;4.5.4.48&quot;, 60)
drawXCenteredString(gc, &quot;5.2.0.771&quot;, 90)
drawXCenteredString(gc, &quot;5.3.0.564&quot;, 110)

gc:setFont(&quot;sansserif&quot;, &quot;r&quot;, 10)

if ndless then
gc:drawString(&quot;Ndless is already installed!&quot;, 5, 60, &quot;top&quot;)
gc:drawString(&quot;Ndless is already installed!&quot;, 5, 150, &quot;top&quot;)
return
end

gc:setColorRGB(0, 0, 0)
gc:fillRect(0, 100, platform.window:width(), 2)

gc:setFont(&quot;sansserif&quot;, &quot;r&quot;, 9)
gc:drawString(&quot;(this line is just deco)&quot;, 198 + 0, 53 + 30, &quot;top&quot;)
gc:drawString(&quot;Installing ndless...&quot;, 5, 150, &quot;top&quot;)

s = ""
s = string.rep(installer, 768)
if attempt &gt; 2 then
gc:drawString(&quot;Several attempts failed,&quot;, 5, 170, &quot;top&quot;)
gc:drawString(&quot;missing ndless_resources.tns?&quot;, 5, 185, &quot;top&quot;)
end
end

timer.start(0.2)
s = ""
s = string.rep(installer, 768)
if not ndless then
timer.start(0.3)
end

function on.timer()
Expand All @@ -32,8 +41,8 @@
shape = physics.CircleShape(body, 1, physics.Vect(0, 0))
space:addShape(shape)

a = ""
x = string.pack("u32", 0x13000000)
local a = ""
local x = string.pack("u32", 0x13000000)

function preSolveCb()
space:removeCollisionHandler(0, 0)
Expand All @@ -45,6 +54,10 @@
end
space:addCollisionHandler(0, 0, {preSolve = preSolveCb})
space:step(1)

attempt = attempt + 1
platform.window:invalidate()
timer.start(1)
end
</sc:script>
</wdgt>
Expand Down
52 changes: 0 additions & 52 deletions ndless/src/installer-5.2/Problem1_bot_5.2.0.xml

This file was deleted.

2 changes: 1 addition & 1 deletion ndless/src/installer-5.2/Problem1_top.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
</sc:md>
<sc:script version="33817092" id="0">
platform.apiLevel = &quot;2.7&quot;
attempt = 0

local function drawXCenteredString(gc, str, y)
gc:drawString(str, (platform.window:width() - gc:getStringWidth(str)) / 2, y, &quot;top&quot;)
end

function on.paint(gc)
37 changes: 36 additions & 1 deletion ndless/src/installer-5.2/stage0.S
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.text
_start: .global _start
.org 0 @ Actually not, but this is PIC
.rep 1024
.rep 1152
b begin
.endr

Expand Down Expand Up @@ -112,6 +112,41 @@ nextos:
.word 0x1043AF3C @ fread
.word 0x1043A5B8 @ fclose

.word 0x10417DA0 @ 5.3.0.564 CAS CX II
.word 0x1048CB78 @ stat
.word 0x1047E988 @ malloc
.word 0x104847DC @ fopen
.word 0x10484980 @ fread
.word 0x1048425C @ fclose

.word 0x10417460 @ 5.3.0.564 non-CAS CX II-T
.word 0x1048C238 @ stat
.word 0x1047E048 @ malloc
.word 0x10483E9C @ fopen
.word 0x10484040 @ fread
.word 0x1048391C @ fclose

.word 0x10416CC0 @ 5.3.0.564 non-CAS CX II
.word 0x1048BA98 @ stat
.word 0x1047D8A8 @ malloc
.word 0x104836FC @ fopen
.word 0x104838A0 @ fread
.word 0x1048317C @ fclose

.word 0x103B4130 @ 4.5.4.48 CAS CX
.word 0x10444168 @ stat
.word 0x104365B8 @ malloc
.word 0x1043BEA8 @ fopen
.word 0x1043C04C @ fread
.word 0x1043B6C8 @ fclose

.word 0x103B3A10 @ 4.5.4.48 non-CAS CX
.word 0x10443A00 @ stat
.word 0x10435E98 @ malloc
.word 0x1043B788 @ fopen
.word 0x1043B92C @ fread
.word 0x1043AFA8 @ fclose

endos:
.word 0x0

Expand Down
2 changes: 1 addition & 1 deletion ndless/src/resources/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GENZEHN = genzehn

GCCFLAGS = -Wall -Wextra -W -marm
LDFLAGS = -Wl,-e,main,--gc-sections
ZEHNFLAGS = --name "ndless_resources" --include-bss --uses-lcd-blit true --version 2016
ZEHNFLAGS = --name "ndless_resources" --include-bss --uses-lcd-blit true --version 2017

ifeq ($(DEBUG),FALSE)
GCCFLAGS += -Os
Expand Down
20 changes: 16 additions & 4 deletions ndless/src/resources/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ static unsigned const ploader_hook_addrs[NDLESS_MAX_OSID+1] =
0x1000AD90, 0x1000AD8C,
0x1000ADAC, 0x1000ADB4,
0x1000ADAC, 0x1000ADE4,
0x1002612C, 0x10026144, 0x10026164};
0x1002612C, 0x10026144, 0x10026164,
0x1000B034, 0x1000B074,
0x10028168, 0x100282A4, 0x100282F8};

// initialized at load time. Kept in resident program memory, use nl_is_3rd_party_loader to read it.
static BOOL loaded_by_3rd_party_loader = FALSE;
Expand All @@ -66,6 +68,8 @@ static unsigned const end_of_init_addrs[NDLESS_MAX_OSID+1] =
0x10012E54, 0x10012E00,
0x10012E8C, 0x10012E44,
0x0, 0x0,
0x0, 0x0, 0x0,
0x0, 0x0,
0x0, 0x0, 0x0};

// OS-specific
Expand All @@ -83,7 +87,9 @@ static unsigned const error_msg_patch_addrs[NDLESS_MAX_OSID+1] =
0x10125670, 0x10125508,
0x10125B58, 0x10125A7C,
0x10126084, 0x10125FB4,
0x1015CC6C, 0x1015CE10, 0x1015CDFC};
0x1015CC6C, 0x1015CE10, 0x1015CDFC,
0x1012656C, 0x101264F4,
0x101600AC, 0x10160354, 0x1016038C};

// OS-specific (only set if the installer document needs to be closed)
// close_document
Expand All @@ -100,7 +106,9 @@ static unsigned const close_document_addrs[NDLESS_MAX_OSID+1] =
0x1000b240, 0x1000b23c,
0x0, 0x0,
0x1000B278, 0x1000B2B0,
0x100265D4, 0x10026614, 0x1002660C};
0x100265D4, 0x10026614, 0x1002660C,
0x1000B4E4, 0x1000B524,
0x10028610, 0x10028770, 0x100287A0};

void ins_uninstall(void) {
ut_calc_reboot();
Expand Down Expand Up @@ -214,7 +222,9 @@ const unsigned ins_successmsg_hook_addrs[NDLESS_MAX_OSID+1] =
0x100310FC, 0x100310A4,
0x100311C4, 0x10031164,
0x100311C0, 0x10031198,
0x1004AD6C, 0x1004ADF4, 0x1004ADB4};
0x1004AD6C, 0x1004ADF4, 0x1004ADB4,
0x1003167C, 0x10031660,
0x1004CE70, 0x1004D018, 0x1004D00C};

// OS-specific
// number of the HOME icon
Expand All @@ -231,6 +241,8 @@ const unsigned ins_successmsg_icon[NDLESS_MAX_OSID+1] =
0x172, 0x172,
0x172, 0x172,
0x172, 0x172,
0x14F, 0x14F, 0x14F,
0x18C, 0x18C,
0x14F, 0x14F, 0x14F};

void ins_install_successmsg_hook(void) {
Expand Down
8 changes: 6 additions & 2 deletions ndless/src/resources/lcd_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ static uint32_t lcd_mirror_ptr[NDLESS_MAX_OSID+1] = {0, 0, 0, 0, 0, 0,
0x113496E4, 0x113B16E4,
0x1134D6E4, 0x113B16E4,
0x1134D6E4, 0x113B16E4,
0x0, 0x0, 0x0,
0x1134D6E4, 0x113B56E4,
0x0, 0x0, 0x0};

static uint32_t *real_lcdc = (uint32_t*) 0xE0000000;
Expand Down Expand Up @@ -152,12 +154,14 @@ static uint32_t spi_send_ptr[NDLESS_MAX_OSID+1] = {0, 0, 0, 0, 0, 0,
0x10023D08, 0x10023C98,
0x10023D2C, 0x10023CC8,
0x10023D2C, 0x10023CF8,
0x100106F4, 0x100106F4, 0x100106F4};
0x100106F4, 0x100106F4, 0x100106F4,
0x100241B4, 0x10024188,
0x10010734, 0x10010734, 0x10010734};

static void spi_send(uint8_t cmd, const uint8_t *data, unsigned int data_count)
{
// Different method signatures
if(ut_os_version_index < 34)
if(!nl_is_cx2())
{
void (*os_spi_send)(uint16_t, const uint8_t *, int) = (typeof(os_spi_send))spi_send_ptr[ut_os_version_index];
os_spi_send(cmd, data, data_count);
Expand Down
8 changes: 6 additions & 2 deletions ndless/src/resources/luaext.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ static unsigned const interp_startup_addrs[NDLESS_MAX_OSID+1] =
0x10141830, 0x10141A50,
0x101420E0, 0x1014241C,
0x10142838, 0x10142B7C,
0x10178748, 0x101788F4, 0x10178E38};
0x10178748, 0x101788F4, 0x10178E38,
0x10142D40, 0x101430F4,
0x1017BBCC, 0x1017BE74, 0x1017C40C};

// At the beginning of lua_close
// OS-specific
Expand All @@ -101,7 +103,9 @@ static unsigned const interp_shutdown_addrs[NDLESS_MAX_OSID+1] =
0x10871420, 0x10871A6C,
0x10872178, 0x108728E4,
0x10872BB4, 0x10873370,
0x108A6D1C, 0x108A73EC, 0x108A8104};
0x108A6D1C, 0x108A73EC, 0x108A8104,
0x10873B2C, 0x108742E4,
0x108AE9D8, 0x108AF1B4, 0x108AFEF4};

void lua_install_hooks(void) {
if(interp_startup_addrs[ut_os_version_index] != 0)
Expand Down
6 changes: 3 additions & 3 deletions ndless/src/resources/ndless_version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define NDLESS_VERSION 52
#define NDLESS_REVISION 2016
#define NDLESS_MAX_OSID 36
#define NDLESS_VERSION 53
#define NDLESS_REVISION 2017
#define NDLESS_MAX_OSID 41
4 changes: 3 additions & 1 deletion ndless/src/resources/ploaderhook.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ static const uintptr_t tct_current_thread_addrs[NDLESS_MAX_OSID+1] =
0x103B2BAC, 0x103B31AC,
0x103B3B1C, 0x103B423C,
0x103B436C, 0x103B4A8C,
0x1040F760, 0x1040FD70, 0x10410640};
0x1040F760, 0x1040FD70, 0x10410640,
0x103B4D5C, 0x103B547C,
0x10417F50, 0x104186F0, 0x10419030};

/* Expand the stack of the currently running Task by 128K */
static bool expand_stack()
Expand Down
Loading

0 comments on commit 3e57e9b

Please sign in to comment.