iderwsectorscommand.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 53 行
JAVA
53 行
/*
* $Id: IDERWSectorsCommand.java,v 1.1 2003/11/25 11:50:42 epr Exp $
*/
package org.jnode.driver.ide;
/**
* IDE Read and Write common initialization code
* @author gbin
*/
public abstract class IDERWSectorsCommand extends IDECommand {
protected final long lbaStart;
protected final int sectors;
public IDERWSectorsCommand(
int taskfile,
boolean master,
long lbaStart,
int sectors) {
super(taskfile, master);
this.lbaStart = lbaStart;
this.sectors = sectors;
if ((sectors < 1) || (sectors > 256)) {
throw new IllegalArgumentException("Sectors must be between 1 and 256");
}
}
protected void setup(IDEBus ide) {
final int select;
final int sectors;
final int lbaLow = (int) (lbaStart & 0xFF);
final int lbaMid = (int) ((lbaStart >> 8) & 0xFF);
final int lbaHigh = (int) ((lbaStart >> 16) & 0xFF);
final int lbaRem = (int) ((lbaStart >> 24) & 0x0F);
if (master) {
select = lbaRem | SEL_BLANK | SEL_LBA | SEL_DRIVE_MASTER;
} else {
select = lbaRem | SEL_BLANK | SEL_LBA | SEL_DRIVE_SLAVE;
}
if (this.sectors == 256) {
sectors = 0;
} else {
sectors = this.sectors;
}
ide.setSectorCountReg(sectors);
ide.setLbaLowReg(lbaLow);
ide.setLbaMidReg(lbaMid);
ide.setLbaHighReg(lbaHigh);
ide.setSelectReg(select);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?