Example #1
0
def vgarechain():
    ports.outb(4, 0x3CE)
    ports.outb(0, 0x3CF)  # plane 0
    ports.writevec(0x3C4, 0x3C5, 3, 1, 0xf, 0, 0xe)  # chain-4
    ports.outb(0x14, 0x3D4)
    ports.outb(0x40, 0x3D5)
    ports.outb(0x17, 0x3D4)
    ports.outb(0xa3, 0x3D5)
Example #2
0
def vgaunchain():
    ports.outb(4, 0x3CE)
    ports.outb(2, 0x3CF)  # plane 2
    ports.writevec(0x3C4, 0x3C5, 3, 1, 4, 0, 6)  # unchained
    ports.outb(0x14, 0x3D4)
    ports.outb(0x00, 0x3D5)
    ports.outb(0x17, 0x3D4)
    ports.outb(0xe3, 0x3D5)
Example #3
0
def set320x200x256():
	ports.inb(0x3DA)
	ports.outb(0, 0x3C0)

	ports.writevec(0x3C4,0x3C5,  3,1,0xf,0,0xe) # 6 for mode X
	
	ports.outb(0x63, 0x3C2)
	ports.writevec(0x3C4,0x3C5,  3)

	ports.outb(0x11, 0x3D4)
	ports.outb(   0, 0x3D5)
	ports.writevec(0x3D4,0x3D5,
		0x5f, 0x4f, 0x50, 0x82,  0x54, 0x80, 0xbf, 0x1f,
		0x00, 0x41, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
		0x9c, 0x0e, 0x8f, 0x28,  0x40, 0x96, 0xb9, 0xa3,
					# 0x00, ..., 0xe3 for mode X
		0xff)

	ports.writevec(0x3CC,0x3CA,  1)
        ports.writevec(0x3CE,0x3CF,
		0x00, 0x00, 0x00, 0x00,  0x00, 0x40, 0x05, 0x0f,
		0xff)

	ports.inb(0x3DA)
	ports.writevec(0x3C0,0x3C0,
		0x00, 0x01, 0x02, 0x03,  0x04, 0x05, 0x06, 0x07,
		0x08, 0x09, 0x0A, 0x0B,  0x0C, 0x0D, 0x0E, 0x0F,
		0x41, 0x00, 0x0F, 0x00)

	ports.inb(0x3DA)
	ports.outb(0x20, 0x3C0)
Example #4
0
def set80x25():
	ports.inb(0x3DA)
	ports.outb(0, 0x3C0)

	ports.writevec(0x3C4,0x3C5,  1,0,3,0,2)

	ports.outb(0x67, 0x3C2)
	ports.writevec(0x3C4,0x3C5,  3)

	ports.outb(0x11, 0x3D4)
	ports.outb(   0, 0x3D5)
	ports.writevec(0x3D4,0x3D5,
		0x5f, 0x4f, 0x50, 0x82,  0x55, 0x81, 0xbf, 0x1f,
		0x00, 0x4f, 0x0d, 0x0e,  0x00, 0x00, 0x00, 0x00,
		0x9c, 0x8e, 0x8f, 0x28,  0x1f, 0x96, 0xb9, 0xa3,
		0xff)

	ports.writevec(0x3CC,0x3CA,  1)
        ports.writevec(0x3CE,0x3CF,
		0x00, 0x00, 0x00, 0x00,  0x00, 0x10, 0x0e, 0x00,
		0xff)

	ports.inb(0x3DA)
	ports.writevec(0x3C0,0x3C0,
		0x00, 0x01, 0x02, 0x03,  0x04, 0x05, 0x06, 0x07,
		0x08, 0x09, 0x0A, 0x0B,  0x0C, 0x0D, 0x0E, 0x0F,
		0x0C, 0x00, 0x0F, 0x08)

	ports.inb(0x3DA)
	ports.outb(0x20, 0x3C0)
Example #5
0
def set640x480x16():
	ports.inb(0x3DA)
	ports.outb(0, 0x3C0)

	ports.writevec(0x3C4,0x3C5,  1,1,4,0,6)

	ports.outb(0xe3, 0x3C2)
	ports.writevec(0x3C4,0x3C5,  3)

	ports.outb(0x11, 0x3D4)
	ports.outb(   0, 0x3D5)

	ports.writevec(0x3D4,0x3D5,
                0x5f, 0x4f, 0x50, 0x82,  0x54, 0x80, 0x0b, 0x3e,
                0x00, 0x40, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
                0xea, 0x8c, 0xdf, 0x28,  0x00, 0xe7, 0x04, 0xe3,
                0xff)

	ports.writevec(0x3CC,0x3CA,  1)
        ports.writevec(0x3CE,0x3CF,
                0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x05, 0x0f,
                0xff)

	ports.inb(0x3DA)
	ports.writevec(0x3C0,0x3C0,
                0x00, 0x01, 0x02, 0x03,  0x04, 0x05, 0x06, 0x07,
                0x08, 0x09, 0x0A, 0x0B,  0x0C, 0x0D, 0x0E, 0x0F,
                0x01, 0x00, 0x0F, 0x00)

	ports.inb(0x3DA)
	ports.outb(0x20, 0x3C0)
