Re: Another one
Avatar Zondertau wrote:
Avatar,
Thank you.
How about this one? It also produces an 'Operand size mismatch'
mov Result+1, al // save to allocated string/last position {<---}
For other questions it might be useful if you also provided the
declarations for the variables and types involved.
You're right. I should have.
Here is the function the above line comes from. Marked with {<---}
function Hexs(const byte: byte; const uppercase: boolean = YES): string;
const
ByteDigits = 2;
asm
//PUSH Result //@Result = ECX
PUSH ebx
lea ebx, HEX_UPPERCASE +1 // init ebx with default value
test uppercase, 1 // is uppercase flag = YES?
jne @skipsetlocase // nz = YES, then dont bother to kowercase
lea ebx, HEX_LOWERCASE +1 // uppercase flags = FALSE
@skipsetlocase:
mov ah, al; push eax // save copy first
mov eax, Result // where the result will be stored
call System.@LStrClr // cleared for ease
mov edx, ByteDigits // how much length of str requested
call System.@LStrSetLength// result: new allocation pointer in EAX
mov Result, [eax] // eax contains the new allocated pointer
// we got the storage as well at once
pop eax
and al, $f; xlat // strip high nibbles, translate
mov Result+1, al // save to allocated string/last position {<---}
mov al, ah
shr eax, 3 * 4 // shift 3 nibbles away (high nibble of AH)
and al, $f; xlat // strip high nibbles, translate
mov [Result], al // save to allocated string / first position
//mov Result, edx
//call System.@LStrLAsg
pop ebx
mov eax, @Result
end;
Cheers
Adem
.
Relevant Pages
- Re: Preventing XP from knowing that you program crashed.
... > Delphi for 10 years would know a thing or two about exception ... call APISelectObject D$gBackBufferDC eax ... mov D$OldPen eax ... mov ebx D@ColIndex ... (alt.lang.asm) - Re: US Military Dead during Iraq War
... jz good_command_line mov esi, ... int 80h or eax, eax jns goodopen neg eax call showeaxd jmp exit ... mov ebx, eax xor ecx, ecx mov edx, 2; ... (alt.lang.asm) - Re: Which assembler (or compiler) to start with? (newbie question)
... xor ebx ebx ... cmp eax 1 | jc ExitProg ... mov ecx d$current_column, edx d$current_row ... (alt.lang.asm) - Re: Fastcode UpperCase B&V 3.0 -2
... test edx, edx ... test ecx, ecx ... sub ebx, 1 ... mov eax, ... (borland.public.delphi.language.basm) - Re: Official release of the Twelve Assembly Lessons
... bubble sort" is that it's too complex to do the job in assembly ... lea ebx D$edi+ecx*4 | mov eax D$edi ... (alt.lang.asm) |
|