diff options
Diffstat (limited to 'c')
| -rw-r--r-- | c/blk.c | 13 | ||||
| -rw-r--r-- | c/gbos.h | 2 | ||||
| -rw-r--r-- | c/libc.s | 14 |
3 files changed, 29 insertions, 0 deletions
@@ -0,0 +1,13 @@ +#include "gbos.h" +/* blk: exercise the block device. blk fill <n> <v> | blk peek <n> */ +void main(void) { + char *argv[4]; + unsigned char argc = argv_parse(argv, 4); + if (argc >= 3 && argv[0][0] == 'f') { + bfill(atou(argv[1]), atou(argv[2])); + } else if (argc >= 2 && argv[0][0] == 'p') { + putu(bpeek(atou(argv[1]))); nl(); + } else { + puts("usage: blk fill <n> <v> | blk peek <n>"); nl(); + } +} @@ -43,4 +43,6 @@ unsigned char psget(unsigned char slot, unsigned char *buf); /* {pid,state,prog} void progname(unsigned char id, char *buf); /* id -> name */ void yield(void); unsigned char reap(void); /* reap a finished bg job, or 0 */ +void bfill(unsigned char block, unsigned char byte); /* [debug] disk */ +unsigned char bpeek(unsigned char block); /* [debug] disk */ #endif @@ -199,3 +199,17 @@ _reap: ld c, #22 ; SYS_REAP rst #0x30 ret + + .globl _bfill, _bpeek + ;; void bfill(unsigned char block /*A*/, unsigned char byte /*E*/) +_bfill: + ld b, a + ld c, #23 ; SYS_BFILL + rst #0x30 + ret + ;; unsigned char bpeek(unsigned char block /*A*/) -> A +_bpeek: + ld b, a + ld c, #24 ; SYS_BPEEK + rst #0x30 + ret |
