Annotation of coherent/d/PS2_KERNEL/io.286/hld/psas.s, revision 1.1.1.1

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: / PS Hard Disk Assembler Support
                      9: 
                     10: 
                     11:        .globl  com_data_, fcn_trn0_, fcn_trn1_,fcn_trn2_,fcn_trn7_,fcn_trn15_
                     12:        .globl  i0_, i1_, i2_, i7_, i15_, end_table_
                     13:        
                     14:        .shri
                     15: 
                     16:        .globl  iresult_, mlkh_
                     17: iresult_:
                     18:        mov     ax,cs:mlkh_
                     19:        ret
                     20: 
                     21: mlkh_: .word   0x1234
                     22: 
                     23:        .blkb 15
                     24: extram:        .blkb 15
                     25:        .blkb 15
                     26: com_data_:.blkb 0x80
                     27: fcn_trn0_:
                     28:        .blkb 0x10
                     29: dev_blk0_:
                     30:        .blkb 0x10
                     31: fcn_trn1_:
                     32:        .blkb 0x50
                     33: dev_blk1_:
                     34:        .blkb 0x56
                     35: fcn_trn2_:
                     36:        .blkb 0x40
                     37: dev_blk2_:
                     38:        .blkb 0x96
                     39: fcn_trn7_:
                     40:        .blkb 0x50
                     41: dev_blk7_:
                     42:        .blkb 0x56
                     43: fcn_trn15_:
                     44:        .blkb 0x58
                     45: dev_blk15_:
                     46:        .blkb 0x2e
                     47: end_table_:
                     48: 
                     49: i0_:   .word   0
                     50: i1_:   .word   0
                     51: i2_:   .word   0
                     52: i7_:   .word   0
                     53: i15_:  .word   0
                     54: 
                     55: sp_:   .blkw   0x24                    
                     56: it_:   .blkw   432                     /This gives room for 18 items
                     57: 
                     58: 
                     59:        .globl iabios_r_
                     60: iabios_r_:
                     61:        mov     ax,cs
                     62:        mov     ds,ax
                     63:        mov     es,ax
                     64: 
                     65:        mov     di,$sp_         / Destination for the system parameter table
                     66:        call    build_sys_p
                     67:        mov     di,$it_         / Destination for the Initialization tables
                     68:        call    build_itab
                     69: 
                     70: 
                     71:        mov     si,0
                     72:        movb    cl,$24
                     73: 0:     
                     74:        mov     ax, si
                     75:        cmp     ax, sp_+30
                     76:        jge     2f
                     77: 
                     78:        imulb   cl
                     79:        mov     di, ax
                     80:        add     di,$it_
                     81: 
                     82:        cmp     (di), $0
                     83:        jne     1f
                     84:        mov     i0_, di
                     85: 1:
                     86:        cmp     (di), $1
                     87:        jne     1f
                     88:        mov     i1_, di
                     89: 1:
                     90:        cmp     (di), $2
                     91:        jne     1f
                     92:        mov     i2_, di
                     93: 1:
                     94:        cmp     (di), $7
                     95:        jne     1f
                     96:        mov     i7_, di
                     97: 1:
                     98:        cmp     (di), $15
                     99:        jne     1f
                    100:        mov     i15_, di
                    101: 1:
                    102:        inc     si
                    103:        jmp     0b
                    104: 2:
                    105:        call    init_dev
                    106:        mov     cs:mlkh_, ax
                    107:        ret
                    108: 
                    109: 
                    110: build_sys_p:
                    111:        push    ds
                    112: 
                    113:        xor     ax,ax   / Set Ds to 0, meaning that there are no Ram
                    114:        mov     ds,ax   /   extentions to be loaded
                    115:        movb    ah,$4
                    116:        int     0x15    / Bios call to build the System parameter table
                    117: 
                    118:        jc      1f      / Error?
                    119: 
                    120:        xor     ax,ax   / No error
                    121: 
                    122: 0:     pop     ds      / Restore registers and return
                    123:        ret
                    124: 
                    125: 1:     mov     ax,$0xffff      / Return that an error has occured
                    126:        jmp     0b
                    127: 
                    128: 
                    129: 
                    130: build_itab:
                    131:        push    ds
                    132: 
                    133:        mov     ax,$extram      / Set up extram so that it starts at the
                    134:        shr     ax,$4           /   begining of a segment. This is becuase
                    135:        mov     bx,ds           /   the Cbios is expecting a pointer of the
                    136:        add     ax,bx           /   sort DS:0
                    137:        mov     ds,ax
                    138:        mov     0,$0xaa55       /  Extram header value.
                    139:        movb    ah,$5
                    140:        int     0x15            / Cbios call to build init table
                    141: 
                    142:        jc      1f              / Error?
                    143: 
                    144:        xor     ax,ax           / No error
                    145: 
                    146: 0:     pop     ds              / Restore registers and return
                    147:        ret
                    148: 
                    149: 1:     mov     ax,$0xffff      / Return that an error has occured
                    150:        jmp     0b
                    151: 
                    152: 
                    153: init_dev:
                    154:        mov     ax,$com_data_/ Set up com_data so that it starts at the
                    155:        shr     ax,$4           /   begining of a segment. This is becuase
                    156:        mov     dx,ds           /   the Cbios is expecting a pointer of the
                    157:        add     ax,dx           /   sort DS:0 for the Common data table
                    158:        mov     ds,ax
                    159: 
                    160:        mov      0,$72          / Pointer to pointer 0. Note that as we add 
                    161:                                /  devices to the system, this will move 
                    162:                                /  farther down by 8 for every db/ftt pair 
                    163:                                /  and 6 for every data pointer.
                    164: 
                    165:        mov      2,$6           / Number of pointer pairs in the table
                    166:        mov      8,$0           / Dummy dev blk and fcn tbl pntr for Id 1
                    167:        mov     10,$0           /  This is required for initialization
                    168:        mov     12,$0           /  Remember only to have one for Id 1. This 
                    169:        mov     14,$0           /  Fails if you also have one for Id 0.
                    170:        mov     16,$dev_blk0_   /\
                    171:        mov     18,dx           / \
                    172:        mov     20,$fcn_trn0_   /  \
                    173:        mov     22,dx           /   |
                    174:        mov     24,$dev_blk1_   /   |
                    175:        mov     26,dx           /   |
                    176:        mov     28,$fcn_trn1_   /   | long ptrs to the device blocks and 
                    177:        mov     30,dx           /   | the function transfer tables for 
                    178:        mov     32,$dev_blk7_   /   | devs 0, 1, 7, 15, 2
                    179:        mov     34,dx           /   |
                    180:        mov     36,$fcn_trn7_   /   |
                    181:        mov     38,dx           /   |
                    182:        mov     40,$dev_blk15_  /   |
                    183:        mov     42,dx           /   |
                    184:        mov     44,$fcn_trn15_  /   |
                    185:        mov     46,dx           /   |
                    186:        mov     48,$dev_blk2_   /   |
                    187:        mov     50,dx           /  /
                    188:        mov     52,$fcn_trn2_   / / 
                    189:        mov     54,dx           //
                    190: 
                    191:                              / At this point we should initialize the pointer
                    192:                                /   part of the table, but since these values
                    193:                                /   are already 0, we can skip it. 
                    194: 
                    195: 
                    196:        mov     bx, cs:i0_      / Initialize the internal functions
                    197:        mov     cx,$1
                    198:        mov     dx,$0x2         / Logical device 2
                    199: 
                    200:        .word   0xff26, 0x065f  / calll  es:(bx+6)
                    201: 
                    202:        cmpb    al,$0           / Was there an error?
                    203:        jne     0f
                    204: 
                    205:        mov     bx, cs:i1_      / Initialize the diskette
                    206:        mov     cx,$1
                    207:        mov     dx,$3           / Logical device 3
                    208: 
                    209:        .word   0xff26, 0x065f  / calll  es:(bx+6)
                    210:        
                    211:        cmpb    al,$0           / Was there an error?
                    212:        jne     0f
                    213: 
                    214:        mov     bx, cs:i7_      / Initialize the system timer
                    215:        mov     cx,$1
                    216:        mov     dx,$4           / Logical device 4
                    217: 
                    218:        .word   0xff26, 0x065f  / calll  es:(bx+6)
                    219:        
                    220:        cmpb    al,$0           / Was there an error?
                    221:        jne     0f
                    222: 
                    223:        mov     bx, cs:i15_     / Initialize the DMA
                    224:        mov     cx,$1
                    225:        mov     dx,$5           / Logical device 5
                    226: 
                    227:        .word   0xff26, 0x065f  / calll  es:(bx+6)
                    228:        
                    229:        cmpb    al,$0           / Was there an error?
                    230:        jne     0f
                    231: 
                    232:        mov     bx, cs:i2_      / Initialize the hard disk
                    233:        mov     cx,$1
                    234:        mov     dx,$6           / Logical device 6
                    235: 
                    236:        .word   0xff26, 0x065f  / calll  es:(bx+6)
                    237:        
                    238:        cmpb    al,$0           / Was there an Error?
                    239:        je      1f
                    240: 
                    241: 0:     mov     ax,$0xffff      / Inform caller that we could not init
                    242: 1:     ret
                    243:        
                    244: 
                    245:        .globl  d2_func_, com_data_p_, fcn2_, fcn2p_, dev2p_
                    246: d2_func_:
                    247:        push    bp
                    248:        mov     bp,sp
                    249: 
                    250:        push    com_data_p_+2   / save the anchor pointer segment
                    251:        
                    252:        push    sds_            / Save the request block segment
                    253:        push    4(bp)           / Save the request block offset
                    254: 
                    255:        push    fcn2p_+2        / Save the Function transfer table Segment
                    256:        push    fcn2p_          / Save the Function transfer table Offset
                    257: 
                    258:        push    dev2p_+2        / Save the device block Segment
                    259:        push    dev2p_          / Save the device block Offset
                    260: 
                    261:        mov     bx,6(bp)        / Bx points to start, interrupt or time-out
                    262:        .word   0x9fff,fcn2_    / Call far (bx + fcn2_)
                    263: 1:     
                    264:        add     sp,$0xe         / Clean up the stack
                    265: 
                    266:        pop     bp
                    267:        ret
                    268: 
                    269: 
                    270: 
                    271:        .globl  d1_func_, fcn1_, fcn1p_, dev1p_
                    272: d1_func_:
                    273:        push    bp
                    274:        mov     bp,sp
                    275: 
                    276:        push    com_data_p_+2   / save the anchor pointer segment
                    277:        
                    278:        push    sds_            / Save the request block segment
                    279:        push    4(bp)           / Save the request block offset
                    280: 
                    281:        push    fcn1p_+2        / Save the Function transfer table Segment
                    282:        push    fcn1p_          / Save the Function transfer table Offset
                    283: 
                    284:        push    dev1p_+2        / Save the device block Segment
                    285:        push    dev1p_          / Save the device block Offset
                    286: 
                    287:        mov     bx,6(bp)        / Bx points to start, interrupt or time-out
                    288:        .globl aaazq
                    289: aaazq:
                    290:        .word   0x9fff,fcn1_    / Call far (bx + fcn2_)
                    291: 1:     
                    292:        add     sp,$0xe         / Clean up the stack
                    293: 
                    294:        pop     bp
                    295:        ret
                    296: 
                    297: 
                    298: 
                    299: 
                    300:        .globl pip_
                    301: pip_:
                    302:        pop     ax
                    303:        push    ax
                    304:        ret

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.