flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Matrix 07 Oct 2005, 04:37
vid, you know what i mean.
you dont have to explain type casting to me. |
|||
![]() |
|
Bitdog 09 Oct 2005, 09:29
Here's some upper/lower info for ya to mess with......
Bit 5 is the toggle for Lower case or upper case alph. If the character is in AL OR AL,00100000b ;to lower case (32d or 20h = binary shown) AND AL,11011111b ; to upper case (223d or 0DFh = binary shown) |
|||
![]() |
|
rugxulo 10 Oct 2005, 07:51
xor al,20h ; toggle case
Bitdog wrote: Here's some upper/lower info for ya to mess with...... |
|||
![]() |
|
vid 10 Oct 2005, 12:35
matrix:
![]() |
|||
![]() |
|
vbVeryBeginner 13 Nov 2005, 13:19
hi, could i know why the mov bx, 10 must be inside loop?
Code: .loop: xor dx,dx mov bx,10 div bx add dl,"0" mov [si],dl dec si loop .loop i mean, it could be put before the loop, since nobody would modify the content of bx. Code: mov bx,10 .loop: xor dx,dx div bx add dl,"0" mov [si],dl dec si loop .loop |
|||
![]() |
|
Matrix 28 Nov 2005, 00:39
vbVeryBeginner:
true true Bitdog wrote: Here's some upper/lower info for ya to mess with...... yes, indeed, if you read http://maven.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html there are some advanced codes with magical values on this forum i remember too, that use "magical values" for this type of conversion, so sub, add in this case can be left out, logical operations are simpler than addition, substraction. ( however on modern processors they can be even paralleled, and we are moving towards risc architecture, more and more segments of processor working in parallel, so not big difference, but its there. ) anyway there can be a case when you need range checking too, you cant convert "1%%!/=" for example to upper case, and not convert binary digit "z" to ascii digit . |
|||
![]() |
|
SDragon 29 Nov 2005, 12:08
Code: toupper: ; input: [ecx] = string @@: ; uses eax, edx movzx edx, byte[ecx] lea eax, [edx - 'a'] sub eax, 26 sbb eax, eax ; all zeros if eax < 26, all ones otherwise and eax, 'a' - 'A' sub byte[ecx], al add ecx, 1 test edx, edx jne @B ret tolower: ; input: [ecx] = string @@: ; uses eax, edx movzx edx, byte[ecx] lea eax, [edx - 'A'] sub eax, 26 sbb eax, eax ; all zeros if eax < 26, all ones otherwise and eax, 'a' - 'A' add byte[ecx], al add ecx, 1 test edx, edx jne @B ret Sorry for 32-bit code. Hope you can adapt this for DOS ![]() |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.