1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2025-03-03 14:29:23 +00:00

Add ability to load things onto bus from buffer.

This commit is contained in:
Radosław Kujawa 2017-02-02 12:06:41 +01:00
parent eb7179f89a
commit 3075ed87fa
2 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,23 @@ bus_init()
return t;
}
bool
bus_load_buf(bus_t *t, uint16_t addr, uint8_t *buf, uint16_t bufsize)
{
uint16_t i;
i = 0;
/* XXX: add sanity checks */
while (i < bufsize) {
t->space[i] = buf[i]; // XXX: overflow addr
i++;
}
return true;
}
bool
bus_load_file(bus_t *t, uint16_t addr, const char *filename)
{

View File

@ -17,6 +17,7 @@ void bus_write_1(bus_t *, uint16_t, uint8_t);
bus_t bus_init();
void bus_finish(bus_t *);
bool bus_load_file(bus_t *, uint16_t, const char *);
bool bus_load_buf(bus_t *, uint16_t, uint8_t *, uint16_t);
#endif /* _BUS_H_ */