mbv: some debug stuff

This commit is contained in:
Paul Mathieu 2025-06-10 23:48:29 -07:00
parent 3db383d461
commit d15e930649
2 changed files with 31 additions and 0 deletions

View File

@ -5,6 +5,11 @@ MEMORY
_vector_table = 0x0;
BiosUartRead = 0x0d4;
BiosUartWrite = 0x22c;
BiosWozmon = 0x340;
BiosUartWriteNibble = 0x324;
SECTIONS
{
.text :

26
mbv/hal/debug.cc Normal file
View File

@ -0,0 +1,26 @@
#include <cstdint>
extern "C" {
uint8_t BiosUartRead();
void BiosUartWrite(uint8_t);
void BiosWozmon();
void BiosUartWriteNibble(uint8_t n);
__attribute__((used))
void UartWriteU32(uint32_t a) {
for (int i = 0; i < 8; i++) {
BiosUartWriteNibble(a >> 28);
a <<= 4;
}
}
__attribute__((used))
void UartWriteString(const char* s) {
while (*s) {
BiosUartWrite(*s);
s++;
}
}
}