From fcf1a05454aa8a25996e75223ee29e43e9fc09dc Mon Sep 17 00:00:00 2001 From: cpg Date: Sat, 19 Feb 2005 01:04:41 +0000 Subject: [PATCH] add query_sectorsize: query sector size of disk by reading sector #4 and making a status command ($53) to the drive: initial check-in, needs cleanup git-svn-id: svn://svn.cc65.org/cc65/trunk@3394 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/atari/diopncls.s | 130 +++++++++++++++++++++++++++++++++++----- 1 file changed, 114 insertions(+), 16 deletions(-) diff --git a/libsrc/atari/diopncls.s b/libsrc/atari/diopncls.s index 7826e0cc1..8995e79e6 100644 --- a/libsrc/atari/diopncls.s +++ b/libsrc/atari/diopncls.s @@ -1,20 +1,22 @@ ; -; Christian Groessler, October 2000 +; Christian Groessler, February 2005 ; -; This file provides the __dio_open and __dio_close functions +; This file provides the _dio_open and _dio_close functions ; Since on the Atari no real open and close is necessary, they -; do not much. The __dio_open sets the sector size of the -; drive which is later used by the _dio_read and _dio_write -; functions. +; do not open or close something. The _dio_open sets the sector +; size of the drive which is later used by the _dio_read and +; _dio_write functions. To query the sector size, the _dio_open +; accesses the disk drive. ; -; dhandle_t __fastcall__ dio_open (driveid_t drive_id); +; dhandle_t __fastcall__ dio_open (driveid_t drive_id); ; unsigned char __fastcall__ dio_close (dhandle_t handle); ; - .export _dio_open,_dio_close + .export _dio_open, _dio_close .export sectsizetab - .import __oserror - .importzp ptr1,tmp1 + .import __oserror, __sio_call, _dio_read + .import pushax, addysp, subysp + .importzp ptr2, tmp1, sp .include "atari.inc" @@ -34,7 +36,7 @@ sectsizetab: asl a ; make index from drive id asl a tax - lda #128 ; currently hardcoded (until I get an 815 :-) + lda #128 ; preset sectsize, will be overridden by query_sectorsize sta sectsizetab+sst_sectsize,x sta sectsizetab+sst_flag,x ; set flag that drive is "open" lda #0 @@ -42,8 +44,6 @@ sectsizetab: sta __oserror ; success tya sta sectsizetab+sst_driveno,x -; lda #SSTIDVAL -; sta sectsizetab+sst_id+1,x stx tmp1 lda #DVSTAT + lda #