flat assembler
Message board for the users of flat assembler.
Index
> DOS > toupper |
Author |
|
shaolin007 01 Sep 2005, 20:16
I did this one in NASM but you could easily do it in FASM with a little bit of modification. It asks for input then converts it then displays the modified string.
Code: ;NASM-IDE ASM Assistant Assembler Project File BITS 16 ;Set code generation to 16 bit mode ORG 0x0100 ;Set code start address to 0100h ;TO UPPERCASE USING DOS SERVICES, SIMPLER VERSION! SEGMENT .text ;Main code segment mov ax, 0003h int 10h mov ah, 9 mov dx, msg int 21h mov ah, 0ah mov dx, buffer int 21h mov si, buffer+2 cld call To_Uppercase mov ah, 9 mov dx, crlf int 21h mov ah, 9 mov dx, toupper int 21h mov ah, 9 mov dx, buffer+2 int 21h mov ah, 9 mov dx, crlf int 21h mov ah, 9 mov dx, anykey int 21h mov ah, 0 int 16h mov ax, 4c00h int 21h To_Uppercase: cmp byte [si], '$' je Done lodsb and al, 11011111b mov [ds:si-1], al jmp To_Uppercase Done: ret SEGMENT .data ;Initialised data segment msg db "Please enter up to 16 characters to convert to uppercase: ",'$' buffer db 17 db 0 times 17 db 0 db '$' crlf db 10,13,10,13,'$' toupper db "Conversion to uppercase: ",'$' anykey db "Press any key to continue",'$' SEGMENT .bss ;Uninitialised data segment [/code] |
|||
01 Sep 2005, 20:16 |
|
Matrix 03 Sep 2005, 19:48
Denial,
i think you have done a good work translating toupper and it should meet all your needs in converting, for code size and for speed too. it should be optimal performance. as for the byte to string conversion, see some examples (working codes) on how to write byte value word value / dword value on to screen. basically it is tha same apart from that text mode screen needs 1 byte for color and 1 byte for character value. example for rendering byte value into string you make divisions by 10 ( for base 10 conversion ) and write mod. until byte value is 0. |
|||
03 Sep 2005, 19:48 |
|
denial 04 Sep 2005, 10:15
Thank you very much... I'll look at some examples and give it a try.
|
|||
04 Sep 2005, 10:15 |
|
Matrix 04 Sep 2005, 18:01
i' ve split this to so easier to find, and has own thread:
how to convert byte to string http://board.flatassembler.net/topic.php?t=4083 |
|||
04 Sep 2005, 18:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.