|
|
| version 1.3, 2004/02/07 08:01:28 | version 1.4, 2004/02/07 21:23:22 |
|---|---|
| Line 8 | Line 8 |
| xchgbits: push cx ; alのbitを逆転... | _xchgbits: push cx ; alのbitを逆転... |
| mov cx, 8 | mov cx, 8 |
| mov ah, al | xchgbitslp: rcr al, 1 |
| xchgbitslp: rcr ah, 1 | rcl ah, 1 |
| rcl al, 1 | |
| loop xchgbitslp | loop xchgbitslp |
| pop cx | pop cx |
| ret | ret |
| check_p: push bx ; パリティの計算 | |
| mov bx, 80h | |
| check_plp: test al, bl | |
| je short check_p1 | |
| inc bh | |
| check_p1: shr bl, 1 | |
| jne short check_plp | |
| test bh, 1 | |
| pop bx | |
| ret | |
| ; --------------------------------------------------------------------------- | ; --------------------------------------------------------------------------- |
| INIT_DIPSW: mov byte ptr ds:[DIPSW_1], 01111100b | INIT_DIPSW: mov byte ptr ds:[DIPSW_1], 01111100b |
| mov byte ptr ds:[DIPSW_2], 11000110b | mov byte ptr ds:[DIPSW_2], 11001110b |
| mov byte ptr ds:[DIPSW_3], 11011110b | mov byte ptr ds:[DIPSW_3], 11011110b |
| ret | ret |
| Line 44 GET_DIPSW: mov dx, 841eh | Line 33 GET_DIPSW: mov dx, 841eh |
| in al, dx | in al, dx |
| and al, 11111100b | and al, 11111100b |
| or al, 00000010b | or al, 00000010b |
| call xchgbits | call _xchgbits |
| mov ds:[DIPSW_1], al | in al, 33h |
| inc dh | test al, 08h |
| jne short getsw1ed | |
| or ah, 80h | |
| getsw1ed: mov ds:[DIPSW_1], ah | |
| mov dh, 85h | |
| in al, dx | in al, dx |
| and al, 11101111b | and al, 11101111b |
| call xchgbits | call _xchgbits |
| mov ds:[DIPSW_2], al | mov dh, 87h |
| inc dh | |
| in al, dx | |
| and al, 01111111b | |
| call xchgbits | |
| mov ds:[DIPSW_3], al | |
| inc dh | |
| in al, dx | in al, dx |
| test al, 20h | test al, 20h |
| je short sw25ed | je short getsw2ed |
| or byte ptr ds:[DIPSW_2], 08h | or ah, 08h |
| sw25ed: mov dh, 08eh | getsw2ed: mov ds:[DIPSW_2], ah |
| mov dh, 86h | |
| in al, dx | |
| and al, 01111111b | |
| call _xchgbits | |
| mov dh, 08eh | |
| in al, dx | in al, dx |
| test al, 10h | test al, 10h |
| je sw38ed | je short getsw3ed |
| or byte ptr ds:[DIPSW_3], 01h | or ah, 01h |
| sw38ed: ret | getsw3ed: mov ds:[DIPSW_3], ah |
| ret | |
| SET_DIPSW: mov dx, 841eh | SET_DIPSW: mov dx, 841eh |
| mov al, ds:[DIPSW_1] | mov al, ds:[DIPSW_1] |
| call xchgbits | call _xchgbits |
| and al, 11111100b | and ah, 11111100b |
| mov ah, al | |
| in al, dx | in al, dx |
| and al, 00000010b ; soundbios | and al, 00000010b ; soundbios |
| or al, ah | or al, ah |
| call check_p | jpo short putdipsw1 |
| jne short putdipsw1 | |
| or al, 00000001b | or al, 00000001b |
| putdipsw1: out dx, al | putdipsw1: out dx, al |
| inc dh | inc dh |
| mov al, ds:[DIPSW_2] | mov al, ds:[DIPSW_2] |
| call xchgbits | call _xchgbits |
| mov al, ah | |
| and al, 11101111b | and al, 11101111b |
| call check_p | jpo short putdipsw2 |
| jne short putdipsw2 | |
| or al, 00010000b | or al, 00010000b |
| putdipsw2: out dx, al | putdipsw2: out dx, al |
| inc dh | inc dh |
| mov al, ds:[DIPSW_3] | mov al, ds:[DIPSW_3] |
| call xchgbits | call _xchgbits |
| mov al, ah | |
| and al, 01111111b | and al, 01111111b |
| call check_p | jpo short putdipsw3 |
| jne short putdipsw3 | |
| or al, 10000000b | or al, 10000000b |
| putdipsw3: out dx, al | putdipsw3: out dx, al |
| Line 107 putdipsw3: out dx, al | Line 100 putdipsw3: out dx, al |
| test byte ptr ds:[DIPSW_2], 08h | test byte ptr ds:[DIPSW_2], 08h |
| je short sw25on | je short sw25on |
| or al, 00100000b | or al, 00100000b |
| sw25on: call check_p | sw25on: test al, al |
| jne putdipsw25 | jpo putdipsw25 |
| or al, 10000000b | or al, 10000000b |
| putdipsw25: out dx, al | putdipsw25: out dx, al |
| Line 118 putdipsw25: out dx, al | Line 111 putdipsw25: out dx, al |
| test byte ptr ds:[DIPSW_3], 1 | test byte ptr ds:[DIPSW_3], 1 |
| je short sw38on | je short sw38on |
| or al, 00010000b | or al, 00010000b |
| sw38on: call check_p | sw38on: test al, al |
| jne putdipsw38 | jpo putdipsw38 |
| or al, 10000000b | or al, 10000000b |
| putdipsw38: out dx, al | putdipsw38: out dx, al |
| ret | ret |