Protypical implementation of DPT copying

This commit is contained in:
Nero 2020-10-24 22:50:23 +00:00
parent 33f4fe37a8
commit dc6035fe9d
4 changed files with 80 additions and 21 deletions

View File

@ -4,6 +4,7 @@
%include "inc/bpb.asm" %include "inc/bpb.asm"
%include "inc/mbr.asm" %include "inc/mbr.asm"
%include "inc/fcb.asm" %include "inc/fcb.asm"
%include "inc/dpt.asm"
; kernel stack size in words ; kernel stack size in words
%define stacksize 512 %define stacksize 512
@ -36,6 +37,7 @@ print_banner: mov si, banner
hlt: hlt hlt: hlt
jmp hlt jmp hlt
%include "kernel/far.asm"
%include "kernel/fcb.asm" %include "kernel/fcb.asm"
%include "kernel/drive.asm" %include "kernel/drive.asm"

View File

@ -1,13 +1,5 @@
struc dpt DPTMTT equ 2
.steprate resb 1 DPTSS equ 3
.dmahdld resb 1 DPTSPT equ 4
.motoroff resb 1
.sectorsize resb 1 DPTSIZE equ 11
.lastsector resb 1
.gaplen resb 1
.dtl resb 1
.gapfmt resb 1
.fillchar resb 1
.hdsettle resb 1
.motoron resb 1
endstruc

View File

@ -8,24 +8,37 @@ dskseek: resd 1
; disk buffer for I/O operations ; disk buffer for I/O operations
dskbuf: resb 512 dskbuf: resb 512
dpt: resb DPTSIZE
section .text section .text
ret: ret ret: ret
; Convert drive number into DL for int 13h
; IN dl dos drive number
; OUT dl bios drive number
getdl: cmp dl, 2
jc ret
mov dl, 0x80
ret
; select drive ; select drive
; IN dl drive number ; IN dl drive number
dsksel: cmp dl, 1 dsksel: cmp dl, byte [dsknum]
jnc ret
mov al, dl
and al, 0x02
ror dl, 1
ror dl, 1
cmp dl, byte [dsknum]
je ret je ret
call dskrst call dskrst
int 3 call getdl
mov ah, 8
les di, [0x1E*4]
int 0x13
; copy dpt
mov bx, di
mov dx, dpt
mov cx, DPTSIZE
call lod
ret ret

52
kernel/far.asm Normal file
View File

@ -0,0 +1,52 @@
; far pointer load
; IN ES:BX far pointer to data
; CX number of bytes to copy
; 0:DX destination buffer
; only CX is trashed
lod: push si
push di
push es
; ES:DI := DS:DX
mov ax, ds
mov es, ax
mov di, dx
; DS:SI := 0:BX
xor ax, ax
mov ds, ax
mov si, bx
; copy
pushf
cld
rep movsb
popf
; reset DS to kernel data
mov ds, cx
pop es
pop di
pop si
ret
; far pointer store
; IN ES:BX far ptr
; CX number of bytes
; 0:DX source buffer
; only CX is trashed
sto: push si
push di
mov si, dx
mov di, bx
; do the copy
pushf
cld
rep movsb
popf
pop di
pop si
ret