From b625c6304eca827c04eda719fa6f7927294b80bc Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 29 Jul 2021 20:07:13 -0700 Subject: support non-line-oriented processing in next-word Immediately this simplifies support for comments in image data. --- linux/127next-word.subx | 37 ++++++++++++++++++++++++++----------- linux/assort | Bin 46755 -> 46801 bytes linux/braces | Bin 48808 -> 48854 bytes linux/calls | Bin 53791 -> 53837 bytes linux/dquotes | Bin 50377 -> 50423 bytes linux/hex | Bin 48935 -> 48981 bytes linux/labels_baremetal | Bin 51495 -> 51541 bytes linux/mu | Bin 608842 -> 608888 bytes linux/pack | Bin 59765 -> 59811 bytes linux/sigils | Bin 61162 -> 61208 bytes linux/survey_baremetal | Bin 47436 -> 47482 bytes linux/survey_elf | Bin 56329 -> 56375 bytes linux/tests | Bin 45546 -> 45592 bytes 13 files changed, 26 insertions(+), 11 deletions(-) (limited to 'linux') diff --git a/linux/127next-word.subx b/linux/127next-word.subx index 5af326d4..17f9e88c 100644 --- a/linux/127next-word.subx +++ b/linux/127next-word.subx @@ -38,29 +38,44 @@ $next-word:check0: # . return out c7 0/subop/copy 0/mod/direct 7/rm32/edi . . . . . 0/imm32 # copy to *edi c7 0/subop/copy 1/mod/*+disp8 7/rm32/edi . . . . 4/disp8 0/imm32 # copy to *(edi+4) - eb/jump $next-word:end/disp8 + e9/jump $next-word:end/disp32 $next-word:check-for-comment: # out->start = &line->data[line->read] 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 4/disp8 . # copy *(esi+4) to ecx 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx . 0/r32/eax 0xc/disp8 . # copy esi+ecx+12 to eax 89/copy 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . . # copy eax to *edi - # if (line->data[line->read] == '#') out->end = &line->data[line->write]), skip rest of stream and return + # if (line->data[line->read] == '#') return rest of line # . eax = line->data[line->read] 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx . 0/r32/AL 0xc/disp8 . # copy byte at *(esi+ecx+12) to AL # . compare 3d/compare-eax-and 0x23/imm32/pound - 75/jump-if-!= $next-word:regular-word/disp8 + 0f 85/jump-if-!= $next-word:regular-word/disp32 $next-word:comment: - # . out->end = &line->data[line->write] - 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax - 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 . # copy esi+eax+12 to eax + # out->end = out->start + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx . 0/r32/eax 0xc/disp8 . # copy esi+ecx+12 to eax 89/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 . # copy eax to *(edi+4) - # . line->read = line->write - 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax - 89/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 . # copy eax to *(esi+4) - # . return - eb/jump $next-word:end/disp8 + # var write/ecx: int = line->write + 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx +$next-word:comment-loop: + # if (line->read >= line->write) break + 39/compare 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 4/disp8 . # compare *(esi+4) with ecx + 0f 8d/jump-if->= $next-word:comment-break/disp32 + # ++line->read + ff 0/subop/increment 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 . # increment *(esi+4) + # ++out->end + ff 0/subop/increment 1/mod/*+disp8 7/rm32/edi . . . . 4/disp8 . # increment *(edi+4) + # if (*out->end == newline) break + 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 . # copy *(edi+4) to eax + 8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL + 25/and-eax-with 0xff/imm32 + 3d/compare-eax-and 0xa/imm32/newline + 0f 84/jump-if-= $next-word:comment-break/disp32 + # loop + e9/jump $next-word:comment-loop/disp32 +$next-word:comment-break: + # return + e9/jump $next-word:end/disp32 $next-word:regular-word: # otherwise skip-chars-not-matching-whitespace(line) # including trailing newline # . . push args diff --git a/linux/assort b/linux/assort index 9841efba..f4f73847 100755 Binary files a/linux/assort and b/linux/assort differ diff --git a/linux/braces b/linux/braces index 573a66be..0930284c 100755 Binary files a/linux/braces and b/linux/braces differ diff --git a/linux/calls b/linux/calls index f92f9d24..e2c8b5bb 100755 Binary files a/linux/calls and b/linux/calls differ diff --git a/linux/dquotes b/linux/dquotes index d523ca81..0339ae16 100755 Binary files a/linux/dquotes and b/linux/dquotes differ diff --git a/linux/hex b/linux/hex index 70293365..e6c63c83 100755 Binary files a/linux/hex and b/linux/hex differ diff --git a/linux/labels_baremetal b/linux/labels_baremetal index de2749d8..12a545ca 100755 Binary files a/linux/labels_baremetal and b/linux/labels_baremetal differ diff --git a/linux/mu b/linux/mu index cd11865e..ecf884a2 100755 Binary files a/linux/mu and b/linux/mu differ diff --git a/linux/pack b/linux/pack index 87671827..32db6ad3 100755 Binary files a/linux/pack and b/linux/pack differ diff --git a/linux/sigils b/linux/sigils index 64f78222..3bcd2d9c 100755 Binary files a/linux/sigils and b/linux/sigils differ diff --git a/linux/survey_baremetal b/linux/survey_baremetal index 46de25b7..b5429495 100755 Binary files a/linux/survey_baremetal and b/linux/survey_baremetal differ diff --git a/linux/survey_elf b/linux/survey_elf index bd1c816c..9d1a715c 100755 Binary files a/linux/survey_elf and b/linux/survey_elf differ diff --git a/linux/tests b/linux/tests index 65c743fd..04a112ef 100755 Binary files a/linux/tests and b/linux/tests differ -- cgit 1.4.1-2-gfad0