| | |
cant get ah = 0ah to work!
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
You aren't saying what's happening, and you aren't mentioning your toolset.
See if <buffer> is in its own segment or sitting at 0100h in the code instruction pointer path!
See if <buffer> is in its own segment or sitting at 0100h in the code instruction pointer path!
Assembly Syntax (Toggle Plain Text)
buffer db 10,?, 10 dup(' ') ; Get Buffered Keyboard input mov dx, offset buffer mov ah, 0ah ; Command Buffered Keyboard Input int 21h ; DOS interrupt ; 0:bufsize, 1:char count, 2...N buffer xor bx,bx mov bl, buffer[1] ; mov buffer[bx+2], '$' mov buffer[bx+1], '$' ; Replace carriage return with terminator mov dx, offset buffer + 2 mov ah,09 int 21h ;;;; ret mov ah,4ch int 21h
•
•
Join Date: Sep 2009
Posts: 7
Reputation:
Solved Threads: 0
I've used masm32 only for debugin stuff, I usually assemble my own code so I can have it be more efficient, even though its a time waster.
I looked at what you got, there's nothing wrong with it, so i debugged it, and I saw that the values of the DS and CS when the program was loaded are different, and when I assembled it with the linker, it sticks both the code section and the data section together, so the address being loaded into the DX register was pointing to the wrong data,
Try sticking this in before you start:
also, it looks like you are not giving your program a time where it will wait to show you the result, you might want to add a keyboard wait after you have the string displayed back like:
I tried it, it worked, but it may look like it doesn't do any thing, because the string that is typed into the buffer is cleared from the screen after it is inputted, so it looks as though nothing really happens, but its working.
I looked at what you got, there's nothing wrong with it, so i debugged it, and I saw that the values of the DS and CS when the program was loaded are different, and when I assembled it with the linker, it sticks both the code section and the data section together, so the address being loaded into the DX register was pointing to the wrong data,
Try sticking this in before you start:
Assembly Syntax (Toggle Plain Text)
mov ax,cs mov ds,ax
also, it looks like you are not giving your program a time where it will wait to show you the result, you might want to add a keyboard wait after you have the string displayed back like:
Assembly Syntax (Toggle Plain Text)
mov ah,00h int 16h
I tried it, it worked, but it may look like it doesn't do any thing, because the string that is typed into the buffer is cleared from the screen after it is inputted, so it looks as though nothing really happens, but its working.
Assembly Syntax (Toggle Plain Text)
bits 16 org 100h jmp start buf db 32,0 times 32 db 0 start: mov dx,buf mov ah,0ah ;you called function 0ah correctly int 21h ;you terminated the string and used function 09h correctly mov bl,[buf+1] xor bh,bh mov byte [bx+buf+2],24h mov dx,buf+2 mov ah,09 int 21h int 20h
Last edited by NotNull; Sep 6th, 2009 at 2:24 pm.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
![]() |
Similar Threads
- Need 2 techies for tech-support, work from home (Tech / IT Consultant Job Offers)
- Requesting shadowing work at home job (Software Development Job Offers)
- 3D Engine Developer Needed from India - Work from home (Web Development Job Offers)
Other Threads in the Assembly Forum
- Previous Thread: Input Characters
- Next Thread: Writing *.bin Files To Floppy in Windows
| Thread Tools | Search this Thread |





