|
|
1.1 ! root 1: / (lgl- ! 2: / COHERENT Driver Kit Version 1.1.0 ! 3: / Copyright (c) 1982, 1990 by Mark Williams Company. ! 4: / All rights reserved. May not be copied without permission. ! 5: / -lgl) ! 6: //////// ! 7: / ! 8: / AT Hard Disk Assembler Support ! 9: / ! 10: / $Log: atas.s,v $ ! 11: / Revision 1.3 91/10/30 08:07:49 bin ! 12: / updated by hal for 3203 kernel ! 13: / ! 14: /Revision 1.3 91/10/24 12:37:44 hal ! 15: /COH 3.2.03k. ! 16: /Poll HF_REG (3F6) rather than CSR_REG (1F7). ! 17: / ! 18: / ! 19: / atsend( off, seg ) - send 512 bytes from seg:off into hard disk buffer ! 20: / atrecv( off, seg ) - receive 512 bytes from hard disk buffer into seg:off. ! 21: / DRQ is not checked. DRQ must be true before atsend/atrecv are called. ! 22: / ! 23: / atbsyw() - wait while controller is busy ! 24: / atdrqw() - wait for controller to request data transfer ! 25: / ! 26: //////// ! 27: ! 28: .globl atsend_ ! 29: .globl atrecv_ ! 30: .globl atbsyw_ ! 31: .globl atdrqw_ ! 32: ! 33: HF_REG = 0x03F6 ! 34: BSY_ST = 0x80 ! 35: DRQ_ST = 0x08 ! 36: ! 37: //////// ! 38: / ! 39: / void ! 40: / atsend( fp ) -- send 512 bytes to AT disk controller. ! 41: / faddr_t fp; ! 42: / ! 43: / Input: fp = far pointer [sel:off] to data buffer. ! 44: / ! 45: / Action: Transfer 512 bytes to AT disk controller from buffer. ! 46: / ! 47: //////// ! 48: ! 49: atsend_: ! 50: push si ! 51: push ds ! 52: push bp ! 53: mov bp, sp ! 54: lds si, 8(bp) ! 55: mov cx, $256 ! 56: mov dx, $0x1F0 ! 57: cld ! 58: rep ! 59: outs ! 60: pop bp ! 61: pop ds ! 62: pop si ! 63: ret ! 64: ! 65: //////// ! 66: / ! 67: / void ! 68: / atrecv( fp ) -- receive 512 bytes from AT disk controller. ! 69: / faddr_t fp; ! 70: / ! 71: / Input: fp = far pointer [sel:off] to data buffer. ! 72: / ! 73: / Action: Transfer 512 bytes from AT disk controller to buffer. ! 74: / ! 75: //////// ! 76: ! 77: atrecv_: ! 78: push di ! 79: push es ! 80: push bp ! 81: mov bp, sp ! 82: les di, 8(bp) ! 83: mov cx, $256 ! 84: mov dx, $0x1F0 ! 85: cld ! 86: rep ! 87: ins ! 88: pop bp ! 89: pop es ! 90: pop di ! 91: ret ! 92: ! 93: //////// ! 94: / ! 95: / atbsyw() -- wait for AT disk controller to become not busy ! 96: / ! 97: / Return: 0 = timeout ! 98: / * = not busy ! 99: / ! 100: //////// ! 101: ! 102: atbsyw_: ! 103: mov dx, $HF_REG ! 104: mov bx, $4 / add another layer of iteration for 486's ! 105: 0: mov cx, $-1 ! 106: 1: inb al, dx ! 107: testb al, $BSY_ST ! 108: loopne 1b ! 109: je 2f / not busy - return nonzero value ! 110: dec bx ! 111: jne 0b ! 112: 2: mov ax, cx ! 113: ret ! 114: ! 115: //////// ! 116: / ! 117: / atdrqw() -- wait for AT disk controller to initiate data request ! 118: / ! 119: / Return: 0 = timeout ! 120: / * = data requested ! 121: / ! 122: //////// ! 123: ! 124: atdrqw_: ! 125: mov dx, $HF_REG ! 126: mov bx, $4 ! 127: 0: mov cx, $-1 ! 128: 1: inb al, dx ! 129: testb al, $DRQ_ST ! 130: loope 1b ! 131: jne 2f / not busy - return nonzero value ! 132: dec bx ! 133: jne 0b ! 134: 2: mov ax, cx ! 135: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.