diff --git a/extra/dragon/disk1.dr b/extra/dragon/disk1.dr index 29a386e..07194b3 100644 Binary files a/extra/dragon/disk1.dr and b/extra/dragon/disk1.dr differ diff --git a/extra/dss/bios/drivers.dss b/extra/dss/bios/drivers.dss index 9a5061f..aa9c461 100644 --- a/extra/dss/bios/drivers.dss +++ b/extra/dss/bios/drivers.dss @@ -44,6 +44,7 @@ _int_20_end: ## ========================== BIOS Video Interrupt handler ========================= _int_30_handler: + ## debug_profile_start 0xE0, DBGProfilerTime.MILLIS mov ACC, R10 jeq $_int_30_direct_print_char_text_single, 0x0001 jeq $_int_30_direct_new_line_text_single, 0x0002 @@ -138,6 +139,7 @@ _int_30_write_vram_text16: inc R9 movb [VGA_Registers.MEMORY_CONTROLLER_Y_BYTE], *R9 movb [VGA_Registers.SIGNAL], Sig_VGA_Text_16_Color.WRITE_VRAM + ## debug_profile_stop jmp $_int_30_end _int_30_read_vram_text16: diff --git a/extra/dss/bios_api.dss b/extra/dss/bios_api.dss index 87f9ccc..531b2d2 100644 --- a/extra/dss/bios_api.dss +++ b/extra/dss/bios_api.dss @@ -1,5 +1,5 @@ ## -- -## -- This file is automatically generated by the DragonAssembler (version 0.4.1612) +## -- This file is automatically generated by the DragonAssembler (version 0.4.1613) ## -- Please do not modify this file in any way. ## -- diff --git a/extra/dss/drake/bootsector.dss b/extra/dss/drake/bootsector.dss index 7927e9a..95ebdca 100644 --- a/extra/dss/drake/bootsector.dss +++ b/extra/dss/drake/bootsector.dss @@ -25,7 +25,9 @@ draw_loop: mov R10, 0x21 mov R9, $textCell + ## debug_profile_start 0xE0, DBGProfilerTime.MILLIS int 0x30 + ## debug_profile_stop inc R5 mov ACC, R5 diff --git a/extra/dss/drake/disk.dss b/extra/dss/drake/disk.dss index b586ed5..2df07a0 100644 --- a/extra/dss/drake/disk.dss +++ b/extra/dss/drake/disk.dss @@ -63,9 +63,9 @@ _disk_load_from_ddd_blocking: and FL, 0b1111111111111110 ## Disable interrupts mov FL, ACC _disk_load_from_ddd_blocking_wait_loop: - debug_profile_start 0xE0, DBGProfilerTime.MILLIS + ## debug_profile_start 0xE0, DBGProfilerTime.MILLIS mov ACC, [{DISK_INTERFACE_ADDR + DiskRegisters.RO_STATUS}] - debug_profile_stop + ## debug_profile_stop jne $_disk_load_from_ddd_blocking_wait_loop, DiskStatus.FREE or FL, 0b0000000000000001 ## Enable interrupts mov FL, ACC diff --git a/src/gui/Renderer.cpp b/src/gui/Renderer.cpp index ad177c9..23278cc 100644 --- a/src/gui/Renderer.cpp +++ b/src/gui/Renderer.cpp @@ -45,7 +45,10 @@ namespace dragon void Renderer::updateBuffer(void) { if (isInvalid()) return; + ostd::Timer timer; + timer.start(true, "DISPLAY_PROFILER", ostd::eTimeUnits::Milliseconds); SDL_UpdateTexture(m_texture, NULL, m_pixels, m_windowWidth * 4); + timer.end(true); } void Renderer::displayBuffer(void) diff --git a/src/hardware/VirtualDisplay.cpp b/src/hardware/VirtualDisplay.cpp index 4101086..6f6abac 100644 --- a/src/hardware/VirtualDisplay.cpp +++ b/src/hardware/VirtualDisplay.cpp @@ -70,11 +70,12 @@ namespace dragon m_refreshScreen = false; } } + m_renderer.updateBuffer(); m_renderer.displayBuffer(); } - static char c = 'A'; + // static char c = 'A'; void VirtualDisplay::onUpdate(void) { @@ -146,15 +147,15 @@ namespace dragon int16_t y = mem.read16(vga_addr + tRegisters::MemControllerY); //TODO: Remove this override used for testing purposes - for (int32_t i = 0; i < RawTextRenderer::CONSOLE_CHARS_V * RawTextRenderer::CONSOLE_CHARS_H; i++) - { - auto xy = CONVERT_1D_2D(i, RawTextRenderer::CONSOLE_CHARS_H); - DragonRuntime::vGraphicsInterface.writeVRAM_16Colors(static_cast(xy.x), static_cast(xy.y), c++, 0, 15); - if (c > 'Z') - c = 'A'; - } + // for (int32_t i = 0; i < RawTextRenderer::CONSOLE_CHARS_V * RawTextRenderer::CONSOLE_CHARS_H; i++) + // { + // auto xy = CONVERT_1D_2D(i, RawTextRenderer::CONSOLE_CHARS_H); + // DragonRuntime::vGraphicsInterface.writeVRAM_16Colors(static_cast(xy.x), static_cast(xy.y), c++, 0, 15); + // if (c > 'Z') + // c = 'A'; + // } - // DragonRuntime::vGraphicsInterface.writeVRAM_16Colors(static_cast(x), static_cast(y), textCell.character, textCell.backgroundColor, textCell.foregroundColor); + DragonRuntime::vGraphicsInterface.writeVRAM_16Colors(static_cast(x), static_cast(y), textCell.character, textCell.backgroundColor, textCell.foregroundColor); } } else return; diff --git a/src/runtime/DragonRuntime.cpp b/src/runtime/DragonRuntime.cpp index bae5ef5..f1c9fce 100644 --- a/src/runtime/DragonRuntime.cpp +++ b/src/runtime/DragonRuntime.cpp @@ -352,14 +352,14 @@ namespace dragon ostd::Timer clock_timer; bool running = true; bool fixed_clock = machine_config.fixed_clock; - // ostd::Timer _timer; + ostd::Timer _timer; while (running || vDiskInterface.isBusy()) { clock_timer.startCount(ostd::eTimeUnits::Microseconds); ostd::SignalHandler::refresh(); uint16_t addr = cpu.readRegister(dragon::data::Registers::IP); uint16_t spAddr = cpu.readRegister(dragon::data::Registers::SP); - // _timer.start(true, "Profiling", ostd::eTimeUnits::Microseconds, &out); + // _timer.start(true, "Profiling", ostd::eTimeUnits::Microseconds, &out); running = cpu.execute() && vDisplay.isRunning(); // _timer.end(true); vDisplay.update(); @@ -374,6 +374,7 @@ namespace dragon avg_count++; avg_tot += _time; s_avgInstTime = (uint64_t)std::round(avg_tot / avg_count); + // out.fg(ostd::ConsoleColors::Red).p(s_avgInstTime).nl().reset(); acc = 0; } _time = clock_timer.endCount();