1

I'm writing a small app that runs on MacOS 7.x - 9.x (using Macintosh Toolbox) and I've decided to include Duktape.

I use CodeWarrior 6.0 running on MacOS 9.
I use the Low Memory configuration, found here.

It runs perfectly when I compile for PPC - but when I compile for 68k I'm getting a lot strange behaviour and crashes.

For example, if I were to call duk_peval_string with the following:

var i = 3; <- no errors
var i = 3; function a() { return 4; } <- no errors
var i = 3; function a() { return 4; } i = a(); <-- "ReferenceError: -4e+0"
function a() { return 4; } i = a(); <-- crash on start

I've enabled the self tests (DUK_USE_SELF_TESTS) to try to figure out what might be going on - enabling 8-Byte Doubles and changing the Struct Alignment to PowerPC (instead of 68K settings) under processor settings cause Duktape to pass the tests - but it still doesn't fix the problem.

Defining __m68k__ (or not) doesn't seem to affect anything.

I know it's a long shot, but after spending ~4 hours changing almost every setting I can find on the IDE and duk_config, I'm out of ideas - so any help would be much appreciated.

ejder
  • 11
  • 1
  • Javascript does most computations with floating point numbers. When something as old as 68k is concerned, you should start with checking the state of FPU on that system. Is hardware FPU available at all? Does it properly supports IEEE 754 (I doubt most old 68k do)? And so on. – oakad Jan 13 '20 at 03:31
  • @oakad good question! Duktape says it supports Atari ST series (also running 68k) which, afaik, doesn't have an FPU unit though, so I'm guessing they have a workaround for this? – ejder Jan 13 '20 at 17:56
  • `-msoft-float`, I would presume. – oakad Jan 14 '20 at 01:49

0 Answers0