From c8c6fc6a4064efb1a69a99fe75b37cdf5944f60f Mon Sep 17 00:00:00 2001 From: jede Date: Fri, 17 Mar 2023 23:10:15 +0100 Subject: [PATCH] add xfseek --- asminc/telestrat.inc | 2 ++ libsrc/telestrat/lseek.s | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 libsrc/telestrat/lseek.s diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 682696887..c57bd3de8 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -277,6 +277,8 @@ XRECLK = $3C ; Reset clock XCLCL = $3D ; Close clock XWRCLK = $3E ; Displays clock in the address in A & Y registers +XFSEEK = $3F ; Only in Orix + ; Sound primitives XSONPS = $40 ; Send data to PSG register (14 values) XOUPS = $42 ; Send Oups sound into PSG diff --git a/libsrc/telestrat/lseek.s b/libsrc/telestrat/lseek.s new file mode 100644 index 000000000..11d1fad33 --- /dev/null +++ b/libsrc/telestrat/lseek.s @@ -0,0 +1,39 @@ +; +; Jede (jede@oric.org), 2023-03-13 +; + +; off_t __fastcall__ lseek(int fd, off_t offset, int whence); + + .export _lseek + + .include "telestrat.inc" + .include "zeropage.inc" + + .import popax + +.proc _lseek + ; Save whence + sta tmp1 + ; Skip X + + ; Get offset and store + + jsr popax + sta tmp2 + stx tmp3 + + jsr popax + sta RESB + stx RESB+1 + + ; Get FD + jsr popax + ; Does not need X + sta RES ; Save FD + + lda tmp2 + ldy tmp3 + ldx tmp1 ; Get whence + BRK_TELEMON XFSEEK + rts +.endproc