Newer
Older
SECTION .text
USE16
align 512, db 0
config:
times 512 - ($ - config) db 0
save_config:
mov eax, (config - boot) / 512
mov bx, config
mov cx, 1
xor dx, dx
call store
ret
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
; store some sectors to disk from a buffer in memory
; buffer has to be below 1MiB
; IN
; ax: start sector
; bx: offset of buffer
; cx: number of sectors (512 Bytes each)
; dx: segment of buffer
; CLOBBER
; ax, bx, cx, dx, si
; TODO rewrite to (eventually) move larger parts at once
; if that is done increase buffer_size_sectors in startup-common to that (max 0x80000 - startup_end)
store:
cmp cx, 127
jbe .good_size
pusha
mov cx, 127
call store
popa
add ax, 127
add dx, 127 * 512 / 16
sub cx, 127
jmp store
.good_size:
mov [DAPACK.addr], eax
mov [DAPACK.buf], bx
mov [DAPACK.count], cx
mov [DAPACK.seg], dx
call print_dapack
mov dl, [disk]
mov si, DAPACK
mov ah, 0x43
int 0x13
jc error
ret