This is the open source Pawn interpreter ported to mbed. See here: http://www.compuphase.com/pawn/pawn.htm and here: http://code.google.com/p/pawnscript/

Dependents:   Pawn4Test

Some instructions:

  • Put the attached include folder next to your source, so when you compile you get all the proper definitions
  • Use the attached main.p as a starting point if you wish
  • Compile your main.p into main.amx - Put your main.amx on the mbed 'drive'
  • Reset and be amazed.

Important Compile Notes:

  • You should use the -S# option to define a smaller default stack size. Start with -S64 and go up from there if needed.
  • To use on the Cortex-M0 version of the mbed (LPC11U24), you MUST include the TARGET=3 command-line option as well, so the pin names are properly defined. In the future this may be handled on the native code side.

Known Issues:

  • At the moment it appears the kbhit() function is not working right - at least on my mac. Will continue testing on Windows. Working fine.

Todo:

  • Add more wrappers for the mbed peripherals
  • Add Pawn overlay support, to allow much larger scripts to run (even on the LPC11U24)
Revision:
2:01588bd27169
Parent:
0:3ab1d2d14eb3
--- a/amxtime.c	Wed May 22 12:20:59 2013 +0000
+++ b/amxtime.c	Wed May 22 16:30:01 2013 +0000
@@ -27,10 +27,10 @@
 
 #define CELLMIN   (-1 << (8*sizeof(cell) - 1))
 
-#define SECONDS_PER_MINUTE	60
-#define SECONDS_PER_HOUR	3600
-#define SECONDS_PER_DAY		86400
-#define SECONDS_PER_YEAR	31556952	/* based on 365.2425 days per year */
+#define SECONDS_PER_MINUTE    60
+#define SECONDS_PER_HOUR    3600
+#define SECONDS_PER_DAY        86400
+#define SECONDS_PER_YEAR    31556952    /* based on 365.2425 days per year */
 
 #if !defined CLOCKS_PER_SEC
   #define CLOCKS_PER_SEC CLK_TCK
@@ -165,9 +165,8 @@
 
 static void setdate(cell year,cell month,cell day)
 {
-  int maxday;
-
   #if defined __WIN32__ || defined _WIN32 || defined WIN32
+    int maxday;
     SYSTEMTIME systim;
 
     GetLocalTime(&systim);
@@ -291,9 +290,9 @@
   INIT_TIMER();
   cptr=amx_Address(amx,params[1]);
   #if defined __WIN32__ || defined _WIN32 || defined WIN32
-    *cptr=1000;               	/* granularity = 1 ms */
+    *cptr=1000;                   /* granularity = 1 ms */
   #else
-    *cptr=(cell)CLOCKS_PER_SEC;	/* in Unix/Linux, this is often 100 */
+    *cptr=(cell)CLOCKS_PER_SEC;    /* in Unix/Linux, this is often 100 */
   #endif
   return gettimestamp() & 0x7fffffff;
 }