]> git.sur5r.net Git - cc65/blobdiff - libsrc/geos-cbm/disk/dio_openclose.s
Merge pull request #14 from groessler/something_to_pull
[cc65] / libsrc / geos-cbm / disk / dio_openclose.s
index 727a66dc3e349e3ef921c96cbe94de00f2436c33..ec5aa87956b5f80f4154beca746b147fcf9cadc0 100644 (file)
@@ -4,82 +4,80 @@
 ; based on Atari version by Christian Groessler
 ; 2.7.2001
 ;
-; dhandle_t     __fastcall__ dio_open  (driveid_t drive_id);
+; dhandle_t     __fastcall__ dio_open  (unsigned char device);
 ; unsigned char __fastcall__ dio_close (dhandle_t handle);
 ;
 ; dio_open sets given device as current and initializes disk
 ; dio_close does nothing special
 
-       .export _dio_open, _dio_close
-       .import __oserror, _OpenDisk
-       .importzp ptr1, tmp1
-       .include "dio.inc"
-        .include "jumptab.inc"
-        .include "geossym.inc"
-       .include "const.inc"
+            .export _dio_open, _dio_close
+            .import __oserror, _OpenDisk
+            .importzp ptr1, tmp1
+
+            .include "dio.inc"
+            .include "jumptab.inc"
+            .include "geossym.inc"
+            .include "const.inc"
 
 .bss
 
 sectsizetab:
-       .res    4 * sst_size            ; this is hardcoded
+        .res 4 * sst_size       ; this is hardcoded
 
 .code
 
-.proc  _dio_open
-       pha
-       tax
-       lda driveType,x         ; check if there's a device
-       beq _inv_drive
-       txa
-       clc
-       adc #8                  ; normalize devnum
-       sta curDevice
-       jsr SetDevice
-       jsr _OpenDisk           ; take care for errors there
-
-       pla
-       tay                     ; drive #
-       asl     a               ; make index from drive id
-       asl     a
-       tax
+_dio_open:
+        pha
+        tax
+        lda driveType,x         ; check if there's a device
+        beq _inv_drive
+        txa
+        clc
+        adc #8                  ; normalize devnum
+        sta curDevice
+        jsr SetDevice
+        jsr _OpenDisk           ; take care for errors there
 
-       lda     #0
-       sta     sectsizetab+sst_sectsize,x
-       lda     #128
-       sta     sectsizetab+sst_flag,x          ; set flag that drive is "open"
-       lda     #1
-       sta     sectsizetab+sst_sectsize+1,x
-       tya
-       sta     sectsizetab+sst_driveno,x
+        pla
+        tay                     ; drive #
+        asl a                   ; make index from drive id
+        asl a
+        tax
+            
+        lda #0
+        sta sectsizetab+sst_sectsize,x
+        lda #128
+        sta sectsizetab+sst_flag,x ; set flag that drive is "open"
+        lda #1
+        sta sectsizetab+sst_sectsize+1,x
+        tya
+        sta sectsizetab+sst_driveno,x
+            
+        stx tmp1
+        lda #<sectsizetab
+        clc
+        adc tmp1
+        sta tmp1
+        lda #>sectsizetab
+        adc #0
+        tax
+        lda tmp1
 
-       stx     tmp1
-       lda     #<sectsizetab
-       clc
-       adc     tmp1
-       sta     tmp1
-       lda     #>sectsizetab
-       adc     #0
-       tax
-       lda     tmp1
-
-       rts
+        rts
 
 _inv_drive:
-       lda #DEV_NOT_FOUND
-       sta __oserror
-       lda #0
-       tax
-       rts
-
-.endproc
+        lda #DEV_NOT_FOUND
+        sta __oserror
+        lda #0
+        tax
+        rts
 
-.proc  _dio_close
-       sta     ptr1
-       stx     ptr1+1
-       lda     #0
-       ldy     #sst_flag
-       sta     (ptr1),y
-       sta     __oserror       ; success
-       tax
-       rts                     ; return no error
-.endproc
+_dio_close:
+        sta ptr1
+        stx ptr1+1
+        lda #0
+        ldy #sst_flag
+        sta (ptr1),y
+        sta __oserror           ; success
+        tax
+        rts                     ; return no error