Drop MCBs as mean to manage memory
This commit is contained in:
parent
f7d3d5c62f
commit
4a92c4bc1e
3 changed files with 19 additions and 90 deletions
|
@ -1,70 +0,0 @@
|
|||
; 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_split
|
||||
mov word [si+1], 8
|
||||
ret
|
||||
|
||||
; split mcb block into two
|
||||
; IN dx segment of second block
|
||||
mcb_split:
|
||||
call mcb_find
|
||||
dec dx
|
||||
push dx
|
||||
; Calculate size of first block
|
||||
; dx = dx - ds - 1
|
||||
stc
|
||||
mov ax, ds
|
||||
sbb dx, ax
|
||||
;
|
||||
push dx
|
||||
; swap old size with new size
|
||||
xchg dx, [si+3]
|
||||
; if current mcb is last, its not anymore
|
||||
mov cl, 'M'
|
||||
xchg cl, byte [si+0]
|
||||
; advance DS to begin of first block
|
||||
pop ax
|
||||
stc
|
||||
sbb dx, ax
|
||||
pop ax
|
||||
mov ds, ax
|
||||
; write MCB data
|
||||
mov byte [si+0], cl
|
||||
mov word [si+1], 0
|
||||
mov word [si+3], dx
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue