Shop OBEX P1 Docs P2 Docs Learn Events
PropCMD -- like PropDOS but with less music and more SD — Parallax Forums

PropCMD -- like PropDOS but with less music and more SD

localrogerlocalroger Posts: 3,452
edited 2009-04-05 23:24 in Propeller 1
Update -- PropCMD is now in the obex, with the aigeneric video drive commented IN by default and a couple of other minor changes.· /roger

This is my rewrite of PropDOS to make it a lot more DOS like. I removed the music functions because I don't have the hardware but it would be pretty easy to put them back in. I was more interested in a tool for exploring the SD, and in the future I plan to redo the FAT file systme so it can open more than one file at a time.

As I mentioned elsewhere this version uses TV_TEXT instead of the aigeneric 25-line video driver, so it only gets 13 lines of text on the screen. I see in that thread that aigeneric is going MIT, but I'm leaving it as is for now because it's also quite a bit smaller using the built in font. The code has detailed instructions for converting; I'm all ears as to which version should be posted to the obex.

If I may quote my own documentation...

If there is a file on the SD named AUTOEXEC.BAT, when PropCMD
starts it will open the file, read the name of a file, and
load and run that file as if it were the argument of a SPIN
command. Holding ESC down during boot inhibits this. Note
that this is the opposite of PropDOS' autostart feature.
Also note this is not a true batch interpreter, and no other
commands can be included in autoexec.bat (so far).

PropCMD checks for AUTOEXEC.BAT before deciding to halt if
there is no keyboard, so it can be used to autoload a SD
program which does not in turn need a keyboard.

PropCMD COMMANDS:

MOUNT
Mount the SD.
This is done automatically at startup if possible.

UNMOUNT
Unmount the SD.
The SD can then safely be changed.

DIR [noparse][[/noparse]*.ext] [noparse][[/noparse]/w] [noparse][[/noparse]/h] [noparse][[/noparse]/c] [noparse][[/noparse]|more]
Show the root directory of the SD.
*.ext -- show only files with the indicated extension
/w -- wide format
/h -- show hidden files (based on attribute bit)
/c -- show starting clusters
|more -- pause between screens, ESC to quit
ctrl-C cancels

TYPE filename [noparse][[/noparse]|more]
Echo the file to the console.
|more -- pause between screens, ESC to quit
ctrl-C cancels

DEL filename
Delete the file. Does not ask for confirmation.

COPY CON filename
Echo lines of user input to the file until CTRL-Z pressed.
ESC cancels the current input line without ending input.

SPIN filename
Load the binary file and reboot the Propeller to run it.
Forces .BIN extension whether it or any other is specified.

DUMP filename [noparse][[/noparse]|more]
Display the file contents in hex and ASCII format.
|more -- pause between screens, ESC to quit
ctrl-C cancels

SD sectornum [noparse][[/noparse]|more]
Sector Dump = display contents of the given SD sector
in the Dump command format.

ROOTDIR
Display the SD sector where the root directory begins

CLUST2SD clusternum
Display the SD sector where DOS cluster begins

VER
display the version

COLOR colornum
Sets the display text color 0-7.

NUM number
Display the hex and decimal equivalents of number.
If number has no prefix or $, it is hexadecimal
# prefix means decimal, e.g. B == $B == #11
This format is used for all numeric arguments.

DIRA pin [noparse][[/noparse]value]
If value is supplied, set the given pin DIRA to
the value; otherwise display the pin DIRA value.

OUTA pin [noparse][[/noparse]value]
If value is supplied, set the given pin OUTA to
the value; otherwise display the pin OUTA value.

PULSE pin time
Invert the given pin OUTA for the time in system
waitcnt ticks.

INA pin
Display the INA value for the pin.

PropCMD does not attempt to SPIN commands it does not
recognize; it will reply Unknown Command.

Note that while this code observes the directory Hidden
Attribute bit, there are no functions to manipulate it.
fsrw does not expose this functionality and I would
rather work on a totally new filesystem capable of
opening multiple files than further patching to fsrw.


Object "PropCMD" Interface:

PUB mainProgram

Program: 2,999 Longs
Variable: 758 Longs

Note -- I am a Prop n00b although I've been programming for many years, and I've probably missed a lot of tricks that could make the code tighter. I am open to all suggestions.

