ch14p3.s
Original bytes preserved. This is a browser-readable view.
; MD-120 diagnostic command 0x32 on the FX-870P org 0 start 0 ld $0,&H05 ;FDD command &H05: enter the diagnostic mode cal cm1 ;send the command $0 to the FDD ld $0,&H32 ;diagnostic command &H32: beep cal cm1 ;send the command $0 to the FDD cal rd1 ;read a byte from the FDD to $0 ld $0,&H21 ;diagnostic command &H21: system restart cal cm1 ;send the command $0 to the FDD pst ua,&H54 rtn ; read a byte from the FDD to $0 rd1: gst ua,$1 ld $2,$1 or $2,&H30 pst ua,$2 pre ix,&HFFFF rd2: ld $0,(ix+$sx) ;FDD status anc $0,$sy jr nz,rd2 ;wait until the FDD sends the data byte ld $0,(ix-$sy) ;FDD data pst ua,$1 rtn ; write a byte $0 to the FDD wr1: gst ua,$1 ld $2,$1 or $2,&H30 pst ua,$2 pre ix,&HFFFF st $0,(ix-$sy) ;FDD data wr2: ld $0,(ix+$sx) ;FDD status anc $0,&H02 jr z,wr2 ;wait until the FDD reads the data byte pst ua,$1 rtn ; write a command $0 to the FDD cm1: gst ua,$1 ld $2,$1 or $2,&H30 pst ua,$2 pre ix,&HFFFF st $0,(ix+$sx) ;FDD command cm2: ld $0,(ix+$sx) ;FDD status anc $0,&H04 jr z,cm2 ;wait until the FDD reads the command byte pst ua,$1 rtn