HD61700 ASSEMBLER Rev 0.45 - ASSEMBLY LIST OF [ch14p1.s]
00001:0000            ; MD-120 diagnostic command 0x31 on the FX-870P
00002:0000            
00003:0000                         org     0
00004:0000                         start   0
00005:0000            
00006:0000  420005                 ld      $0,&H05               ;FDD command &H05: enter the diagnostic mode
00007:0003  778A00                 cal     cm1                   ;send the command $0 to the FDD
00008:0006  420031                 ld      $0,&H31               ;diagnostic command &H31: write to the LED
00009:0009  778A00                 cal     cm1                   ;send the command $0 to the FDD
00010:000C  42004E                 ld      $0,&H4E               ;pattern 'C'
00011:000F  777000                 cal     wr1                   ;write byte $0 to the FDD
00012:0012  774E00                 cal     delay
00013:0015  420077                 ld      $0,&H77               ;pattern 'A'
00014:0018  777000                 cal     wr1                   ;write byte $0 to the FDD
00015:001B  774E00                 cal     delay
00016:001E  42005B                 ld      $0,&H5B               ;pattern 'S'
00017:0021  777000                 cal     wr1                   ;write byte $0 to the FDD
00018:0024  774E00                 cal     delay
00019:0027  420030                 ld      $0,&H30               ;pattern 'I'
00020:002A  777000                 cal     wr1                   ;write byte $0 to the FDD
00021:002D  774E00                 cal     delay
00022:0030  42007E                 ld      $0,&H7E               ;pattern 'O'
00023:0033  777000                 cal     wr1                   ;write byte $0 to the FDD
00024:0036  774E00                 cal     delay
00025:0039  0200                   ld      $0,$sx                ;terminate the command
00026:003B  777000                 cal     wr1                   ;write byte $0 to the FDD
00027:003E  774E00                 cal     delay
00028:0041  775700                 cal     rd1                   ;read a byte from the FDD to $0
00029:0044  420021                 ld      $0,&H21               ;diagnostic command &H21: system restart
00030:0047  778A00                 cal     cm1                   ;send the command $0 to the FDD
00031:004A  566054                 pst     ua,&H54
00032:004D  F7                     rtn     
00033:004E            
00034:004E            ; delay 500 ms
00035:004E  D100324D  delay:       ldw     $0,19762
00036:0052  8920      delay1:      sbw     $0,$sy                ;14 cycles
00037:0054  B483                   jr      nz,delay1             ;9 cycles
00038:0056  F7                     rtn     
00039:0057            
00040:0057            ; read a byte from the FDD to $0
00041:0057  1E61      rd1:         gst     ua,$1
00042:0059  026201                 ld      $2,$1
00043:005C  4E0230                 or      $2,&H30
00044:005F  1662                   pst     ua,$2
00045:0061  D600FFFF               pre     ix,&HFFFF
00046:0065  2800      rd2:         ld      $0,(ix+$sx)           ;FDD status
00047:0067  0420                   anc     $0,$sy
00048:0069  B485                   jr      nz,rd2                ;wait until the FDD sends the data byte
00049:006B  28A0                   ld      $0,(ix-$sy)           ;FDD data
00050:006D  1661                   pst     ua,$1
00051:006F  F7                     rtn     
00052:0070            
00053:0070            ; write a byte $0 to the FDD
00054:0070  1E61      wr1:         gst     ua,$1
00055:0072  026201                 ld      $2,$1
00056:0075  4E0230                 or      $2,&H30
00057:0078  1662                   pst     ua,$2
00058:007A  D600FFFF               pre     ix,&HFFFF
00059:007E  20A0                   st      $0,(ix-$sy)           ;FDD data
00060:0080  2800      wr2:         ld      $0,(ix+$sx)           ;FDD status
00061:0082  440002                 anc     $0,&H02
00062:0085  B086                   jr      z,wr2                 ;wait until the FDD reads the data byte
00063:0087  1661                   pst     ua,$1
00064:0089  F7                     rtn     
00065:008A            
00066:008A            ; write a command $0 to the FDD
00067:008A  1E61      cm1:         gst     ua,$1
00068:008C  026201                 ld      $2,$1
00069:008F  4E0230                 or      $2,&H30
00070:0092  1662                   pst     ua,$2
00071:0094  D600FFFF               pre     ix,&HFFFF
00072:0098  2000                   st      $0,(ix+$sx)           ;FDD command
00073:009A  2800      cm2:         ld      $0,(ix+$sx)           ;FDD status
00074:009C  440004                 anc     $0,&H04
00075:009F  B086                   jr      z,cm2                 ;wait until the FDD reads the command byte
00076:00A1  1661                   pst     ua,$1
00077:00A3  F7                     rtn     
00078:00A4            
00079:00A4            

ASSEMBLY COMPLETE, NO ERRORS FOUND

HD61700 ASSEMBLER Rev 0.45 - MAP LIST OF [ch14p1.s]
 LABEL           : ADDRESS(hex)  | LABEL           : ADDRESS(hex)
-------------------------------------------------------------------
 delay           :   004Eh     A | delay1          :   0052h      A
 rd1             :   0057h     A | rd2             :   0065h      A
 wr1             :   0070h     A | wr2             :   0080h      A
 cm1             :   008Ah     A | cm2             :   009Ah      A

 START ADDRESS   = 0000h
 END ADDRESS     = 00A3h
 EXECUTE ADDRESS = 0000h
