News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Binary to displayable text, any base

Started by ahsat, March 31, 2024, 04:37:00 AM

Previous topic - Next topic

jj2007

Quote from: ahsat on March 31, 2024, 01:38:32 PMI would be very interested in a speed test of base 10. Also, it should be simple and quick to convert to 32 bit.

Here are timings for your algo, base 16 and base 10:
This program was assembled with UAsm64 in 64-bit format.
AMD Athlon Gold 3150U with Radeon Graphics
500 milliseconds
485 milliseconds
484 milliseconds
484 milliseconds
485 milliseconds
The number is 075BCD15
500 milliseconds
516 milliseconds
516 milliseconds
484 milliseconds
500 milliseconds
The number is 123456789

With base 10, it's 30% faster than my Str$() algo. I attach both sources and executables.

Note I have modified your algo a bit, not in its content but instead of xx proc I used xx:, i.e. a label, to make sure the assembler doesn't create any overhead.

sinsi

AnyToAnyRay.zip > AnyToAny.exe > oops
(1f00.30e0): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=000000b4 ebx=00000010 ecx=89ab5db4 edx=000000b5 esi=000000b4 edi=000000b4
eip=7758343a esp=0019ff3c ebp=0019ff64 iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246
KERNELBASE!lstrlenA+0x1a:
7758343a 8a08            mov     cl,byte ptr [eax]          ds:002b:000000b4=??




This program was assembled with UAsm64 in 32-bit format.
This is the 64 bit number, in hex:
bye


jj2007

Quote from: sinsi on March 31, 2024, 09:26:54 PMAnyToAnyRay.zip > AnyToAny.exe > oops

Oops indeed - wrong exe attached, sorry. ^^^ Corrected ^^^

sinsi

Nice
This program was assembled with UAsm64 in 64-bit format.
13th Gen Intel(R) Core(TM) i9-13900KF
156 milliseconds
140 milliseconds
141 milliseconds
141 milliseconds
140 milliseconds
The number is 075BCD15
157 milliseconds
156 milliseconds
172 milliseconds
156 milliseconds
156 milliseconds
The number is 123456789

ahsat

Quote from: jj2007 on March 31, 2024, 09:01:26 PMWith base 10, it's 30% faster than my Str$() algo.

I don't understand the code or the results you posted, but I think you are saying that base 10, it did beat the algos in the Laboratory.

How did you attach files to your post?

jj2007

Quote from: ahsat on April 01, 2024, 12:30:35 AMI don't understand the code or the results you posted, but I think you are saying that base 10, it did beat the algos in the Laboratory.

The code is basically some wrappers for measuring time with a GetTickCount pair, plus your original two algos. The only modification was to use AnyToAny: instead of AnyToAny proc, i.e. a simple label instead of the proc macro. The latter may trigger certain things that could slow down your code, such as creating a stack frame.

Quote from: ahsat on April 01, 2024, 12:30:35 AMHow did you attach files to your post?

There are two modes to respond:
1. Quick edit
2. Reply

Both show Add image to post at the bottom.
Only the Reply mode shows Click or drag files here to attach them.

Zip your code and attach the archive, using the Reply mode.
If you accidentally already posted in Quick edit mode, use More... Modify in the lower right corner.

ahsat

Quote from: jj2007 on April 01, 2024, 01:15:21 AMIf you accidentally already posted in Quick edit mode, use

I think the last part of the text in your post was cut off.

jj2007

Quote from: ahsat on April 01, 2024, 01:18:49 AMI think the last part of the text in your post was cut off.

Just hit F5 or Ctrl F5.

jj2007

I posted a testbed in the Laboratory. It's 32-bit code, so if you can convert your algo to 32-bit, I can add it to the testbed.

ahsat

Quote from: jj2007 on April 01, 2024, 03:46:04 AMif you can convert your algo to 32-bit, I can add it to the testbed.

Do you mean to convert just the to ten instruction routines (AnyToAny and ctAnyToAny) or the whole program Anybase?

Remember, I am very new in the modern development environments. The MASM32 STK does not like something on my computer and will not install. I will have to research why, so converting the whole program may take me awhile.

jj2007


ahsat

Quote from: jj2007 on April 01, 2024, 06:56:37 AMHave a look

I did, and made a comment.

Perhaps you would be so kind as to help me with the MASM32 SDK. I am getting an error that has me stumped. I have reduced the code to this:
.386
.model flat
.data
      db      0dh, 0ah, 0
end
I then get the following:
d:\masm32\AnyBase32>D:\masm32\bin\ml.exe /c AnyBase.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: AnyBase.asm

d:\masm32\AnyBase32>D:\masm32\bin\polink.exe /SUBSYSTEM:CONSOLE /OUT:AnyBase32.exe AnyBase.obj
POLINK: fatal error: Invalid machine type in object 'AnyBase.obj'.
Note that I am using egerything from the SDK, but still getting the POLINK error.

TimoVJL

May the source be with you

NoCforMe

You might want to create a batch file to do your assembling and linking, rather than typing it every time at the command line as you apparently did. Here's mine, lifted from [somewhere in] the MASM32 SDK and modified:

@echo off

ml /c /coff /Fl /Sg /Sn %1.asm
:ml /c /coff /Fl /Sn /Zi %1.asm
if errorlevel 1 goto errasm

link /SUBSYSTEM:WINDOWS %1
:link /SUBSYSTEM:WINDOWS /debug %1
if errorlevel 1 goto errlink
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

It's got all those command-line switches that are needed, plus there is a "debug" flavor (commented out here) for when you need to look at your code using OllyDbug or some other debugger.

This version creates a regular Windows GUI application. To create a console app, replace SUBSYSTEM:WINDOWS with SUBSYSTEM:CONSOLE.

Invoke it without the ".asm" in the filename (or you can modify it to accept the full root filename).
Assembly language programming should be fun. That's why I do it.

ahsat

I have the program entry named entry_point.

Now the linker or assembler is adding a leading underscore to my public procs. Can anyone help with this one?
d:\masm32\AnyBase32>D:\masm32\bin\ml.exe /c /coff /Fl /Sg /Sn AnyBase.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: AnyBase.asm

***********
ASCII build
***********


d:\masm32\AnyBase32>D:\masm32\bin\polink.exe /SUBSYSTEM:CONSOLE /ENTRY:entry_point /OUT:AnyBase32.exe AnyBase.obj
POLINK: error: Unresolved external symbol '_entry_point'.