]> git.sur5r.net Git - cc65/commitdiff
Fixed bugs in geos-cbm's dio_open().
authorGreg King <gregdk@users.sf.net>
Mon, 24 Aug 2015 06:53:47 +0000 (02:53 -0400)
committerGreg King <gregdk@users.sf.net>
Fri, 23 Feb 2018 21:12:12 +0000 (16:12 -0500)
* Trying to open an unused drive would leave a byte on the hardware stack.

* Too high device numbers weren't caught.

libsrc/geos-cbm/disk/dio_openclose.s

index ec5aa87956b5f80f4154beca746b147fcf9cadc0..72e3e32e90fbf20ab33e53ff02f2d2222b07b947 100644 (file)
@@ -1,8 +1,8 @@
 ;
-; Maciej 'YTM/Elysium' Witkowiak
+; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
+; 2015-08-24, Greg King
 ;
 ; based on Atari version by Christian Groessler
-; 2.7.2001
 ;
 ; dhandle_t     __fastcall__ dio_open  (unsigned char device);
 ; unsigned char __fastcall__ dio_close (dhandle_t handle);
@@ -27,11 +27,13 @@ sectsizetab:
 .code
 
 _dio_open:
-        pha
+        cmp #4
+        bcs _inv_drive
         tax
         lda driveType,x         ; check if there's a device
         beq _inv_drive
         txa
+        pha
         clc
         adc #8                  ; normalize devnum
         sta curDevice