calling GemDOS functions in STOS

STOS-related stuff in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Captain Atari
Captain Atari
Posts: 267
Joined: Mon Mar 03, 2008 10:33 pm

calling GemDOS functions in STOS

Postby mlynn1974 » Mon Feb 12, 2018 1:32 am

Hi, I have written a small routine in assembly language to allow STOS to use fopen\fread\fseek and fclose.
This was necessary to write my double buffered sample player in STOS.
Bload is fine, but it doesn't allow partial loading or seeking to a part of the file and reading it into a smaller buffer.

I spent a couple of hours debugging this today. fopen should return the file handle in dreg(0) but I couldn't see it. Then I realised that dreg(0) was being overwritten by interpreter activity or other interrupts. Hence I store the file handle in the code and expose it as a word at offset 32 in the header. FREAD calls $3F in read-only mode.

10 hide : key off : mode 0 : curs off : flash off : click off : move off
20 S10=start(10)+28
30 FOPEN=S10
40 FREAD=S10+8
50 FSEEK=S10+16
60 FCLOSE=S10+24
70 FHAN=S10+32

open file:
call FOPEN

get file handle:
print deek($FHAN)

load buffer:
reserve as data 5,65535
call FREAD

call FSEEK

close file:

Hope someone might find it useful.
You do not have the required permissions to view the files attached to this post.
Still got, still working: Atari 4Mb STe, 520STFM, 2.5Mb STF.
Hardware: Cumana CSA 354, Ultimate Ripper, Blitz Turbo, Synchro Express II (US and UK Versions).

Social Media


Return to “STOS”

Who is online

Users browsing this forum: No registered users and 3 guests