+ lda #NONDEV ; non-existent device
+ sta __oserror
+ lda #0
+ tax
+ rts ; return NULL
+
+_dio_open:
+
+ cmp #NUMDRVS ; valid drive id?
+ bcs _inv_drive
+ tay ; drive #
+ asl a ; make index from drive id
+ asl a
+ tax
+ lda #128 ; preset sectsize
+ sta sectsizetab+sst_sectsize,x
+ sta sectsizetab+sst_flag,x ; set flag that drive is "open"
+ lda #0
+ sta sectsizetab+sst_sectsize+1,x
+ sta __oserror ; success
+ tya
+ sta sectsizetab+sst_driveno,x
+ stx ptr2
+ lda #<sectsizetab
+ clc
+ adc ptr2
+ sta ptr2
+ lda #>sectsizetab
+ adc #0
+ tax
+ stx ptr2+1 ; ptr2: pointer to sectsizetab entry