--- /dev/null
+
+void print (char *);
+
+void hires();
+void text();
+void oups();
+void ping();
+void zap();
+void shoot();
+void explode();
+
+void paper(char color);
+void ink(char color);
+
+void kbdclick1();
+
+
+
+void curset(char x,char y);
+void circle(char rayon);
+
+char key(void);
+
+
+/* PEEK, POKE, DEEK, DOKE */
+
+#define POKE(addr,val) (*(unsigned char*) (addr) = (val))
+
+
+#define PCHN_1 001
+#define PCHN_2 002
+#define PCHN_12 003
+#define PCHN_3 004
+#define PCHN_13 005
+#define PCHN_23 006
+#define PCHN_123 007
+
+#define ENV_DECAY 001 /* \_________ envelope */
+#define ENV_ATTACK_CUT 002 /* /_________ envelope */
+#define ENV_SAW_DOWN 003 /* \\\\\\\\\\ envelope */
+#define ENV_WAVE 004 /* /\/\/\/\/\ envelope */
+#define ENV_DECAY_CONT 005 /* \~~~~~~~~~ envelope */
+#define ENV_SAW_UP 006 /* ////////// envelope */
+#define ENV_ATTACK_CONT 007 /* /~~~~~~~~~ envelope */
+
+#define VOL_ENVELOPE 0x0
+#define VOL_QUIETEST 0x1
+#define VOL_LOUDEST 0xe
+
+extern int play(int soundchanels,int noisechanels,int envelop,int volume);
+
+
+/* Play a musical tone through the selected channel. */
+
+#define CHAN_1 1
+#define CHAN_2 2
+#define CHAN_3 3
+
.importzp sp,tmp2,tmp3,tmp1
; int open (const char* name, int flags, ...); /* May take a mode argument */
.include "telemon30.inc"
-
+ .include "errno.inc"
+ .include "fcntl.inc"
+
.proc _open
; Throw away any additional parameters passed through the ellipsis
; Parameters ok. Pop the flags and save them into tmp3
-parmok: jsr popax ; Get flags
+parmok: jsr popax ; Get flagss
+ sta tmp3 ; save flags
+
+ ;AND #O_RDONLY
+ ;beq READONLY
+ ;lda tmp3
+ ;AND #O_WRONLY
+ ;beq WRITEONLY
+ ;jmp next
+;READONLY:
+; lda #'r'
+; BRK_TELEMON XWR0
+; jmp next
+;WRITEONLY:
+; lda #'w'
+; BRK_TELEMON XWR0
+
+;next:
; Get the filename from stack and parse it. Bail out if is not ok
jsr popax ; Get name
-
+
+
+ ldy tmp3 ; Get flags
+
BRK_TELEMON XOPEN
+
+ ; For XA65 compatibily in the futur
+ .FEATURE c_comments,labels_without_colons,pc_assignment, loose_char_term
.export _ch376_set_file_name
.export _ch376_file_open
.export _ch376_ic_get_version
.export _ch376_check_exist
.export _ch376_disk_mount
.export _ch376_set_usb_mode
+ .export _ch376_file_create
+ .export _ch376_fcreate
+
+ ; High level function
+ .export _ch376_fcreate
+
.import popax
.importzp sp,tmp2,tmp3,tmp1
.include "telemon30.inc"
+/*
+*/
; CODE FOR CH376_SET_USB_MODE *************************************************
CH376_SET_USB_MODE_CODE_USB_HOST_SOF_PACKAGE_AUTOMATICALLY := $06
CH376_USB_INT_SUCCESS := $14
CH376_ERR_MISS_FILE := $42
-CH376_DATA :=$340
-CH376_COMMAND :=$341
+
CH376_GET_IC_VER := $01
CH376_SET_BAUDRATE := $02
CH376_DISK_MOUNT := $31
CH376_FILE_OPEN := $32
CH376_FILE_ENUM_GO := $33
+CH376_FILE_CREATE := $34
CH376_FILE_CLOSE := $36
CH376_BYTE_READ := $3A
CH376_BYTE_RD_GO := $3b
CH376_DISK_CAPACITY := $3E
CH376_DISK_RD_GO := $55
+.proc _ch376_file_create
+ lda #CH376_FILE_CREATE
+ sta CH376_COMMAND
+ jsr _ch376_wait_response
+ rts
+.endproc
+; void _ch376_fcreate(char *filename)
+.proc _ch376_fcreate
+ jsr _ch376_set_file_name
+ jsr _ch376_file_open
+ jsr _ch376_file_create
+.endproc
; void ch376_set_file_name(char *filename)
.proc _ch376_set_file_name