X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fboot%2Fboot.s;h=554f5a2f2ca0b9e522a8d74ca274efe4ddde24f6;hb=c3e1be53f1269385b7f2b64442b85747e20b2412;hp=7f8ee685a241218d102c11fdd570b2d9b6ab94cf;hpb=06e632cd7cf56db0d187bf1c8ee80172bc56e685;p=bootcensus diff --git a/src/boot/boot.s b/src/boot/boot.s index 7f8ee68..554f5a2 100644 --- a/src/boot/boot.s +++ b/src/boot/boot.s @@ -1,3 +1,19 @@ +# pcboot - bootable PC demo/game kernel +# Copyright (C) 2018 John Tsiombikas +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + .code16 .section .boot,"a" @@ -32,6 +48,7 @@ boot: mov $_boot2_size, %eax call print_num + mov $_boot2_size, %eax mov %eax, %ebx shr $9, %eax and $0x1ff, %ebx @@ -52,7 +69,7 @@ boot: .set ARG_SIDX, 4 loading_msg: .asciz "\nLoad " -driveno_msg: .asciz "Drive: " +driveno_msg: .asciz "Drv:" sect_per_track: .short 18 num_cylinders: .short 80 @@ -193,7 +210,7 @@ read_sector: pop %bp ret -str_read_error: .asciz "rderr: " +str_read_error: .asciz "rderr:" abort_read: mov $str_read_error, %si @@ -221,7 +238,13 @@ print_str: # expects character in al print_char: push %es - pushw $0xb800 + + push %ax + cmp $10, %ax + jnz 0f + mov $32, %ax + +0: pushw $0xb800 pop %es movw cursor_x, %di shl $1, %di @@ -230,6 +253,7 @@ print_char: movb $7, %es:1(%di) incw cursor_x + pop %ax call ser_putchar pop %es ret @@ -268,12 +292,8 @@ print_num: .set DIV_9600, 115200 / 9600 .set LCTL_8N1, 0x03 .set LCTL_DLAB, 0x80 - .set FIFO_ENABLE, 0x01 - .set FIFO_SEND_CLEAR, 0x04 - .set FIFO_RECV_CLEAR, 0x02 - .set MCTL_DTR, 0x01 - .set MCTL_RTS, 0x02 - .set MCTL_OUT2, 0x08 + .set FIFO_ENABLE_CLEAR, 0x07 + .set MCTL_DTR_RTS_OUT2, 0x0b .set LST_TREG_EMPTY, 0x20 setup_serial: @@ -292,21 +312,16 @@ setup_serial: mov $UART_LCTL, %dx out %al, %dx # clear and enable fifo - mov $FIFO_ENABLE, %al - or $FIFO_SEND_CLEAR, %al - or $FIFO_RECV_CLEAR, %al + mov $FIFO_ENABLE_CLEAR, %al mov $UART_FIFO, %dx out %al, %dx # assert RTS and DTR - mov $MCTL_DTR, %al - or $MCTL_RTS, %al - or $MCTL_OUT2, %al + mov $MCTL_DTR_RTS_OUT2, %al mov $UART_MCTL, %dx out %al, %dx ret # expects a character in al - .global ser_putchar ser_putchar: push %dx