?? ide-8255.txt
字號:
0000 = 0002 DataP1 equ $0002 | Data Port1
0000 = 0003 DataP2 equ $0003 | Data Port 2
0000 = 0008 Tcon equ $0008 | Timer Control
0000 = 0009 THigh equ $0009 | Timer high byte
0000 = 000A TLow equ $000A | Timer low byte
0000 = 0009 Timer equ $0009 | Timer for word access
0000 = 000B TComH equ $000B | Timer output compare high byte
0000 = 000C TComL equ $000C | Timer output compare low byte
0000 = 000B TCom equ $000B | Timer output compare word access
0000 = 000D TCapH equ $000D | Timer input capture high byte
0000 = 000E TCapL equ $000E | Timer input capture low byte
0000 = 000D TCap equ $000D | Timer input capture word address
0000 = 0010 ModBaud equ $0010 | Sio baudrate and mode control register
0000 = 0011 SioCon equ $0011 | Sio control register
0000 = 0012 SioRec equ $0012 | Sio receive register
0000 = 0013 SioSnd equ $0013 | Sio transmit register
0000 = 0014 RamCon equ $0014 | Ram Control register
0000 |
0000 |------------------------------------------------
0000 | Some of the Interrupts I do not use here and now.
0000 |------------------------------------------------
0000 |
0000 = 7FF0 ToiInt equ $7FF0 | vector them to RAM
0000 = 7FF4 IciInt equ $7FF4 |
0000 = 7FF8 IrqInt equ $7FF8 |
0000 = 7FFC NMIInt equ $7FFC |
0000 |
0000 |------------------------------------------------
0000 | The bytes SioByte and SioStat are used as
0000 | follows:
0000 | SioByte is the latest received byte from the Sio
0000 | SioStat indicates the status of the sio with the
0000 | following bits:
0000 |
0000 = 0080 SioEcho equ %10000000 | echo modus ON
0000 = 0040 SioRaw equ %01000000 | RAW input modus
0000 = 0020 SioInAv equ %00100000 | input received
0000 = 0010 SioEsc equ %00010000 | Run modus interrupt enable
0000 |
0000 |-------------------------------------------------
0000 | constans etc.. for the program
0000 |-------------------------------------------------
0000 |
0000 = 000A lf equ $0A | <LF>
0000 = 000D cr equ $0D | <CR>
0000 = 0000 eom equ $00 | end of message
0000 |
0000 |-------------------------------------------------
0000 | a few constants for single-step control
0000 |-------------------------------------------------
0000 |
0000 = 003F swic equ $3F | opcode for swi
0000 = 4000 start equ $4000 | default start adres voor single-step
0000 = FFFF nil equ $FFFF | nil pointer
0000 |
0000 |---------------------
0000 | System entry points
0000 |---------------------
0000 |
0000 = F000 SndData equ $F000 | send a data byte to the sio
0000 = F003 RecSio equ $F003 | receive a (raw) data byte from the sio
0000 = F006 RecData equ $F006 | receive a (coocked) data byte from the sio
0000 = F009 SndStr equ $F009 | send (X) ASCIZ string to the sio
0000 = F00C Prompt equ $F00C | give a prompt
0000 = F00F NewLine equ $F00F | print new line
0000 = F012 WaitRet equ $F012 | wait for a return
0000 = F015 RecHex equ $F015 | receive hex byte from the sio
0000 = F018 RecHex1 equ $F018 | receive non-space byte from the sio
0000 = F01B ConvHex equ $F01B | convert byte from ASCII -> hex
0000 = F01E SndHex equ $F01E | send byte as two hex ASCII chars
0000 = F021 SndHex1 equ $F021 | no-space send byte asc ASCII chars
0000 = F024 SndHDig equ $F024 | send one hex digit
0000 = F027 RecAdr equ $F027 | receive starta and enda from sio
0000 = F02A RecAdr1 equ $F02A | receive enda from the sio
0000 = F02D CI equ $F02D | Command Interpreter
0000 = F030 GetName equ $F030 | get name string pointer for address
0000 = F033 Go equ $F033 | edit memory
0000 = F039 Edit equ $F039 | go start at some address
0000 = F03F HexFile equ $F03F | download hexfile
0000 = F042 ModReg equ $F042 | modify single-step registers
0000 = F045 Ver equ $F045 | print version info
0000 = F048 Help equ $F048 | give help message
0000 = F04B NoCmd equ $F04B | No Command found
0000 = F04E Adr equ $F04E | set start Adres
0000 = F051 Break equ $F051 | set breakpoint address
0000 = F054 Cont equ $F054 | Continue till address
0000 = F057 JmpSub equ $F057 | -> JmpSub
0000 = F05A Step equ $F05A | -> single-step
0000 = F05D GoBrks equ $F05D | -> GoBreaks
0000 = F060 Trap equ $F060 | -> Trap
0000 = F063 Stop equ $F063 | -> Stop
0000 = F066 RunInt equ $F066 | -> RunInt
0000 = F069 SndRegs equ $F069 | -> SndRegs
0000 = F06C NumByt equ $F06C | -> NumByt
0000 = F06F UnAsm equ $F06F | -> UnAsm
0000 = F072 DisAsm equ $F072 | -> DisAsm
0000 = F075 Tmon equ $F075 | -> TMon
0000 = F078 SYS equ $F078 | -> SYS
0000 = F07B SysIrq equ $F07B | -> SysIrq
0000 |
0000 |---------------------
0000 | System calls function numbers
0000 |---------------------
0000 |
0000 = 0000 sysSusp equ $00 | suspend task
0000 = 0001 sysSleep equ $01 | sleep for B clock ticks
0000 = 0002 sysPer equ $02 | periodic schedule
0000 = 0003 sysSched equ $03 | schedule a task
0000 = 0004 sysPar equ $04 | get scheduling par
0000 = 0005 sysSusSig equ $05 | suspend for signal
0000 = 0006 sysSndSig equ $06 | send a signal
0000 = 0007 sysGetRes equ $07 | get/suspend on resources
0000 = 0008 sysGivRes equ $08 | release resources
0000 = 0009 sysSioSnd equ $09 | send data to sio
0000 = 000A sysSioRec equ $0A | receive/wait for sio byte
0000 = 000B sysIntWait equ $0B | wait for an interrupt
0000 = 000C sysIntArm equ $0C | clear interrupt status
0000
** END INCLUDE ** end
0000
0000 |Defs-----------------------------------------------------------
0000 |
0000 | The I/O ports of the IDE controller
0000 |
0000 = 0500 IoBase equ $0500 | I/O base address for the disk
0000 = 0500 IoCtl equ $0500 | Control byte for IDE
0000 = 0501 IoDatL equ $0501 | Low byte data IDE
0000 = 0502 IoDatH equ $0502 | High byte data IDE
0000 = 0503 IoMod equ $0503 | I/O modus IDE
0000 |
0000 | The I/O modi I use
0000 |
0000 = 0080 DMout equ $80 | all output
0000 = 008B DMin equ $8B | ctl = output, data input
0000 |
0000 | The bits of the control byte
0000 |
0000 = 0000 DCNOP equ %00000000 | Nothing on IDE ctl bus
0000 = 0080 DCRes equ %10000000 | /reset bit
0000 = 0040 DCIor equ %01000000 | /IORD bit
0000 = 0020 DCIow equ %00100000 | /IOWR bit
0000 = 0010 DCCs1 equ %00010000 | /CS1 bit
0000 = 0008 DCCs0 equ %00001000 | /CS0 bit
0000 = 0007 DCADR equ %00000111 | ADR mask bits
0000 |
0000 | IDE adresses
0000 |
0000 = 0007 IDECmd equ $07 | addres for command
0000 = 0007 IDESts equ $07 | addres status register
0000 = 0006 IDEHd equ $06 | addres head number
0000 = 0005 IDECylH equ $05 | addres cylinder number high
0000 = 0004 IDECylL equ $04 | addres cylinder number low
0000 = 0003 IDEsec equ $03 | addres sector number
0000 = 0002 IDEnum equ $02 | addres number of sectors
0000 = 0000 IDEData equ $00 | addres for data bus
0000 = 000E IDERIRQ equ $0E | addres Reset/IRQ register
0000 = 0001 IDEErr equ $01 | addres Error register
0000 |
0000 | The head number (0..F) also has the mask for master/slave
0000 | I fix this at Master, I do not think I will use two drives
0000 | on my IDE interface.
0000 |
0000 = 000F IDEHdA equ %00001111 | head number and mask
0000 = 00A0 IDEHdO equ %10100000 | head number or mask
0000 |
0000 | The Reset/IRQ register has two interesting bits
0000 |
0000 = 0100 IDESRes equ $00000100 | Soft Reset bit
0000 = 0010 IDENIRQ equ $00000010 | 0 = IRQ active
0000 |
0000 | The bits from IDESts
0000 |
0000 = 0080 StsBsy equ %10000000 | busy flag
0000 = 0040 StsRdy equ %01000000 | ready flag
0000 = 0020 StsWft equ %00100000 | Write error
0000 = 0010 StsSKC equ %00010000 | seek complete
0000 = 0008 StsDRQ equ %00001000 | Data Request
0000 = 0004 StsCorr equ %00000100 | ECC executed
0000 = 0002 StsIdx equ %00000010 | Index found
0000 = 0001 StsErr equ %00000001 | error flag
0000 |
0000 | Command opcodes
0000 |
0000 = 0010 CmdRecal equ $10 | recalibrate disk
0000 = 0020 CmdRead equ $20 | write a block
0000 = 0030 CmdWrite equ $30 | read block
0000 = 00E0 CmdStop equ $E0 | Stop disk
0000 = 00E1 CmdStrt equ $E1 | Start disk
0000 = 00EC CmdIdent equ $EC | Identify disk
0000 |
0000 | The default state (I will always leave it in this state) is:
0000 | IDE bus on input, control word == IDENOP ($FF)
0000 |
0000 | I use a memory command packet to tell the disk what to do
0000 | This packet has the following makeup:
0000 |
0000 = 0000 SDA equ 0 | offset source/destination
0000 | address in memory for the
0000 | operation
0000 = 0002 LBA3 equ 2 | offset LBA
0000 = 0003 LBA2 equ 3 | 32-bits number for a disk
0000 = 0004 LBA1 equ 4 | of max 2.1E12 bytes...
0000 = 0005 LBA0 equ 5 | should be enough!
0000 |
0000 | I use Lineair Block Access (LBA) ALL THE TIME. For this disk
0000 | (that does not support it by itself) I have a routine called
0000 | SetLBA to convert the LBA to a CHS configuration.
0000 |
0000 | I use two parameters to decribe the disk geometry:
0000 |
0000 | - The number of blocks per cylinder:
0000 | in CHS terms this is HxS
0000 |
0000 | - The number of blocks per track
0000 | in CHS terms this is S
0000 |
0000 | From these two I can convert LBA to CHS completely. They are
0000 | stored in the following two words:
0000 |
0000 | 42 MB disk:
0000 = 0055 SPC equ 85 | Sectors per Cylinder
0000 = 0011 SPT equ 17 | Sectors per track
0000 |
0000 | 127 MB disk:
0000 |SPC equ 272 | Sectors per Cylinder
0000 |SPT equ 17 | Sectors per track
0000 |
0000 | 212 MB disk:
0000 |SPC equ 420 | Sectors per Cylinder
0000 |SPT equ 35 | Sectors per track
0000 |
0000 | I now use the CPU's /IRQ input to handle the disk's IRQ
0000 | signals. The below parameters are for handling these IRQ-s
0000 |
0000 = 0001 irqdisk equ %00000001 | IRQ bit 0 used for the disk
0000 |
0000 |End------------------------------------------------------------
0000
0000 |Debug----------------------------------------------------------
0000 |
0000 | debug defines for this code
0000 |
0000 |End------------------------------------------------------------
0000
0000 | make the thing as a task
0000 org $4000 | some address
4000 54534B0E db "TSK",$0E | low prio task, a disk is SLOOOW
4004 4040 dw DiskTask | code address
4006 4FFF dw DiskStk | stack
4008 4469736B5461 db "DiskTask" | module name
4010
4010 = 4FFF DiskStk equ $4FFF | leave some room (a LOT, in
4010 | fact)
4010
4010 | command block 0
4010 4800 CMDBLK0:dw $4800 | SDA = $4800
4012 0000 dw $0000 | LBA = $00000000
4014 0000 dw $0000 |
4016
4016 | command block 1
4016 4A00
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -