Skip to content

Commit

Permalink
[iQue] Decompile dbpprint.c (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thar0 authored Nov 28, 2024
1 parent ade805e commit ee9fd71
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/PR/bcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@



#define RDB_WRITE16(addr,data) (*(vu16*)PHYS_TO_K1(addr)=(u16)(data))
#define RDB_READ16(addr) (*(vu16*)PHYS_TO_K1(addr))

#define RDB_20000_REG (PI_BASE_REG + 0x20000)
#define RDB_E0400_REG (PI_BASE_REG + 0xE0400)
#define RDB_E8000_REG (PI_BASE_REG + 0xE8000)

/**
* Serial Interface (SI) Additional Registers
*/
Expand Down
25 changes: 25 additions & 0 deletions src/bb/misc/dbpprint.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "PR/os_internal.h"
#include "PR/bcp.h"

void __osBbPPutter(void* str, char* buf, size_t n) {
int i = 0;

while (n != 0) {
RDB_WRITE16(RDB_E0400_REG, 0x500 | buf[i]);
IO_READ(RDB_20000_REG);

RDB_WRITE16(RDB_E8000_REG, 1);
IO_READ(RDB_20000_REG);

i++;

while (!(RDB_READ16(RDB_E8000_REG) & 8)) {
;
}

RDB_WRITE16(RDB_E8000_REG, 8);
IO_READ(RDB_20000_REG);

n--;
}
}

0 comments on commit ee9fd71

Please sign in to comment.