Added --save-final-stage option to dasm
This commit is contained in:
parent
d1362c0218
commit
3123ae6231
6 changed files with 8 additions and 22 deletions
Binary file not shown.
|
|
@ -3,10 +3,10 @@
|
||||||
.entry _kernel0_main
|
.entry _kernel0_main
|
||||||
.header KERNEL0_BOOT
|
.header KERNEL0_BOOT
|
||||||
|
|
||||||
@include <memory.dss>
|
|
||||||
@include <../drivers/display_driver.dss>
|
@include <../drivers/display_driver.dss>
|
||||||
@include <../drivers/keyboard_driver.dss>
|
@include <../drivers/keyboard_driver.dss>
|
||||||
@include <sdk/bios_api.dss>
|
@include <sdk/bios_api.dss>
|
||||||
|
@include <memory.dss>
|
||||||
|
|
||||||
|
|
||||||
## =========================================================================================================================
|
## =========================================================================================================================
|
||||||
|
|
@ -28,7 +28,7 @@ _kernel0_main:
|
||||||
push $test_str
|
push $test_str
|
||||||
push 1
|
push 1
|
||||||
call $_print_string
|
call $_print_string
|
||||||
## debug_break
|
debug_break
|
||||||
_infinite_loop_0:
|
_infinite_loop_0:
|
||||||
## jmp $_infinite_loop_0
|
## jmp $_infinite_loop_0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,5 @@
|
||||||
.code
|
.code
|
||||||
|
|
||||||
_init_memory_handler:
|
_init_memory_handler:
|
||||||
|
nop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
_alloc_memory:
|
|
||||||
|
|
@ -18,7 +18,7 @@ printf "\n${green}2) bootsector.dss\n${clear}"
|
||||||
|
|
||||||
printf "\n${green}Compiling DragonOS...\n${clear}"
|
printf "\n${green}Compiling DragonOS...\n${clear}"
|
||||||
printf "\n${green}1) kernel0.dss\n${clear}"
|
printf "\n${green}1) kernel0.dss\n${clear}"
|
||||||
./dasm dss/DragonOS/kernel0/kernel0.dss -o dragon/kernel0.bin -I dss $1
|
./dasm dss/DragonOS/kernel0/kernel0.dss -o dragon/kernel0.bin -I dss --save-final-stage ./kernel0_final_stage.txt $1
|
||||||
./dtools load-binary dragon/disk1.dr dragon/kernel0.bin 0x00018000
|
./dtools load-binary dragon/disk1.dr dragon/kernel0.bin 0x00018000
|
||||||
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#include <ostd/io/File.hpp>
|
#include <ostd/io/File.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <ostd/io/FileSystem.hpp>
|
||||||
#include <ostd/io/Serial.hpp>
|
#include <ostd/io/Serial.hpp>
|
||||||
#include <ostd/io/IOHandlers.hpp>
|
#include <ostd/io/IOHandlers.hpp>
|
||||||
#include <ostd/io/Memory.hpp>
|
#include <ostd/io/Memory.hpp>
|
||||||
|
|
@ -51,7 +52,7 @@ namespace dragon
|
||||||
replaceLabelRefs();
|
replaceLabelRefs();
|
||||||
combineDataAndCode();
|
combineDataAndCode();
|
||||||
createExportFiles();
|
createExportFiles();
|
||||||
if (Application::args.disassembly_file_path.trim() != "")
|
if (Application::args.final_stage_path.trim() != "")
|
||||||
saveCurrentStageToFile();
|
saveCurrentStageToFile();
|
||||||
m_programSize = m_code.size();
|
m_programSize = m_code.size();
|
||||||
if (m_fixedSize > 0 && m_code.size() > m_fixedSize)
|
if (m_fixedSize > 0 && m_code.size() > m_fixedSize)
|
||||||
|
|
@ -774,7 +775,8 @@ namespace dragon
|
||||||
|
|
||||||
void Assembler::saveCurrentStageToFile(void)
|
void Assembler::saveCurrentStageToFile(void)
|
||||||
{
|
{
|
||||||
|
std::cout << "LINES: " << (int)m_lines.size() << "\n";
|
||||||
|
ostd::FileSystem::writeTextFile(Application::args.final_stage_path, m_lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include "VirtualCPU.hpp"
|
#include "VirtualCPU.hpp"
|
||||||
#include "../tools/GlobalData.hpp"
|
#include "../tools/GlobalData.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <ostd/io/Memory.hpp>
|
#include <ostd/io/Memory.hpp>
|
||||||
|
|
||||||
#include "../runtime/DragonRuntime.hpp"
|
#include "../runtime/DragonRuntime.hpp"
|
||||||
|
|
@ -804,17 +803,9 @@ namespace dragon
|
||||||
break;
|
break;
|
||||||
case data::OpCodes::CallImm:
|
case data::OpCodes::CallImm:
|
||||||
{
|
{
|
||||||
bool test = false;
|
|
||||||
if (readRegister(data::Registers::IP) == 0x2CF1)
|
|
||||||
test = true;
|
|
||||||
uint16_t subroutineAddr = fetch16();
|
uint16_t subroutineAddr = fetch16();
|
||||||
pushStackFrame();
|
pushStackFrame();
|
||||||
writeRegister16(data::Registers::IP, subroutineAddr);
|
writeRegister16(data::Registers::IP, subroutineAddr);
|
||||||
if (test)
|
|
||||||
{
|
|
||||||
std::cout << ostd::String::getHexStr(subroutineAddr, true, 2) << "\n";
|
|
||||||
std::cin.get();
|
|
||||||
}
|
|
||||||
m_subroutineCounter++;
|
m_subroutineCounter++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -836,18 +827,12 @@ namespace dragon
|
||||||
break;
|
break;
|
||||||
case data::OpCodes::ArgReg:
|
case data::OpCodes::ArgReg:
|
||||||
{
|
{
|
||||||
if (isInDebugBreakPoint())
|
|
||||||
{
|
|
||||||
std::cout << ostd::String::getHexStr(readRegister(data::Registers::IP));
|
|
||||||
std::cin.get();
|
|
||||||
}
|
|
||||||
uint8_t regAddr = fetch8();
|
uint8_t regAddr = fetch8();
|
||||||
if (!isInSubRoutine()) break;
|
if (!isInSubRoutine()) break;
|
||||||
int16_t pp_val = readRegister(data::Registers::PP);
|
int16_t pp_val = readRegister(data::Registers::PP);
|
||||||
int16_t arg_data = m_memory.read16(pp_val);
|
int16_t arg_data = m_memory.read16(pp_val);
|
||||||
writeRegister16(data::Registers::PP, pp_val - 2);
|
writeRegister16(data::Registers::PP, pp_val - 2);
|
||||||
writeRegister16(regAddr, arg_data);
|
writeRegister16(regAddr, arg_data);
|
||||||
// std::cout << ostd::String::getHexStr(readRegister(data::Registers::IP), true, 2) << "\n";
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case data::OpCodes::RetInt:
|
case data::OpCodes::RetInt:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue