Added some export functionality to dasm

This commit is contained in:
OmniaX 2024-08-18 05:50:13 +02:00
parent 2cbc8847b2
commit a9ba9c8013
9 changed files with 75 additions and 21 deletions

Binary file not shown.

View file

@ -82,6 +82,37 @@
@define INST_BIOS_NODE_TOGGLE 0x02 @define INST_BIOS_NODE_TOGGLE 0x02
## =============================================================================================== ## ===============================================================================================
## ========================================== Other Data =========================================
@export_comment /BIOS_API "Structure of a DPT (Dragon Partition Table)."
@group /BIOS_API DPTStructure
DISK_ADDR 0x0200
ENTRIES_START 0x000C
ENTRY_START_ADDR 0x0000
ENTRY_PART_SIZE 0x0004
ENTRY_FLAGS 0x0008
ENTRY_PART_LBL 0x0024
ID_CODE 0xF1CA
ENTRY_SIZE_B 100
@end
@export_comment /BIOS_API "\n"
@export_start /BIOS_API
@struct DPTBlock
ID:2
VersionMaj:1
VersionMin:1
PartCount:1
Reserved:7
Entries:500
@end
@export_end
## ===============================================================================================
.data .data
$_bios_version_number_maj 0x00, 0x00 $_bios_version_number_maj 0x00, 0x00
$_bios_version_number_min 0x00, 0x04 $_bios_version_number_min 0x00, 0x04

View file

@ -46,3 +46,14 @@
@define Sig_VGA_Text_Single_Color.CLEAR_SCREEN 0xE1 @define Sig_VGA_Text_Single_Color.CLEAR_SCREEN 0xE1
## -- ## --
## -- Structure of a DPT (Dragon Partition Table).
@define DPTStructure.DISK_ADDR 0x0200
@define DPTStructure.ENTRIES_START 0x000C
@define DPTStructure.ENTRY_START_ADDR 0x0000
@define DPTStructure.ENTRY_PART_SIZE 0x0004
@define DPTStructure.ENTRY_FLAGS 0x0008
@define DPTStructure.ENTRY_PART_LBL 0x0024
@define DPTStructure.ID_CODE 0xF1CA
@define DPTStructure.ENTRY_SIZE_B 100
## --

View file

@ -8,8 +8,6 @@
$dpt_block <DPTBlock> $dpt_block <DPTBlock>
.code .code
mov R10, 0xE0
int 0x30
mov R10, 0x0C mov R10, 0x0C
mov R9, $string mov R9, $string
int 0x30 int 0x30
@ -33,7 +31,7 @@ _load_dpt_block:
mov [$ddd.MemoryAddress], $dpt_block.ID mov [$ddd.MemoryAddress], $dpt_block.ID
and FL, 0b1111111111111110 ## Disable interrupts and FL, 0b1111111111111110 ## Disable interrupts
mov FL, ACC mov FL, ACC
push $ddd.Mode push $ddd
push 1 push 1
call $_disk_load_from_ddd_blocking call $_disk_load_from_ddd_blocking
or FL, 0b0000000000000001 ## Enable interrupts or FL, 0b0000000000000001 ## Enable interrupts

View file

@ -1,18 +1,5 @@
@guard _DPT_DSS_ @guard _DPT_DSS_
@group DPTStructure
DISK_ADDR 0x0200
ENTRIES_START 0x000C
ENTRY_START_ADDR 0x0000
ENTRY_PART_SIZE 0x0004
ENTRY_FLAGS 0x0008
ENTRY_PART_LBL 0x0024
ID_CODE 0xF1CA
ENTRY_SIZE_B 100
@end
@struct DPTBlock @struct DPTBlock
ID:2 ID:2
VersionMaj:1 VersionMaj:1

View file

