2 ; Oliver Schmidt, 2012-09-04
3 ; Christian Groessler, 2017-12-28
5 ; unsigned char getfirstdevice (void);
6 ; unsigned char __fastcall__ getnextdevice (unsigned char device);
10 .export _getfirstdevice
11 .export _getnextdevice
15 ;------------------------------------------------------------------------------
22 ;------------------------------------------------------------------------------
38 none: ldx #255 ; INVALID_DEVICE (see include/device.h)
39 bne done ; jump always
41 ;------------------------------------------------------------------------------
42 ; check_device - checks if a disk device is present
43 ; input: X - device id (0 = D1, 1 = D2, ...)
44 ; output: NF - 0/1 for detected/not detected
45 ; X register preserved
51 sta DCOMND ; set command into DCB
52 lda #%01000000 ; direction value, "receive data"
53 sta DSTATS ; set data flow directon
55 sta DTIMLO ; value got from DOS source
57 sta DAUX1 ; set sector # (dummy: 4)
58 sta DBYTLO ; # of bytes to transfer
65 sta DBUFLO ; set buffer address into DCB
66 lda #DISKID ; SIO bus ID of diskette drive
69 stx DUNIT ; unit number (1-based)
71 jsr SIOV ; execute SIO command