From d5ba0636027feab064614b669c9196ef24ed6287 Mon Sep 17 00:00:00 2001 From: jede Date: Wed, 4 Jan 2017 20:03:19 +0100 Subject: [PATCH] Correcting some bugs --- include/telemon.h | 58 ++++++++++++++++++++++++++++++++++++++++ libsrc/telemon30/_open.s | 28 ++++++++++++++++--- libsrc/telemon30/ch376.s | 27 +++++++++++++++++-- 3 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 include/telemon.h diff --git a/include/telemon.h b/include/telemon.h new file mode 100644 index 000000000..70033a9ad --- /dev/null +++ b/include/telemon.h @@ -0,0 +1,58 @@ + +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 + diff --git a/libsrc/telemon30/_open.s b/libsrc/telemon30/_open.s index f308632d9..a002bbce1 100644 --- a/libsrc/telemon30/_open.s +++ b/libsrc/telemon30/_open.s @@ -3,7 +3,9 @@ .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 @@ -16,12 +18,32 @@ ; 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 diff --git a/libsrc/telemon30/ch376.s b/libsrc/telemon30/ch376.s index 90e2878e1..24df14471 100644 --- a/libsrc/telemon30/ch376.s +++ b/libsrc/telemon30/ch376.s @@ -1,3 +1,6 @@ + + ; 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 @@ -5,10 +8,18 @@ .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 @@ -17,8 +28,7 @@ CH376_USB_INT_DISK_READ := $1d 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 @@ -34,6 +44,7 @@ CH376_DISK_CONNECT := $30 ; check the disk connection status 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 @@ -41,7 +52,19 @@ CH376_BYTE_WRITE := $3C 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 -- 2.39.5