• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revision64e741f124eb4e2c75ec2826e5ad2f07efc99879 (tree)
Time2018-03-25 16:17:16
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[VM][FM77L4] Add FM77L4.Maybe 400lines board still not working.

Change Summary

Incremental Difference

--- a/source/build-cmake/cmake/config_emufm7.cmake
+++ b/source/build-cmake/cmake/config_emufm7.cmake
@@ -137,9 +137,9 @@ elseif(BUILD_FM77L2)
137137 elseif(BUILD_FM77L4)
138138 set(EXEC_TARGET emufm77l4)
139139 add_definitions(-D_FM77L4)
140- set(RESOURCE ${CMAKE_CURRENT_SOURCE_DIR}/source/src/qt/fm7/fm77.qrc)
141- set(RESOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../../src/qt/common/qrc/fm77l4.qrc)
142- set(VMFILES_LIB ${VMFILES_LIB} ay_3_891x.cpp)
140+ #set(RESOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../../src/qt/common/qrc/fm77l4.qrc)
141+ set(RESOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../../src/qt/common/qrc/fm77.qrc)
142+ set(VMFILES_LIB ${VMFILES_LIB} ay_3_891x.cpp hd46505.cpp)
143143 set(FLAG_USE_Z80 ON)
144144 add_definitions(-DBUILD_Z80)
145145
--- /dev/null
+++ b/source/build-cmake/fm77l4/CMakeLists.txt
@@ -0,0 +1,16 @@
1+# Build Common Sourcecode Project, Agar.
2+# (C) 2014 K.Ohta <whatisthis.sowhat@gmail.com>
3+# This is part of , but license is apache 2.2,
4+# this part was written only me.
5+
6+cmake_minimum_required (VERSION 2.8)
7+cmake_policy(SET CMP0011 NEW)
8+
9+
10+project (emufm77l4)
11+
12+set(CMAKE_MODULE_PATH "${emufm77l4_SOURCE_DIR}/../cmake")
13+set(BUILD_FM77L4 ON CACHE BOOL "Build for FM77L4")
14+
15+include(config_emufm7)
16+include(config_commonsource)
--- a/source/src/vm/fm7/display.cpp
+++ b/source/src/vm/fm7/display.cpp
@@ -255,9 +255,10 @@ void DISPLAY::reset()
255255 text_xmax = 80;
256256
257257 cursor_addr.d = 0;
258- curcor_start = 0;
258+ cursor_start = 0;
259259 cursor_end = 0;
260260 cursor_type = 0;
261+ text_scroll_count = 0;
261262 //memset(crtc_regs, 0x00, sizeof(crtc_regs));
262263 #endif
263264
@@ -606,6 +607,7 @@ void DISPLAY::setup_400linemode(uint8_t val)
606607 display_mode = DISPLAY_MODE_8_200L;
607608 }
608609 if(oldmode != display_mode) {
610+ scrntype_t *pp;
609611 if(display_mode == DISPLAY_MODE_1_400L) {
610612 emu->set_vm_screen_size(640, 400, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH_ASPECT, WINDOW_HEIGHT_ASPECT);
611613 for(int y = 0; y < 400; y++) {
@@ -1895,6 +1897,7 @@ void DISPLAY::write_signal(int id, uint32_t data, uint32_t mask)
18951897 display_mode = DISPLAY_MODE_8_200L;
18961898 }
18971899 if(oldmode != display_mode) {
1900+ scrntype_t *pp;
18981901 if(display_mode == DISPLAY_MODE_1_400L) {
18991902 emu->set_vm_screen_size(640, 400, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH_ASPECT, WINDOW_HEIGHT_ASPECT);
19001903 for(int y = 0; y < 400; y++) {
@@ -2113,12 +2116,12 @@ uint32_t DISPLAY::read_mmio(uint32_t addr)
21132116 #if defined(_FM77L4)
21142117 case 0x0b:
21152118 if(stat_400linecard) {
2116- retval = l4crtc->read_io8(0, val)
2119+ retval = l4crtc->read_io8(0);
21172120 }
21182121 break;
21192122 case 0x0c:
21202123 if(stat_400linecard) {
2121- retval = l4crtc->read_io8(1, val);
2124+ retval = l4crtc->read_io8(1);
21222125 // Update parameters.
21232126 }
21242127 break;
@@ -2385,7 +2388,7 @@ void DISPLAY::write_vram_data8(uint32_t addr, uint8_t data)
23852388 #elif defined(_FM77L4) //_FM77L4
23862389 if(display_mode == DISPLAY_MODE_1_400L) {
23872390 if(addr < 0x8000) {
2388- if(workram_400l) {
2391+ if(workram_l4) {
23892392 //if(multimode_accessflags[2]) return;
23902393 vramaddr = ((addr + offset) & 0x3fff) + 0x8000;
23912394 gvram[vramaddr] = data;
@@ -2654,7 +2657,7 @@ void DISPLAY::write_mmio(uint32_t addr, uint8_t data)
26542657 case 0x05:
26552658 set_cyclesteal((uint8_t)data);
26562659 # if defined(_FM77L4)
2657- setup_400linecard((uint8_t)data);
2660+ setup_400linemode((uint8_t)data);
26582661 # endif
26592662 break;
26602663 #endif
@@ -2702,19 +2705,19 @@ void DISPLAY::write_mmio(uint32_t addr, uint8_t data)
27022705 #if defined(_FM77L4)
27032706 case 0x0b:
27042707 if(stat_400linecard) {
2705- l4crtc->write_io8(0, val & 0x1f);
2708+ l4crtc->write_io8(0, data & 0x1f);
27062709 }
27072710 break;
27082711 case 0x0c:
27092712 if(stat_400linecard) {
2710- l4crtc->write_io8(1, val);
2713+ l4crtc->write_io8(1, data);
27112714 // Update parameters.
2712- uint8_t crtc_addr = l4crtc->read_io8(0, val);
2713- conct uint8_t *regs = l4crtc->get_regs();
2715+ uint8_t crtc_addr = l4crtc->read_io8(0);
2716+ const uint8_t *regs = l4crtc->get_regs();
27142717 switch(crtc_addr & 0x1f) {
27152718 case 10:
27162719 case 11:
2717- curcor_addr.w.l &= 0x0ffc;
2720+ cursor_addr.w.l &= 0x0ffc;
27182721 cursor_addr.w.l |= (((uint16_t)regs[14]) << 10);
27192722 cursor_addr.w.l |= (((uint16_t)regs[15]) << 2);
27202723 if(cursor_lsb) {
@@ -2732,7 +2735,7 @@ void DISPLAY::write_mmio(uint32_t addr, uint8_t data)
27322735 }
27332736 break;
27342737 case 13:
2735- text_start_addr.w.l &= 0xfc00
2738+ text_start_addr.w.l &= 0xfc00;
27362739 text_start_addr.w.l |= ((uint16_t)data << 2);
27372740 text_scroll_count++;
27382741 if((text_scroll_count & 1) == 0) {
@@ -2743,7 +2746,7 @@ void DISPLAY::write_mmio(uint32_t addr, uint8_t data)
27432746 text_scroll_count++;
27442747 if((text_scroll_count & 1) == 0) {
27452748 // Redraw request
2746- curcor_addr.w.l &= 0x0ffc;
2749+ cursor_addr.w.l &= 0x0ffc;
27472750 cursor_addr.w.l |= (((uint16_t)regs[14]) << 10);
27482751 cursor_addr.w.l |= (((uint16_t)regs[15]) << 2);
27492752 if(cursor_lsb) {
@@ -3307,10 +3310,10 @@ void DISPLAY::initialize()
33073310 text_xmax = 80;
33083311
33093312 cursor_addr.d = 0;
3310- curcor_start = 0;
3313+ cursor_start = 0;
33113314 cursor_end = 15;
33123315 cursor_type = 0;
3313-
3316+ text_scroll_count = 0;
33143317 event_id_l4_text_blink = -1;
33153318 #endif
33163319
@@ -3546,10 +3549,11 @@ void DISPLAY::save_state(FILEIO *state_fio)
35463549 state_fio->FputUint32_BE(text_xmax);
35473550
35483551 state_fio->FputUint32_BE(cursor_addr.d);
3549- state_fio->FputInt32_BE(curcor_start);
3552+ state_fio->FputInt32_BE(cursor_start);
35503553 state_fio->FputInt32_BE(cursor_end);
35513554 state_fio->FputUint8(cursor_type);
3552-
3555+ state_fio->FputUint8(text_scroll_count);
3556+
35533557 state_fio->FputInt32_BE(event_id_l4_text_blink);
35543558 #endif
35553559 }
@@ -3741,9 +3745,10 @@ bool DISPLAY::load_state(FILEIO *state_fio)
37413745 text_xmax = state_fio->FgetUint32_BE();
37423746
37433747 cursor_addr.d = state_fio->FgetUint32_BE();
3744- curcor_start = state_fio->FgetInt32_BE();
3748+ cursor_start = state_fio->FgetInt32_BE();
37453749 cursor_end = state_fio->FgetInt32_BE();
37463750 cursor_type = state_fio->FgetUint8();
3751+ text_scroll_count = state_fio->FgetUint8();
37473752
37483753 event_id_l4_text_blink = state_fio->FgetInt32_BE();
37493754 #endif
--- a/source/src/vm/fm7/fm7_display.h
+++ b/source/src/vm/fm7/fm7_display.h
@@ -274,10 +274,9 @@ protected:
274274 uint8_t subsys_l4[4800];
275275 uint8_t text_vram[0x1000];
276276 uint8_t crtc_regs[18];
277-
277+ uint8_t text_scroll_count;
278278 bool workram_l4;
279279 bool cursor_lsb;
280- bool text_width40;
281280
282281 bool text_blink;
283282 bool text_width40;
@@ -285,9 +284,10 @@ protected:
285284 pair_t text_start_addr;
286285 uint32_t text_lines;
287286 uint32_t text_xmax;
287+ uint32_t text_ymax;
288288
289289 pair_t cursor_addr;
290- int curcor_start;
290+ int cursor_start;
291291 int cursor_end;
292292 uint8_t cursor_type;
293293
@@ -342,7 +342,6 @@ protected:
342342 void GETVRAM_8_400L(int yoff, scrntype_t *p, bool window_inv = false);
343343 void GETVRAM_256k(int yoff, scrntype_t *p, scrntype_t *px, bool scan_line = false);
344344 #endif
345- uint8_t read_vram_l4_400l(uint32_t addr, uint32_t offset);
346345 uint32_t read_mmio(uint32_t addr);
347346
348347 void init_read_table(void);
@@ -373,7 +372,6 @@ protected:
373372 void write_subsys_cgram(uint32_t addr, uint8_t data);
374373 void write_subsys_ram(uint32_t addr, uint8_t data);
375374 #endif
376- void write_vram_l4_400l(uint32_t addr, uint32_t offset, uint32_t data);
377375 void write_mmio(uint32_t addr, uint8_t data);
378376 void write_dummy(uint32_t addr, uint8_t data);
379377
--- a/source/src/vm/fm7/vram.cpp
+++ b/source/src/vm/fm7/vram.cpp
@@ -12,51 +12,6 @@
1212 #include "hd46505.h"
1313 #endif
1414
15-uint8_t DISPLAY::read_vram_l4_400l(uint32_t addr, uint32_t offset)
16-{
17-#if defined(_FM77L4)
18- if(addr < 0x8000) {
19- if(workram) {
20- uint32_t raddr = addr & 0x3fff;
21- if((multimode_accessmask & 0x04) == 0) {
22- return gvram[0x8000 + (raddr + offset) & 0x7fff];
23- }
24- return 0xff;
25- }
26- pagemod = addr & 0x4000;
27- return gvram[((addr + offset) & mask) | pagemod];
28- } else if(addr < 0x9800) {
29- return textvram[addr & 0x0fff];
30- } else { // $9800-$bfff
31- return subsys_l4[addr - 0x9800];
32- }
33-#endif
34- return 0xff;
35-}
36-
37-void DISPLAY::write_vram_l4_400l(uint32_t addr, uint32_t offset, uint32_t data)
38-{
39-#if defined(_FM77L4)
40- if(addr < 0x8000) {
41- if(workram) {
42- uint32_t raddr = addr & 0x3fff;
43- if((multimode_accessmask & 0x04) == 0) {
44- gvram[0x8000 + (raddr + offset) & 0x7fff] = (uint8_t)data;
45- }
46- return;
47- }
48- pagemod = addr & 0x4000;
49- gvram[((addr + offset) & mask) | pagemod] = (uint8_t)data;
50- } else if(addr < 0x9800) {
51- text_vram[addr & 0x0fff] = (uint8_t)data;
52- } else { // $9800-$bfff
53- //return subsys_l4[addr - 0x9800];
54- }
55- return;
56-#endif
57-}
58-
59-
6015
6116 void DISPLAY::draw_screen()
6217 {
@@ -258,6 +213,7 @@ void DISPLAY::draw_screen2()
258213 uint8_t charcode;
259214 uint8_t attr_code;
260215 scrntype_t on_color;
216+ int xlim, ylim;
261217 bool do_green;
262218 if((y & 0x0f) == 0) {
263219 for(yy = 0; yy < 16; yy++) renderf |= vram_draw_table[y + yy];
@@ -305,6 +261,7 @@ void DISPLAY::draw_screen2()
305261 bool display_char;
306262 int raster;
307263 bool cursor_rev;
264+ uint8_t bitdata;
308265 if(text_width40) {
309266 xlim = 40;
310267 } else {
@@ -312,33 +269,33 @@ void DISPLAY::draw_screen2()
312269 }
313270
314271 for(x = 0; x < xlim; x++) {
315- naddr = (text_start_addr + ((y / text_lines) * text_xmax + x) * 2) & 0x0ffe;
272+ naddr = (text_start_addr.w.l + ((y / text_lines) * text_xmax + x) * 2) & 0x0ffe;
316273 charcode = text_vram[naddr];
317274 attr_code = text_vram[naddr + 1];
318275
319276 on_color = GETVRAM_TEXTCOLOR(attr_code, do_green);
320277
321- display_char = ((attrcode & 0x10) == 0);
322- reverse = ((attrcode & 0x08) != 0);
278+ display_char = ((attr_code & 0x10) == 0);
279+ reverse = ((attr_code & 0x08) != 0);
323280
324281 for(yy = 0; yy < 16; yy++) {
325282 raster = y % text_lines;
326283 bitdata = 0x00;
327- p = emu->get_screen_buffer(y + yy);
328- if(p == NULL) continue;
329- if((raster < 16) && (display_char || text_blink)) {
330- bitdata = subsys_cg_l4[(uint32_t)charcode * 16 + (uint32_t)raster];
331- }
332- cursor_rev = false;
333- if((naddr = cursor_addr) && (cursor_type != 1) &&
334- (cursor_blink || (cursor_type == 0))) {
335- if((raster >= cursor_start) && (raster <= cursor_end)) {
336- cursor_rev = true;
337- }
284+ p = emu->get_screen_buffer(y + yy);
285+ if(p == NULL) continue;
286+ if((raster < 16) && (display_char || text_blink)) {
287+ bitdata = subsys_cg_l4[(uint32_t)charcode * 16 + (uint32_t)raster];
288+ }
289+ cursor_rev = false;
290+ if((naddr = (uint32_t)(cursor_addr.w.l)) && (cursor_type != 1) &&
291+ (text_blink || (cursor_type == 0))) {
292+ if((raster >= cursor_start) && (raster <= cursor_end)) {
293+ cursor_rev = true;
338294 }
339- bitdata = GETVRAM_TEXTPIX(bitdata, reverse, cursor_rev);
340- if(bitdata != 0) {
341- if(text_width40) {
295+ }
296+ bitdata = GETVRAM_TEXTPIX(bitdata, reverse, cursor_rev);
297+ if(bitdata != 0) {
298+ if(text_width40) {
342299 scrntype_t *pp = &(p[x * 2]);
343300 for(ii = 0; ii < 8; ii++) {
344301 if((bitdata & 0x80) != 0) {
@@ -348,17 +305,17 @@ void DISPLAY::draw_screen2()
348305 bitdata <<= 1;
349306 p += 2;
350307 }
351- } else {
352- scrntype_t *pp = &(p[x * 2]);
353- for(ii = 0; ii < 8; ii++) {
354- if((bitdata & 0x80) != 0) {
355- p[0] = on_color;
356- }
357- bitdata <<= 1;
358- p += 1;
359- }
360- }
308+ } else {
309+ scrntype_t *pp = &(p[x * 2]);
310+ for(ii = 0; ii < 8; ii++) {
311+ if((bitdata & 0x80) != 0) {
312+ p[0] = on_color;
313+ }
314+ bitdata <<= 1;
315+ p += 1;
316+ }
361317 }
318+ }
362319 }
363320 }
364321 }
@@ -658,8 +615,8 @@ void DISPLAY::GETVRAM_1_400L(int yoff, scrntype_t *p)
658615
659616 __DECL_VECTORIZED_LOOP
660617 for(int i = 0; i < 8; i++) {
661- tmpd[i] = ppx[i];
662- tmpd[i] = tmpd[i] >> 5;
618+ tmp_d[i] = ppx[i];
619+ tmp_d[i] = tmp_d[i] >> 5;
663620 }
664621
665622 __DECL_VECTORIZED_LOOP
@@ -683,8 +640,8 @@ void DISPLAY::GETVRAM_1_400L_GREEN(int yoff, scrntype_t *p)
683640
684641 __DECL_VECTORIZED_LOOP
685642 for(int i = 0; i < 8; i++) {
686- tmpd[i] = ppx[i];
687- tmpd[i] = tmpd[i] >> 5;
643+ tmp_d[i] = ppx[i];
644+ tmp_d[i] = tmp_d[i] >> 5;
688645 }
689646
690647 __DECL_VECTORIZED_LOOP
Show on old repository browser