@ -27,7 +27,7 @@
and FL, 0b1111111111111110 ## Disable interrupts and FL, 0b1111111111111110 ## Disable interrupts
mov FL, ACC mov FL, ACC
push $ddd.Mode push $ddd
push 1 push 1
call $_disk_load_from_ddd_blocking call $_disk_load_from_ddd_blocking
or FL, 0b0000000000000001 ## Enable interrupts or FL, 0b0000000000000001 ## Enable interrupts

View file

@ -177,6 +177,9 @@
Registers (case-insensitive) Registers (case-insensitive)
(?<!\w)(r[1-9]|r10|fl|pp|rv|fp|sp|ip|acc)(?!\w) (?<!\w)(r[1-9]|r10|fl|pp|rv|fp|sp|ip|acc)(?!\w)
Variables in dasm
VARIABLE_NAME(?!\.)(?!\w)
#========================================================================================================================================== #==========================================================================================================================================

View file

@ -1,8 +1,6 @@
Assembler: Assembler:
Add evaluation of direct struct instance name as as struct's first member
Add Struct export functionality Add Struct export functionality
Add single Define export functionality Add subroutine address export functionality
Add subroutine addres export functionality
Bugs: Bugs:
Fix VM closing when reaching hlt instruction Fix VM closing when reaching hlt instruction
@ -16,6 +14,8 @@ External:
Done: Done:
*Add evaluation of direct struct instance name as as struct's first member
*Add single Define export functionality
*Inverted Colors in Text-Single-Color *Inverted Colors in Text-Single-Color
*show where interrupts are disabled (in call-tree view) *show where interrupts are disabled (in call-tree view)
*Text visualization for hardware interrupts (in call-tree view) *Text visualization for hardware interrupts (in call-tree view)

View file

@ -736,6 +736,7 @@ namespace dragon
return; return;
} }
int32_t data_index = 0; int32_t data_index = 0;
newLines.push_back("!" + symbolName);
for (auto& member : struct_def.members) for (auto& member : struct_def.members)
{ {
ostd::String newLine = symbolName; ostd::String newLine = symbolName;
@ -914,10 +915,25 @@ namespace dragon
void Assembler::parseDataSection(void) void Assembler::parseDataSection(void)
{ {
// for (auto& line : m_rawDataSection)
// std::cout << line << "\n";
for (auto& line : m_rawDataSection) for (auto& line : m_rawDataSection)
{ {
ostd::String lineEdit(line); ostd::String lineEdit(line);
tSymbol symbol; tSymbol symbol;
if (lineEdit.startsWith("!"))
{
if (lineEdit.contains(" "))
{
std::cout << "Invalid phantom data entry: " << lineEdit << "\n";
continue;
}
lineEdit.substr(1).trim();
symbol.bytes.clear();
symbol.address = m_currentDataAddr;
m_symbolTable[lineEdit] = symbol;
continue;
}
if (!lineEdit.startsWith("$") || lineEdit.indexOf(" ") < 2) if (!lineEdit.startsWith("$") || lineEdit.indexOf(" ") < 2)
{ {
std::cout << "Invalid data entry: " << lineEdit << "\n"; std::cout << "Invalid data entry: " << lineEdit << "\n";
@ -2367,7 +2383,15 @@ namespace dragon
{ {
ostd::String lineEdit(line); ostd::String lineEdit(line);
for (auto& symbol : m_symbolTable) for (auto& symbol : m_symbolTable)
lineEdit.replaceAll(symbol.first, ostd::Utils::getHexStr(symbol.second.address, true, 2)); {
ostd::String regex = "\\" + symbol.first.new_regexReplace("\\.", "\\.") + "(?!\\.)(?!\\w)";
// std::cout << "SYMBOL: " << symbol.first << "\n";
// std::cout << "LINE: " << lineEdit << "\n";
// std::cout << "REGEX: " << regex << "\n";
lineEdit.regexReplace(regex, ostd::Utils::getHexStr(symbol.second.address, true, 2), false);
// std::cout << "NEW_LINE: " << lineEdit << "\n\n";
}
return lineEdit; return lineEdit;
} }