|
|
| version 1.3, 2004/01/31 20:05:23 | version 1.4, 2004/06/10 04:49:48 |
|---|---|
| Line 1 | Line 1 |
| .186 | ORG 100h |
| USE16 | |
| CPU 186 | |
| CODE SEGMENT | |
| ASSUME CS:CODE,DS:nothing,ES:nothing,SS:nothing | |
| ORG 0100H | |
| include np2tool.inc | |
| include hostdrv.inc | |
| %include 'np2tool.inc' | |
| %include 'hostdrv.inc' | |
| START: jmp short keep_addr | START: jmp short keep_addr |
| id db 'host_drv' | id db 'host_drv' |
| Line 25 int2f: cmp ah, 11h | Line 23 int2f: cmp ah, 11h |
| shr al, 3 | shr al, 3 |
| and cl, 7 | and cl, 7 |
| inc cl | inc cl |
| mov bx, offset i2f_nochkbmp | mov bx, i2f_nochkbmp |
| db FIXCS | db FIXCS |
| xlat | xlat |
| rcr al, cl | rcr al, cl |
| Line 38 i2f_callnp2: pushf | Line 36 i2f_callnp2: pushf |
| int 2fh | int 2fh |
| popf | popf |
| mov bx, si | mov bx, si |
| mov si, offset intr_hostdrv | mov si, intr_hostdrv |
| mov dx, NP2PORT | mov dx, NP2PORT |
| mov cx, 12 | mov cx, 12 |
| cld | cld |
| Line 58 i2f_end: pop es | Line 56 i2f_end: pop es |
| i2f_chain: db 0eah | i2f_chain: db 0eah |
| org_int2f dd 0 | org_int2f dd 0 |
| inf HDRVIF <0, 0, 0, 0> | inf db 0 |
| dw 0 | |
| dw 0 | |
| dw 0 | |
| ; 76543210 fedcba98 | ; 76543210 fedcba98 |
| i2f_nochkbmp db 11010101b, 00111111b | i2f_nochkbmp db 11010101b, 00111111b |
| Line 79 errexit_lv2: sti | Line 80 errexit_lv2: sti |
| errexit_lv1: sti | errexit_lv1: sti |
| mov ah, 9 | mov ah, 9 |
| int 21h | int 21h |
| mov dx, offset crlf | mov dx, str_crlf |
| mov ah, 9 | mov ah, 9 |
| int 21h | int 21h |
| mov ax, 4c01h | mov ax, 4c01h |
| Line 89 main: cld | Line 90 main: cld |
| push cs | push cs |
| pop ds | pop ds |
| mov ah, 9 | mov ah, 9 |
| mov dx, offset title_msg | mov dx, title_msg |
| int 21h | int 21h |
| ; 機種チェック | ; 機種チェック |
| cli | cli |
| call np2_check | call np2_check |
| mov dx, offset macerr_msg | mov dx, macerr_msg |
| jne short errexit_lv2 | jne short errexit_lv2 |
| mov ax, 352fh | mov ax, 352fh |
| int 21h | int 21h |
| mov si, offset id | mov si, id |
| mov di, si | mov di, si |
| mov cl, 4 | mov cl, 4 |
| repe cmpsw | repe cmpsw |
| Line 109 main: cld | Line 110 main: cld |
| stay: mov si, 0080h | stay: mov si, 0080h |
| mov dx, offset usage_msg | mov dx, usage_msg |
| xor cx, cx | xor cx, cx |
| lodsb | lodsb |
| add cl, al | add cl, al |
| Line 123 stay_error: jmp errexit_lv1 | Line 124 stay_error: jmp errexit_lv1 |
| drvcheck: and al, 0dfh | drvcheck: and al, 0dfh |
| sub al, 'A' | sub al, 'A' |
| cmp al, 26 | cmp al, 26 |
| mov dx, offset drverr0_msg | mov dx, drverr0_msg |
| jae short stay_error | jae short stay_error |
| mov ds:inf.drive_no, al | mov [ds:inf + HDRVIF.drive_no], al |
| mov ah, 30h | mov ah, 30h |
| int 21h | int 21h |
| mov ds:inf.dosver, ax | mov [ds:inf + HDRVIF.dosver], ax |
| xchg al, ah | xchg al, ah |
| cmp ax, 030ah | cmp ax, 030ah |
| mov dx, offset doserr_msg | mov dx, doserr_msg |
| jc short stay_error | jc short stay_error |
| mov ax, 1100h ; inst check | mov ax, 1100h ; inst check |
| int 2fh | int 2fh |
| cmp ax, 1 | cmp ax, 1 |
| mov dx, offset cntsty_msg | mov dx, cntsty_msg |
| je short stay_error | je short stay_error |
| mov ax, 5d06h ; get SDA addr | mov ax, 5d06h ; get SDA addr |
| int 21h | int 21h |
| mov cs:inf.sda_off, si | mov [cs:inf + HDRVIF.sda_off], si |
| mov cs:inf.sda_seg, ds | mov [cs:inf + HDRVIF.sda_seg], ds |
| push cs | push cs |
| pop ds | pop ds |
| mov si, offset stay_param | mov si, stay_param |
| call sendnp2port | call sendnp2port |
| call checknp2port | call checknp2port |
| mov dx, offset np2err_msg | mov dx, np2err_msg |
| jne short stay_error | jne short stay_error |
| ; assign_cds | ; assign_cds |
| call getcds | call getcds |
| mov dx, offset drverr1_msg | mov dx, drverr1_msg |
| jc short stay_error | jc short stay_error |
| test byte ptr es:[di + 1].cds_flag, 0c0h | test byte [es:di + CDS.flag + 1], 0c0h |
| mov dx, offset drverr2_msg | mov dx, drverr2_msg |
| jne short stay_error | jne short stay_error |
| xor cx, cx | xor cx, cx |
| lodsb | lodsb |
| mov cl, al | mov cl, al |
| or es:[di].cds_flag, 0c080h | or word [es:di + CDS.flag], 0c080h |
| mov es:[di].cds_root, cx | mov [es:di + CDS.root], cx |
| rep movsb | rep movsb |
| movsw | movsw |
| mov bx, offset inf | mov bx, inf |
| mov di, cs | mov di, cs |
| xor cx, cx | xor cx, cx |
| mov es, cx | mov es, cx |
| xchg bx, es:[0600h] | xchg bx, [es:0600h] |
| xchg di, es:[0602h] | xchg di, [es:0602h] |
| call sendnp2port | call sendnp2port |
| call checknp2port | call checknp2port |
| mov es:[0600h], bx | mov [es:0600h], bx |
| mov es:[0602h], di | mov [es:0602h], di |
| jne short ass_err | jne short ass_err |
| mov ax, 352fh | mov ax, 352fh |
| int 21h | int 21h |
| mov word ptr ds:org_int2f, bx | mov [ds:org_int2f + 0], bx |
| mov word ptr ds:org_int2f + 2, es | mov [ds:org_int2f + 2], es |
| mov ax, 252fh | mov ax, 252fh |
| mov dx, offset int2f | mov dx, int2f |
| int 21h | int 21h |
| mov cl, 13 | mov cl, 13 |
| mov dx, offset user | mov dx, str_user |
| mov ax, 5e01h | mov ax, 5e01h |
| int 21h | int 21h |
| sti | sti |
| mov al, ds:inf.drive_no | mov al, [ds:inf + HDRVIF.drive_no] |
| add byte ptr ds:sty_drive, al | add byte [ds:sty_drive], al |
| mov ah, 9 | mov ah, 9 |
| mov dx, si | mov dx, si |
| int 21h | int 21h |
| mov ax, 3100h | mov ax, 3100h |
| mov dx, (offset keep_addr) + 15 | mov dx, keep_addr + 15 |
| mov cl, 4 | mov cl, 4 |
| shr dx, cl | shr dx, cl |
| int 21h | int 21h |
| ass_err: call getcds | ass_err: call getcds |
| mov es:[di].cds_flag, 0 | mov word [es:di + CDS.flag], 0 |
| mov dx, offset styerr_msg | mov dx, styerr_msg |
| jmp errexit_lv1 | jmp errexit_lv1 |
| release: mov ax, 252fh | release: mov ax, 252fh |
| lds dx, es:org_int2f | lds dx, [es:org_int2f] |
| int 21h | int 21h |
| push es | push es |
| pop ds | pop ds |
| call getcds | call getcds |
| mov es:[di].cds_flag, 0 | mov word [es:di + CDS.flag], 0 |
| mov es, ds:[2ch] | mov es, [ds:002ch] |
| mov ah, 49h | mov ah, 49h |
| int 21h | int 21h |
| push ds | push ds |
| Line 228 release: mov ax, 252fh | Line 229 release: mov ax, 252fh |
| int 21h | int 21h |
| push cs | push cs |
| pop ds | pop ds |
| mov si, offset rel_param | mov si, rel_param |
| call sendnp2port | call sendnp2port |
| sti | sti |
| mov ah, 9 | mov ah, 9 |
| Line 241 release: mov ax, 252fh | Line 242 release: mov ax, 252fh |
| getcds: mov ax, 5200h ; get lol addr | getcds: mov ax, 5200h ; get lol addr |
| int 21h | int 21h |
| mov al, ds:inf.drive_no | mov al, [ds:inf + HDRVIF.drive_no] |
| cmp al, es:[bx].lol_lastdrv | cmp al, [es:bx + LOL.lastdrv] |
| jae short gcds_err | jae short gcds_err |
| les di, es:[bx].lol_cds | les di, [es:bx + LOL.cds] |
| mov ah, size CDS | mov ah, CDS.size |
| cmp byte ptr ds:inf.dosver, 3 | cmp byte [ds:inf + HDRVIF.dosver], 3 |
| je short gcds_calc | je short gcds_calc |
| add ah, 7 | add ah, 7 |
| gcds_calc: mul ah | gcds_calc: mul ah |
| Line 256 gcds_err: stc | Line 257 gcds_err: stc |
| ret | ret |
| include np2tool.x86 | %include 'np2tool.x86' |
| title_msg db "host-drive driver for np2+dos (" | title_msg db "host-drive driver for np2+dos (" |
| db VERSION_ID | db VERSION_ID |
| db ")" | db ")" |
| crlf db 13, 10, "$" | str_crlf db 13, 10, "$" |
| user db "NekoProjectII " | str_user db "NekoProjectII " |
| stay_param db 13, "check_hostdrv" | stay_param db 13, "check_hostdrv" |
| Line 289 drverr1_msg db "drive higher than last | Line 290 drverr1_msg db "drive higher than last |
| drverr2_msg db "drive already assigned$" | drverr2_msg db "drive already assigned$" |
| styerr_msg db "cannot assign$" | styerr_msg db "cannot assign$" |
| ends | |
| CODE ENDS | |
| END START | |