src/mess/video/m6847.c
| r5923 | r5924 | |
| 1096 | 1096 | |
| 1097 | 1097 | static int attr_index_from_attribute(const device_config *device, UINT8 attr) |
| 1098 | 1098 | { |
| 1099 | | mc6847_state *mc6847 = get_safe_token(device); |
| 1100 | 1099 | int result; |
| 1101 | 1100 | |
| 1102 | 1101 | result = ((attr & (M6847_AG | M6847_AS | M6847_INTEXT | M6847_INV | M6847_CSS)) >> 3) |
| 1103 | 1102 | | ((attr & (M6847_GM1 | M6847_GM0)) << 5); |
| 1104 | 1103 | |
| 1105 | 1104 | /* sanity check */ |
| 1106 | | assert(result < ARRAY_LENGTH(mc6847->fontdata)); |
| 1105 | assert(result < ARRAY_LENGTH(get_safe_token(device)->fontdata)); |
| 1107 | 1106 | return result; |
| 1108 | 1107 | } |
| 1109 | 1108 | |
| 1110 | 1109 | static UINT8 attribute_from_attr_index(const device_config *device, int attr_index) |
| 1111 | 1110 | { |
| 1112 | | mc6847_state *mc6847 = get_safe_token(device); |
| 1113 | | |
| 1114 | 1111 | /* sanity check */ |
| 1115 | 1112 | assert(attr_index >= 0); |
| 1116 | | assert(attr_index < ARRAY_LENGTH(mc6847->fontdata)); |
| 1113 | assert(attr_index < ARRAY_LENGTH(get_safe_token(device)->fontdata)); |
| 1117 | 1114 | |
| 1118 | 1115 | return (UINT8) ((attr_index & 0x1F) << 3) |
| 1119 | 1116 | | ((attr_index & 0x60) >> 5); |