]> git.sur5r.net Git - cc65/commitdiff
Merge pull request #42 from groessler/something_to_pull
authorOliver Schmidt <ol.sc@web.de>
Wed, 18 Sep 2013 13:23:25 +0000 (06:23 -0700)
committerOliver Schmidt <ol.sc@web.de>
Wed, 18 Sep 2013 13:23:25 +0000 (06:23 -0700)
Testprogram for _sys() on Atari; some atari.h changes

include/atari.h
testcode/lib/atari/sys.c [new file with mode: 0644]

index 61de88beb4d00d57967df0fad086ed02cb6a99f2..ff23526eeca25510c007615171fec980485fc306 100644 (file)
@@ -286,5 +286,30 @@ struct __iocb {
 #define ZIOCB (*(struct __iocb *)0x20)  /* zero page IOCB */
 #define IOCB (*(struct __iocb *)0x340)  /* system IOCB buffers */
 
+/* IOCB Command Codes */
+#define IOCB_OPEN        0x03  /* open */
+#define IOCB_GETREC      0x05  /* get record */
+#define IOCB_GETCHR      0x07  /* get character(s) */
+#define IOCB_PUTREC      0x09  /* put record */
+#define IOCB_PUTCHR      0x0B  /* put character(s) */
+#define IOCB_CLOSE       0x0C  /* close */
+#define IOCB_STATIS      0x0D  /* status */
+#define IOCB_SPECIL      0x0E  /* special */
+#define IOCB_DRAWLN      0x11  /* draw line */
+#define IOCB_FILLIN      0x12  /* draw line with right fill */
+#define IOCB_RENAME      0x20  /* rename disk file */
+#define IOCB_DELETE      0x21  /* delete disk file */
+#define IOCB_LOCKFL      0x23  /* lock file (set to read-only) */
+#define IOCB_UNLOCK      0x24  /* unlock file */
+#define IOCB_POINT       0x25  /* point sector */
+#define IOCB_NOTE        0x26  /* note sector */
+#define IOCB_GETFL       0x27  /* get file length */
+#define IOCB_CHDIR_MYDOS 0x29  /* change directory (MyDOS) */
+#define IOCB_MKDIR       0x2A  /* make directory (MyDOS/SpartaDOS) */
+#define IOCB_RMDIR       0x2B  /* remove directory (SpartaDOS) */
+#define IOCB_CHDIR_SPDOS 0x2C  /* change directory (SpartaDOS) */
+#define IOCB_GETCWD      0x30  /* get current directory (MyDOS/SpartaDOS) */
+#define IOCB_FORMAT      0xFE  /* format */
+
 /* End of atari.h */
 #endif /* #ifndef _ATARI_H */
diff --git a/testcode/lib/atari/sys.c b/testcode/lib/atari/sys.c
new file mode 100644 (file)
index 0000000..a35be9d
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * testprogram for _sys() function on Atari
+ *
+ * 17-Sep-2013, chris@groessler.org
+ *
+ * uses PUTCHR IOCB function to display a string
+ */
+
+#include <atari.h>
+#include <6502.h>
+#include <conio.h>
+
+static struct regs regs;
+static struct __iocb *iocb = &IOCB;  /* use IOCB #0 */
+
+static char message[] = "I'm the sys test text\n";
+
+int main(void)
+{
+    /* setup IOCB for CIO call */
+    iocb->buffer = message;
+    iocb->buflen = sizeof(message) - 1;
+    iocb->command = IOCB_PUTCHR;
+
+    /* setup input registers */
+    regs.x = 0;         /* IOCB #0 */
+    regs.pc = 0xe456;   /* CIOV */
+
+    /* call CIO */
+    _sys(&regs);
+
+    if (regs.y != 1)
+        cprintf("CIO error 0x%02\r\n", regs.y);
+
+    cgetc();
+    return 0;
+}