flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > High Level DOS macros |
Author |
|
me239 22 Feb 2011, 05:59
Hello everyone! Today I would like to post some macros I made with FASM for, but not limited to, DOS. These macros may not be the most efficient, but they blow QBasic out of the water when it comes to size (obviously). The macros go as the following:
print - accepts either null-terminated string, direct quotes, or numbers in a register to printed as decimal input(my favorite) - accepts up to 255 characters and stores it in a predefined buffer createfile - creates files. Accepts either quotes or string followed by permissions openfile - opens files. Accepts either quotes or string followed by permisstions. handle returned in BX writefile - writes to file. Accepts quote marks or string followed by bytes to write and whether to append, prepend, or current location(2, 0, 1 respectively) exit - exits program newline - creates newline on the far left keywait - pauses program and makes user press any key to continue Here is a sample program using all functions Code: format MZ ; exe file include 'macro.inc' ; include our macros start: mov cx, 54d print "Hello, ", msg, cx ; prints 2 messages followed by number input buffer, 0ffh ; accept input into buffer up to 255 bytes createfile "hello.txt", 0 ; create file "hello.txt" as a readable writable file openfile "hello.txt", 2 ; open "hello.txt" as read/write permissions xchg ax, bx ; put file handle in BX writefile buffer, 0ffh, 2 ; append file, write 255 bytes of buffer newline print "Process Done!" exit msg db "what is your name", 0 counter db 0 ; required as counter for input directive buffer db 256 dup (0) ; 256 byte buffer. Extra byte is so that the string ends on 0 remember, all of this code(except file operations) can be modified to boot. Just replace "format MZ" with org 7c00h and round file off to 512 bytes. ENJOY!!!
Last edited by me239 on 23 Feb 2011, 03:30; edited 1 time in total |
|||||||||||
22 Feb 2011, 05:59 |
|
me239 23 Feb 2011, 03:29
Dex4u wrote:
|
|||
23 Feb 2011, 03:29 |
|
edfed 25 Feb 2011, 22:16
fasm macro system as a programming language, to program langages, and then. very cool!
but where are the bloat ( ) % ? ho yeah, no need because of asm. for create file, openfil, etc... why not implement a basic file system??? make the brigde between DOS and your new file system to import files... and so on... the world don't comes in one day |
|||
25 Feb 2011, 22:16 |
|
wht36 26 Feb 2011, 03:24
Very nice! I remember seeing something similar in MASM before ... MASMBasic, I think. It would be nice to have a FASM basic as well!
|
|||
26 Feb 2011, 03:24 |
|
rCX 24 Mar 2011, 03:26
|
|||
24 Mar 2011, 03:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.