| | |
strings in assembly
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hi everyone,
got a slight problem. trying to make a program that takes the users input and puts it into a string untill it detects a CR character then outputs the string, i've made a start but i'm at a dead end on what to do.
thanks in advance for any help
-Midi
got a slight problem. trying to make a program that takes the users input and puts it into a string untill it detects a CR character then outputs the string, i've made a start but i'm at a dead end on what to do.
ASM Syntax (Toggle Plain Text)
BITS 16 ;Set code generation to 16 bit mode ORG 0x0100; SECTION .text; MAIN: %include 'STDIO.asm' mov bx , offset Array ;store start of array in bx call Getch ;read in first character to register while1: cmp DL, 0dh ;while character is not equal to cr je Next mov byte ptr [bx], DL ;assign the value of DL to position bx in the array inc bx; increment bx call Getch;read in next character to DL register jmp while1 Next: mov bx , offset Array ;set bx to the start of Array while2: cmp byte ptr[bx] , 0dh;while character is not equal to cr je Exit mov DL , byte ptr[bx]; set DL to be equal to the value at BX in the array call Putch ; puts the character in DL onto the screen inc BX jmp while2 Exit: MOV AH,04Ch ; Select exit function MOV AL,00 ; Return 0 INT 21h ; Call the interrupt to exit SECTION .bss Array resb (20*1)
thanks in advance for any help
-Midi
EDIT:
Using NASM with the 80x86
I get this error
"Comma or End of Line Expected" on these lines
Using NASM with the 80x86
I get this error
"Comma or End of Line Expected" on these lines
ASM Syntax (Toggle Plain Text)
mov bx , offset Array ;store start of array in bx mov byte ptr [bx], DL ;assign the value of DL to position bx in the array mov bx , offset Array ;set bx to the start of Array cmp byte ptr[bx] , 0dh;while character is not equal to cr mov DL , byte ptr[bx]; set DL to be equal to the value at BX in the array
well i have written the program in tasm and it works fine .
the programmin stlye is a bit different but i guess u can undestand
i guess this should do the trick .
the programmin stlye is a bit different but i guess u can undestand
Assembly Syntax (Toggle Plain Text)
.model small .stack 40 .data str1 db 50 dup('$') msg db 10,13, 'enter the str1ing : $' disp db 10,13, 'displaying the str1ing : $' .code mov ax,@data mov ds,ax lea dx,msg mov ah,09h int 21h lea si,str1 ; making si to hold the starting address xor cx,cx ; clearing cx register lp: mov ah , 01h ; the first two lines are to read from keyyboard int 21h cmp al 0dh ; compares until we press enter character jz stop mov [si] , al ; if enter key is not pressed contents are stored in inc si ; string and si is incremented inc cx jmp lp stop: lea dx , disp mov ah,09h int 21h lea si , str1 lpz: mov dl , [si] mov ah , 02h ; the first two lines displays the data int 21h inc si dec cx jnz lpz mov ah,4ch int 21h end
i guess this should do the trick .
<?php
$data = $_POST['data'];
if(empty($data)) {
echo "byte me" ; }
?>
$data = $_POST['data'];
if(empty($data)) {
echo "byte me" ; }
?>
![]() |
Similar Threads
- Assembly language comparing strings (Assembly)
- I Need Assembly help w/reversing strings (Assembly)
- separating strings (Assembly)
- Assembly, machine code and compilers (Assembly)
Other Threads in the Assembly Forum
- Previous Thread: Assembly project problem
- Next Thread: help me assembler
| Thread Tools | Search this Thread |
Tag cloud for Assembly
3d 68hc11 6811 80386 adress array asm assembler assembly boot bootloader buffer compression cursor debug directory division docs dos draw emulator endtask error exceptions file int10h integer intel interrupt interrupts language loop nohau osdevelopment print program range read remainder shape string text theory tsr x86





