Amazing #02
14 июля 1998 |
|
Assembler - SH-93: Procedures for direct work with the floppy drive controller.
(C) 1998 by Dr. Serg Music by Spider ; Sector write procedure ; Entry: BC-trek, sect ; Recording from addresses HL ; (WrMode) keeps a record type sector ; 00 bit 2 is set (# FB) ; 10100h00 ; # FF bit 2 set (# F8) , Output: A = 0 OK.v HL-next addres ; A = a positioning error ; A = 2 error records ; After the disk status register. , Is rewritten by (ErrWG) , With type 2 error is repeating ; Attempt to read (PowtRDS) raz.pri this ; Increasing. value (Bader) 1 WrSect ld a, (WrMode) ld ix, Wrseccom res 0, (ix +1) and a: jr z, Wrsec1 set 0, (ix +1) Wrsec1 ld de, PowtRDS ld a, (de): inc de ld (de), a ld (Wrsec6 +1), hl ld a, -1 call Posic and a jr nz, Wrsec3 Wrsec2 push bc ld a, c ld c, # 5f call Dos1; Register sector ld c, # 1f Wrseccom ld a,% 10100000 call Dos1; command register ld c, # 7f ld ix, # 3fba call Dos2; write cycle ld ix, # 3c30 call Dos2 ld (ErrWG), a; registration status push hl Wrsec6 ld de, 0 inc de and a sbc hl, de pop hl pop bc jr z, Wrsec4; not write and% 11111111 jr nz, Wrsec4 xor a jr Wrsec5 Wrsec4 ld hl, (Baderr) inc hl ld (Baderr), hl ld hl, (Wrsec6 +1) ld a, (PowtRDS +1) dec a ld (PowtRDS +1), a ld a, 2 jp m, Wrsec5 jr Wrsec2 Wrsec3 ld a, 1 Wrsec5 out (# fe), a ret ; Procedure readout sector ; Entry: BC-trek, sect ; Reading is made at HL , Output: A = 0 HL-len load data (128,256 ..) ; A = a positioning error ; A = 2 error load data ; After the disk status register. , Is rewritten by (ErrWG) , With type 2 error is repeating ; Attempt to read (PowtRDS) n raz.pri this ; Increasing. value (Bader) 1 Rd1Sec ld de, PowtRDS ld a, (de) inc de ld (de), a ld (Rdsec6 +1), hl ld a, -1 call Posic and a jr nz, Rdsec3 Rdsec2 push bc ld a, c ld c, # 5f call Dos1; Register sector ld c, # 1f ld a,% 10000000 call Dos1; command register ld c, # 7f ld ix, # 3fd5 call Dos2; cycle read ld ix, # 3c30 call Dos2 ld (ErrWG), a; registration status push hl Rdsec6 ld de, 0 inc de and a sbc hl, de pop hl pop bc jr z, Rdsec4; not read and% 11011111 jr nz, Rdsec4 out (# fe), a ret Rdsec4 ld hl, (Baderr) inc hl ld (Baderr), hl ld hl, (Rdsec6 +1) ld a, (PowtRDS +1) dec a ld (PowtRDS +1), a ld a, 2 jp m, Rdsec5 jr Rdsec2 Rdsec3 ld a, 1 Rdsec5 out (# fe), a ret WrMode DB 0 PowtRDS DB 10,0 Baderr DW 0 ; Procedure of positioning the head ; Login: B - track number 0-159 ;: A = 0 test position 1 ; (0001 1h00) ;: A = 255 not verify 0 ; Output: A = 0 O.K. ; A <> 0 Error, bit 7, a = 1 command is not , Adopted ; Bit 4, a = 1 error on; zitsionirovaniya ; Bit 0, a = 1 controller ; Not ready to receive ; Changes IX, AF ; Service Registry => (ErrWG) ; When starting the engine pauses ; Opred.konstantoy => (DrPause) Posic push bc ld ix, posicC and a set 2, (ix +1) jr z, posic3 res 2, (ix +1) posic3 ld ix, posicex push ix ; Ust.side ld a, b srl a ld b, a ld ix, # 1feb jr nc, posic1 ld ix, # 1ff6 posic1 call Dos2 ld ix, # 3c30 call Dos2 bit 0, a jr z, posic4 ; SH not gotova.preryvanie Kamanda ld a,% 11010000 ld c, # 1f ld ix, # 2a53 jr posic1 ; Checking motor rotation , And the modification of const. delay posic4 ld ix, 1 bit 7, a jr z, posic5 ld ix, (DrPause) posic5 ld (posicp +2), ix ld a, b ld c, # 7f call Dos1; ust.nom.treka posicC ld a,% 00011100; bit 2-way navigation key and check .. ld c, # 1f call Dos1; Track Search ld ix, # 3c30; in a, (# 1f) posic2 call Dos2 bit 0, a; is the command jp nz, posic2 bit 7, a ret nz; Emergency exit ; Drive worth! bit 4, a ret nz; error search bit 3, a ret nz; error control. ; Code (if CHECK) ld (ErrWG), a ; Pause, if there was engine start posicp ld ix, 0 posic6 dec ix ld a, xl or xh jr nz, posic6 pop bc pop bc ret posicex ld (ErrWG), a pop bc ret ; Procedure to pass in TR.DOS ; On # 2A53: OUT (BC), A: RET Dos1 ld ix, # 2a53; out (c), a: ret Dos2 push ix jp # 3d2f ErrWG DB 0 DrPause DW # A000
Other articles:
Similar articles:
В этот день... 21 November