mu/baremetal/ex2.mu
Kartik Agaram 6e36ce06dd 7521 - new plan for tests
It's not really manageable to make the fake screen pixel-oriented. Feels
excessive to compare things pixel by pixel when we will mostly be
writing text to screen. It'll also make expected screen assertions
more difficult to manage.

So I'm not sure how to make assertions about pixels for now. Instead
we'll introduce fake screens at draw-grapheme.
2021-01-15 20:30:07 -08:00

32 lines
668 B
Forth

# Test out the video mode by filling in the screen with pixels.
#
# To build a disk image:
# ./translate_mu_baremetal baremetal/ex2.mu # emits disk.img
# To run:
# qemu-system-i386 disk.img
# Or:
# bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.img
#
# Expected output:
# html/baremetal.png
fn main {
var y/eax: int <- copy 0
{
compare y, 0x300 # 768
break-if->=
var x/edx: int <- copy 0
{
compare x, 0x400 # 1024
break-if->=
var color/ecx: int <- copy x
color <- and 0xff
pixel-on-real-screen x, y, color
x <- increment
loop
}
y <- increment
loop
}
}