flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
DOS386 10 Aug 2013, 08:24
...
Code: ; FASM challenge (again At the occasion of brewing my fascinating app that I'll release when it's ready, I encountered this interesting function. 2. find out what useful it is supposed to do 3. guess what the app could be about 4. optimize it 5. port it to C+++ , compile , measure bloat and compare with my FASM version PS: http://board.flatassembler.net/topic.php?t=13749 http://board.flatassembler.net/topic.php?t=11044 http://board.flatassembler.net/topic.php?t=10874 http://board.flatassembler.net/topic.php?t=9016 http://board.flatassembler.net/topic.php?t=2164 _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
![]() |
|
bitRAKE 11 Aug 2013, 20:22
2) I don't quite have a clue, yet...
4b) BTS only uses the bits required for the register size. MOV CL,31 can be changed to any number which has the least five bits set. So, if we choose MOV CL,-1 then further along MOV CL,0 can be changed to INC ECX -- saving a byte. |
|||
![]() |
|
bitRAKE 11 Aug 2013, 20:50
4c) If the role of CH and AH are swapped, then SAHF can be used to test for high bit -- that'll save a couple bytes - replacing both TEST CH,CH. (The condition changes in (4a) will remain unchanged.) This doesn't conflict with (4b) because CMP AL,32 is the same number of bytes as CMP AL,CH; and MOV CH,32 can follow INC ECX.
Looks like six bytes so far... |
|||
![]() |
|
DOS386 19 Aug 2013, 11:58
Interesting ... your optimizations could be valid ... but 2) is still unresolved
![]() |
|||
![]() |
|
quirck 19 Aug 2013, 16:23
My wild guess... Looks like it checks whether certain symbols are present in the string pointed to by [in0] of length [in1]. As a result, in [out0]:
bit 0 is set whenever the string contains a space; bit 1 is for symbols in range '!' .. '*'; bit 2 is for '+'; bit 3 is for ','; bit 4 is for '-'; bit 5 is for '.'; bit 6 is for '/'; bit 7 is for digits; bit 8 is for symbols in range ':'..'@'; bit 9 is for uppercase letters; bit 10 indicates presence of '['; bit 11 is for '\'; bit 12 is for ']'; bit 13 is for '^'; bit 14 is for '_' or '`'; bit 15 is for lowercase letters; bit 16 is for symbols in range '{'..'~'; bits 17-30 are zero; bit 31 indicates that the string contains symbols outside the range ' '..'~' |
|||
![]() |
|
DOS386 19 Aug 2013, 16:31
quirck wrote: My wild guess... Looks like it checks whether certain symbols are present in the string Welcome to the FASM forum ![]() ![]() PS: "3. guess what the app could be about" is still unresolved _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
![]() |
|
bitshifter 08 Sep 2013, 19:14
Quote: 3. guess what the app could be about Is it for a data compression/decompression utility? |
|||
![]() |
|
DOS386 10 Sep 2013, 08:58
> Is it for a data compression/decompression
no |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.