flat assembler
Message board for the users of flat assembler.
Index
> DOS > Input and Output String Goto page Previous 1, 2 |
Author |
|
estrang 11 Nov 2005, 09:22
Thnks for the help guys. I feel lazy today to read all these post. Ill probably read these when i wake up later.
Question: Ive read a lot about dos and bios function like in this thread. What are the dirrence between these 2 and which one you guys recommend to use? And when in C compiles a program similar to this. What does code it produce for dos or for bios?? |
|||
11 Nov 2005, 09:22 |
|
vbVeryBeginner 12 Nov 2005, 07:48
DOS function (INT) is the INT that only available when you are using DOS Operating System, whether MS-DOS or PC-DOS or DOS clones.
Bios (INT) are the INT that are mostly available in almost every x86 computer. DOS function (INT) are actually relies on BIOS INT, they are just wrapper functions that enhance the BIOS INT. In another meaning, DOS INT uses BIOS INT and depend on it. when C compile program, depend on wat output you want, if you compile for MS-DOS, then they would use DOS INT, if you compile for non-DOS, then they would use BIOS INT. |
|||
12 Nov 2005, 07:48 |
|
estrang 12 Nov 2005, 08:34
vbVeryBeginner wrote: DOS function (INT) is the INT that only available when you are using DOS Operating System, whether MS-DOS or PC-DOS or DOS clones. Thnks very much for the explanation. Now i understand quite a bit. |
|||
12 Nov 2005, 08:34 |
|
estrang 12 Nov 2005, 08:37
Can someone help me with this code?? This is supposed to be the short version of the problem im trying to do. Can someone convert this conde to fasm??
I got this from emu8086 tut. It has been very useful for me. So sad the author seemed to stopped updating his app. Code: org 100h mov dx, offset buffer mov ah, 0ah int 21h jmp print buffer db 10,?, 10 dup(' ') print: xor bx, bx mov bl, buffer[1] mov buffer[bx+2], '$' mov dx, offset buffer + 2 mov ah, 9 int 21h ret |
|||
12 Nov 2005, 08:37 |
|
vbVeryBeginner 12 Nov 2005, 09:02
wat u wanna do is almost quite similiar to wat xddxogm3 wanna do, try read this thread, it is almost the same. ur supplied function just want to prepend the "$" at the end of input string.
http://board.flatassembler.net/topic.php?t=4365 |
|||
12 Nov 2005, 09:02 |
|
estrang 12 Nov 2005, 09:11
I didnt see thnks.
|
|||
12 Nov 2005, 09:11 |
|
estrang 12 Nov 2005, 10:41
I decided to write my own function for learning purposes. And also becoz im having lots of problems with function 0Ah.
Can someone point me to what im doing wrong here?? The problem is commented below. tnks . Code: org 100h jmp start start: mov dx, msg1 ;param for function call below call func_printString call func_inputString mov dx, msgbuffer call func_printString terminate: mov ax, 4C00h int 21h func_inputString: mov ax, 0600h mov dx, 00FFh int 21h ret func_printString: mov cx, 0200h start_input: mov ax, 0900h int 21h cmp ah, 000Ah je exit_func mov byte [msgbuffer+cx], al ;Im trying to modify address in memory ;by using a counter. Like pointer arithmethic in C. ;But how come this wont work? ;Can someone tell me how to do a loop ;correctly with also using a counter variable?? inc cx jmp start_input exit_func: ret texts: msg1 db 'Enter a String:', 24h mm: msgbuffer db 0Fh, ?, 0Fh dup( 00h ), 24h Updated Code. Still not working Code: org 100h jmp start start: mov dx, msg1 ;param for function call below call func_printString call func_inputString mov dx, msgbuffer call func_printString terminate: mov ax, 4C00h int 21h func_inputString: mov cl, 02h mov ax, 0100h start_input: int 21h cmp al, ' ' je exit_func mov [msgbuffer+msgctr], al inc [msgctr] jmp start_input exit_func: mov [msgbuffer], 0Ah mov [msgbuffer+1], 0Dh ret func_printString: mov ax, 0900h int 21h ret texts: msg1 db 'Enter a String:', 24h mm: msgbuffer db 0Fh, ?, 0Fh dup( 'x' ), 24h msgctr db 02h |
|||
12 Nov 2005, 10:41 |
|
estrang 12 Nov 2005, 12:24
I got it working. But i use SI instead of CX for my counter variable. Is this recommended??
Code: org 100h jmp start start: mov dx, msg1 ;param for function call below call func_printString call func_inputString mov dx, msg2 call func_printString mov dx, msgbuffer call func_printString terminate: mov ax, 4C00h int 21h func_inputString: mov si, 01h mov ax, 0100h start_input: int 21h cmp al, 0Dh je exit_func mov [msgbuffer + si], al inc si jmp start_input exit_func: mov [msgbuffer + si], 24h ret func_printString: mov ax, 0900h int 21h ret texts: msg1 db 'Enter a String: ', 24h msg2 db 0Ah, 'You entered the String: ', 24h msgbuffer db 0Fh dup( 00h ), 24h |
|||
12 Nov 2005, 12:24 |
|
vid 14 Nov 2005, 16:07
maybe this... i am not sure about dup, i don't use it. and i suppose buffer[x] = [buffer + size_of_buffer_element*x]
Code: org 100h mov dx, buffer mov ah, 0ah int 21h jmp print buffer db 10, ?, 10 dup(' ') print: xor bx, bx mov bl, [buffer + 1] mov [bx+buffer + 2], '$' mov dx, buffer + 2 mov ah, 9 int 21h ret |
|||
14 Nov 2005, 16:07 |
|
estrang 14 Nov 2005, 16:16
Thnks for the conversion. Though it doesnt seem to work like the emu8086 version.
|
|||
14 Nov 2005, 16:16 |
|
daluca 16 Nov 2005, 07:07
Code: org 100h mov dx,buffer ;WE SET DE BUFFER mov ah,0ah int 21h ;AND CALL INT 21H FOR USER INPUT ;----------------------- jmp print ;WE JUMP THE BUFFER ;----------------------- buffer db 10,?, 10 dup ' ' ;WE DEFINE THE BUFFER: ;10 CHARACTERS MAXIMUM ;IN THE ? THE INT 21 WILL ;PUT A BYTE WITH THE NUMBER ;OF CHARACTERS THE USER ;INPUTED. 10 DUP ' ' MEANS ;DUPLICATE 10 TIMES THE CHARACTER ;THAT IS INSIDE THE QUOTES(= SPACE) print: xor bx,bx ;WE MAKE BX = 0 ,FASTER THAN MOV BX,0 mov bl,[buffer+1] ;WE MOVE THE NUMBER OF CHARACTERS TYPED TO BL ;[buffer] = 10,[buffer+1] = ?, ;now bx = number of characters inputed mov [bx + buffer +2],'$' ;we move the $ sign to the end of the string ;= buffer + lenght in bx + 2(to skip the 10,?) ;---------------------------- mov dx,buffer+2 ;and print the result mov ah,9 int 21h ret ;and exit if you compile this and run it you get the prompt were you type your name and after presing enter it will look like nothing hapens becouse your name is being printed over your typed name, to see more clearly the result after the mov [bx+buffer+2],'$' put the next line: mov word[buffer],0a0dh and instead of the line mov dx,buffer+2 put: mov dx,buffer so the line feed and carriage return get printed. and you can see what you type. if you want more characters just replace the 10's with any value you want (up to 255) |
|||
16 Nov 2005, 07:07 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.