flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > Command-Line Interpreter Goto page 1, 2, 3 Next |
Author |
|
roboman 23 Feb 2010, 03:07
OpenDos / DR dos might be a good starting point to look at http://drdosprojects.de/
It's in asm open source and has a good batch processor (nearly the same as ms dos) Batch 'programs' are stored in a *.bat file. They were a left over thing from mainframes, where you would write a little script that would run a batch of programs over night or over the weekend. When desktops came around, IBM / Microsoft included the ability to run batch scripts and even expanded it a little. MS & DR dos will both run a batch file called autoex.bat when they start and a lot of programs for Dos were started with a bat file, to make sure the drivers and other things were setup right |
|||
23 Feb 2010, 03:07 |
|
adroit 23 Feb 2010, 03:41
Thanks for the info.
I checked out DR DOS and, but it's a bit complicated. I was thinking of designing my interpreter purely from assembly. Do you know any open sources like that where I can study the code. |
|||
23 Feb 2010, 03:41 |
|
DOS386 18 Mar 2010, 07:18
> OpenDos / DR dos might be a good starting point to look at http://drdosprojects.de/
> It's in asm open source and has a good batch processor (nearly the same as ms dos) Only the kernel is in (not-F)ASM, command thing is in C > I'd like to announce my idea of a command-line interpreter. DOS or Win32 ??? > Do you know any open sources like that where I can study the code. NO. All known are in C |
|||
18 Mar 2010, 07:18 |
|
adroit 18 Mar 2010, 11:55
Oh OK! Thanks!!
|
|||
18 Mar 2010, 11:55 |
|
baldr 18 Mar 2010, 15:31
MeshNix,
MS-DOS command.com had strange but useful feature: it closed the batch file after the line was parsed (remembering the offset at which the next line will be, to reopen and read later), so current command can modify .Bat and enjoy the possibility of self-modifying batch. 4DOS shell simulated this behavior and have separate .BTM (Batch-to-memory) files for immutable contract. |
|||
18 Mar 2010, 15:31 |
|
adroit 18 Mar 2010, 15:52
That is similar to call, and ret, but instead, it closes and returns to the offset at which it was closed
|
|||
18 Mar 2010, 15:52 |
|
baldr 18 Mar 2010, 16:56
MeshNix,
Yes, but .Bat file can be changed in transit. Hell to debug, but fun to see one. Do you have specs for syntax/semantics of your batch lang? |
|||
18 Mar 2010, 16:56 |
|
adroit 19 Mar 2010, 00:19
Yes- I've designed some syntax for some instructions!
I not sure what to do after this. |
|||
19 Mar 2010, 00:19 |
|
baldr 19 Mar 2010, 04:02
MeshNix,
Now you need (at least) function to read one line from file. Can you present those design docs? To put it under scrutiny of some constructive critique. |
|||
19 Mar 2010, 04:02 |
|
adroit 19 Mar 2010, 04:32
I have a draft document.
|
|||
19 Mar 2010, 04:32 |
|
adroit 19 Mar 2010, 23:39
Quote: Now you need (at least) function to read one line from file. What I was planning to do was to read the entire content of the file and store it into a variable, then parse each line until 0Dh (carriage return) is met, then that signifies the end of that line. The problem is, what if the file contains more than 256 characters. Then it cannot store into the variable. |
|||
19 Mar 2010, 23:39 |
|
ManOfSteel 19 Mar 2010, 23:53
And why should that "variable" be limited to 256 bytes? Why not allocate as much as you need and load the entire script?
|
|||
19 Mar 2010, 23:53 |
|
adroit 20 Mar 2010, 04:21
I don't understand
|
|||
20 Mar 2010, 04:21 |
|
revolution 20 Mar 2010, 04:33
Allocate a buffer of whatever size needed to store the entire file. No need to limit things to 256 bytes, is there?
|
|||
20 Mar 2010, 04:33 |
|
adroit 20 Mar 2010, 05:09
I guess not. Do i use rb instead of db?
|
|||
20 Mar 2010, 05:09 |
|
revolution 20 Mar 2010, 05:22
Probably best to allocate it dynamically. At runtime, get the file size first and then allocate the needed amount.
|
|||
20 Mar 2010, 05:22 |
|
DOS386 20 Mar 2010, 09:35
MeshNix wrote: I guess not. Do i use rb instead of db? You reasonably won't use db for this buffer or any buffer at all Set some limit (maybe 4 KiB for the beginning), do GetFileSizeEx, check against your limit, reject if too bloated, if good hog the memory, and start processing, be aware of the CR vs LF vs CRLF mess, also don't forget to check for invlaid characters (ZERO) and handle them in a well defined way |
|||
20 Mar 2010, 09:35 |
|
adroit 20 Mar 2010, 15:33
CRLF it will be used for EOL.
In using DOS interrupts not Win32 APIs. |
|||
20 Mar 2010, 15:33 |
|
adroit 23 Mar 2010, 20:23
I'm seeking advice for my project (codename: Quantum-lite)
(1) My CLI supports loop statements like FOR loop, and WHILE loop. These loops are mutli-line loops example: Code: .start FOR A = 1 TO 5: { PRINT "Repetition was successive " %A " times" } .ENDFOR .end PRINT writes text to screen. %A is a variable in the shell. In that script, how would the shell do a repeat when it only processes line-by-line. Please give some advices. (2) What type of commands would you like into be implemented in my shell? Please provide: - Command/Statement name - Syntax - Description Last edited by adroit on 24 Mar 2010, 22:59; edited 3 times in total |
|||
23 Mar 2010, 20:23 |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.