add UART init code and send every char to UART
This commit is contained in:
parent
ab6cede5b7
commit
aabea9d9f5
1 changed files with 25 additions and 3 deletions
28
messages.asm
28
messages.asm
|
@ -11,6 +11,15 @@ PIT_CH2_DATA_PORT equ 0x42 ; PIT channel 2 data port
|
|||
;; see http://www.ctyme.com/intr/int-10.htm for interrupts
|
||||
|
||||
start:
|
||||
|
||||
mov sp, 0x2000 ; initialise stack pointer
|
||||
|
||||
;; initialise serial port
|
||||
mov ah, 0x0 ; initialise UART
|
||||
mov al, 0b111_00_0_11 ; baud 9600, no parity, 1 stop bit, 8 data bits
|
||||
mov dx, 0x0 ; COM1
|
||||
int 0x14
|
||||
|
||||
;; Use color mode
|
||||
mov ax, VIDEO_MODE
|
||||
int 10h
|
||||
|
@ -31,12 +40,13 @@ mov dh, HEIGHT ; row (bottommost row)
|
|||
mov dl, 0x00 ; col (leftmost col)
|
||||
int 0x10
|
||||
|
||||
mov sp, 0x2000 ; initialise stack pointer
|
||||
|
||||
.loop:
|
||||
mov ah, 0x00 ; Read a character
|
||||
;; read a character, ASCII in al
|
||||
mov ah, 0x00 ; Read character
|
||||
int 0x16
|
||||
|
||||
call UART_send_char
|
||||
|
||||
cmp al, 0x08 ; backspace
|
||||
je change_color_mode
|
||||
|
||||
|
@ -52,6 +62,18 @@ mov sp, 0x2000 ; initialise stack pointer
|
|||
call newline
|
||||
jmp .loop
|
||||
|
||||
;; Prints a character in al to the serial port
|
||||
;;
|
||||
;; CLOBBERS
|
||||
;; - ax
|
||||
;; - dx
|
||||
UART_send_char:
|
||||
mov ah, 0x01 ; transmit character
|
||||
mov dx, 0x0 ; COM1
|
||||
int 0x14
|
||||
|
||||
ret
|
||||
|
||||
;; Update the color_mode variable with a byte from the keyboard
|
||||
;;
|
||||
;; CLOBBERS
|
||||
|
|
Loading…
Reference in a new issue