diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-12-26 19:13:23 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-12-26 19:13:23 -0800 |
commit | 73728ec665e8b128b63c6c633f7c1dd7cfcae2f4 (patch) | |
tree | b09e704fad0fb64642f7fcb9d7fbb68da0c22d83 /baremetal | |
parent | 4b26c93e69e13462b7397f860b4f52b12aae2897 (diff) | |
download | mu-73728ec665e8b128b63c6c633f7c1dd7cfcae2f4.tar.gz |
7412 - drawing pixels to screen
This works, but colors are unexpected. 0xff isn't white. Lots of colors are black. Perhaps I need to initialize a palette.
Diffstat (limited to 'baremetal')
-rw-r--r-- | baremetal/ex1.hex | 2 | ||||
-rw-r--r-- | baremetal/ex2.hex | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/baremetal/ex1.hex b/baremetal/ex1.hex index 0c605df1..8a0e5907 100644 --- a/baremetal/ex1.hex +++ b/baremetal/ex1.hex @@ -12,7 +12,7 @@ # Or: # bochs -f apps/boot.bochsrc # boot.bochsrc loads disk.img -# address 0x8000 +# main: (address 0x8000) e9 fb ff ff ff # jump to address 0x8000 # vim:ft=subx diff --git a/baremetal/ex2.hex b/baremetal/ex2.hex new file mode 100644 index 00000000..d3fbec8d --- /dev/null +++ b/baremetal/ex2.hex @@ -0,0 +1,29 @@ +# Test out the video mode without running afoul of video memory banking. Fill +# just the first row with pixels. +# +# To run, first prepare a realistically sized disk image: +# dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB +# Load the disk image: +# cat baremetal/boot.hex baremetal/ex2.hex |./bootstrap run apps/hex > a.bin +# dd if=a.bin of=disk.img conv=notrunc +# To run: +# qemu-system-i386 disk.img +# Or: +# bochs -f apps/boot.bochsrc # boot.bochsrc loads disk.img + +# main: (address 0x8000) +b8 ff 04 0a 00 # eax <- 0xa0000 (start of video RAM) + 0x4ff (1279 = final pixel in first row) +# $loop: +3d 00 00 0a 00 # compare eax with 0xa0000 +7c 06 # break if < +# *eax <- 0xff +c6 # copy imm8 to m8 at r32 + 00 # 00/mod/indirect 000/subop 000/eax + 31 # imm32 +48 # decrement eax +eb f3 # loop = -13 bytes + +# $break: +e9 fb ff ff ff # hang indefinitely + +# vim:ft=subx |