Final changes and tweaks before submission

This commit is contained in:
iDunnoDev
2022-11-25 11:19:26 +00:00
committed by iDunnoDev
parent 4d5dd089f6
commit 75183113f4
25 changed files with 100 additions and 220 deletions

View File

@ -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)

Binary file not shown.