Compare commits
12 commits
fasm-putch
...
master
Author | SHA1 | Date | |
---|---|---|---|
57dd60bcef | |||
091f7cb4b8 | |||
f9e2dc33e9 | |||
0d9fcf5ae4 | |||
c2e69b6f7f | |||
7a22e4aed7 | |||
32ccb3abd1 | |||
bcf49f4fef | |||
bbd80c4f78 | |||
3dd934bd83 | |||
a0ba839215 | |||
e4172c14bb |
10 changed files with 273 additions and 213 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,3 +4,5 @@
|
||||||
*.bin
|
*.bin
|
||||||
mnt/
|
mnt/
|
||||||
build/
|
build/
|
||||||
|
bx_enh_dbg.ini
|
||||||
|
serial.out
|
||||||
|
|
35
Makefile
35
Makefile
|
@ -4,22 +4,43 @@ clean:
|
||||||
|
|
||||||
start32.bin: src/*
|
start32.bin: src/*
|
||||||
fasm src/start32.asm start32.bin
|
fasm src/start32.asm start32.bin
|
||||||
image: start32.bin mount
|
image: start32.bin mount grub-cfg roska.img mnt/roska/
|
||||||
cp start32.bin mnt/roska/
|
cp start32.bin mnt/roska/
|
||||||
sync
|
sync
|
||||||
|
|
||||||
qemu-multiboot: start32.bin
|
qemu-run: image roska.img
|
||||||
qemu-system-i386 -kernel start32.bin -serial stdio
|
|
||||||
qemu-image: image
|
|
||||||
qemu-system-i386 roska.img -serial stdio
|
qemu-system-i386 roska.img -serial stdio
|
||||||
|
bochs-run: image roska.img
|
||||||
|
touch serial.out
|
||||||
|
bochs -qf bochsrc.txt
|
||||||
mount: roska.img mnt/
|
mount: roska.img mnt/
|
||||||
@if ! mountpoint -q "mnt/"; then \
|
@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/; \
|
sudo mount -o loop,offset=1048576,umask=177,dmask=022,uid=$(shell id -u),gid=$(shell id -g) roska.img mnt/; \
|
||||||
fi;
|
fi;
|
||||||
umount:
|
umount:
|
||||||
@sudo umount mnt
|
@if mountpoint -q "mnt/"; then \
|
||||||
|
sudo umount mnt/; \
|
||||||
|
fi;
|
||||||
mnt/:
|
mnt/:
|
||||||
@mkdir mnt
|
@mkdir -p mnt
|
||||||
|
mnt/roska/: mount roska.img
|
||||||
|
@mkdir -p mnt/roska
|
||||||
build/:
|
build/:
|
||||||
@mkdir build
|
@mkdir build
|
||||||
|
|
||||||
|
roska.img: mnt/
|
||||||
|
dd if=/dev/zero of=roska.img bs=1k count=16128
|
||||||
|
echo 'type=83' | sudo sfdisk roska.img
|
||||||
|
sudo losetup /dev/loop0 roska.img
|
||||||
|
sudo losetup /dev/loop1 roska.img -o1048576
|
||||||
|
sudo mkdosfs -F32 -f 2 /dev/loop1
|
||||||
|
sudo mount /dev/loop1 mnt/
|
||||||
|
sudo grub-install --target=i386-pc --root-directory=mnt --boot-directory=mnt/boot --no-floppy --modules="normal part_msdos multiboot" /dev/loop0
|
||||||
|
sudo umount mnt/
|
||||||
|
sudo losetup -d /dev/loop1
|
||||||
|
sudo losetup -d /dev/loop0
|
||||||
|
grub-cfg: grub.cfg mount
|
||||||
|
cp grub.cfg mnt/boot/grub/grub.cfg
|
||||||
|
lo-unsetup: umount
|
||||||
|
sudo losetup -d /dev/loop1
|
||||||
|
sudo losetup -d /dev/loop0
|
||||||
|
|
14
bochsrc.txt
Normal file
14
bochsrc.txt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
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
|
||||||
|
# Serial is piped to serial.out for your `tail`ing sweetness
|
||||||
|
com1: enabled=1, mode=file, dev=serial.out
|
3
grub.cfg
Normal file
3
grub.cfg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
menuentry "rOSka" {
|
||||||
|
multiboot /roska/start32.bin
|
||||||
|
}
|
85
src/font.asm
85
src/font.asm
|
@ -1,25 +1,43 @@
|
||||||
;; Thank you Terminus for letting us use this font under SIL licence
|
;;; Resolution: 8x16
|
||||||
kfont:
|
kfontbasicascii:
|
||||||
; controlchars
|
;; 0 NULL
|
||||||
times 31 db 0x00000000000000000000000000000000
|
db 11001100b
|
||||||
; space
|
db 11001100b
|
||||||
db 11000000b
|
db 00110011b
|
||||||
db 10000000b
|
db 00110011b
|
||||||
db 00000000b
|
db 11001100b
|
||||||
db 00000000b
|
db 11001100b
|
||||||
db 00000000b
|
db 00110011b
|
||||||
db 00000001b
|
db 00110011b
|
||||||
db 00000001b
|
db 11001100b
|
||||||
db 00000001b
|
db 11001100b
|
||||||
db 00000001b
|
db 00110011b
|
||||||
|
db 00110011b
|
||||||
|
db 11001100b
|
||||||
|
db 11001100b
|
||||||
|
db 00110011b
|
||||||
|
db 00110011b
|
||||||
|
;; 1-31 control characters
|
||||||
|
rb 30*16
|
||||||
|
;; 32 Space
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000001b
|
db 00000000b
|
||||||
db 00000011b
|
db 00000000b
|
||||||
; !
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
;; 33 !
|
||||||
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00011000b
|
db 00011000b
|
||||||
|
@ -29,10 +47,43 @@ db 00011000b
|
||||||
db 00011000b
|
db 00011000b
|
||||||
db 00011000b
|
db 00011000b
|
||||||
db 00011000b
|
db 00011000b
|
||||||
|
db 00011000b
|
||||||
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00011000b
|
db 00011000b
|
||||||
db 00011000b
|
db 00011000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
|
;; 34 "
|
||||||
|
db 00000000b
|
||||||
|
db 01100110b
|
||||||
|
db 01100110b
|
||||||
|
db 01100110b
|
||||||
|
db 01100110b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
;; 35 #
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 00000000b
|
||||||
|
db 01100110b
|
||||||
|
db 01100110b
|
||||||
|
db 11111111b
|
||||||
|
db 11111111b
|
||||||
|
db 01100110b
|
||||||
|
db 01100110b
|
||||||
|
db 11111111b
|
||||||
|
db 11111111b
|
||||||
|
db 01100110b
|
||||||
|
db 01100110b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
db 00000000b
|
db 00000000b
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
;; x, y, brightness
|
macro kputpixel x*, y*, r*, g*, b* {
|
||||||
|
push b ;b
|
||||||
|
push g ;g
|
||||||
|
push r ;r
|
||||||
|
push y ;y
|
||||||
|
push x ;x
|
||||||
|
call putpixel
|
||||||
|
add esp, 4*5
|
||||||
|
}
|
||||||
|
|
||||||
|
;; x, y, r, g, b
|
||||||
putpixel:
|
putpixel:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
|
|
||||||
push eax
|
|
||||||
push ebx
|
push ebx
|
||||||
push ecx
|
|
||||||
push edi
|
push edi
|
||||||
|
|
||||||
; check pixel is in screen
|
; check pixel is in screen
|
||||||
|
@ -28,74 +36,37 @@ putpixel:
|
||||||
add edi, eax
|
add edi, eax
|
||||||
|
|
||||||
|
|
||||||
; Brightness
|
|
||||||
mov eax, [ebp + 16]
|
|
||||||
|
|
||||||
; Poke videomemory
|
; Poke videomemory
|
||||||
cld
|
xor eax, eax
|
||||||
rep stosb
|
mov ebx, [ebp+16]
|
||||||
|
mov cl, [mbootinfo.fb_rpos]
|
||||||
|
shl ebx, cl
|
||||||
|
or eax, ebx
|
||||||
|
|
||||||
|
mov ebx, [ebp+20]
|
||||||
|
mov cl, [mbootinfo.fb_gpos]
|
||||||
|
shl ebx, cl
|
||||||
|
or eax, ebx
|
||||||
|
|
||||||
|
mov ebx, [ebp+24]
|
||||||
|
mov cl, [mbootinfo.fb_bpos]
|
||||||
|
shl ebx, cl
|
||||||
|
or eax, ebx
|
||||||
|
|
||||||
|
cmp [mbootinfo.fb_bpp], 32
|
||||||
|
jne .bpp24
|
||||||
|
stosd
|
||||||
|
jmp .done
|
||||||
|
.bpp24:
|
||||||
|
stosb
|
||||||
|
shr eax, 8
|
||||||
|
stosb
|
||||||
|
shr eax, 8
|
||||||
|
stosb
|
||||||
.done:
|
.done:
|
||||||
pop edi
|
pop edi
|
||||||
pop ecx
|
|
||||||
pop ebx
|
pop ebx
|
||||||
pop eax
|
|
||||||
|
|
||||||
pop ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; char, x, y
|
|
||||||
putchar:
|
|
||||||
push ebp
|
|
||||||
mov ebp, esp
|
|
||||||
push eax
|
|
||||||
push ebx
|
|
||||||
push ecx
|
|
||||||
push edx
|
|
||||||
|
|
||||||
; skip non printable
|
|
||||||
mov eax, [ebp+8] ;char
|
|
||||||
cmp eax, 0x20
|
|
||||||
jl .unprintable
|
|
||||||
cmp eax, 0x7e
|
|
||||||
jg .unprintable
|
|
||||||
|
|
||||||
mov ecx, 16
|
|
||||||
mul ecx
|
|
||||||
mov esi, [kfont+eax]
|
|
||||||
|
|
||||||
mov ebx, [ebp+12] ;x
|
|
||||||
mov edx, [ebp+16] ;y
|
|
||||||
|
|
||||||
cld
|
|
||||||
xor eax, eax
|
|
||||||
.loop:
|
|
||||||
lodsb ; load font row to al
|
|
||||||
mov ah, 0
|
|
||||||
.loop2:
|
|
||||||
shl al
|
|
||||||
jnc .blankpix
|
|
||||||
; draw a pixel
|
|
||||||
push 0xff
|
|
||||||
push edx ;x
|
|
||||||
push ecx ;y
|
|
||||||
.blankpix:
|
|
||||||
inc ah
|
|
||||||
cmp ah, 8
|
|
||||||
je .loop
|
|
||||||
|
|
||||||
|
|
||||||
.done:
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
pop eax
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
||||||
.unprintable:
|
|
||||||
push .unprintablemsg
|
|
||||||
call serialwrite
|
|
||||||
add esp, 4
|
|
||||||
jmp .done
|
|
||||||
.unprintablemsg: db 10,"Err: Unprintable char not handled!", 0
|
|
||||||
|
|
||||||
include "src/font.asm"
|
|
||||||
|
|
29
src/itoa.asm
29
src/itoa.asm
|
@ -1,8 +1,12 @@
|
||||||
;; Modified from: https://gist.github.com/SplittyDev/8e728627012e57ac0deac196660014fb
|
;; 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.
|
; Routine to convert a 32-bit integer to a string.
|
||||||
; Registers are preserved.
|
|
||||||
;
|
;
|
||||||
; EAX: Source integer
|
; EAX: Source integer
|
||||||
; EBX: Target address
|
; EBX: Target address
|
||||||
|
@ -26,19 +30,28 @@
|
||||||
; ECX: Target address (active)
|
; ECX: Target address (active)
|
||||||
; EDX: Target address (temporary)
|
; EDX: Target address (temporary)
|
||||||
;
|
;
|
||||||
|
; return:
|
||||||
|
; put original target at EAX
|
||||||
|
; (we trust this blindly)
|
||||||
|
|
||||||
|
macro kuitoa src*, dest*, base* {
|
||||||
|
push base
|
||||||
|
push dest
|
||||||
|
push src
|
||||||
|
call __uitoa
|
||||||
|
add esp, 3*4
|
||||||
|
}
|
||||||
|
|
||||||
__uitoa:
|
__uitoa:
|
||||||
.start:
|
.start:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
|
|
||||||
push eax
|
|
||||||
push ebx
|
push ebx
|
||||||
push ecx
|
|
||||||
push edx
|
|
||||||
|
|
||||||
mov eax, [ebp+8]
|
mov eax, [ebp+8]
|
||||||
mov ecx, [ebp+12]
|
mov ebx, [ebp+12]
|
||||||
mov ebx, [ebp+16]
|
mov ecx, [ebp+16]
|
||||||
|
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
|
@ -75,11 +88,9 @@ __uitoa:
|
||||||
dec ecx
|
dec ecx
|
||||||
jmp .reverse
|
jmp .reverse
|
||||||
.end:
|
.end:
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
pop ebx
|
||||||
pop eax
|
|
||||||
|
|
||||||
|
mov eax, [ebp+12] ; Return target address
|
||||||
pop ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
mbootgetinfo:
|
mbootgetinfo:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
push ebx
|
|
||||||
push esi
|
push esi
|
||||||
push edi
|
push edi
|
||||||
cld
|
cld
|
||||||
|
@ -10,23 +9,23 @@ mbootgetinfo:
|
||||||
cmp eax, 0x2badb002
|
cmp eax, 0x2badb002
|
||||||
jne mbootnomagic
|
jne mbootnomagic
|
||||||
|
|
||||||
mov ebx, [ebp+12]
|
mov edx, [ebp+12]
|
||||||
mov eax, [ebx]
|
mov eax, [edx]
|
||||||
mov [mbootinfo.flags], eax
|
mov [mbootinfo.flags], eax
|
||||||
|
|
||||||
;; Get memoryinformation
|
;; Get memoryinformation
|
||||||
test eax, 1b
|
test eax, 1b
|
||||||
jz mbootnomeminfo
|
jz mbootnomeminfo
|
||||||
mov eax, [ebx+4]
|
mov eax, [edx+4]
|
||||||
mov [mbootinfo.mem_lower], eax
|
mov [mbootinfo.mem_lower], eax
|
||||||
mov eax, [ebx+8]
|
mov eax, [edx+8]
|
||||||
mov [mbootinfo.mem_upper], eax
|
mov [mbootinfo.mem_upper], eax
|
||||||
|
|
||||||
;; Get videoinformation
|
;; Get videoinformation
|
||||||
test [mbootinfo.flags], (1 shl 02)
|
test [mbootinfo.flags], (1 shl 02)
|
||||||
jz mbootnovideoinfo
|
jz mbootnovideoinfo
|
||||||
|
|
||||||
mov esi, ebx
|
mov esi, edx
|
||||||
add esi, 88
|
add esi, 88
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
mov [mbootinfo.fb_addr], eax
|
mov [mbootinfo.fb_addr], eax
|
||||||
|
@ -54,6 +53,8 @@ mbootgetinfo:
|
||||||
mov [mbootinfo.fb_type], al
|
mov [mbootinfo.fb_type], al
|
||||||
inc esi
|
inc esi
|
||||||
|
|
||||||
|
;garbage?
|
||||||
|
add esi, 2
|
||||||
;; r/g/b positions and masks
|
;; r/g/b positions and masks
|
||||||
mov ecx, 6
|
mov ecx, 6
|
||||||
mov edi, mbootinfo.fb_rpos
|
mov edi, mbootinfo.fb_rpos
|
||||||
|
@ -62,13 +63,12 @@ mbootgetinfo:
|
||||||
.bytesppcalc:
|
.bytesppcalc:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov al, [mbootinfo.fb_bpp]
|
mov al, [mbootinfo.fb_bpp]
|
||||||
mov ebx, 8
|
mov edx, 8
|
||||||
div bl
|
div dl
|
||||||
mov [mbootinfo.fb_bytespp], al
|
mov [mbootinfo.fb_bytespp], al
|
||||||
.done:
|
.done:
|
||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
pop ebx
|
|
||||||
pop ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
SERIAL_PORT equ 0x3f8
|
SERIAL_PORT equ 0x3f8
|
||||||
serialinitialized db 0
|
serialinitialized db 0
|
||||||
|
|
||||||
serialinit:
|
; Write null terminated string in address str_pointer to serial
|
||||||
push ax
|
macro serw [str_pointer*] {
|
||||||
|
push str_pointer
|
||||||
|
call serialwrite
|
||||||
|
add esp, 4
|
||||||
|
}
|
||||||
|
|
||||||
|
serialinit:
|
||||||
;Disable ints
|
;Disable ints
|
||||||
mov dx, SERIAL_PORT+1
|
mov dx, SERIAL_PORT+1
|
||||||
mov al, 0x00
|
mov al, 0x00
|
||||||
|
@ -54,7 +59,6 @@ serialinit:
|
||||||
out dx, al
|
out dx, al
|
||||||
mov [serialinitialized], 1
|
mov [serialinitialized], 1
|
||||||
.end:
|
.end:
|
||||||
pop ax
|
|
||||||
ret
|
ret
|
||||||
.errormsg db "Serial init failed", 0
|
.errormsg db "Serial init failed", 0
|
||||||
|
|
||||||
|
@ -64,7 +68,6 @@ serialwrite:
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
push esi
|
push esi
|
||||||
push ax
|
|
||||||
cld
|
cld
|
||||||
mov esi, [ebp+8]
|
mov esi, [ebp+8]
|
||||||
.loop:
|
.loop:
|
||||||
|
@ -80,7 +83,6 @@ serialwrite:
|
||||||
out dx, al
|
out dx, al
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
pop ax
|
|
||||||
pop esi
|
pop esi
|
||||||
pop ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
145
src/start32.asm
145
src/start32.asm
|
@ -13,7 +13,7 @@ MB_CHECKSUM equ -(MB_HEADER_MAGIC + MB_HEADER_FLAGS)
|
||||||
|
|
||||||
VWIDTH equ 640
|
VWIDTH equ 640
|
||||||
VHEIGHT equ 480
|
VHEIGHT equ 480
|
||||||
VDEPTH equ 24
|
VDEPTH equ 32
|
||||||
|
|
||||||
multiboot:
|
multiboot:
|
||||||
dd MB_HEADER_MAGIC
|
dd MB_HEADER_MAGIC
|
||||||
|
@ -29,6 +29,13 @@ multiboot:
|
||||||
dd VHEIGHT ; video height
|
dd VHEIGHT ; video height
|
||||||
dd VDEPTH ; video depth
|
dd VDEPTH ; video depth
|
||||||
|
|
||||||
|
; Includes yayyy
|
||||||
|
include "src/serial.asm"
|
||||||
|
include "src/mbootinfo.asm"
|
||||||
|
include "src/itoa.asm"
|
||||||
|
include "src/framebuffer.asm"
|
||||||
|
include "src/roskalogoraw.asm"
|
||||||
|
|
||||||
start:
|
start:
|
||||||
; Setup stack
|
; Setup stack
|
||||||
mov ebp, stack_top
|
mov ebp, stack_top
|
||||||
|
@ -38,77 +45,60 @@ start:
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
call serialinit
|
call serialinit
|
||||||
push stuff.bootmsg
|
|
||||||
call serialwrite
|
serw stuff.bootmsg
|
||||||
add esp, 4
|
|
||||||
|
|
||||||
call mbootgetinfo
|
call mbootgetinfo
|
||||||
add esp, 2*4
|
add esp, 2*4
|
||||||
|
|
||||||
push stuff.fbaddrmsgpfx
|
|
||||||
call serialwrite
|
|
||||||
add esp, 4
|
|
||||||
|
|
||||||
sub esp, 36 ;Reserve stack for return
|
sub esp, 36 ;Reserve stack for return
|
||||||
push dword esp ;Destination address
|
mov ebx, esp ;Store str buff addr
|
||||||
push dword 16 ;Base
|
|
||||||
push dword [mbootinfo.fb_addr] ;source
|
|
||||||
call __uitoa
|
|
||||||
add esp, 3*4
|
|
||||||
push esp
|
|
||||||
call serialwrite
|
|
||||||
add esp, 4
|
|
||||||
|
|
||||||
push stuff.fbdimensionsmsgpfx
|
kuitoa [mbootinfo.fb_addr], ebx, 16
|
||||||
call serialwrite
|
serw stuff.fbaddrmsgpfx, ebx
|
||||||
add esp, 4
|
|
||||||
push dword esp ;destination address
|
|
||||||
push dword 10 ;base
|
|
||||||
push dword [mbootinfo.fb_width]
|
|
||||||
call __uitoa
|
|
||||||
add esp, 3*4
|
|
||||||
push esp
|
|
||||||
call serialwrite
|
|
||||||
add esp, 4
|
|
||||||
push stuff.x
|
|
||||||
call serialwrite
|
|
||||||
add esp, 4
|
|
||||||
|
|
||||||
push dword esp ;destination address
|
kuitoa [mbootinfo.fb_width], ebx, 10
|
||||||
push dword 10 ;base
|
serw stuff.fbdimensionsmsgpfx, ebx, stuff.x
|
||||||
push dword [mbootinfo.fb_height]
|
|
||||||
call __uitoa
|
|
||||||
add esp, 3*4
|
|
||||||
push esp
|
|
||||||
call serialwrite
|
|
||||||
add esp, 4
|
|
||||||
push stuff.x
|
|
||||||
call serialwrite
|
|
||||||
add esp, 4
|
|
||||||
|
|
||||||
push dword esp ;destination address
|
kuitoa [mbootinfo.fb_height], ebx, 10
|
||||||
push dword 10 ;base
|
serw ebx, stuff.x
|
||||||
xor eax, eax
|
|
||||||
mov al, [mbootinfo.fb_bpp]
|
movzx eax, byte [mbootinfo.fb_bpp]
|
||||||
push dword eax
|
kuitoa eax, ebx, 10
|
||||||
call __uitoa
|
serw ebx
|
||||||
add esp, 3*4
|
|
||||||
push esp
|
|
||||||
call serialwrite
|
movzx eax, byte [mbootinfo.fb_rpos]
|
||||||
add esp, 4
|
kuitoa eax, ebx, 10
|
||||||
|
serw stuff.rpostxt, ebx
|
||||||
|
|
||||||
|
movzx eax, byte [mbootinfo.fb_gpos]
|
||||||
|
kuitoa eax, ebx, 10
|
||||||
|
serw stuff.gpostxt, ebx
|
||||||
|
|
||||||
|
movzx eax, byte [mbootinfo.fb_bpos]
|
||||||
|
kuitoa eax, ebx, 10
|
||||||
|
serw stuff.bpostxt, ebx
|
||||||
|
|
||||||
|
|
||||||
|
movzx eax, byte [mbootinfo.fb_rmasksize]
|
||||||
|
kuitoa eax, ebx, 10
|
||||||
|
serw stuff.rmasksizetxt, ebx
|
||||||
|
|
||||||
|
movzx eax, byte [mbootinfo.fb_gmasksize]
|
||||||
|
kuitoa eax, ebx, 10
|
||||||
|
serw stuff.gmasksizetxt, ebx
|
||||||
|
|
||||||
|
movzx eax, byte [mbootinfo.fb_bmasksize]
|
||||||
|
kuitoa eax, ebx, 10
|
||||||
|
serw stuff.bmasksizetxt, ebx
|
||||||
|
|
||||||
add esp, 36 ;Clean reserved uitoa return string from stack
|
add esp, 36 ;Clean reserved uitoa return string from stack
|
||||||
|
|
||||||
; Draw a test pixel to bottom right corner
|
; Draw a green test pixel to bottom-right
|
||||||
mov eax, 0xff
|
kputpixel VWIDTH-1, VHEIGHT-1, 0x00, 0xff, 0x00
|
||||||
mov ebx, 767
|
|
||||||
mov ecx, 1023
|
|
||||||
push 0xff
|
|
||||||
push 479
|
|
||||||
push 639
|
|
||||||
call putpixel
|
|
||||||
add esp, 3*4
|
|
||||||
|
|
||||||
|
; Draw a predefined logo in magenta to top-left
|
||||||
rOSkalogodraw:
|
rOSkalogodraw:
|
||||||
mov esi, roskalogo
|
mov esi, roskalogo
|
||||||
mov eax, 0 ;Brightness
|
mov eax, 0 ;Brightness
|
||||||
|
@ -116,13 +106,12 @@ rOSkalogodraw:
|
||||||
mov ecx, 0 ;x
|
mov ecx, 0 ;x
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
push eax
|
|
||||||
push ebx
|
|
||||||
push ecx
|
push ecx
|
||||||
call putpixel
|
push eax
|
||||||
pop ecx
|
kputpixel ecx, ebx, eax, 0x00, eax
|
||||||
pop ebx
|
|
||||||
pop eax
|
pop eax
|
||||||
|
pop ecx
|
||||||
|
|
||||||
inc ecx
|
inc ecx
|
||||||
cmp byte cl, [roskalogo.w]
|
cmp byte cl, [roskalogo.w]
|
||||||
|
@ -132,36 +121,32 @@ rOSkalogodraw:
|
||||||
cmp byte bl, [roskalogo.h]
|
cmp byte bl, [roskalogo.h]
|
||||||
jne .loop
|
jne .loop
|
||||||
.done:
|
.done:
|
||||||
|
|
||||||
push byte 0x21
|
|
||||||
push byte 0x21
|
|
||||||
push byte 0x21
|
|
||||||
call putchar
|
|
||||||
add esp, 3*4
|
|
||||||
|
|
||||||
jmp hang
|
jmp hang
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hang:
|
hang:
|
||||||
push .msg
|
serw .msg
|
||||||
call serialwrite
|
|
||||||
cli
|
cli
|
||||||
.loop:
|
.loop:
|
||||||
hlt
|
hlt
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.msg db 10, "Halting...", 10, 0
|
.msg db 10, "Halting...", 10, 0
|
||||||
|
|
||||||
include "src/serial.asm"
|
|
||||||
include "src/mbootinfo.asm"
|
|
||||||
include "src/itoa.asm"
|
|
||||||
include "src/framebuffer.asm"
|
|
||||||
include "src/roskalogoraw.asm"
|
|
||||||
|
|
||||||
stuff:
|
stuff:
|
||||||
.bootmsg db 10, "=== rOSka ===", 10, 0
|
.bootmsg db 10, "=== rOSka ===", 10, 0
|
||||||
.fbaddrmsgpfx db 10, "Framebuffer address: 0x", 0
|
.fbaddrmsgpfx db 10, "Framebuffer address: 0x", 0
|
||||||
.fbdimensionsmsgpfx db 10, "Framebuffer dimensions: ", 0
|
.fbdimensionsmsgpfx db 10, "Framebuffer dimensions: ", 0
|
||||||
.x db "x", 0
|
.x db "x", 0
|
||||||
|
|
||||||
|
|
||||||
|
.rpostxt db 10, "rPos: ", 0
|
||||||
|
.gpostxt db 10, "gPos: ", 0
|
||||||
|
.bpostxt db 10, "bPos: ", 0
|
||||||
|
.rmasksizetxt db 10, "rMaskSize: ", 0
|
||||||
|
.gmasksizetxt db 10, "gMaskSize: ", 0
|
||||||
|
.bmasksizetxt db 10, "bMaskSize: ", 0
|
||||||
|
|
||||||
align 4096
|
align 4096
|
||||||
bss_start:
|
bss_start:
|
||||||
;align 4096
|
;align 4096
|
||||||
|
|
Loading…
Reference in a new issue