Final changes and tweaks before submission
This commit is contained in:
@ -38,52 +38,6 @@ cons_writeline:
|
||||
call cons_write_crlf
|
||||
ret
|
||||
|
||||
# Added Write Hex and Int functions to help with debugging
|
||||
HexChars: .ascii "0123456789ABCDEF"
|
||||
|
||||
cons_write_hex:
|
||||
movw $4, %cx
|
||||
movb $0x0E, %ah
|
||||
|
||||
hexloop:
|
||||
rol $4, %bx
|
||||
movw %bx, %si
|
||||
and $0x000F, %si
|
||||
movb HexChars(%si), %al
|
||||
int $0x10
|
||||
loop hexloop
|
||||
ret
|
||||
|
||||
cons_write_int:
|
||||
movw $IntBuffer + 4, %si
|
||||
movw %bx, %ax
|
||||
|
||||
cmpw $0, %ax
|
||||
jge getdigit
|
||||
|
||||
xor %ax, %ax # Added to handle signed numbers, it adds the minus and then neg's the number
|
||||
movb $0x0E, %ah
|
||||
movb $0x2D, %al
|
||||
int $0x10
|
||||
|
||||
movw %bx, %ax
|
||||
negw %ax
|
||||
|
||||
getdigit:
|
||||
xor %dx, %dx
|
||||
movw $10, %cx
|
||||
idiv %cx
|
||||
addb $48, %dl
|
||||
movb %dl, (%si)
|
||||
dec %si
|
||||
cmp $0, %ax
|
||||
jne getdigit
|
||||
inc %si
|
||||
call cons_write
|
||||
ret
|
||||
|
||||
IntBuffer: .string " "
|
||||
|
||||
# Draw Line function DrawLine(x0 (4), y0 (6), x1 (8), y1 (10), color (12))
|
||||
# Define parameter address positions in stack
|
||||
#define color 12
|
||||
@ -230,9 +184,6 @@ cons_plot_pixel:
|
||||
mul %dx # does the (y * 320) part of our math
|
||||
add %cx, %ax # Add the value of x to register ax
|
||||
movw %ax, %si # Move the value of ax into the si counter
|
||||
|
||||
movw $0xA000, %bx # Set the start of the video memory location
|
||||
movw %bx, %es # Move that address into the "extra segment" es register
|
||||
movw pixelcolor(%bp), %bx # Load the color into a register
|
||||
movb %bl, %es:(%si) # Load the lower half of the color (since they should only be from 0 to 255)
|
||||
# and place it at the given byte in the segment
|
||||
@ -253,6 +204,9 @@ real_start:
|
||||
movw $boot_message, %si # Display our boot message
|
||||
call cons_writeline
|
||||
|
||||
movw $0xA000, %bx # Set the start of the video memory location
|
||||
movw %bx, %es # Move that address into the "extra segment" es register
|
||||
|
||||
draw_start:
|
||||
# Set the Video mode to VGA 320 x 200 x 256
|
||||
movb $0, %ah
|
||||
@ -332,6 +286,36 @@ draw_start:
|
||||
pushw $180 # x0
|
||||
call cons_draw_line
|
||||
|
||||
#---------------------------
|
||||
|
||||
pushw $11 # Color
|
||||
pushw $160 # y1
|
||||
pushw $30 # x1
|
||||
pushw $160 # y0
|
||||
pushw $20 # x0
|
||||
call cons_draw_line
|
||||
|
||||
pushw $11 # Color
|
||||
pushw $180 # y1
|
||||
pushw $30 # x1
|
||||
pushw $160 # y0
|
||||
pushw $30 # x0
|
||||
call cons_draw_line
|
||||
|
||||
pushw $11 # Color
|
||||
pushw $170 # y1
|
||||
pushw $30 # x1
|
||||
pushw $170 # y0
|
||||
pushw $20 # x0
|
||||
call cons_draw_line
|
||||
|
||||
pushw $11 # Color
|
||||
pushw $180 # y1
|
||||
pushw $30 # x1
|
||||
pushw $180 # y0
|
||||
pushw $20 # x0
|
||||
call cons_draw_line
|
||||
|
||||
endless_loop: # Loop forever more
|
||||
jmp endless_loop
|
||||
|
||||
@ -339,7 +323,7 @@ endless_loop: # Loop forever more
|
||||
boot_message:
|
||||
.string "Boot Loader Stage 2 loaded"
|
||||
|
||||
screen_width:
|
||||
screen_width: # Global variables for the screen height and width
|
||||
.word 320
|
||||
screen_height:
|
||||
.Word 200
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
stage3/xv6.img
(Stored with Git LFS)
BIN
stage3/xv6.img
(Stored with Git LFS)
Binary file not shown.
Reference in New Issue
Block a user