| | |
int 21h/ah=09h string output
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 29
Reputation:
Solved Threads: 0
im using fasm (flat assembler 1.68), and im trying to output a string with int21h/ah=09h
this code outputs "hello world", but it outputs some control characters before it ([SOME WEIRD CONTROL CHARACTERS]hello world)
so how can i fix this?
Assembly Syntax (Toggle Plain Text)
jmp main msg db "hello world$" main: mov dx, msg mov ah, 09 int 21h
this code outputs "hello world", but it outputs some control characters before it ([SOME WEIRD CONTROL CHARACTERS]hello world)
so how can i fix this?
•
•
Join Date: Dec 2007
Posts: 33
Reputation:
Solved Threads: 4
0
#2 17 Days Ago
Strange.
Presumably DOS, or you'd get nothing.
I notice the lack of a return statement. The control chars may appear at the beginning of the line, but that doesn't mean they were printed before your message. You might be running past the end of your program, and hitting something that moves the cursor, then prints who-knows-what.
Also, I don't see any segment setup, so this is a com program?
Presumably DOS, or you'd get nothing.
I notice the lack of a return statement. The control chars may appear at the beginning of the line, but that doesn't mean they were printed before your message. You might be running past the end of your program, and hitting something that moves the cursor, then prints who-knows-what.
Also, I don't see any segment setup, so this is a com program?
•
•
Join Date: Dec 2008
Posts: 29
Reputation:
Solved Threads: 0
0
#3 17 Days Ago
•
•
•
•
Strange.
Presumably DOS, or you'd get nothing.
I notice the lack of a return statement. The control chars may appear at the beginning of the line, but that doesn't mean they were printed before your message. You might be running past the end of your program, and hitting something that moves the cursor, then prints who-knows-what.
Also, I don't see any segment setup, so this is a com program?
even if i put
Assembly Syntax (Toggle Plain Text)
mov ah, 4Ch int 21h
i still see control characters before my message
•
•
Join Date: Dec 2007
Posts: 33
Reputation:
Solved Threads: 4
0
#4 17 Days Ago
Hmmm... not a fasm user, so just some other observations. No org statement, or use 16 statement. Thought fasm syntax was a dollar symbol before hex numbers, but that may be optional. Some assemblers need exe2bin to fix linkage of programs. Maybe give us the whole program and the process you follow and it could attract a solution.
Actually, it's so short, a dir listing of executable (so we see file size) and use debug to dump the contents, and post it here.
Actually, it's so short, a dir listing of executable (so we see file size) and use debug to dump the contents, and post it here.
Last edited by dan63043; 17 Days Ago at 2:54 am. Reason: Add request for debug output
•
•
Join Date: Dec 2008
Posts: 29
Reputation:
Solved Threads: 0
0
#5 16 Days Ago
•
•
•
•
Hmmm... not a fasm user, so just some other observations. No org statement, or use 16 statement. Thought fasm syntax was a dollar symbol before hex numbers, but that may be optional. Some assemblers need exe2bin to fix linkage of programs. Maybe give us the whole program and the process you follow and it could attract a solution.
Actually, it's so short, a dir listing of executable (so we see file size) and use debug to dump the contents, and post it here.
Assembly Syntax (Toggle Plain Text)
1462:0100 EB0C JMP 010E 1462:0102 68 DB 68 1462:0103 65 DB 65 1462:0104 6C DB 6C 1462:0105 6C DB 6C 1462:0106 6F DB 6F 1462:0107 20776F AND [BX+6F],DH 1462:010A 726C JB 0178 1462:010C 64 DB 64 1462:010D 24BA AND AL,BA 1462:010F 0200 ADD AL,[BX+SI] 1462:0111 B409 MOV AH,09 1462:0113 CD21 INT 21 1462:0115 B44C MOV AH,4C 1462:0117 CD21 INT 21 1462:0119 0200 ADD AL,[BX+SI] 1462:011B B409 MOV AH,09 1462:011D CD21 INT 21 1462:011F B44C MOV AH,4C -u 1462:0121 CD21 INT 21
•
•
Join Date: Dec 2007
Posts: 33
Reputation:
Solved Threads: 4
0
#6 16 Days Ago
Ha! Isn't funny how we overlook the obvious? When you pointed DX at 0002, you forgot that your program actually loads at 0100. Just change
to
BTW, here's how to use debug to get a decent listing (ok, pathetic listing, but we're using "debug")
Assembly Syntax (Toggle Plain Text)
MOV DX,0002
Assembly Syntax (Toggle Plain Text)
MOV DX,0102
BTW, here's how to use debug to get a decent listing (ok, pathetic listing, but we're using "debug")
Assembly Syntax (Toggle Plain Text)
-u100,101 139A:0100 EB0C JMP 010E -d102,10d 139A:0100 68 65 6C 6C 6F 20-77 6F 72 6C 64 24 hello world$ -u10e,122 139A:010E BA0200 MOV DX,0002 139A:0111 B409 MOV AH,09 139A:0113 CD21 INT 21 139A:0115 B44C MOV AH,4C 139A:0117 CD21 INT 21 139A:0119 0200 ADD AL,[BX+SI] 139A:011B B409 MOV AH,09 139A:011D CD21 INT 21 139A:011F B44C MOV AH,4C 139A:0121 CD21 INT 21
![]() |
Similar Threads
- int 21 causes an access violation (Assembly)
- any way to write to a string to an output file? and also why do i get this error? (C++)
- bios level video instructions (Assembly)
- Simple Assembly Copy Program using int 21h (Assembly)
- lower-case to upper-case (Assembly)
- problem with output values (Assembly)
- convert uppercase into lower case (Assembly)
- better way or technique to write this (Assembly)
- Confused~~please help me~~ (Assembly)
Other Threads in the Assembly Forum
- Previous Thread: x86 help with procedures
- Next Thread: Trying to analyse code
| Thread Tools | Search this Thread |





