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.
This commit is contained in:
Kartik Agaram 2020-12-26 19:13:23 -08:00
parent 4b26c93e69
commit 73728ec665
4 changed files with 32 additions and 3 deletions

View File

@ -136,7 +136,7 @@ void test_cannot_copy_byte_to_ESP_EBP_ESI_EDI() {
//:
:(before "End Initialize Op Names")
put_new(Name, "c6", "copy imm8 to r8/m8-at-r32 (mov)");
put_new(Name, "c6", "copy imm8 to r8/m8-at-r32 with subop 0 (mov)");
:(code)
void test_copy_imm8_to_mem_at_rm32() {

View File

@ -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

29
baremetal/ex2.hex Normal file
View File

@ -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

View File

@ -80,7 +80,7 @@ Opcodes currently supported by SubX:
bf: copy imm32 to EDI (mov)
c1: shift rm32 by imm8 bits depending on subop (sal/sar/shl/shr)
c3: return from most recent unfinished call (ret)
c6: copy imm8 to r8/m8-at-r32 (mov)
c6: copy imm8 to r8/m8-at-r32 with subop 0 (mov)
c7: copy imm32 to rm32 with subop 0 (mov)
cd: software interrupt (int)
d3: shift rm32 by CL bits depending on subop (sal/sar/shl/shr)