Nemo HDD
ZXNet echo conference «code.zx»
From Kirill Frolov → To Sergey Selev 2 April 2001
Press RESET immediately, Sergey!
27 Mar 01 11:23, Sergey Selev wrote to All:
SS> A description of the subject ports is needed.
Base address: %xxxxxxxx aaacc11h
21010 <- parts of the address
x = any bit
a = address part of the accumulator register: a0, a1, a2
c = CSx select register bank 0/1.
h = if (1) then writing/reading occurs from the register storing
the high half of the address bus. When writing from 16-bit numbers to
the drive must first write the higher half of the number
into this register (the values of the _a_ and _c_ bits are not important),
and then write the lower half to the desired register. While reading
from the 16-bit number storage after reading from the main
register of the lower half can be read from this register
the leading part of the number.
Thus it turns out:
#xx10 low half of the data register
#xx30 property and error register....
.....
#xxF0 command and status register
#xxC8 alternative status and device control register
For a description of the registers, see the doc on the IDE interface.
Here is an example (not tested, not working, not completed and not at all
look at him):
=== Cut === file: nemo_hdd.inc
; nemo-hdd controller
ctlr equ 0xff08
ctlr equ 0xff10
has equ ctlr+0xc0
hdc equ ctlr+0xc0hdr equ cmdr+0x00
her equ cmdr+0x20 ; r
hfr equ cmdr+0x20 ; w
hsc equ cmdr+0x40
hsn equ cmdr+0x60
hcl equ cmdr+0x80
hch equ cmdr+0xa0
hdh equ cmdr+0xc0
hsr equ cmdr+0xe0 ; r
hcr equ cmdr+0xe0 ; w
hdrh equ hdr+0x01
=== Cut ===
=== Cut === file: nemo_ctl.as
include nemo_hdd.inc
public idewrr, iderdr
public idewrb, iderdb
public idedev
; write DE to IDE register BC (get reg. addr. from nemo_hdd.inc etc...)
idewrr: inc c
out (c), d
dec c
out (c), e
ret
; read IDE register BC to DE
iderdr: in e, (c)
inc c
in d, (c)
dec c
ret
; read data block (512 bytes) in PIO mode from IDE device to (HL++)
iderdb: ld bc, hdr
ld a, 64
rdb1: ini
inc c
ini
dec c
ini
inc c
ini
dec c
ini
inc c
ini
dec c
ini
inc c
ini
dec c
dec a
jr nz, rdb1
ret
; write data block (512 bytes) in PIO mode to IDE device from (HL++)
idewrb: ld bc, hdr
ld a, 64
wrb1: inc hl
inc c
outd
dec c
outi
inc hl
inc hl
inc c
outd
dec c
outi
inc hl
inc hl
inc c
outd
dec c
outi
inc hl
inc hl
inc c
outd
dec c
outi
inc hl
dec a
jr nz, wrb1
ret
=== Cut ===
=== Cut === file: ide_comm.inc
; hdd commands
sbsy equ 0x80 ; status register masks
sdrdy equ 0x40
sdf equ 0x20
ssdc equ 0x10
sdrq equ 0x08
scorr equ 0x04
sidx equ 0x02
serr equ 0x01
mdev equ 0x10 ; head/dev register bits
mlba equ 0x40
hdiag equ 0x90 ; commands
hident equ 0xec
hinit equ 0x91
hnop equ 0x00
hrdbuf equ 0xe4
hread equ 0x20
hverify equ 0x40
hrecal equ 0x10
hseek equ 0x70
hfeaut equ 0xef
hwrbuf equ 0xe8
hwrsam equ 0xe9
hwrite equ 0x30
hstdby0 equ 0x94
hstdby1 equ 0xe0
hrdmult equ 0xc4
hwrmult equ 0xc5
hrdlong equ 0x22
hwrlong equ 0x32
hsetmul equ 0xc6
=== Cut ===
=== Cut === file: ide_comm.as
include ide_comm.inc
extrn idewrr, iderdr, idewrb, idewrb
public idebsy, iderdy, ide_dh, chslba, lbachs
; convert LBA to CHS
; dehl=lba address, de=CylinderSize, c=Sectors
; -> hl=cylinder, d=head, e=sector
; CylinderSize = Heads * Sectors
; CYL=LBA/CylinderSize temp1=LBA%CylinderSize
; HEAD=temp1/Sectors temp2=temp1%Sectors
; SEC=temp2+1
;
lbachs:
; hl=dehl(28bit)/de' hl'=dehl%de'
ld hl, 0
exx
add hl, hl
rl e
rl d
add hl, hl
rl e
rl d
add hl, hl
rl e
rl d
add hl, hl
rl e
rl d ; skip 4 bits (32-28)
ld b, 28
lbadiv1:
add hl, hl
rl e
rl d
exx
adc hl, hl
sbc hl, de
exx
jr nc, lbadiv2
exx
add hl, de
exx
dec l
ldadic2:
inc l
djnz lbadiv1
push hl ; store cylinder
exx ; hl=temp1
; hl=hl/c a=hl%c
ld b, 16
xor a
lbadiv3:
add hl, hl
rla
sbc a, c
jr nc, lbadiv4
add a, c
dec l
lbadiv4:
inc l
djnz lbadiv3
ld d, l ; head
inc a
ld e, a ; sector
pop hl ; cylinder
ret
; convert CHS to LBA
; hl=cylinder, d=head, e=sector, b=Heads, c=Sectors
; -> dehl=lba address
; LBA=(CYL*Heads+HEAD)*Sectors+SEC-1
;
chslba:
push de ; store head and sector
push bc ; store Sectors
ex de, hl ; de=cylinder
ld c, b ; c=Heads
; ahl=de*c
ld hl, 0
xor a
ld b, 8
chsmul1:
add hl, hl
adc a, a
rl c
jr nc, chsmul2
add hl, de
adc a, 0
chsmul2:
djnz chsmul1
pop bc ; c=Sectors
pop de ; d=head, e=sector
ld b, c
ld c, d
ld d, b
ld b, 0 ; bc=head, d=Sectors, e=sector
add hl, bc
adc a, 0
ex de, hl ; de=hl
exx
ld e, a
ld hl, 0
ld d, l ; de'=a
exx
ld c, l ; c=sector
ld a, h ; a=Sectors
ld hl, 0
; hl'hl=de'de*a
ld b, 8
chsmul3:
add hl, hl
exx
adc hl, hl
exx
rla
jr nc, chsmul4
add hl, de
exx
adc hl, de
exx
chsmul4:
djnz chsmul3
dec c ; bc=sector-1
add hl, bc
push hl
exx
ex de, hl
pop hl
rl e
rl d ; dehl=hl'hl+bc
ret
; set dev/head register (lba/chs mode, device and head)
; a=mode lba=1/chs=0, d=head , e=device
ide_dh: or a
jr z, idedh1
ld a, mlba
idedh1: bit 0, e
jr z, idedh2
or mdev
idedh2: or d
ld e, a
ld bc, hdh
jp idewrr
; wait while selected ide device is busy
; return a=status reg, cy=1 if timeout
idebsy: call itimer
ld (bsytm1), hl
bsyw: ld bc, has
call iderdr
ld a, e
and sbsy
ld a, e
ret z ; not busy now
push de
call itimer
ld de, 0
bsytm1 equ $-2
or a
sbc hl, de
ld de, idetio ; max. timeout
or a
sbc hl, de
pop de
jr c, bsyw
ld a, e
scf ; timeout
ret
; wait while selected ide device is not ready
; return a=status reg, cy=1 if timeout
iderdy: call itimer
ld (rdytm1), hl
rdyw: ld bc, hsr
call iderdr
ld a, e
and sdrdy
ld a, e
ret nz ; ready now
push de
call itimer
ld de, 0
rdytm1 equ $-2
or a
sbc hl, de
ld de, idetio ; max. timeout
or a
sbc hl, de
pop de
jr c, rdyw
ld a, e
scf ; timeout
ret
=== Cut ===
From Sergey Zotov → To Denis Kitel 20 April 2001
On Sun 8 Apr 2001, Denis Kitel wrote:
DK>>> Try asking Nemo. :)))
SS>> He doesn’t have a network, as far as I know.
DK> And it never will be, for some reason this Mr. Nemo is against networks, and
DK> does not want to disclose the screw ports, arguing that
DK> people will immediately start writing their own “leftist” programs and drivers
DK> and worldwide chaos will begin! :(
Will this make him feel bad?
By the way! You can dig into the is-dos of the drider and get the addresses if you really need it.
Personally, KAY's are neither hot nor cold. Only one thing infuriates me: is it really at the end of the 20th century
It was impossible to install the fdd controller on the board. And even go for 2 only!
E-mail: zs80@nm.ru ~/ <~ http://www.zx.ru/zs/
ZXNet: 500:8462/1 /_ _> ftp://zx-museum.org.ru/zs/
From Evgeny Poddubny → To Sergey Zotov 21 April 2001
Greetings, Sergey
Somehow Friday April 20, 2001 at 17:45:10 soaped
Sergey Zotov to Denis Kitel on the topic Nemo HDD
DK>>>> Try asking Nemo. :)))
SS>>> He doesn’t have a network, as far as I know.
DK>> And it never will be, for some reason this Mr. Nemo is against networks, and
DK>> does not want to disclose the screw ports, arguing that
DK>> what
DK>> people will immediately start writing their own “left-handed” programs and drivers
DK>> and worldwide chaos will begin! :(
SZ> Will this make him feel bad?
SZ> By the way! You can dig into the drider's is-dos and find out the addresses
There is no need to suffer through bullshit - there are addresses:
═══════════════════ ports.tx.C ══════════════════
================== begin of file "NemoHDD .C" ==================
DATL EQU #10 ;10: Data register low byte
DATH EQU DATL+1 ;11: Data register high byte
ERRF EQU DATL+#20 ;31:Error Rg
SCNT EQU ERRF+#20 ;51:Pg sector counter
SNMB EQU SCNT+#20 ;71: Sector no.
CYLL EQU SNMB+#20 ;91:Rg cylinder no. (junior)
CYLH EQU CYLL+#20 ;B1: Cylinder no. (major)
SDH EQU CYLH+#20 ;D1: Drive and head no.
RSTA EQU SDH+#20 ;F1:Pr state
RCOM EQU RSTA ;F1:Rg commandsASR EQU #C8 ;Alter Stat Rg
FDR EQU #C8 ;Fixed disk Rg
DIR EQU #E8 ;Dig In Rg
SYSR EQU #F8 ;sys rg
================== end of file "NemoHDD.C" ==================
.
════════════════════════ ════════════════════════
SZ> if anyone really needs it. Personally, KAY's are neither hot nor cold.
SZ> Only one thing infuriates me: was it really impossible to fdd
SZ> place the controller on the board. And even go for 2 only!
SAYO:NARA, DO:ZO O-GENKI-DE, Evgeny Poddubny.
From Stanislav Udin → To Sergey Zotov 1 May 2001
Hello Sergey!
30 Apr 01 01:31, Sergey Zotov -> Stanislav Udin:
SU>> It was possible, of course, but Nemo planned to do it later
SU>> separate HDD+FDD controller and insert into one slot.
SU>> Apparently something didn’t work out for him.
SZ> And imho it will never grow together now. And the users of this suffer
SZ> machines. :/
In any case, two free slots in KAE are more than one free slot
in Scorpio.
SZ>>> And even move to 2 only!
SU>> Why more?
SZ> Do I have 2 A's and 1 C? Most have only A's, that's it
SZ> I need to copy to 5 by 5, because even with a screw on it, everything is not
SZ> put it down. And I use three for everything with the PC.
I have a Scorpio and I had to give up one A in favor of a C.
At first I struggled, but then I got used to using only two drives.
SZ> With the help of 2 microcircuits, my yellow Scorp was fitted with 2 more
SZ> drive to the available 2m. Is it possible to do this on KAY?
I have no idea :)
Stanislav