Skip to content

Commit 42b3785

Browse files
committed
Fix Find panel in toolkit
also some typos commented out code to follow newton script calls better help text
1 parent 74751be commit 42b3785

File tree

9 files changed

+249
-82
lines changed

9 files changed

+249
-82
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Copyright 2003-2022 by Paul Guyot ([email protected]) and others.
66
# ==============================
77

8-
cmake_minimum_required(VERSION 3.15)
8+
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
99

1010
project( "Einstein" VERSION "2024.4.22" )
1111

Emulator/JIT/Generic/TJITGenericROMPatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ class TJITGenericPatchNativeCall : public TJITGenericPatchObject
279279
\brief This Macro makes it easy to replace code anywhere in ROM.
280280
281281
The original ARM command at the given address is replaced with a call into
282-
native code. The 'C' code can immediatly follow the Macro. The function must
282+
native code. The 'C' code can immediately follow the Macro. The function must
283283
end in `return ioUnit;` if the next instruction is to be executed, or in
284284
`return 0L;` if the PC changed and execution shall continue elsewhere.
285-
Two prameters are available to the function: 'JITUnit* ioUnit' and
285+
Two parameters are available to the function: 'JITUnit* ioUnit' and
286286
'TARMProcessor* ioCPU'.
287287
288288
The sample code replaces this sequence that returns

Emulator/Screen/TScreenManager.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,29 @@
2222
// ==============================
2323

2424
//
25-
// The original Newton MP2x00 is an LCD screen with 480x320 resolution, 16
26-
// shades of gray, and a backlight. The resistive touchscreen is glued to the
27-
// front of the display. The viewing area of the display is 129mm x 87mm.
28-
// The screen diagonal is about 6.1 inches.
25+
// The original Newton MP2x00 is a black and white LCD screen with 480x320
26+
// resolution and a removable backlight. Screen data is stored at 16 shades of
27+
// gray in memory. The DMA hardware displays those shades of gray by turning
28+
// pixels on and off at various pulse widths and pattern.
29+
// The resistive touchscreen is glued to the front of the display. The viewing
30+
// area of the display is 129mm x 87mm.
31+
// The screen diagonal is 156mm or 6.15 inches.
2932
//
3033
// Markings on the display are 4C112522AH52, LCDFAT650MC, an M650-LOA, 93 11 18
3134
// LM48019K STN480X C, 97H00928 a, 5.4"
3235
//
33-
// The display data is sent via a AWM 2896 80C VW 1 flatband cable (20pin).
36+
// The display data is sent via a AWM 2896 80C VW 1 flat ribbon cable (20pin).
3437
// Backlight and touchscreen use additional wires.
3538
//
3639
// ??? Sharp LM5H40TA LQ057V3DG02, similar (same?) pinout
3740
// SHARP 5.5 inch display panel recommendation:
3841
// LS055R1SX04 LS055R1SX03 LS055T1SX01 LS055R3SX01 LQ055K3SX02 LQ055T3SX02 LS055R1SC01 LQ055T3SX03 LQ055T3SX02Z LM32C041 LS055T3SX05 LS055D1SX02 LS055R3SX01 (G) LM6Q32 LS055R1SX08 LS055T1SX01A LS055D1SX05(G) LM6Q401 LM32C04P LM6Q40A LQ055W1GC01 LS055T1SX10 LQ055T3SX02Z(G) LS055D1SX04 LS055T3SX13 LS055T3SX09 LQ055T3SX05 LS055T1SX13 LQ055W1GC01Z LM5H40TA LM5H40TB LM6Q31 LM6Q33 LM6Q35 LM6Q40 LQ055T1SX05 LQ055T3SX02(G) LS055T3SX01(G) LS055T1SX09
3942
//
43+
// 6 inch e-ink: ED060SC7 EPD ($28, Kindle 3 D009001 spare part)
44+
// 6 inch e-ink: GDE060BA-T, GDE060BAFL-T (front light, touch), 600x800, 4:3,
45+
// parallel port with 20+ data pins (cut to 14?!)
46+
// 122.4x90.6mm active, 138.4x101.8 outline
47+
//
4048

4149
#include "TScreenManager.h"
4250

Toolkit/TFLTerminalPanel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ TFLTile::TFLTile(int x, int y, int w, int h, const char* label) :
129129
void
130130
TFLTile::resize(int x, int y, int w, int h)
131131
{
132-
Fl_Widget* monitor = child(2);
133-
int mh = monitor->h();
132+
// Fl_Widget* monitor = child(2);
133+
// int mh = monitor->h();
134134
Fl_Tile::resize(x, y, w, h);
135-
child(1)->resize(x, y, w, h - mh);
136-
child(2)->resize(x, y + h - mh, w, mh);
137-
init_sizes();
135+
// child(1)->resize(x, y, w, h - mh);
136+
// child(2)->resize(x, y + h - mh, w, mh);
137+
// init_sizes();
138138
}
139139

140140
// ============================================================================ //

Toolkit/TFLToolkitUI.fl

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ if (mi)
7373
Function {CreateToolkitWindow(int x, int y)} {open
7474
} {
7575
Fl_Window wToolkitWindow {open
76-
xywh {282 267 720 600} type Double resizable
76+
xywh {408 471 720 600} type Double resizable
7777
code0 {wToolkitWindow->position(x, y);} visible
7878
} {
7979
Fl_Menu_Bar wToolkitMenubar {open
@@ -174,7 +174,7 @@ Function {CreateToolkitWindow(int x, int y)} {open
174174
}
175175
MenuItem {} {
176176
label {ROM Patcher}
177-
callback {gToolkit->LoadSampleCode(4);} selected
177+
callback {gToolkit->LoadSampleCode(4);}
178178
xywh {40 40 100 20}
179179
}
180180
}
@@ -262,17 +262,16 @@ Function {CreateToolkitWindow(int x, int y)} {open
262262
}
263263
MenuItem {} {
264264
label {Open Project...}
265-
xywh {0 0 100 20} deactivate
266-
}
267-
MenuItem {} {
268-
label {Decompile Package...}
269-
callback {gToolkit->UserActionDecompilePkg();}
270-
xywh {0 0 100 20}
265+
xywh {0 0 100 20} deactivate divider
271266
}
272267
MenuItem {} {
273268
label {Add File...}
274269
xywh {0 0 100 20} deactivate
275270
}
271+
MenuItem {} {
272+
label {Remove File}
273+
xywh {0 0 100 20} deactivate divider
274+
}
276275
MenuItem {} {
277276
label Build
278277
callback {gToolkit->UserActionBuild();}
@@ -296,14 +295,14 @@ Function {CreateToolkitWindow(int x, int y)} {open
296295
MenuItem {} {
297296
label {Process Earlier}
298297
callback {gToolkit->AppInstall();}
299-
xywh {16 16 100 20} shortcut 0x400032 deactivate
298+
xywh {16 16 100 20} shortcut 0xffbf deactivate
300299
}
301300
MenuItem {} {
302301
label {Process Later}
303302
callback {gToolkit->AppBuild();
304303
gToolkit->AppInstall();
305304
gToolkit->AppRun();}
306-
xywh {16 16 100 20} shortcut 0x400072 deactivate divider
305+
xywh {16 16 100 20} shortcut 0xffc0 deactivate divider
307306
}
308307
MenuItem {} {
309308
label {Project Settings...}
@@ -624,6 +623,11 @@ gToolkit->AppRun();}
624623
tkHelpDialog->show();}
625624
xywh {12 12 100 20}
626625
}
626+
MenuItem {} {
627+
label {Decompile Package...}
628+
callback {gToolkit->UserActionDecompilePkg();}
629+
xywh {0 0 100 20}
630+
}
627631
MenuItem {} {
628632
label {About Toolkit...}
629633
xywh {0 0 100 20} deactivate
@@ -711,7 +715,7 @@ tkHelpDialog->show();}
711715
Fl_Button wToolkitFindHide {
712716
label X
713717
callback {gToolkit->UserActionFindHide();}
714-
xywh {701 58 18 18} box FLAT_BOX down_box DOWN_BOX color 51 labelsize 11 hide
718+
xywh {701 58 18 18} box FLAT_BOX down_box DOWN_BOX color 51 labelsize 11
715719
}
716720
Fl_Button wToolkitReplaceNext {
717721
label Replace
@@ -728,11 +732,8 @@ tkHelpDialog->show();}
728732
xywh {0 114 720 486} resizable
729733
class TFLTile
730734
} {
731-
Fl_Box wTileResizable {
732-
xywh {20 150 380 414} hide resizable
733-
}
734-
Fl_Group wScriptPanel {
735-
xywh {0 114 720 386}
735+
Fl_Group wScriptPanel {selected
736+
xywh {0 114 720 386} resizable
736737
class TFLScriptPanel
737738
} {}
738739
Fl_Text_Display wToolkitTerminal {

Toolkit/TTkHelpText.html

Lines changed: 85 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,112 @@ <h1>NewtonScript Extensions</h1>
55

66
<h2>Globals</h2>
77

8-
<b>MakeBinaryFromString(str, sym)</b>: Generate a binary object from an ASCII string.
9-
<br>
10-
<b>MakeBinaryFromARM(ARM_Instructions)</b>: Generate a binary function from ARM assembler text.
11-
Lines should be separated with \n characters.
12-
<br>
13-
<b>MakeBinaryFromARMFile(ARM_Assembler_Filename)</b>:
14-
<br>
15-
<b>PatchFileFromARM(ARM_Instructions, filename)</b>:
16-
<br>
17-
<b>AddStepForm(mainView, scrollClipper)</b>:
18-
<br>
19-
StepDeclare(mainView, scrollClipper, 'scrollClipper)</b>:
20-
<br>
8+
<b>MakeBinaryFromString(str, sym)</b>: Generate a binary object with the given
9+
symbol from an Unicode text. The input format is UTF-8. The format of the binary
10+
object is UTF-8 for newt/64, but it is converted to UTF-16 when written into
11+
a 32 bit package or streaming package, and the symbol is <tt>'string</tt>.
12+
13+
<p>
14+
<b>PatchFileFromARM(ARM_Instructions, filename)</b>: This global function
15+
is a little helper for a very specific job. The first argument is a string
16+
with ARM assembler instructions, usually starting with <tt>org address</tt> to
17+
define the position in the binary. The second argument is the the file path and
18+
name of an ARM binary, usually the NewtonOS ROM file. Calling
19+
<tt>PatchFileFromARM</tt> will assemble and link the ARM code into ARM commends
20+
and then overwrite the code in the ROM file with the new ARM code at the
21+
given addresses.
22+
23+
<p>
24+
<b>MakeBinaryFromARM(ARM_Instructions)</b>: Create the binary part of
25+
a <tt>BinCFunction</tt> from ARM assembly code. Here, <tt>nativeMath</tt> and
26+
<tt>newtonScriptMath</tt> are both functions that can be called from anywhere
27+
in a script:
28+
<p>
29+
<pre>
30+
nativeMath: {
31+
class : 'BinCFunction,
32+
numArgs: 2,
33+
offset: 0,
34+
code: MakeBinaryFromARM("
35+
ldr r1, [r1] @ Unref the first argument
36+
ldr r1, [r1] @ Get the integer object
37+
mov r1, r1, lsr #2 @ convert it into an integer
38+
ldr r2, [r2]
39+
ldr r2, [r2] @ do the same with the second arg
40+
mov r2, r2, lsr #2
41+
add r0, r1, r2 @ add both integers
42+
mov r0, r0, lsl #2 @ convert the result into an integer object
43+
mov pc, lr @ return to the interpreter
44+
")
45+
}
46+
// The same in Newton Script
47+
newtonScriptMath: func(a, b) begin
48+
return a+b;
49+
end
50+
</pre>
51+
52+
<p>
53+
<b>MakeBinaryFromARMFile(ARM_Assembler_Filename)</b>: Same as above, but
54+
instead of as string with ARM instructions, this call takes a file path and
55+
name of an ARM assembler code file.
56+
57+
<p>
58+
<b>AddStepForm(theParentView, myView)</b>: This is an original NTK function.
59+
It ensures that the parent view has a frame named "StepChildren", and then
60+
adds <tt>myView</tt> to that frame. This is needed to ensure that a new view
61+
will appear as a child of the parent view when an app is opened.
62+
63+
<p>
64+
<b>StepDeclare(theParentView, myView, 'myView)</b>: This is an original NTK
65+
function. It ensures that the parent view has an array named
66+
"StepAllocateContext", and the appends <tt>myView</tt> and the symbol
67+
<tt>'myView</tt> to the array.
68+
69+
<p>
2170
<b>_STDERR_</b>:
22-
<br>
71+
72+
<p>
2373
<b>_STDOUT_</b>:
2474

2575
<h2>FLTK extensions</h2>
2676

2777
<b>fltk:message(message)</b>: Open a message dialog box.
28-
<br>
78+
79+
<p>
2980
<b>fltk:choice(message, cancel_button, ok_button, opt_button)</b>:
3081
Open a user choice dialog box and return the selected button id.
31-
<br>
82+
83+
<p>
3284
<b>fltk:filechooser(message, pattern, filename, relative)</b>:
3385
Open a file chooser dialog. Returns filename or NIL.
34-
<br>
3586

3687
<h2>Host File Access extensions</h2>
88+
3789
<b>file:new()</b>: Create a frame to access files on the host machine.
38-
<br>
90+
91+
<p>
3992
<b>file:open(filename, mode)</b>: Open a file, mode is 'read|'write|'readwrite|'append.
40-
<br>
93+
94+
<p>
4195
<b>file:isOpen()</b>: Returns nil or true.
42-
<br>
96+
97+
<p>
4398
<b>file:size()</b>: Returns file size in bytes.
44-
<br>
99+
100+
<p>
45101
<b>file:read(size)</b>: Read up to size bytes and return a binary object with the data.
46-
<br>
102+
103+
<p>
47104
<b>file:write(binaryObject)</b>: Write the content of a binary object to a file.
48-
<br>
105+
106+
<p>
49107
<b>file:seek(pos, mode)</b>: Set read position, mode is 'set|'cur|'end.
50-
<br>
108+
109+
<p>
51110
<b>file:tell()</b>: Return the current read position in the file.
52-
<br>
111+
112+
<p>
53113
<b>file:close()</b>: Closes a file, returns exception or true.
54-
<br>
55114

56115
</body>
57116
</html>

0 commit comments

Comments
 (0)