Example #6
0
def vgarechain():
	ports.outb(4, 0x3CE); ports.outb(0, 0x3CF)	# plane 0
	ports.writevec(0x3C4,0x3C5,  3,1,0xf,0,0xe)	# chain-4
	ports.outb(0x14, 0x3D4); ports.outb(0x40, 0x3D5)
	ports.outb(0x17, 0x3D4); ports.outb(0xa3, 0x3D5)
Example #7
0
def vgaunchain():
	ports.outb(4, 0x3CE); ports.outb(2, 0x3CF)	# plane 2
	ports.writevec(0x3C4,0x3C5,  3,1,4,0,6)		# unchained
	ports.outb(0x14, 0x3D4); ports.outb(0x00, 0x3D5)
	ports.outb(0x17, 0x3D4); ports.outb(0xe3, 0x3D5)
Example #8
0
		ports.outb(b[i], 0x3C9)
		i = i + 1

# initialize the palette

r = "\00\00\00\00\052\052\052\052\025\025\025\025\077\077\077\077\00\05\010\013\016\021\024\030\034\040\044\050\055\062\070\077\00\020\037\057\077\077\077\077\077\077\077\077\077\057\037\020\00\00\00\00\00\00\00\00\037\047\057\067\077\077\077\077\077\077\077\077\077\067\057\047\037\037\037\037\037\037\037\037\055\061\066\072\077\077\077\077\077\077\077\077\077\072\066\061\055\055\055\055\055\055\055\055\00\07\016\025\034\034\034\034\034\034\034\034\034\025\016\07\00\00\00\00\00\00\00\00\016\021\025\030\034\034\034\034\034\034\034\034\034\030\025\021\016\016\016\016\016\016\016\016\024\026\030\032\034\034\034\034\034\034\034\034\034\032\030\026\024\024\024\024\024\024\024\024\00\04\010\014\020\020\020\020\020\020\020\020\020\014\010\04\00\00\00\00\00\00\00\00\010\012\014\016\020\020\020\020\020\020\020\020\020\016\014\012\010\010\010\010\010\010\010\010\013\014\015\017\020\020\020\020\020\020\020\020\020\017\015\014\013\013\013\013\013\013\013\013\00\00\00\00\00\00\077"
g = "\00\00\052\052\00\00\025\052\025\025\077\077\025\025\077\077\00\05\010\013\016\021\024\030\034\040\044\050\055\062\070\077\00\00\00\00\00\00\00\00\00\020\037\057\077\077\077\077\077\077\077\077\077\057\037\020\037\037\037\037\037\037\037\037\037\047\057\067\077\077\077\077\077\077\077\077\077\067\057\047\055\055\055\055\055\055\055\055\055\061\066\072\077\077\077\077\077\077\077\077\077\072\066\061\00\00\00\00\00\00\00\00\00\07\016\025\035\034\034\034\034\034\034\034\034\025\016\07\016\016\016\016\016\016\016\016\016\021\025\030\034\034\034\034\034\034\034\034\034\030\025\021\024\024\024\024\024\024\024\024\024\026\030\032\034\034\034\034\034\034\034\034\034\032\030\026\00\00\00\00\00\00\00\00\00\04\010\014\020\020\020\020\020\020\020\020\020\014\010\04\010\010\010\010\010\010\010\010\010\012\014\016\020\020\020\020\020\020\020\020\020\016\014\012\013\013\013\013\013\013\013\013\013\014\015\017\020\020\020\020\020\020\020\020\020\017\015\014\00\00\00\00\00\00\077"
b = "\00\052\00\052\00\052\00\052\025\077\025\077\025\077\025\077\00\05\010\013\016\021\024\030\034\040\044\050\055\062\070\077\077\077\077\077\077\057\037\020\00\00\00\00\00\00\00\00\00\020\037\057\077\077\077\077\077\077\077\077\077\067\057\047\037\037\037\037\037\037\037\037\037\047\057\067\077\077\077\077\077\077\077\077\077\072\066\061\055\055\055\055\055\055\055\055\055\061\066\072\077\077\077\077\034\034\034\034\034\025\016\07\00\00\00\00\00\00\00\00\00\07\016\025\034\034\034\034\034\034\034\034\034\030\025\021\016\016\016\016\016\016\016\016\016\021\025\030\034\034\034\034\034\034\034\034\034\032\030\026\024\024\024\024\024\024\024\024\024\026\030\032\034\034\034\034\020\020\020\020\020\014\010\04\00\00\00\00\00\00\00\00\00\04\010\014\020\020\020\020\020\020\020\020\020\016\014\012\010\010\010\010\010\010\010\010\010\012\014\016\020\020\020\020\020\020\020\020\020\017\015\014\013\013\013\013\013\013\013\013\013\014\015\017\020\020\020\020\00\00\00\00\00\00\077"

