Changeset 78 in xtideuniversalbios for trunk/Configurator/Src/Libraries/string.asm
- Timestamp:
- Jan 5, 2011, 7:36:41 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Configurator/Src/Libraries/string.asm
r75 r78 2 2 ; Project name : String library 3 3 ; Created date : 7.10.2009 4 ; Last update : 20.12.20094 ; Last update : 4.1.2011 5 5 ; Author : Tomi Tilli, 6 ; : Kri lle(optimizations)6 ; : Krister Nordvall (optimizations) 7 7 ; Description : ASM library to work as Standard C String and Character. 8 8 … … 130 130 String_IsHexDigit: 131 131 call String_IsAlphaNum ; Is alphabetic letter or digit? 132 jc .CheckHex ; If so, jump to check A...F 133 ret 134 .CheckHex: 132 jnc .ExitStrIsHexDigit ; If it is, check A...F. If not, exit 135 133 push ax ; Store character 136 134 call String_ToLower ; Convert to lower case letter 137 135 cmp al, 'f'+1 ; Last valid hex alphanumeric? 138 136 pop ax ; Restore character 137 138 .ExitStrIsHexDigit: 139 139 ret 140 140 … … 165 165 mov ah, al ; Copy char to AH 166 166 call String_IsDigit ; Is '0'...'9'? 167 jc .ConvertDigit ; If so, jump to convert 167 jnc .CheckForAlpha ; If not, check for alphabetic letter 168 sub al, '0' ; Convert char to integer 169 jmp .FinalizeAXAndCheckBase 170 171 .CheckForAlpha: 168 172 call String_IsAlpha ; Is alphabetic letter? 169 jnc . RetFalse ;If not, return FALSE173 jnc .JustRet ; If not, return FALSE 170 174 call String_ToLower ; Convert to lower case 175 sub al, 'a'-10 ; From char to integer: a=10, b=11... 176 177 .FinalizeAXAndCheckBase: 171 178 xchg al, ah ; Converted char to AH 172 sub ah, 'a'-10 ; From char to integer: a=10, b=11...173 179 cmp ah, cl ; Belongs to base? 174 jae .RetFalse ; If not, return FALSE 175 stc ; Set CF since belongs to base 176 ret 177 ALIGN JUMP_ALIGN 178 .ConvertDigit: 179 sub ah, '0' ; Convert char to integer 180 cmp ah, cl ; Belongs to base? 181 jae .RetFalse ; If not, return FALSE 182 stc ; Set CF since belongs to base 183 ret 184 ALIGN JUMP_ALIGN 185 .RetFalse: 186 clc ; Clear CF since char doesn't belong to b 180 181 .JustRet: ; CF now reflects TRUE/FALSE so just return 187 182 ret 188 183 %endif … … 324 319 jnz .CharLoop ; Loop while characters left 325 320 326 mov ax, bx ; Copy loword to AX 321 stc ; Set CF since success 322 .RetFalse: ; If we jumped to here no CLC is needed to reflect a FALSE condition 323 mov ax, bx ; Copy loword to AX (may be incomplete) 327 324 pop bx ; Restore BX 328 325 pop di ; Restore DI 329 326 pop si ; Restore SI 330 327 pop ds ; Restore DS 331 stc ; Set CF since success332 ret333 ALIGN JUMP_ALIGN334 .RetFalse:335 mov ax, bx ; Copy (likely incomplete) loword to AX336 pop bx ; Restore BX337 pop di ; Restore DI338 pop si ; Restore SI339 pop ds ; Restore DS340 clc ; Clear CF since error341 328 ret 342 329 %endif … … 448 435 ALIGN JUMP_ALIGN 449 436 .Str2NotFound: 450 xor bx, bx ; Zero BX 437 xor bx, bx ; Zero BX and clear CF 451 438 pop si ; Restore SI 452 439 pop cx ; Restore CX 453 clc ; Clear CF since str2 was not found454 440 ret 455 441 %endif … … 578 564 ALIGN JUMP_ALIGN 579 565 .ConvComplete: 580 mov ax, bx ; Copy loword to AX 566 stc ; Set CF since success 567 ALIGN JUMP_ALIGN 568 .RetFalse: ; If we jumped to here no CLC is needed to reflect a FALSE condition 569 mov ax, bx ; Copy loword to AX (may be incomplete) 581 570 pop bx ; Restore BX 582 571 pop si ; Restore SI 583 572 pop ds ; Restore DS 584 stc ; Set CF since success585 ret586 ALIGN JUMP_ALIGN587 .RetFalse:588 mov ax, bx ; Copy (likely incomplete) loword to AX589 pop bx ; Restore BX590 pop si ; Restore SI591 pop ds ; Restore DS592 clc ; Clear CF since error593 573 ret 594 574 %endif
Note:
See TracChangeset
for help on using the changeset viewer.