-> basicly, you do this (In Pascal..sorry!) :
Of course, in assembly (which is >supposedly< the interest of this
echo's participants, although I'm beginning to wonder) it might look
something like this (be forewarned that I haven't tested this so it may
have a few good errors in it):
RADIX 10h
SbFind:
MOV DX, 0210 ;Starting address to search for.
MOV CX, 0007 ;Range of addresses to search (multiples of 10).
Loop1:
PUSH DX
ADD DX, 0006 ;Base port + 06h.
MOV AL, 01
OUT DX, AL
CALL Wait10ms
XOR AL, AL
OUT DX, AL
PUSH CX ;Preserve .CX.
MOV CX, 03E8 ;Set counter to loop 1000 times.
ADD DX, 0008 ;Base port + 0Eh.
Loop2:
IN AL, DX
TEST AL, 80
LOOPZ Loop2
MOV AX, CX ;Preserve last loop count.
POP CX ;Restore .CX.
OR AX, AX ;Is .AX zero?
JZ Reiterate ;If it is then loop.
PUSH CX ;Preserve .CX.
MOV CX, 03E8 ;Set counter to loop 1000 times.
SUB DX, 0004 ;Base port + 0Ah.
Loop3:
IN AL, DX
CMP AL, 0AA
LOOPNE Loop3
MOV AX, CX ;Preserve last loop count.
POP CX ;Restore .CX.
OR AX, AX ;Is .AX zero?
JNZ Found ;Sound Blaster found.
Reiterate:
POP DX ;Restore .DX.
ADD DX, 000A ;Point to next base address.
LOOP Loop1 ;Loop again.
JMP NotFound ;Sound Blaster not found.
Found:
POP DX ;Restore .DX. (This is now the base address.)
Jump or Return or whatever code you want.
Wait10ms:
PUSHA
MOV DX, 2620
XOR CX, CX
MOV AH, 86
INT 15
POPA
RET
** Democracy: 3 wolves and 1 sheep deciding on lunch.
--- PCBoard (R) v15.3/M 5
(1:244/506)
---------------
* Origin: The GameBoard BBS - 905ú689ú3982/9409 - BurlingtonúONúCANADA
|