Added support for \n, \t and \\ in the string printing function
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
; LBA = index of data segment on disk
|
||||
; CHS = cylinder, header, sector
|
||||
; T = LBA/sectors per track
|
||||
; S = (LBA%sectors per track) + 1
|
||||
; H = T % heads
|
||||
; C = T / headers
|
||||
; input, LBA index: ax
|
||||
; sector number: cl
|
||||
; cylinder: ch
|
||||
; head: dh
|
||||
; Example where LBA = 50h (CHS = 2,0,9)
|
||||
; ax = 0050h, push this to the stack
|
||||
; dx = 0000h
|
||||
; dx = 50h % 12h = 0008h
|
||||
; ax = 50h / 12h = 0004h
|
||||
; dx = 0009h
|
||||
; cx = 0009h
|
||||
; dx = 0000h
|
||||
; dx = 04h % 02h = 0000h
|
||||
; ax = 04h / 02h = 0002h
|
||||
; dh = 00h (dx = 0000h)
|
||||
; ch = 02h (cx = 0209h)
|
||||
; ah = 00h (ax = 0002h)
|
||||
; cl = 09h OR 00h = 09h (cx = 0209h)
|
||||
; ax = 0050h
|
||||
; dl = 50h (dx = 0050h)
|
||||
; ax = 0050h
|
||||
; thus:
|
||||
; cylinder (ch) = 02h
|
||||
; head (cl) = 00h
|
||||
; sector (dh) = 09h
|
||||
os_lba_to_chs:
|
||||
push ax
|
||||
push dx
|
||||
|
||||
xor dx,dx ; clear dx
|
||||
div word [bdb_sectors_per_track] ; (LBA % sectors per track) + 1 = sector
|
||||
inc dx ; sector, dx stores the remainder so we increment that.
|
||||
mov cx,dx
|
||||
|
||||
xor dx,dx ; clear dx
|
||||
div word [bdb_number_of_heads]
|
||||
mov dh,dl ; head, dx stores remainder so we move that up 8 bits to dh
|
||||
|
||||
mov ch,al
|
||||
shl ah, 6 ; * 32
|
||||
or cl, ah ; cylinder
|
||||
|
||||
pop ax
|
||||
mov dl,al
|
||||
pop ax
|
||||
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user