diff --git a/stage1/bootasm2.S b/stage1/bootasm2.S index 736c92d..d508d7e 100644 --- a/stage1/bootasm2.S +++ b/stage1/bootasm2.S @@ -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 diff --git a/stage1/bootasm2.o b/stage1/bootasm2.o index 879d313..eb7aeb5 100644 Binary files a/stage1/bootasm2.o and b/stage1/bootasm2.o differ diff --git a/stage1/bootblock2 b/stage1/bootblock2 index df79fff..5e60732 100644 Binary files a/stage1/bootblock2 and b/stage1/bootblock2 differ diff --git a/stage1/bootblock2.o b/stage1/bootblock2.o index 27864b8..689ce3d 100644 Binary files a/stage1/bootblock2.o and b/stage1/bootblock2.o differ diff --git a/stage1/xv6.img b/stage1/xv6.img index e1da1df..7cd291d 100644 --- a/stage1/xv6.img +++ b/stage1/xv6.img @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78f098d34857cf65263e2fb5c83bc70d1a99ad0dd995f67f2d1c7d6b1eaf71ee +oid sha256:efc9c4a600de243bcb4b6307cede9a7d30c5db8a43506fd3de3b514193f8fc40 size 5120000 diff --git a/stage2/bootasm2.S b/stage2/bootasm2.S index 690d4e2..94caf07 100644 --- a/stage2/bootasm2.S +++ b/stage2/bootasm2.S @@ -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 diff --git a/stage2/bootasm2.o b/stage2/bootasm2.o index cd1591e..fb7d9bc 100644 Binary files a/stage2/bootasm2.o and b/stage2/bootasm2.o differ diff --git a/stage2/bootblock2 b/stage2/bootblock2 index 7739c21..ce4d864 100644 Binary files a/stage2/bootblock2 and b/stage2/bootblock2 differ diff --git a/stage2/bootblock2.o b/stage2/bootblock2.o index f1af6f0..7eb3b4c 100644 Binary files a/stage2/bootblock2.o and b/stage2/bootblock2.o differ diff --git a/stage2/xv6.img b/stage2/xv6.img index 4624f07..db2c998 100644 --- a/stage2/xv6.img +++ b/stage2/xv6.img @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3387e710619086765701b1604f260a81c230c4a84dd5f73519cdb7bd922fdd7d +oid sha256:a5ce5d8db69ea875e2a0f44fb290e72d69088f0109e960b031cd0ac8b05b254e size 5120000 diff --git a/stage3/bootasm2.S b/stage3/bootasm2.S index b435145..83917ed 100644 --- a/stage3/bootasm2.S +++ b/stage3/bootasm2.S @@ -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 \ No newline at end of file diff --git a/stage3/bootasm2.o b/stage3/bootasm2.o index b9342db..b228aa4 100644 Binary files a/stage3/bootasm2.o and b/stage3/bootasm2.o differ diff --git a/stage3/bootblock2 b/stage3/bootblock2 index 01bc4ed..085487d 100644 Binary files a/stage3/bootblock2 and b/stage3/bootblock2 differ diff --git a/stage3/bootblock2.o b/stage3/bootblock2.o index 49f36a7..641018c 100644 Binary files a/stage3/bootblock2.o and b/stage3/bootblock2.o differ diff --git a/stage3/xv6.img b/stage3/xv6.img index 1c56e61..0bac2e5 100644 --- a/stage3/xv6.img +++ b/stage3/xv6.img @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9bedb7e2f1ba67990f6d1aaa49deb02e479cfdd6baa4669f2c23bca5b1034d0d +oid sha256:fe4446bd0f46403e99e4a31f095ded3533cef123aa3b6a8c936afc6ff2f7ac28 size 5120000 diff --git a/stage4/bootasm2.S b/stage4/bootasm2.S index ebd077c..754655a 100644 --- a/stage4/bootasm2.S +++ b/stage4/bootasm2.S @@ -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 \ No newline at end of file diff --git a/stage4/bootasm2.o b/stage4/bootasm2.o index 3410ea9..089f29f 100644 Binary files a/stage4/bootasm2.o and b/stage4/bootasm2.o differ diff --git a/stage4/bootblock2 b/stage4/bootblock2 index 8f6d29a..98e64c6 100644 Binary files a/stage4/bootblock2 and b/stage4/bootblock2 differ diff --git a/stage4/bootblock2.o b/stage4/bootblock2.o index 13fe6b5..0db227c 100644 Binary files a/stage4/bootblock2.o and b/stage4/bootblock2.o differ diff --git a/stage4/xv6.img b/stage4/xv6.img index 1b593b8..62fa83f 100644 --- a/stage4/xv6.img +++ b/stage4/xv6.img @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:465ada267f22651cb6209e385990be1d287f9831c9b4c7c1db2efd0a005e1d6a +oid sha256:7078622026ed900ced67bab583b8c13e539521ff17aecadb0d1b4d93f4d81938 size 5120000 diff --git a/stage5/bootasm2.S b/stage5/bootasm2.S index 0346d27..e94632d 100644 --- a/stage5/bootasm2.S +++ b/stage5/bootasm2.S @@ -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 diff --git a/stage5/bootasm2.o b/stage5/bootasm2.o index 7176aeb..e848278 100644 Binary files a/stage5/bootasm2.o and b/stage5/bootasm2.o differ diff --git a/stage5/bootblock2 b/stage5/bootblock2 index 1312f17..64a3a71 100644 Binary files a/stage5/bootblock2 and b/stage5/bootblock2 differ diff --git a/stage5/bootblock2.o b/stage5/bootblock2.o index 8a1e1b9..c13dd8b 100644 Binary files a/stage5/bootblock2.o and b/stage5/bootblock2.o differ diff --git a/stage5/xv6.img b/stage5/xv6.img index fe67061..808c0d2 100644 --- a/stage5/xv6.img +++ b/stage5/xv6.img @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a108667751cb7525a5bed280f5f36a5b873b513ecf2ddaa3758c560bcd0d3ade +oid sha256:49a1abae6715cb4397f92449ae7548d1e0462ab2b0c00b9bdd4ed4d523502fa2 size 5120000