diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-12-29 19:14:26 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-12-29 19:14:26 -0800 |
commit | c5dfa89bb31bac8f03b646eaa3b5b204b854b2b9 (patch) | |
tree | ac75ebdc9f27d4e4a747a20511059225a0602340 /baremetal | |
parent | 796f3b70f264a13a48f8b0247a997f074e5995c3 (diff) | |
download | mu-c5dfa89bb31bac8f03b646eaa3b5b204b854b2b9.tar.gz |
7462 - SubX version of baremetal/ex2.subx
Diffstat (limited to 'baremetal')
-rw-r--r-- | baremetal/ex2.subx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/baremetal/ex2.subx b/baremetal/ex2.subx new file mode 100644 index 00000000..1a0f429d --- /dev/null +++ b/baremetal/ex2.subx @@ -0,0 +1,35 @@ +# Test out the video mode by filling in the screen with pixels. +# +# To build a disk image: +# ./translate_subx_baremetal baremetal/ex2.subx # emits disk.img +# To run: +# qemu-system-i386 disk.img +# Or: +# bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.img + +# main: (address 0x8800) + +== code + +# ecx <- start of video memory +8b/-> 0/mod/indirect 5/rm32/use-disp32 0x7f28/disp32/video-memory 1/r32/ecx + +# eax <- final pixel of video memory +8d/copy-address *(ecx + 0x0bffff) 0/r32/eax # 0xbffff = 1024*768 - 1 + +# for each pixel in video memory +{ + 39/compare %eax 1/r32/ecx + 7c/jump-if-< break/disp8 + # write its column number to it + 88/byte<- *eax 0/r32/AL + 48/decrement-eax + eb/jump loop/disp8 +} + +# hang indefinitely +{ + eb/jump loop/disp8 +} + +# vim:ft=subx |