[34] | 1 | Index: ioemu/hw/vga.c |
---|
| 2 | =================================================================== |
---|
| 3 | --- ioemu.orig/hw/vga.c 2006-08-06 02:22:01.441324863 +0100 |
---|
| 4 | +++ ioemu/hw/vga.c 2006-08-06 02:22:46.606290142 +0100 |
---|
| 5 | @@ -1728,6 +1728,136 @@ |
---|
| 6 | } |
---|
| 7 | } |
---|
| 8 | |
---|
| 9 | +/* do the same job as vgabios before vgabios get ready - yeah */ |
---|
| 10 | +void vga_bios_init(VGAState *s) |
---|
| 11 | +{ |
---|
| 12 | + uint8_t palette_model[192] = { |
---|
| 13 | + 0, 0, 0, 0, 0, 170, 0, 170, |
---|
| 14 | + 0, 0, 170, 170, 170, 0, 0, 170, |
---|
| 15 | + 0, 170, 170, 85, 0, 170, 170, 170, |
---|
| 16 | + 85, 85, 85, 85, 85, 255, 85, 255, |
---|
| 17 | + 85, 85, 255, 255, 255, 85, 85, 255, |
---|
| 18 | + 85, 255, 255, 255, 85, 255, 255, 255, |
---|
| 19 | + 0, 21, 0, 0, 21, 42, 0, 63, |
---|
| 20 | + 0, 0, 63, 42, 42, 21, 0, 42, |
---|
| 21 | + 21, 42, 42, 63, 0, 42, 63, 42, |
---|
| 22 | + 0, 21, 21, 0, 21, 63, 0, 63, |
---|
| 23 | + 21, 0, 63, 63, 42, 21, 21, 42, |
---|
| 24 | + 21, 63, 42, 63, 21, 42, 63, 63, |
---|
| 25 | + 21, 0, 0, 21, 0, 42, 21, 42, |
---|
| 26 | + 0, 21, 42, 42, 63, 0, 0, 63, |
---|
| 27 | + 0, 42, 63, 42, 0, 63, 42, 42, |
---|
| 28 | + 21, 0, 21, 21, 0, 63, 21, 42, |
---|
| 29 | + 21, 21, 42, 63, 63, 0, 21, 63, |
---|
| 30 | + 0, 63, 63, 42, 21, 63, 42, 63, |
---|
| 31 | + 21, 21, 0, 21, 21, 42, 21, 63, |
---|
| 32 | + 0, 21, 63, 42, 63, 21, 0, 63, |
---|
| 33 | + 21, 42, 63, 63, 0, 63, 63, 42, |
---|
| 34 | + 21, 21, 21, 21, 21, 63, 21, 63, |
---|
| 35 | + 21, 21, 63, 63, 63, 21, 21, 63, |
---|
| 36 | + 21, 63, 63, 63, 21, 63, 63, 63 |
---|
| 37 | + }; |
---|
| 38 | + |
---|
| 39 | + s->latch = 0; |
---|
| 40 | + |
---|
| 41 | + s->sr_index = 3; |
---|
| 42 | + s->sr[0] = 3; |
---|
| 43 | + s->sr[1] = 0; |
---|
| 44 | + s->sr[2] = 3; |
---|
| 45 | + s->sr[3] = 0; |
---|
| 46 | + s->sr[4] = 2; |
---|
| 47 | + s->sr[5] = 0; |
---|
| 48 | + s->sr[6] = 0; |
---|
| 49 | + s->sr[7] = 0; |
---|
| 50 | + |
---|
| 51 | + s->gr_index = 5; |
---|
| 52 | + s->gr[0] = 0; |
---|
| 53 | + s->gr[1] = 0; |
---|
| 54 | + s->gr[2] = 0; |
---|
| 55 | + s->gr[3] = 0; |
---|
| 56 | + s->gr[4] = 0; |
---|
| 57 | + s->gr[5] = 16; |
---|
| 58 | + s->gr[6] = 14; |
---|
| 59 | + s->gr[7] = 15; |
---|
| 60 | + s->gr[8] = 255; |
---|
| 61 | + |
---|
| 62 | + /* changed by out 0x03c0 */ |
---|
| 63 | + s->ar_index = 32; |
---|
| 64 | + s->ar[0] = 0; |
---|
| 65 | + s->ar[1] = 1; |
---|
| 66 | + s->ar[2] = 2; |
---|
| 67 | + s->ar[3] = 3; |
---|
| 68 | + s->ar[4] = 4; |
---|
| 69 | + s->ar[5] = 5; |
---|
| 70 | + s->ar[6] = 6; |
---|
| 71 | + s->ar[7] = 7; |
---|
| 72 | + s->ar[8] = 8; |
---|
| 73 | + s->ar[9] = 9; |
---|
| 74 | + s->ar[10] = 10; |
---|
| 75 | + s->ar[11] = 11; |
---|
| 76 | + s->ar[12] = 12; |
---|
| 77 | + s->ar[13] = 13; |
---|
| 78 | + s->ar[14] = 14; |
---|
| 79 | + s->ar[15] = 15; |
---|
| 80 | + s->ar[16] = 12; |
---|
| 81 | + s->ar[17] = 0; |
---|
| 82 | + s->ar[18] = 15; |
---|
| 83 | + s->ar[19] = 8; |
---|
| 84 | + s->ar[20] = 0; |
---|
| 85 | + |
---|
| 86 | + s->ar_flip_flop = 1; |
---|
| 87 | + |
---|
| 88 | + s->cr_index = 15; |
---|
| 89 | + s->cr[0] = 95; |
---|
| 90 | + s->cr[1] = 79; |
---|
| 91 | + s->cr[2] = 80; |
---|
| 92 | + s->cr[3] = 130; |
---|
| 93 | + s->cr[4] = 85; |
---|
| 94 | + s->cr[5] = 129; |
---|
| 95 | + s->cr[6] = 191; |
---|
| 96 | + s->cr[7] = 31; |
---|
| 97 | + s->cr[8] = 0; |
---|
| 98 | + s->cr[9] = 79; |
---|
| 99 | + s->cr[10] = 14; |
---|
| 100 | + s->cr[11] = 15; |
---|
| 101 | + s->cr[12] = 0; |
---|
| 102 | + s->cr[13] = 0; |
---|
| 103 | + s->cr[14] = 5; |
---|
| 104 | + s->cr[15] = 160; |
---|
| 105 | + s->cr[16] = 156; |
---|
| 106 | + s->cr[17] = 142; |
---|
| 107 | + s->cr[18] = 143; |
---|
| 108 | + s->cr[19] = 40; |
---|
| 109 | + s->cr[20] = 31; |
---|
| 110 | + s->cr[21] = 150; |
---|
| 111 | + s->cr[22] = 185; |
---|
| 112 | + s->cr[23] = 163; |
---|
| 113 | + s->cr[24] = 255; |
---|
| 114 | + |
---|
| 115 | + s->msr = 103; |
---|
| 116 | + s->fcr = 0; |
---|
| 117 | + s->st00 = 0; |
---|
| 118 | + s->st01 = 0; |
---|
| 119 | + |
---|
| 120 | + /* dac_* & palette will be initialized by os through out 0x03c8 & |
---|
| 121 | + * out 0c03c9(1:3) */ |
---|
| 122 | + s->dac_state = 0; |
---|
| 123 | + s->dac_sub_index = 0; |
---|
| 124 | + s->dac_read_index = 0; |
---|
| 125 | + s->dac_write_index = 16; |
---|
| 126 | + s->dac_cache[0] = 255; |
---|
| 127 | + s->dac_cache[1] = 255; |
---|
| 128 | + s->dac_cache[2] = 255; |
---|
| 129 | + |
---|
| 130 | + /* palette */ |
---|
| 131 | + memcpy(s->palette, palette_model, 192); |
---|
| 132 | + |
---|
| 133 | + s->bank_offset = 0; |
---|
| 134 | + s->graphic_mode = -1; |
---|
| 135 | + |
---|
| 136 | + /* TODO: add vbe support if enabled */ |
---|
| 137 | +} |
---|
| 138 | + |
---|
| 139 | void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, |
---|
| 140 | unsigned long vga_ram_offset, int vga_ram_size) |
---|
| 141 | { |
---|
| 142 | @@ -1769,6 +1899,8 @@ |
---|
| 143 | vga_screen_dump, s); |
---|
| 144 | /* XXX: currently needed for display */ |
---|
| 145 | vga_state = s; |
---|
| 146 | + |
---|
| 147 | + vga_bios_init(s); |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | |
---|