aboutsummaryrefslogtreecommitdiff
path: root/lorchatest.c
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2015-12-29 23:10:50 -0500
committerB. Watson <yalhcru@gmail.com>2015-12-29 23:10:50 -0500
commit2300d2813a524cbfeabac794335e7abe99263df6 (patch)
treed729ca4f99634788cbb3a2101a5b5854a4bc2d06 /lorchatest.c
downloadtaipan-2300d2813a524cbfeabac794335e7abe99263df6.tar.gz
initial commit
Diffstat (limited to 'lorchatest.c')
-rw-r--r--lorchatest.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/lorchatest.c b/lorchatest.c
new file mode 100644
index 0000000..bc53d07
--- /dev/null
+++ b/lorchatest.c
@@ -0,0 +1,37 @@
+#include <peekpoke.h>
+
+extern void __fastcall__ draw_lorcha(int which, int displacement, int mask);
+
+void jsleep(int jiffies) {
+ POKE(20,0);
+ while(PEEK(20) < jiffies)
+ ;
+}
+
+int main(void) {
+ int i, j;
+
+ /* draw all 10 ships in normal state */
+ for(i=0; i<10; i++) {
+ draw_lorcha(i, 0, 0);
+ }
+
+ /* explode and sink all 10 ships */
+ for(i=0; i<10; i++) {
+ /* blast effect */
+ for(j=0; j<8; j++) {
+ draw_lorcha(i, 0, 0x80);
+ jsleep(2);
+ draw_lorcha(i, 0, 0);
+ jsleep(2);
+ }
+
+ /* sinking */
+ for(j=0; j<8; j++) {
+ draw_lorcha(i, j, 0);
+ jsleep(4);
+ }
+ }
+
+hang: goto hang;
+}