flat assembler
Message board for the users of flat assembler.
Index
> DOS > EXE vs COM | Dos Read String/Output String Error Goto page Previous 1, 2 |
Author |
|
Tomasz Grysztar 11 Mar 2012, 09:35
DOS386 wrote: DOS is dumb so your "format binary org $0100" may work, but it's faulty. |
|||
11 Mar 2012, 09:35 |
|
DOS386 11 Mar 2012, 09:39
> DOS recognizes the executable by its header, not by extension
Right ... but it's still dumb. Rename "FASM.TXT" into "FASM.COM" and type "FASM" -> hangs IIRC DOS will even hapilly "launch" an empty ZERO-Byte's-file and hang Anything without MZ "qualifies" as DOS COM ... |
|||
11 Mar 2012, 09:39 |
|
freecrac 11 Mar 2012, 09:47
drewtoby wrote: Hello, I am new to dos and am working on a basic dos code inspired by: http://www.skynet.ie/~darkstar/assembler/tut5.html Ralf Browns x86/MSDOS Interrupt List (RBIL) http://www.pobox.com/~ralf http://www.pobox.com/~ralf/files.html ftp://ftp.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/ RBIL->inter61a.zip->Interrup.a Quote:
RBIL->inter61b.zip->Interrup.f Quote:
RBIL->inter61b.zip->Interrup.g Quote:
Dirk |
|||
11 Mar 2012, 09:47 |
|
Tomasz Grysztar 11 Mar 2012, 09:51
DOS386 wrote: Right ... but it's still dumb. Rename "FASM.TXT" into "FASM.COM" and type "FASM" -> hangs BTW, to convert the source of .com program into MZ executable, it should work to put this on top of the source: Code: format MZ segment text PSP = text - 10h entry PSP:start stack PSP:0FFFEh org 100h ... And, as another side note, this is a kind of .com to .exe conversion that fasm does when you specify a non-MZ file as a stub for PE. |
|||
11 Mar 2012, 09:51 |
|
shutdownall 11 Mar 2012, 20:35
drewtoby wrote: @shutdownall: tried to get your code to display 0 after any string has been entered, only the zero will display over and over again once a char is entered. Well, it has the beeping and random chars (charector) outputs over and over again . Just like my code above First, you call print function (ah,9) but you do not set dx register. dx has to point to the string you want to display. So what the hell should the funtion print instead of some random data. Second, string has to end with '$' not with 0. I put the 0 at the end because it looks nicer, but not necessary. But '$' is necessary. Third, you have to manually exit the program with int 21h and ah,0. If you do not, program will continue and execute the code at label msg. Which causes CPU to execute random data. You should read the DOS functions carefully, what you need for input and what is output. Also take in mind that some register contents are destroyed after calling int 21h. Normally ax is used as feedback, contains 0 if function successful or error code if not successful. Not always. int 21h functions are very simple but you have to read the manual carefully. I propose to use Ralph Brown's interrupt list, can find with google. |
|||
11 Mar 2012, 20:35 |
|
avcaballero 12 Mar 2012, 09:17
Maybe help... but only com source, most of them nasm sintax
URL NForum.7z * Age. Asked how old are you, and you have to insert it using keyboard. The program answer accordingly your age. * Guess. Game of the secret number between 1 and 30. * GuessF. The same for the FASM compiler. * Length. Returns the length of a string. * Rpstrcn1. Replace one string within another. * Strings. Prints a string and its length. Regards _________________ Siempre aprendiendo |
|||
12 Mar 2012, 09:17 |
|
drewtoby 12 Mar 2012, 23:56
Okay, thanks! I'll look over those the next couple days, and they should help a lot!!!!!
|
|||
12 Mar 2012, 23:56 |
|
shutdownall 13 Mar 2012, 00:06
drewtoby wrote: Okay, thanks! I'll look over those the next couple days, and they should help a lot!!!!! Believe me, reading carefully helps more than just to take a look on the code. Regardless what documentation or examples you use. |
|||
13 Mar 2012, 00:06 |
|
p3rlphr33k 07 Apr 2012, 03:17
I am only coding this to learn the language so please dont make fun of my awful code
I had the same issue with getting symbols and beeps, i managed to get passed the issue, but now it appears the text is being hidden by previous lines (if this makes sense). Any one seen this type of problem before? Here is my learning code: Code: org 256 ;make COM instead of BIN mov ah,09h mov dx,mesg int 21h jmp FETCH FETCH: mov ah,0Ah ;call keyboard buffered input mov dx,buffer ;move buffer of 5 chars to data register int 21h jmp HELLO HELLO: mov ah,09h ;call display mov dx,ello ;print hello int 21h jmp KEYS KEYS: mov ah,09h ;call display mov dx,buffer ;mov buffer int 21h jmp BR BR: mov ah,09h mov dx,CRLF int 21h jmp FETCH EXIT: mov ax,4C00h ;call EXIT int 21h buffer db 10 ;Buffer of 10 mesg db 'Welcome to test',13,10,'Enter text:','$' ello db 'Hello $' CRLF db 13,10 db '$' ;rest db to NULL I think I might need to clear the screen before printing the buffer. Would that solve my problem? PS - I know the code loops, i plan on adding CMP soon to read input _________________ -p3rlphr33k- (Soon to be ASMphr33k) |
|||
07 Apr 2012, 03:17 |
|
Picnic 07 Apr 2012, 07:07
|
|||
07 Apr 2012, 07:07 |
|
freecrac 07 Apr 2012, 18:46
Try this sample:
Code: mov ah,0Ah ; call keyboard buffered input mov dx,buffer ; move buffer of 10 chars to data register mov si,dx ; store address of buffer int 21h xor bx,bx ; clear register mov bl,[si+01h] ; number of chars from last input mov [si+bx+3],"$" ; after CR we place a "$" mov ah,09h ; call display mov dx,buffer+02h ; mov buffer int 21h EXIT: mov ax,4C00h ; call EXIT int 21h buffer db 10, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "$" ; Format of DOS input buffer: ; Offset Size Description (Table 01344) ; 00h BYTE maximum characters buffer can hold ; 01h BYTE (call) number of chars from last input which may be recalled (ret) number of characters actually read, excluding CR ; 02h N BYTEs actual characters read, including the final carriage return (placeholder for 10 chars + CR) ;-------------------------------------- ; $ (placeholder for string output function 09h) Dirk |
|||
07 Apr 2012, 18:46 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.