diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-04-01 13:44:58 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-04-13 13:19:56 -0400 |
commit | 731c88d503ef07a06a03dd17a6e9163941b329da (patch) | |
tree | d5be203fa866356a69b9d6cad6fc69426fa9ece3 /vgasrc/vbe.c | |
parent | c5a361c09a19e3b1a83557b01f11f04b27181a11 (diff) | |
download | seabios-731c88d503ef07a06a03dd17a6e9163941b329da.tar.gz |
stdvgaio: Only read/write one color palette entry at a time
Introduce stdvga_dac_read_many() and stdvga_dac_write_many() for
writing multiple dac palette entries. Convert the stdvga_dac_read()
and stdvga_dac_write() low-level IO access functions in stdvgaio.c to
access just one color palette entry.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/vbe.c')
-rw-r--r-- | vgasrc/vbe.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index d2aaace0..2ae0a980 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -403,26 +403,20 @@ vbe_104f09(struct bregs *regs) if (start + count > max_colors) goto fail; u16 seg = regs->es; - u8 *data_far = (void*)(regs->di+0); - u8 rgb[3]; + struct vbe_palette_entry *data_far = (void*)(regs->di+0); int i; switch (regs->bl) { case 0x80: case 0x00: for (i = 0; i < count; i++) { - rgb[0] = GET_FARVAR(seg, data_far[i*4 + 2]); - rgb[1] = GET_FARVAR(seg, data_far[i*4 + 1]); - rgb[2] = GET_FARVAR(seg, data_far[i*4 + 0]); - stdvga_dac_write(GET_SEG(SS), rgb, start + i, 1); + struct vbe_palette_entry rgb = GET_FARVAR(seg, data_far[i]); + stdvga_dac_write(start + i, rgb); } break; case 0x01: for (i = 0; i < count; i++) { - stdvga_dac_read(GET_SEG(SS), rgb, start + i, 1); - SET_FARVAR(seg, data_far[i*4 + 0], rgb[2]); - SET_FARVAR(seg, data_far[i*4 + 1], rgb[1]); - SET_FARVAR(seg, data_far[i*4 + 2], rgb[0]); - SET_FARVAR(seg, data_far[i*4 + 3], 0); + struct vbe_palette_entry rgb = stdvga_dac_read(start + i); + SET_FARVAR(seg, data_far[i], rgb); } break; default: |