#####################
# set up the palette
#####################

ports.inb(0x3DA)
ports.writevec(0x3C0,0x3C0,
		0x00, 0x01, 0x02, 0x03,  0x04, 0x05, 0x06, 0x07,
		0x08, 0x09, 0x0A, 0x0B,  0x0C, 0x0D, 0x0E, 0x0F)

vgadefaultpalette()

######################
# for now, these must be called in 320x200x256

def vgaunchain():
	ports.outb(4, 0x3CE); ports.outb(2, 0x3CF)	# plane 2
	ports.writevec(0x3C4,0x3C5,  3,1,4,0,6)		# unchained
	ports.outb(0x14, 0x3D4); ports.outb(0x00, 0x3D5)
	ports.outb(0x17, 0x3D4); ports.outb(0xe3, 0x3D5)

def vgarechain():
	ports.outb(4, 0x3CE); ports.outb(0, 0x3CF)	# plane 0
Example #9
0
def set320x200x256():
    ports.inb(0x3DA)
    ports.outb(0, 0x3C0)

    ports.writevec(0x3C4, 0x3C5, 3, 1, 0xf, 0, 0xe)  # 6 for mode X

    ports.outb(0x63, 0x3C2)
    ports.writevec(0x3C4, 0x3C5, 3)

    ports.outb(0x11, 0x3D4)
    ports.outb(0, 0x3D5)
    ports.writevec(
        0x3D4,
        0x3D5,
        0x5f,
        0x4f,
        0x50,
        0x82,
        0x54,
        0x80,
        0xbf,
        0x1f,
        0x00,
        0x41,
        0x00,
        0x00,
        0x00,
        0x00,
        0x00,
        0x00,
        0x9c,
        0x0e,
        0x8f,
        0x28,
        0x40,
        0x96,
        0xb9,
        0xa3,
        # 0x00, ..., 0xe3 for mode X
        0xff)

    ports.writevec(0x3CC, 0x3CA, 1)
    ports.writevec(0x3CE, 0x3CF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05,
                   0x0f, 0xff)

    ports.inb(0x3DA)
    ports.writevec(0x3C0, 0x3C0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
                   0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x41,
                   0x00, 0x0F, 0x00)

    ports.inb(0x3DA)
    ports.outb(0x20, 0x3C0)
Example #10
0
def set80x25():
    ports.inb(0x3DA)
    ports.outb(0, 0x3C0)

    ports.writevec(0x3C4, 0x3C5, 1, 0, 3, 0, 2)

    ports.outb(0x67, 0x3C2)
    ports.writevec(0x3C4, 0x3C5, 3)

    ports.outb(0x11, 0x3D4)
    ports.outb(0, 0x3D5)
    ports.writevec(0x3D4, 0x3D5, 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf,
                   0x1f, 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x9c,
                   0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, 0xff)

    ports.writevec(0x3CC, 0x3CA, 1)
    ports.writevec(0x3CE, 0x3CF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e,
                   0x00, 0xff)

    ports.inb(0x3DA)
    ports.writevec(0x3C0, 0x3C0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
                   0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x0C,
                   0x00, 0x0F, 0x08)

    ports.inb(0x3DA)
    ports.outb(0x20, 0x3C0)
Example #11
0
def set640x480x16():
    ports.inb(0x3DA)
    ports.outb(0, 0x3C0)

    ports.writevec(0x3C4, 0x3C5, 1, 1, 4, 0, 6)

    ports.outb(0xe3, 0x3C2)
    ports.writevec(0x3C4, 0x3C5, 3)

    ports.outb(0x11, 0x3D4)
    ports.outb(0, 0x3D5)

    ports.writevec(0x3D4, 0x3D5, 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b,
                   0x3e, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea,
                   0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3, 0xff)

    ports.writevec(0x3CC, 0x3CA, 1)
    ports.writevec(0x3CE, 0x3CF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
                   0x0f, 0xff)

    ports.inb(0x3DA)
    ports.writevec(0x3C0, 0x3C0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
                   0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x01,
                   0x00, 0x0F, 0x00)

    ports.inb(0x3DA)
    ports.outb(0x20, 0x3C0)
