diff options
Diffstat (limited to 'baremetal/115write-byte.subx')
-rw-r--r-- | baremetal/115write-byte.subx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/baremetal/115write-byte.subx b/baremetal/115write-byte.subx index 3ac587f0..45cf9950 100644 --- a/baremetal/115write-byte.subx +++ b/baremetal/115write-byte.subx @@ -22,7 +22,7 @@ append-byte: # f: (addr stream byte), n: int 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # copy *edi to ecx # if (f->write >= f->size) abort 3b/compare 1/mod/*+disp8 7/rm32/edi . . . 1/r32/ecx 8/disp8 . # compare ecx with *(edi+8) - 7d/jump-if->= $append-byte:end/disp8 # TODO: abort + 7d/jump-if->= $append-byte:abort/disp8 $append-byte:to-stream: # write to stream # f->data[f->write] = LSB(n) @@ -40,6 +40,13 @@ $append-byte:end: 5d/pop-to-ebp c3/return +$append-byte:abort: + (draw-text-wrapping-down-then-right-from-cursor-over-full-screen 0 "append-byte: out of space\n" 3) # 3=cyan + { + eb/jump loop/disp8 + } + # never gets here + test-append-byte-single: # - check that append-byte writes to first byte of 'file' # setup |