Sample code to read and write sectors with IDE interface ======================================================== IDEdataLo=&FC40:IDEerror=&FC41:IDEcount=&FC42:IDEsector=&FC43 IDEcylinder=&FC44:IDEhead=&FC46:IDEstatus=&FC47:IDEcommand=&FC47 .IDERead BIT &FF:BMI IDEAbort :\ Escape pressed JSR IDEAddress :\ Write sector address to IDE LDA #&20:STA IDEcommand :\ &20=READ LDA IDEstatus :\ suitable checks for errors LDY #0 .IDEReadLoop LDA IDEdataLo:STA (addr),Y:INY :\ Read data from IDE to memory BNE IDEReadLoop INC addr+1 LDA IDEstatus :\ suitable checks for errors DEC count:BNE IDEReadLoop RTS : .IDEWrite BIT &FF:BMI IDEAbort :\ Escape pressed JSR IDEAddress :\ Write sector address to IDE LDA #&30:STA IDEcommand :\ &30=READ LDA IDEstatus :\ suitable checks for errors LDY #0 .IDEWriteLoop LDA (addr),Y:STA IDEdataLo:INY :\ Write data to IDE from memory BNE IDEReadLoop INC addr+1 LDA IDEstatus :\ suitable checks for errors DEC count:BNE IDEWriteLoop RTS : .IDEAddress LDA IDEstatus:BMI IDERead :\ Wait until IDE not busy LDA count:STA IDEcount :\ Number of sectors to read LDA sector:STA IDEsector :\ Sector or LBA b0-b7 LDA cylinder:STA IDEcylinder :\ Cylinder b0-b7 or LBA b8-b15 LDA cylinder+1:STA IDEcylinder+1 :\ Cylinder b8-b15 or LBA b16-b23 LDA head:STA IDEhead :\ Head b0-b3 or LBA b24-b27 :\ b4=drive 0/drive 1 :\ b6=0 for HCS access :\ b6=1 for logical block address .IDEAbort RTS