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

unix.superglobalmegacorp.com

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