Compare commits

..

No commits in common. "f9e2dc33e904fa2cbaac0ab2d08a86335d99b41c" and "c2e69b6f7f320e8457274d2d935bb4536162e6bb" have entirely different histories.

5 changed files with 36 additions and 53 deletions

1
.gitignore vendored
View file

@ -4,4 +4,3 @@
*.bin
mnt/
build/
bx_enh_dbg.ini

View file

@ -8,10 +8,11 @@ image: start32.bin mount grub-cfg roska.img mnt/roska/
cp start32.bin mnt/roska/
sync
qemu-run: image roska.img
qemu-multiboot: start32.bin
qemu-system-i386 -kernel start32.bin -serial stdio
qemu-image: image roska.img
qemu-system-i386 roska.img -serial stdio
bochs-run: image roska.img
bochs -qf bochsrc.txt
mount: roska.img mnt/
@if ! mountpoint -q "mnt/"; then \
sudo mount -o loop,offset=1048576,umask=177,dmask=022,uid=$(shell id -u),gid=$(shell id -g) roska.img mnt/; \
@ -28,7 +29,7 @@ build/:
@mkdir build
roska.img: mnt/
dd if=/dev/zero of=roska.img bs=1k count=16128
dd if=/dev/zero of=roska.img bs=16M count=1
echo 'type=83' | sudo sfdisk roska.img
sudo losetup /dev/loop0 roska.img
sudo losetup /dev/loop1 roska.img -o1048576

View file

@ -1,13 +0,0 @@
display_library: x, options="gui_debug"
magic_break: enabled=1
romimage: file=$BXSHARE/BIOS-bochs-legacy
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
clock: sync=realtime
cpu: ips=4294967295, reset_on_triple_fault=false
megs: 128
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, mode=flat, path=roska.img, cylinders=32, heads=16, spt=63
boot: disk
# Use `bximage` to get disk geometry
# TODO: Figure out how to get sensible TTY serial

View file

@ -1,12 +1,8 @@
;; Modified from: https://gist.github.com/SplittyDev/8e728627012e57ac0deac196660014fb
; __itoa(src int, target addr, base)
;target address returned in EAX
;EBX, EBP, ESP preserved as our calling convention,
;refer to docs or something
;
; Routine to convert a 32-bit integer to a string.
; Registers are preserved.
;
; EAX: Source integer
; EBX: Target address
@ -30,13 +26,9 @@
; ECX: Target address (active)
; EDX: Target address (temporary)
;
; return:
; put original target at EAX
; (we trust this blindly)
macro kuitoa src*, dest*, base* {
push base
push dest
push base
push src
call __uitoa
add esp, 3*4
@ -47,11 +39,14 @@ __uitoa:
push ebp
mov ebp, esp
push eax
push ebx
push ecx
push edx
mov eax, [ebp+8]
mov ebx, [ebp+12]
mov ecx, [ebp+16]
mov ecx, [ebp+12]
mov ebx, [ebp+16]
mov edx, ecx
mov ecx, ebx
@ -88,9 +83,11 @@ __uitoa:
dec ecx
jmp .reverse
.end:
pop edx
pop ecx
pop ebx
pop eax
mov eax, [ebp+12] ; Return target address
pop ebp
ret

View file

@ -52,46 +52,45 @@ start:
add esp, 2*4
sub esp, 36 ;Reserve stack for return
mov ebx, esp ;Store str buff addr
kuitoa [mbootinfo.fb_addr], esp, 16
serw stuff.fbaddrmsgpfx, esp
kuitoa [mbootinfo.fb_addr], ebx, 16
serw stuff.fbaddrmsgpfx, ebx
kuitoa [mbootinfo.fb_width], esp, 10
serw stuff.fbdimensionsmsgpfx, esp, stuff.x
kuitoa [mbootinfo.fb_width], ebx, 10
serw stuff.fbdimensionsmsgpfx, ebx, stuff.x
kuitoa [mbootinfo.fb_height], ebx, 10
serw ebx, stuff.x
kuitoa [mbootinfo.fb_height], esp, 10
serw esp, stuff.x
movzx eax, byte [mbootinfo.fb_bpp]
kuitoa eax, ebx, 10
serw ebx
kuitoa eax, esp, 10
serw esp
movzx eax, byte [mbootinfo.fb_rpos]
kuitoa eax, ebx, 10
serw stuff.rpostxt, ebx
kuitoa eax, esp, 10
serw stuff.rpostxt, esp
movzx eax, byte [mbootinfo.fb_gpos]
kuitoa eax, ebx, 10
serw stuff.gpostxt, ebx
kuitoa eax, esp, 10
serw stuff.gpostxt, esp
movzx eax, byte [mbootinfo.fb_bpos]
kuitoa eax, ebx, 10
serw stuff.bpostxt, ebx
kuitoa eax, esp, 10
serw stuff.bpostxt, esp
movzx eax, byte [mbootinfo.fb_rmasksize]
kuitoa eax, ebx, 10
serw stuff.rmasksizetxt, ebx
kuitoa eax, esp, 10
serw stuff.rmasksizetxt, esp
movzx eax, byte [mbootinfo.fb_gmasksize]
kuitoa eax, ebx, 10
serw stuff.gmasksizetxt, ebx
kuitoa eax, esp, 10
serw stuff.gmasksizetxt, esp
movzx eax, byte [mbootinfo.fb_bmasksize]
kuitoa eax, ebx, 10
serw stuff.bmasksizetxt, ebx
kuitoa eax, esp, 10
serw stuff.bmasksizetxt, esp
add esp, 36 ;Clean reserved uitoa return string from stack