Contents |
Effect
Writes a sector (512 bytes) of the disk inserted in the specified drive with the data coming from a temporary buffer pointed by addresses &HF351 and &HF352.
Note: Despite the misleading "$" in name DSKO$ is an instruction and therefore does not take any brackets like DSKI$()-function does.
Initially, only integer (16 bit) sector numbers are accepted. However, version 3 of Disk BASIC, provided by the Nextor operating system version 2.0 and higher, accepts 32 bit sector numbers when used in MSX-DOS 2 mode, therefore allowing access to any drive sector, not only the first 65536 sectors of mass storage devices.
Syntax
DSKO$ <DriveNumber>,<SectorNumber>
Parameters
<DriveNumber> is a value between 0 and 8, according the following table:
Number | Drive |
---|---|
0 | Default drive |
1 | Drive A |
2 | Drive B |
3 | Drive C |
4 | Drive D |
5 | Drive E |
6 | Drive F |
7 | Drive G |
8 | Drive H |
<SectorNumber> can vary between 0 and a maximum that depends from the used drive to format the disk. The highest possible maximum on MSX for floppy disks is 719 for single sided disks and 1439 for double sided disks. Initially, it can only be integer numbers.
If you use the Nextor OS in MSX-DOS 2 mode:
- You can reach any sector of mass storage devices: in order to access sectors with numbers over 32767, the sector number must be specified as a single or double precision constant, expression or variable. If a single precision value is specified and the number is so big that one or more of the least significant digits of the number is lost due to truncation, you will get an "Overflow" error. In such cases or to access arbitrary sector numbers in your BASIC code, using double precision variables will provide a safe solution.
- Note that an "Overflow" error will be thrown too if the sector number specified does not fit in 32 bits, that is, if it is greater than 4294967295.
- In order to maintain compatibility with the MSX-DOS equivalent command, negative sector numbers are accepted (to which 65536 is added to get the real sector number) but only if the sector number can be evaluated as an integer (16 bit) expression.
Example
10 SCREEN 0 : WIDTH 38 : COLOR 15,4,4 : DEFINT I 20 PRINT "COPY SECTOR BY SECTOR" 30 PRINT : PRINT 40 PRINT "Insert source disk in drive A:" 45 PRINT "then press a key" 50 A$=INPUT$(1) 60 PRINT : PRINT 70 PRINT "Insert empty disk in drive B:" 75 PRINT "then press a key" 80 A$=INPUT$(1) 90 PRINT : PRINT 100 PRINT "TRACK:" 110 PRINT 120 PRINT "SECTOR:" 130 FOR I=0 TO 719 140 A$=DSKI$(1,I) 150 LOCATE 8,11: PRINT INT(I/9) 160 LOCATE 8,13: PRINT IMOD9 170 DSKO$ 2,I 180 NEXT I
Related to
Compatibility
Disk BASIC 1.0 or higher / both modes of Nextor OS but 32 bit sector numbers and 16 bit negative sector numbers only accepted in MSX-DOS 2 mode