Post Edited (localroger) : 4/4/2009 1:05:32 AM GMT

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-04-01 14:47
    Neat stuff! I'm looking forward to having a chance to look at this.

    Did you keep the virtual folder stuff from 1.7b?

    BTW, Both AiGeneric 2.1 and AiGeneric 2.1cf were released in OBEX last night.
    obex.parallax.com/objects/439/

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-04-01 14:56
    I never really thought of having a non-detected SD mode.. nice..
    A quick glance at the code, I'll say you cleaned it up nicely. [noparse]:)[/noparse]

    An odd thought..

    If you stuck a copy of FemtoBASIC in the higher end of a 64K eeprom,
    and added a little launch command for BASIC, this would make a perfect
    introductory setup for new Propeller users that may not have SD yet.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Bill DrummondBill Drummond Posts: 54
    edited 2009-04-01 15:08
    Probably not the best place to post this but, I would like to see either the top or bottom line of TV_Text treated as a separate device. ie a status line.
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-01 15:14
    Oldbitcollector -- that's an interesting idea. I haven't done much looking at EEPROM tricks because I'm planning to put SD in most of our projects, but if the code is already written to spin the high EEPROM contents it would be easy to add it in. I didn't keep the virtual folders because, as with hidden files, my true goal is to support the regular FAT16 attributes and subdirectory structure. I probably won't do long filenames but I don't see subdirs being an inherently big deal.
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-01 15:19
    Bill -- that should be pretty simple, in tvtext.spin in the PRI newline change rows to rows-1 and lastrow to lastrow-cols, that should prevent the bottom line from scrolling. You could then add a control code to cursor to it for writing to it.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-01 15:28
    Bill -- Look at the windowed TV text driver in the Object Exchange. It works like TV_Text, but allows you to set up separate windows on the screen. These scroll independently, etc. I did a Propeller O/S at one time and used the windowed text driver for the command line. There's a simple screen-based text editor that used a window along the left hand side of the screen for line numbers.

    localroger -- I think there's already a version of FSRW that allows multiple files to be open at a time. It may be in the ObEx.

    Post Edited (Mike Green) : 4/1/2009 3:33:24 PM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-04-01 15:40
    localroger said...
    Bill -- that should be pretty simple, in tvtext.spin in the PRI newline change rows to rows-1 and lastrow to lastrow-cols, that should prevent the bottom line from scrolling. You could then add a control code to cursor to it for writing to it.

    You should be able to get away with doing the same thing with AiGeneric as well.

    OBC


    Edit: I think someone did a nice copy routine in a mod of PropDOS somewhere,
    I'll have to dig it up. It would make a nice addition.

    Glad to hear you are moving toward directory support! Awesome.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-01 16:22
    Mike -- I looked through pretty much everything in the obex this week and didn't see it. I think it would be kind of hard to do it right with fsrw's metadata scheme. I'm planning to have a user settable number of files and buffers (exactly the same as in early versions of DOS) so you can balance performance vs. memory use, and metadata will be common to all open files. This is why adding a new form of metadata, the subdirectory, will be fairly straightforward.
  • mctriviamctrivia Posts: 3,772
    edited 2009-04-01 16:33
    will this work with vga out?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-01 16:56
    localroger -- This was set up so that each instance of the object allowed one file to be open while the SD-card dependent stuff like the metadata buffer was in a shared (DAT) area. You could declare named instances of the object or an array of instances for the multiple files, much better than trying to allocate stuff dynamically.
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-01 19:29
    Mike -- that will work but not real well, since you can't get away from the possibility that metadata is shared. If you have only one metadata buffer you end up churning the hell out of it, and if you have more than one you have what amounts to dynamic allocation because each file might or might not be sharing say a FAT sector with any other, and has to check for that and decide whether the metadata it needs is already loaded and maybe dirty. This gets even worse when you do subdirectories. Dynamic buffer allocation actually simplifies the logic since all buffer accesses are treated the same, and if you have the RAM you can radically improve performance just by setting buffers = #biggernum.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-04-02 03:43
    I finally got a chance to play with this tonight. As promised it was easy enough to
    drop in the AiGeneric font. I'm a little surprised that you didn't include the ability
    to spin binaries simply by typing their name. (A very doslike ability.) All in all, nicely done.

    I'm looking forward to seeing more of your project as you continue with it.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-02 13:04
    @OBC -- I did have that in an earlier build, but I just found it annoying. When I build it for the obex I might put the code back in so it can be uncommented.
  • trodosstrodoss Posts: 577
    edited 2009-04-02 14:33
    @localroger,
    I like what you have so far! If you can get FAT16/attributes sub directories working that would be great!
    Since it sounds like Ariba is working on an 'OS' as well, it will be interesting to see what develops.

    Mike Green's OS has an I/O kernel, which makes it a little more like "OS-like." Is that something that you have considered doing?
    --trodoss

    [noparse][[/noparse]Edit:] I missed the post in another thread where Mike Green mentions the same thing (kernel resources in his OS)...
    http://forums.parallax.com/showthread.php?p=796163

    Post Edited (trodoss) : 4/2/2009 2:48:37 PM GMT
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-02 16:40
    @trodoss,
    The I/O kernal isn't something I need for my own use, though I wouldn't complain if someone were to use PropCMD as a starting point to add it in. My main focus is a particular app which will be doing a lot of disk access. I was thinking of doing I/O redirect within PropCMD mainly as a convenience, e.g. for blowing a file out of a serial port or logging a dump or the output of a file compare to a file. I will also be using the kernal I'm building to launch real applications but since they're going to be purpose written the current method of rebooting into them is fine.

    Right now it seems to me that I/O-wise the Prop is about where operating systems were before CPU's started to have relative jump instructions. With for example CP/M on the 8080 programs had to be loaded to the fixed locations where they were compiled, so it was actually more efficient to just insert direct calls in your application source to the OS resources you needed. When it became possible to load programs anywhere, it made more sense to call a common agreed address or interrupt with a code so that the interface would work no matter where the programs were placed in memory. Since all prop apps pretty much start out as full source in the prop tool, so far nobody has really had much incentive to move to a common API model.
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-04-03 05:40
    I am following this thread with great interest as I hope to get ZiCog and my TriBladeProp running under FAT16 as a prop application and launch via PropDos/PropCMD/Apropos(Ariba)...

    Keep up the good work and keep going guys smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-04 01:01
    @Cluso99,
    Schweeeet. I have put PropCMD up on the obex with a couple of mods, including that the aigeneric is commented IN by default. You will appreciate that |MORE and ctrl-c work with even the chain command with those big disk image files smile.gif
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-04-05 14:55
    SUCCESS jumpin.gif·· Pic attached

    PropCMD is stored in the eeprom. When the Prop on the TriBladeProp boots, it loads PropCMD. I am using a PC for the Terminal so I then load the ZiCog binary from the microSD card. This in turn executes on the Prop and loads the Z80 CPM code into the ZiCogs 64KB memory (external SRAM) and the image of a 960KB CPM drive from the microSD into the remaining SRAM. It then runs the emulator which can run MBASIC, DIR, TYPE, SURVEY, etc CPM commands/programs, all under Z80 emulation by the Prop.

    Thanks to Michael Rychlik (heater) for ZiCog; Roger Williams(localroger)/Michelli Scales for PropCMD·& Jeff Ledger (OBC) for PropDOS; Radical Eye Software (Tomas Rokicki) and Mike Green for fswrFemto; Mike Green for sdspiFemto (which is the ultimate PASM driver for the SD and EEPROM); Andy Schenk for PC_Text & PC_Keyboard; Parallax, Inc.(Chip) and ?? for doing the Plus extensions for FullDuplexSerialPlus. My apologies to anyone I have wrong or missed -·please PM me so I can include you. There have been so many others who have helped me along the way·to learn the prop, including especially Hippy.

    I am so happy I am going to break the rule and post this on both the·ZiCog and·PropCMD threads - please don't abuse me for this cool.gif


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm

    Post Edited (Cluso99) : 4/6/2009 12:27:28 AM GMT
  • localrogerlocalroger Posts: 3,452
    edited 2009-04-05 23:24
    @Cluso99
    That is way cool. BTW when crediting for PropCMD use Roger Williams / localroger -- I am giving Michelli the copyright since they're paying me to do a lot of this work, but I'm the one doing the work. (I do think it is excellent that they understand the usefulness of giving some of the stuff I'm doing to the community, such as PropCMD and the file system I'm working on now, but then I'll be using those tools to do other stuff that isn't public.)
Sign In or Register to comment.