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:
0:3ab1d2d14eb3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_amxmbed.h	Thu Nov 15 17:41:21 2012 +0000
@@ -0,0 +1,44 @@
+/**
+ * Include file for the interface to mbed from Pawn interpreter.
+ *
+ * Copyright 2011 Pulse-Robotics, Inc.
+ * Author: Tyler Wilson
+ */
+
+#ifndef _AMXMBED_H
+#define _AMXMBED_H
+
+//#include "mbed.h"
+
+//void mbed_set_serial(Serial* serial);
+
+#ifdef __cplusplus
+    extern "C" {
+#endif
+
+// from amxcons.c. need to declare them as extrn "C" so we build correctly
+int amx_putstr(const char *);
+int amx_putchar(int);
+int amx_fflush(void);
+int amx_getch(void);
+char* amx_gets(char* ,int);
+int amx_termctl(int,int);
+void amx_clrscr(void);
+void amx_clreol(void);
+int amx_gotoxy(int x,int y);
+void amx_wherexy(int *x,int *y);
+unsigned int amx_setattr(int foregr,int backgr,int highlight);
+void amx_console(int columns, int lines, int flags);
+void amx_viewsize(int *width,int *height);
+int amx_kbhit(void);
+
+//int mbed_getc(void);
+//int mbed_putc(int character);
+//int mbed_puts(const char* str);
+//int mbed_kbhit(void);
+
+#ifdef __cplusplus
+    }
+#endif
+
+#endif /* _AMXMBED_H */