mu/ex2.mu

29 lines
683 B
Forth
Raw Normal View History

# Test out the video mode by filling in the screen with pixels.
#
# To build a disk image:
2021-03-16 04:59:08 +00:00
# ./translate ex2.mu # emits disk.img
# To run:
# qemu-system-i386 disk.img
# Or:
2021-03-16 04:59:08 +00:00
# bochs -f bochsrc # bochsrc loads disk.img
2021-03-28 00:47:23 +00:00
fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
var y/eax: int <- copy 0
{
compare y, 0x300/screen-height=768
break-if->=
var x/edx: int <- copy 0
{
compare x, 0x400/screen-width=1024
break-if->=
2020-12-30 05:19:41 +00:00
var color/ecx: int <- copy x
color <- and 0xff
pixel-on-real-screen x, y, color
x <- increment
loop
}
y <- increment
loop
}
}