I have written a small assembler (RSX) code (in ORGAMS) for basic. Just a sector read/write RSX see below and a small BASIC program:
The BASIC lines for copying SD>Floppy are simple, for writing I just changed |SD with |DISC
10 IF PEEK(&9000)=33 THEN 60
20 MEMORY &8FFF
30 LOAD"sector.bin
40 CALL &9000
50 END
55 :
60 CLS
70 |SD
80 FOR i=0 TO 39
90 FOR j=&C1 TO &C9
100 LOCATE 1,1:PRINT "Track:";USING"###";i;:PRINT " Sector:";HEX$(j)
110 |SECREAD,i,j
120 |DISC
130 |SECWRITE,i,j
140 |SD
150 NEXT j
160 NEXT i
ORG &9000
;constants
kl_log_ext = &BCD1
;initialize RSX
LD HL,rsx_buffer
LD BC,jump_table
CALL kl_log_ext
RET
jump_table
WORD name_table
JP secread
JP secwrite
name_table
BYTE "SECREA","D"+&80
BYTE "SECWRIT","E"+&80
BYTE 0
;end of initialize RSX
;sector read RSX
secread
LD HL,rsx_error_msg-1
CP 2 ;received two parameters (Track, Sector)
JP NZ,error_msg
LD IY,sector_track
LD A,(IX+&00) ;low-byte = sector
LD (IY+&00),A
LD A,(IX+&02) ;low-byte = track
LD (IY+&01),A
LD HL,read
CALL action
RET ;return to BASIC
;sector write RSX
secwrite
LD HL,rsx_error_msg-1
CP 2 ;received two parameters (Track, Sector)
JP NZ,error_msg
LD IY,sector_track
LD A,(IX+&00) ;low-byte = sector
LD (IY+&00),A
LD A,(IX+&02) ;low-byte = track
LD (IY+&01),A
LD HL,write
CALL action
RET ;return to BASIC
;manipulating a sector (hl to be defined read/write)
action
CALL &BCD4
RET NC
LD (faradr),HL
LD A,C
LD (faradr+2),A
LD E,0 ;drive A=0/B=1 (fixed 0)
LD IY,sector_track
LD A,(IY+&00)
LD C,A ;sector number (&cx=data/&4x=system)
LD A,(IY+&01)
LD D,A ;track 0-39
LD HL,&8D00
RST &18
WORD faradr
RET
read
BYTE &84
write
BYTE &85
faradr
FILL 3,0
;end of sector read/write routines
;error messages
error_msg
INC HL
LD A,(HL)
CALL &BB5A
CP 0
JR NZ,error_msg
RET
rsx_error_msg
BYTE "parameter error.",0
sector_track
FILL 2,0
rsx_buffer
FILL 4,0