comparison vdp.c @ 2264:c7781cc950e9

Fix TMS9918A text mode
author Michael Pavone <pavone@retrodev.com>
date Fri, 23 Dec 2022 09:37:25 -0800
parents a98b2d0de2f1
children 6f6f21d0c396
comparison
equal deleted inserted replaced
2263:a98b2d0de2f1 2264:c7781cc950e9
4129 TMS_CHECK_LIMIT 4129 TMS_CHECK_LIMIT
4130 case 3: 4130 case 3:
4131 tms_border(context); 4131 tms_border(context);
4132 external_slot(context); 4132 external_slot(context);
4133 TMS_CHECK_LIMIT 4133 TMS_CHECK_LIMIT
4134 TMS_TEXT_BLOCK(4) 4134 case 4:
4135 TMS_TEXT_BLOCK(7) 4135 tms_border(context);
4136 TMS_TEXT_BLOCK(10)
4137 TMS_TEXT_BLOCK(13)
4138 TMS_TEXT_BLOCK(16)
4139 TMS_TEXT_BLOCK(19)
4140 TMS_TEXT_BLOCK(22)
4141 TMS_TEXT_BLOCK(25)
4142 TMS_TEXT_BLOCK(28)
4143 TMS_TEXT_BLOCK(31)
4144 TMS_TEXT_BLOCK(34)
4145 TMS_TEXT_BLOCK(37)
4146 TMS_TEXT_BLOCK(40)
4147 TMS_TEXT_BLOCK(43)
4148 TMS_TEXT_BLOCK(46)
4149 TMS_TEXT_BLOCK(49)
4150 TMS_TEXT_BLOCK(52)
4151 TMS_TEXT_BLOCK(55)
4152 TMS_TEXT_BLOCK(58)
4153 TMS_TEXT_BLOCK(61)
4154 TMS_TEXT_BLOCK(64)
4155 TMS_TEXT_BLOCK(67)
4156 TMS_TEXT_BLOCK(70)
4157 TMS_TEXT_BLOCK(73)
4158 TMS_TEXT_BLOCK(76)
4159 TMS_TEXT_BLOCK(79)
4160 TMS_TEXT_BLOCK(82)
4161 TMS_TEXT_BLOCK(85)
4162 TMS_TEXT_BLOCK(88)
4163 TMS_TEXT_BLOCK(91)
4164 TMS_TEXT_BLOCK(94)
4165 TMS_TEXT_BLOCK(97)
4166 TMS_TEXT_BLOCK(100)
4167 TMS_TEXT_BLOCK(103)
4168 TMS_TEXT_BLOCK(106)
4169 TMS_TEXT_BLOCK(109)
4170 TMS_TEXT_BLOCK(112)
4171 TMS_TEXT_BLOCK(115)
4172 TMS_TEXT_BLOCK(118)
4173 TMS_TEXT_BLOCK(121)
4174 case 124:
4175 tms_composite(context);
4176 external_slot(context); 4136 external_slot(context);
4177 TMS_CHECK_LIMIT 4137 TMS_CHECK_LIMIT
4138 TMS_TEXT_BLOCK(5)
4139 TMS_TEXT_BLOCK(8)
4140 TMS_TEXT_BLOCK(11)
4141 TMS_TEXT_BLOCK(14)
4142 TMS_TEXT_BLOCK(17)
4143 TMS_TEXT_BLOCK(20)
4144 TMS_TEXT_BLOCK(23)
4145 TMS_TEXT_BLOCK(26)
4146 TMS_TEXT_BLOCK(29)
4147 TMS_TEXT_BLOCK(32)
4148 TMS_TEXT_BLOCK(35)
4149 TMS_TEXT_BLOCK(38)
4150 TMS_TEXT_BLOCK(41)
4151 TMS_TEXT_BLOCK(44)
4152 TMS_TEXT_BLOCK(47)
4153 TMS_TEXT_BLOCK(50)
4154 TMS_TEXT_BLOCK(53)
4155 TMS_TEXT_BLOCK(56)
4156 TMS_TEXT_BLOCK(59)
4157 TMS_TEXT_BLOCK(62)
4158 TMS_TEXT_BLOCK(65)
4159 TMS_TEXT_BLOCK(68)
4160 TMS_TEXT_BLOCK(71)
4161 TMS_TEXT_BLOCK(74)
4162 TMS_TEXT_BLOCK(77)
4163 TMS_TEXT_BLOCK(80)
4164 TMS_TEXT_BLOCK(83)
4165 TMS_TEXT_BLOCK(86)
4166 TMS_TEXT_BLOCK(89)
4167 TMS_TEXT_BLOCK(92)
4168 TMS_TEXT_BLOCK(95)
4169 TMS_TEXT_BLOCK(98)
4170 TMS_TEXT_BLOCK(101)
4171 TMS_TEXT_BLOCK(104)
4172 TMS_TEXT_BLOCK(107)
4173 TMS_TEXT_BLOCK(110)
4174 TMS_TEXT_BLOCK(113)
4175 TMS_TEXT_BLOCK(116)
4176 TMS_TEXT_BLOCK(119)
4177 TMS_TEXT_BLOCK(122)
4178 case 125: 4178 case 125:
4179 tms_composite(context); 4179 tms_composite(context);
4180 external_slot(context); 4180 external_slot(context);
4181 TMS_CHECK_LIMIT 4181 TMS_CHECK_LIMIT
4182 case 126: 4182 case 126:
4183 tms_composite(context);
4184 external_slot(context);
4185 TMS_CHECK_LIMIT
4186 case 127:
4183 tms_composite(context); 4187 tms_composite(context);
4184 external_slot(context); 4188 external_slot(context);
4185 TMS_CHECK_LIMIT 4189 TMS_CHECK_LIMIT
4186 default: 4190 default:
4187 while (context->hslot < 139) 4191 while (context->hslot < 139)
4204 while (context->hslot > 147) { 4208 while (context->hslot > 147) {
4205 if (context->hslot >= 233) { 4209 if (context->hslot >= 233) {
4206 external_slot(context); 4210 external_slot(context);
4207 if (context->hslot + 1 == LINE_CHANGE_MODE4) { 4211 if (context->hslot + 1 == LINE_CHANGE_MODE4) {
4208 vdp_advance_line(context); 4212 vdp_advance_line(context);
4213 if (context->vcounter == 192) {
4214 context->state = INACTIVE;
4215 return;
4216 }
4209 } 4217 }
4210 } 4218 }
4211 TMS_CHECK_LIMIT 4219 TMS_CHECK_LIMIT
4212 } 4220 }
4213 } 4221 }
4402 bg_color = context->colors[bg_index]; 4410 bg_color = context->colors[bg_index];
4403 } else if ((context->regs[REG_MODE_1] & BIT_MODE_4) || context->type != VDP_GENESIS) { 4411 } else if ((context->regs[REG_MODE_1] & BIT_MODE_4) || context->type != VDP_GENESIS) {
4404 bg_index = 0x10 + (context->regs[REG_BG_COLOR] & 0xF); 4412 bg_index = 0x10 + (context->regs[REG_BG_COLOR] & 0xF);
4405 bg_color = context->colors[MODE4_OFFSET + bg_index]; 4413 bg_color = context->colors[MODE4_OFFSET + bg_index];
4406 } else { 4414 } else {
4407 bg_color = context->colors[0]; 4415 bg_color = context->color_map[0];
4408 } 4416 }
4409 if (context->done_composite) { 4417 if (context->done_composite) {
4410 uint8_t pixel = context->compositebuf[dst-context->output]; 4418 uint8_t pixel = context->compositebuf[dst-context->output];
4411 if (!(pixel & 0x3F | test_layer)) { 4419 if (!(pixel & 0x3F | test_layer)) {
4412 pixel = pixel & 0xC0 | bg_index; 4420 pixel = pixel & 0xC0 | bg_index;