41 lines
527 B
NASM
41 lines
527 B
NASM
|
; First MCB block is always at 00540
|
||
|
mcb_first:
|
||
|
mov ax, 0x54
|
||
|
mov ds, ax
|
||
|
ret
|
||
|
|
||
|
mcb_init:
|
||
|
call mcb_first
|
||
|
mov dx, ds
|
||
|
inc dx
|
||
|
xor si, si
|
||
|
int 0x12
|
||
|
mov cl, 6
|
||
|
shl ax, cl
|
||
|
sub ax, dx
|
||
|
mov byte [si+0], 'Z'
|
||
|
mov word [si+1], 0
|
||
|
mov word [si+3], ax
|
||
|
mov dx, cs
|
||
|
call mcb_find
|
||
|
int 3
|
||
|
ret
|
||
|
|
||
|
; IN dx segment we look for
|
||
|
; OUT ds segment where mcb starts
|
||
|
mcb_find:
|
||
|
call mcb_first
|
||
|
xor si, si
|
||
|
.loop: stc
|
||
|
adc ax, [si+3]
|
||
|
cmp dx, ax
|
||
|
jc .found
|
||
|
cmp byte [si+0], 'Z'
|
||
|
jz .fail
|
||
|
mov ds, ax
|
||
|
jmp .loop
|
||
|
.fail: stc
|
||
|
ret
|
||
|
.found: clc
|
||
|
ret
|