serial: make awesome
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,5 +6,6 @@
|
||||
*.o
|
||||
*.so
|
||||
*.tmp
|
||||
*.tmp.*
|
||||
/README.html
|
||||
tmp.S
|
||||
|
||||
1
Makefile
1
Makefile
@@ -55,6 +55,7 @@ bochs: $(RUN_FILE)
|
||||
CYLINDERS="$$(($$(stat -c '%s' '$(RUN_FILE)') / 512))" && \
|
||||
bochs -qf /dev/null \
|
||||
'ata0-master: type=disk, path="$(RUN_FILE)", mode=flat, cylinders='"$$CYLINDERS"', heads=1, spt=1' \
|
||||
'com1: enabled=1, mode=file, dev=$(RUN).tmp.serial' \
|
||||
'boot: disk' \
|
||||
'display_library: sdl2' \
|
||||
'megs: 128'
|
||||
|
||||
22
README.adoc
22
README.adoc
@@ -68,6 +68,11 @@ Then on the terminal start the simulation with:
|
||||
c
|
||||
....
|
||||
|
||||
To quit Bochs either:
|
||||
|
||||
* press the poweroff button inside its GUI
|
||||
* Ctrl + C on terminal and the type `quit` and hit enter
|
||||
|
||||
TODO: automate this step.
|
||||
|
||||
Bibliography: https://stackoverflow.com/questions/6142925/how-can-i-use-bochs-to-run-assembly-code/32871939#32871939
|
||||
@@ -2164,6 +2169,23 @@ While it is possible to learn those topics as you go along, and it is almost cer
|
||||
|
||||
=== Serial UART
|
||||
|
||||
TODO: get working on QEMU, working on Bochs:
|
||||
|
||||
....
|
||||
./run bios_hello_world_serial bochs
|
||||
cat bios_hello_world_serial.tmp.serial
|
||||
....
|
||||
|
||||
File content:
|
||||
|
||||
....
|
||||
hello world
|
||||
....
|
||||
|
||||
Source: link:bios_hello_world_serial.S[]
|
||||
|
||||
Bibliography:
|
||||
|
||||
* https://stackoverflow.com/questions/22571379/intel-galileo-bare-metal-uart
|
||||
* https://stackoverflow.com/questions/27594297/how-to-print-a-string-to-the-terminal-in-x86-64-assembly-nasm-without-syscall
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
#include "common.h"
|
||||
BEGIN
|
||||
DBG
|
||||
mov $0x00, %ah// Initialize COM port
|
||||
mov $0xe3, %al// Initialization value
|
||||
mov $0x00, %dx// Port number
|
||||
int $0x14
|
||||
mov $msg, %si
|
||||
/* Initialize COM port. */
|
||||
mov $0x00, %ah
|
||||
/* Initialization value. */
|
||||
mov $0xe3, %al
|
||||
/* Port number. */
|
||||
mov $0x00, %dx
|
||||
int $0x14
|
||||
mov $msg, %si
|
||||
loop:
|
||||
lodsb
|
||||
mov $0x01, %ah//Send value
|
||||
/* Send value */
|
||||
mov $0x01, %ah
|
||||
or %al, %al
|
||||
jz halt
|
||||
int $0x14
|
||||
@@ -16,4 +19,4 @@ loop:
|
||||
halt:
|
||||
hlt
|
||||
msg:
|
||||
.asciz "hello World!\n"
|
||||
.asciz "hello world\n"
|
||||
|
||||
Reference in New Issue
Block a user