Example #12
0
        ports.outb(b[i], 0x3C9)
        i = i + 1


# initialize the palette

r = "\00\00\00\00\052\052\052\052\025\025\025\025\077\077\077\077\00\05\010\013\016\021\024\030\034\040\044\050\055\062\070\077\00\020\037\057\077\077\077\077\077\077\077\077\077\057\037\020\00\00\00\00\00\00\00\00\037\047\057\067\077\077\077\077\077\077\077\077\077\067\057\047\037\037\037\037\037\037\037\037\055\061\066\072\077\077\077\077\077\077\077\077\077\072\066\061\055\055\055\055\055\055\055\055\00\07\016\025\034\034\034\034\034\034\034\034\034\025\016\07\00\00\00\00\00\00\00\00\016\021\025\030\034\034\034\034\034\034\034\034\034\030\025\021\016\016\016\016\016\016\016\016\024\026\030\032\034\034\034\034\034\034\034\034\034\032\030\026\024\024\024\024\024\024\024\024\00\04\010\014\020\020\020\020\020\020\020\020\020\014\010\04\00\00\00\00\00\00\00\00\010\012\014\016\020\020\020\020\020\020\020\020\020\016\014\012\010\010\010\010\010\010\010\010\013\014\015\017\020\020\020\020\020\020\020\020\020\017\015\014\013\013\013\013\013\013\013\013\00\00\00\00\00\00\077"
g = "\00\00\052\052\00\00\025\052\025\025\077\077\025\025\077\077\00\05\010\013\016\021\024\030\034\040\044\050\055\062\070\077\00\00\00\00\00\00\00\00\00\020\037\057\077\077\077\077\077\077\077\077\077\057\037\020\037\037\037\037\037\037\037\037\037\047\057\067\077\077\077\077\077\077\077\077\077\067\057\047\055\055\055\055\055\055\055\055\055\061\066\072\077\077\077\077\077\077\077\077\077\072\066\061\00\00\00\00\00\00\00\00\00\07\016\025\035\034\034\034\034\034\034\034\034\025\016\07\016\016\016\016\016\016\016\016\016\021\025\030\034\034\034\034\034\034\034\034\034\030\025\021\024\024\024\024\024\024\024\024\024\026\030\032\034\034\034\034\034\034\034\034\034\032\030\026\00\00\00\00\00\00\00\00\00\04\010\014\020\020\020\020\020\020\020\020\020\014\010\04\010\010\010\010\010\010\010\010\010\012\014\016\020\020\020\020\020\020\020\020\020\016\014\012\013\013\013\013\013\013\013\013\013\014\015\017\020\020\020\020\020\020\020\020\020\017\015\014\00\00\00\00\00\00\077"
b = "\00\052\00\052\00\052\00\052\025\077\025\077\025\077\025\077\00\05\010\013\016\021\024\030\034\040\044\050\055\062\070\077\077\077\077\077\077\057\037\020\00\00\00\00\00\00\00\00\00\020\037\057\077\077\077\077\077\077\077\077\077\067\057\047\037\037\037\037\037\037\037\037\037\047\057\067\077\077\077\077\077\077\077\077\077\072\066\061\055\055\055\055\055\055\055\055\055\061\066\072\077\077\077\077\034\034\034\034\034\025\016\07\00\00\00\00\00\00\00\00\00\07\016\025\034\034\034\034\034\034\034\034\034\030\025\021\016\016\016\016\016\016\016\016\016\021\025\030\034\034\034\034\034\034\034\034\034\032\030\026\024\024\024\024\024\024\024\024\024\026\030\032\034\034\034\034\020\020\020\020\020\014\010\04\00\00\00\00\00\00\00\00\00\04\010\014\020\020\020\020\020\020\020\020\020\016\014\012\010\010\010\010\010\010\010\010\010\012\014\016\020\020\020\020\020\020\020\020\020\017\015\014\013\013\013\013\013\013\013\013\013\014\015\017\020\020\020\020\00\00\00\00\00\00\077"

#####################
# set up the palette
#####################

ports.inb(0x3DA)
ports.writevec(0x3C0, 0x3C0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
               0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F)

vgadefaultpalette()

######################
# for now, these must be called in 320x200x256


def vgaunchain():
    ports.outb(4, 0x3CE)
    ports.outb(2, 0x3CF)  # plane 2
    ports.writevec(0x3C4, 0x3C5, 3, 1, 4, 0, 6)  # unchained
    ports.outb(0x14, 0x3D4)
    ports.outb(0x00, 0x3D5)
    ports.outb(0x17, 0x3D4)
    ports.outb(0xe3, 0x3D5)