about summary refs log tree commit diff stats
path: root/ex2.subx
blob: cb75211c410445bf9a36e3a8c58054db235f519d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Test out the video mode by filling in the screen with pixels.
#
# To build a disk image:
#   ./translate_subx boot.hex ex2.subx   # emits disk.img
# To run:
#   qemu-system-i386 disk.img
# Or:
#   bochs -f baremetal/boot.bochsrc       # boot.bochsrc loads disk.img

== code

main:
  # ecx <- start of video memory
  8b/-> *0x8128 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
  }