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
|
||||
cons_draw_line:
|
||||
movw $0, err # Make sure that err starts at 0
|
||||
@ -249,7 +203,7 @@ endless_loop: # Loop forever more
|
||||
boot_message:
|
||||
.string "Boot Loader Stage 2 loaded"
|
||||
|
||||
x0: .word 0
|
||||
x0: .word 0 # Setup the static memory to hold our variables
|
||||
y0: .word 0
|
||||
x1: .word 0
|
||||
y1: .word 0
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
stage1/xv6.img
(Stored with Git LFS)
BIN
stage1/xv6.img
(Stored with Git LFS)
Binary file not shown.
@ -38,53 +38,7 @@ 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))
|
||||
# Draw Line function DrawLine(int x0 (4), int y0 (6), int x1 (8), int y1 (10), short color (12))
|
||||
# Define parameter address positions in stack
|
||||
#define color 12
|
||||
#define y1 10
|
||||
@ -275,6 +229,43 @@ draw_start:
|
||||
pushw $180 # x0
|
||||
call cons_draw_line
|
||||
|
||||
#---------------------------
|
||||
|
||||
pushw $13 # Color
|
||||
pushw $160 # y1
|
||||
pushw $30 # x1
|
||||
pushw $160 # y0
|
||||
pushw $20 # x0
|
||||
call cons_draw_line
|
||||
|
||||
pushw $13 # Color
|
||||
pushw $170 # y1
|
||||
pushw $30 # x1
|
||||
pushw $160 # y0
|
||||
pushw $30 # x0
|
||||
call cons_draw_line
|
||||
|
||||
pushw $13 # Color
|
||||
pushw $170 # y1
|
||||
pushw $30 # x1
|
||||
pushw $170 # y0
|
||||
pushw $20 # x0
|
||||
call cons_draw_line
|
||||
|
||||
pushw $13 # Color
|
||||
pushw $180 # y1
|
||||
pushw $20 # x1
|
||||
pushw $170 # y0
|
||||
pushw $20 # x0
|
||||
call cons_draw_line
|
||||
|
||||
pushw $13 # 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
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
stage2/xv6.img
(Stored with Git LFS)
BIN
stage2/xv6.img
(Stored with Git LFS)
Binary file not shown.
@ -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.
@ -38,53 +38,7 @@ 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))
|
||||
# Draw Line function DrawLine(int x0 (4), int y0 (6), int x1 (8), int y1 (10), short color (12))
|
||||
# Define parameter address positions in stack
|
||||
#define color 12
|
||||
#define y1 10
|
||||
@ -190,7 +144,7 @@ cons_line_loop_end:
|
||||
# we also tell it to free the 10 bytes in the stack for the paramters
|
||||
# 5 x Word (2 bytes)
|
||||
|
||||
# Function PlotPixel(pixelx (4), pixely (6), pixelColor (8))
|
||||
# Function PlotPixel(int pixelx (4), int pixely (6), short pixelColor (8))
|
||||
#define pixelcolor 8
|
||||
#define pixely 6
|
||||
#define pixelx 4
|
||||
@ -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
|
||||
@ -249,7 +200,7 @@ cons_plot_pixel_end:
|
||||
popw %bp
|
||||
ret $6 # Finish the loop and return to the call address
|
||||
|
||||
# Draw Line function DrawFilledRect(rectx (4), recty (6), rectWidth (8), rectHeight (10), rectColor (12))
|
||||
# Draw Line function DrawFilledRect(int rectx (4), int recty (6), int rectWidth (8), int rectHeight (10), int rectColor (12))
|
||||
# Define parameter address positions in stack
|
||||
#define rectcolor 12
|
||||
#define rectheight 10
|
||||
@ -260,8 +211,7 @@ cons_plot_pixel_end:
|
||||
cons_draw_filled_rect:
|
||||
pushw %bp
|
||||
movw %sp, %bp
|
||||
#subw $4, %sp # Make room for our local variables in the stack
|
||||
|
||||
|
||||
# Store existing register values to the stack so we can restore later
|
||||
pushw %ax
|
||||
pushw %bx
|
||||
@ -336,10 +286,7 @@ cons_filled_rect_check_empty:
|
||||
cmpw $0, rectheight(%bp)
|
||||
jle cons_filled_rect_loop_end
|
||||
|
||||
cons_filled_rect_setup:
|
||||
movw $0xA000, %bx # Set the start of the video memory location
|
||||
movw %bx, %es # Move that address into the "extra segment" es register
|
||||
|
||||
cons_filled_rect_setup:
|
||||
movw recty(%bp), %dx
|
||||
movw (screen_width), %ax # Set ax to 320 so that we can multiply this by y
|
||||
mul %dx # does the (y * 320) part of our math
|
||||
@ -537,6 +484,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
|
||||
@ -685,7 +635,7 @@ endless_loop: # Loop forever more
|
||||
boot_message:
|
||||
.string "Boot Loader Stage 2 loaded"
|
||||
|
||||
screen_width:
|
||||
screen_width: # Global variables for the screen width and height
|
||||
.word 320
|
||||
screen_height:
|
||||
.word 200
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
stage4/xv6.img
(Stored with Git LFS)
BIN
stage4/xv6.img
(Stored with Git LFS)
Binary file not shown.
@ -124,7 +124,7 @@ getdigit:
|
||||
|
||||
IntBuffer: .string " "
|
||||
|
||||
# Draw Line function DrawLine(x0 (4), y0 (6), x1 (8), y1 (10), color (12))
|
||||
# Draw Line function DrawLine(int x0 (4), int y0 (6), int x1 (8), int y1 (10), short color (12))
|
||||
# Define parameter address positions in stack
|
||||
#define color 12
|
||||
#define y1 10
|
||||
@ -230,7 +230,7 @@ cons_line_loop_end:
|
||||
# we also tell it to free the 10 bytes in the stack for the paramters
|
||||
# 5 x Word (2 bytes)
|
||||
|
||||
# Function PlotPixel(pixelx (4), pixely (6), pixelColor (8))
|
||||
# Function PlotPixel(int pixelx (4), int pixely (6), short pixelColor (8))
|
||||
#define pixelcolor 8
|
||||
#define pixely 6
|
||||
#define pixelx 4
|
||||
@ -287,7 +287,7 @@ cons_plot_pixel_end:
|
||||
popw %bp
|
||||
ret $6 # Finish the loop and return to the call address
|
||||
|
||||
# Draw Line function DrawFilledRect(rectx (4), recty (6), rectWidth (8), rectHeight (10), rectColor (12))
|
||||
# Draw Line function DrawFilledRect(int rectx (4), int recty (6), int rectWidth (8), int rectHeight (10), short rectColor (12))
|
||||
# Define parameter address positions in stack
|
||||
#define rectcolor 12
|
||||
#define rectheight 10
|
||||
@ -410,7 +410,7 @@ cons_filled_rect_loop_end:
|
||||
# we also tell it to free the 10 bytes in the stack for the paramters
|
||||
# 5 x Word (2 bytes)
|
||||
|
||||
# Draw Line function DrawCircle(circlex (4), circley (6), circleRadius (8), circleColor (10))
|
||||
# Draw Line function DrawCircle(int circlex (4), int circley (6), int circleRadius (8), short circleColor (10))
|
||||
# This follows the bresenham circle drawing algorithm so that we can stick to integer values
|
||||
# Define parameter address positions in stack
|
||||
#define circlecolor 10
|
||||
@ -664,6 +664,7 @@ arr_dump_end:
|
||||
# This function fills the array with FF bytes (FF being a value i can use in a loop to end it and not effect the x/y positions)
|
||||
#define clearsize 6
|
||||
#define clearptr 4
|
||||
|
||||
arr_clear:
|
||||
pushw %bp
|
||||
movw %sp, %bp
|
||||
@ -686,12 +687,12 @@ arr_clear_setup:
|
||||
addw $2, %si # to make sure a correct address was given
|
||||
|
||||
arr_clear_loop_start:
|
||||
movb %al, (%si)
|
||||
movb %al, (%si) # Loop the array and add the bit pattern given as filler
|
||||
inc %si
|
||||
loop arr_clear_loop_start
|
||||
|
||||
arr_clear_add_end_bytes:
|
||||
movw $0x7fff, (%si)
|
||||
movw $0x7fff, (%si) # End the array with the ending word
|
||||
|
||||
arr_clear_loop_end:
|
||||
# Return all the original values to each register before we return back
|
||||
@ -851,9 +852,9 @@ setup_polygon_arrays:
|
||||
call arr_clear
|
||||
|
||||
# Map points for the star polygon array
|
||||
pushw (screen_height)
|
||||
pushw $0
|
||||
pushw $0x1000
|
||||
pushw (screen_height) # y
|
||||
pushw $0 # x
|
||||
pushw $0x1000 # Array ptr
|
||||
call arr_add_point
|
||||
pushw $140
|
||||
pushw $40
|
||||
@ -894,9 +895,9 @@ setup_polygon_arrays:
|
||||
call arr_clear
|
||||
|
||||
# Array for the moon polygon
|
||||
pushw $0
|
||||
pushw $0
|
||||
pushw $0x1050
|
||||
pushw $0 # y
|
||||
pushw $0 # x
|
||||
pushw $0x1050 # Array ptr
|
||||
call arr_add_point
|
||||
pushw $5
|
||||
pushw $8
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
stage5/xv6.img
(Stored with Git LFS)
BIN
stage5/xv6.img
(Stored with Git LFS)
Binary file not shown.
Reference in New Issue
Block a user