Skip to content

Commit

Permalink
Change 1st stage int 13h addressing (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsribeiro authored Jul 16, 2020
1 parent aa9e5b8 commit f02a565
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/stage_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,18 @@ check_int13h_extensions:
load_rest_of_bootloader_from_disk:
lea eax, _rest_of_bootloader_start_addr

# start of memory buffer
# dap buffer segment
mov ebx, eax
shr ebx, 4 # divide by 16
mov [dap_buffer_seg], bx

# buffer offset
shl ebx, 4 # multiply by 16
sub eax, ebx
mov [dap_buffer_addr], ax

lea eax, _rest_of_bootloader_start_addr

# number of disk blocks to load
lea ebx, _rest_of_bootloader_end_addr
sub ebx, eax # end - start
Expand All @@ -99,6 +108,9 @@ load_rest_of_bootloader_from_disk:
mov ah, 0x42
int 0x13
jc rest_of_bootloader_load_failed

# reset segment to 0
mov word ptr [dap_buffer_seg], 0

jump_to_second_stage:
lea eax, [stage_2]
Expand Down

0 comments on commit f02a565

Please sign in to comment.