From 4f26650228506b746fce11895eaa6fa6befb2b31 Mon Sep 17 00:00:00 2001 From: jedeoric Date: Thu, 11 Mar 2021 09:42:14 +0100 Subject: [PATCH] [Telestrat] chdir management (#1419) * add syschdir * revert read.s * remove extra line * Now we update __cwd * Fix tab * Fix another tab * Fix tab * Fix tab and jmp * fix xgetcwd * Fix comments --- asminc/telestrat.inc | 2 ++ libsrc/telestrat/initcwd.s | 3 +-- libsrc/telestrat/read.s | 12 ++++++------ libsrc/telestrat/syschdir.s | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 libsrc/telestrat/syschdir.s diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 2036574a4..556b41f7c 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -284,6 +284,8 @@ XSOUND = $44 XMUSIC = $45 XZAP = $46 ; Send Zap sound to PSG XSHOOT = $47 +XGETCWD = $48 ; Get current CWD +XPUTCWD = $49 ; Chdir XMKDIR = $4B ; Create a folder. Only available in TELEMON 3.x (bank 7 of Orix) XRM = $4D ; Remove a folder or a file. Only available in TELEMON 3.x (bank 7 of Orix) XFWR = $4E ; Put a char on the first screen. Only available in TELEMON 3.x (bank 7 of Orix) diff --git a/libsrc/telestrat/initcwd.s b/libsrc/telestrat/initcwd.s index dc3c53257..7d38dd563 100644 --- a/libsrc/telestrat/initcwd.s +++ b/libsrc/telestrat/initcwd.s @@ -10,8 +10,7 @@ initcwd: - ldx #PWD_PTR - BRK_TELEMON XVARS + BRK_TELEMON(XGETCWD) sta ptr1 sty ptr1+1 diff --git a/libsrc/telestrat/read.s b/libsrc/telestrat/read.s index 76de9d0ac..db764fc84 100644 --- a/libsrc/telestrat/read.s +++ b/libsrc/telestrat/read.s @@ -12,21 +12,21 @@ ;int read (int fd, void* buf, unsigned count); .proc _read - sta ptr1 ; count - stx ptr1+1 ; count - jsr popax ; get buf + + sta ptr1 ; Count + stx ptr1+1 ; Count + jsr popax ; Get buf sta PTR_READ_DEST stx PTR_READ_DEST+1 - sta ptr2 ; in order to calculate nb of bytes read + sta ptr2 ; In order to calculate nb of bytes read stx ptr2+1 ; - ; jsr popax ; fp pointer don't care in this version lda ptr1 ; ldy ptr1+1 ; BRK_TELEMON XFREAD ; calls telemon30 routine - ; compute nb of bytes read + ; Compute nb of bytes read lda PTR_READ_DEST+1 sec sbc ptr2+1 diff --git a/libsrc/telestrat/syschdir.s b/libsrc/telestrat/syschdir.s new file mode 100644 index 000000000..149957215 --- /dev/null +++ b/libsrc/telestrat/syschdir.s @@ -0,0 +1,32 @@ +; +; Jede (jede@oric.org), 2021-02-22 +; +; unsigned char _syschdir (const char* name, ...); +; + + .export __syschdir + .import addysp, popax + .importzp tmp1 + .import initcwd + + .include "telestrat.inc" + .include "zeropage.inc" + + +__syschdir: + ; Throw away all parameters except the name + dey + dey + jsr addysp + + ; Get name + jsr popax + + stx tmp1 + ldy tmp1 + + ; Call telemon primitive + + BRK_TELEMON(XPUTCWD) + + jmp initcwd ; Update cwd