Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Napoleon Commander for CMM2
Page 2 of 5 | |||||
Author | Message | ||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Hi Steve, such errors was remaining when I moved TUI to separate file and changed prefix from NC to TUI (as I will be using TUI for different projects too). Anyway thanks for message and I'm glad NC is getting some fans... I found it in the meantime myself (my english still needs some improvements...), new version will be posted today (because of some BIG improvements). Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Some BIG news (at least for my workflow): NC now can copy between local SD card and server running on other machine connected with CMM2 through serial (now just tested on Mac), so you can BACKUP, EDIT on both, put easy to GIT... You just need to use OPTION CONSOLE SCREEN + OPTION CONSOLE SAVE to leave serial for server, start server on PC and it's done. Tested with baud rate 230400 and it's usable. I will prepare server description (so every can programmed his own in preferred language), in the meantime I will put to GITHub binary for Mac and try to write it in Python. Some other changes: character keys now jumps first to directory with this letter on start, second press to files waiting dialog now can have progress bar (usable on server copy ) some bug fixes (thanks to everybody who put here bug info for help) If somebody feature request, just put it here. Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
I have added simple server binaries for MacOS, Win/64 and Linux/64 as promised. Opens one debug window, directory where is it serving files is app directory, but it can be dropped any folder on window and this set the server root (can be seen in window title). Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Hi, just uploaded python skeleton NCserver.py, that should be usable on all OS (where python is installed). Now it has just 2 basic functions: DIRECTORY and LIFE TEST, everything else is still missing. But at least you are able to test it with going through directories on the server... Just modify 2 lines: serial port #modify to your port ser = serial.Serial( port='/dev/tty.usbmodem14101', baudrate = 230400, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1 ) path to your server root #modify to your path to server root BASEDIR = "/Users/jirsoft/Documents/Maximite/NCserver/" Enjoy! Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Hi epsilon, I already included your MAR expander into NC (modified version), but as now NC has ability to copy over serial cable, it's maybe interesting also include MAC creator. My question is, if will make sense to go this way or include something more standard (as tar). Or could you modify MAR to have (at least limited) TAR compatibility? Or rewrite it to Python (for use on other OS), because for example on MacOS is MMBASIC not (or difficuilt) usable... Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 446 |
I prefer to use more standart formats like tag.gz or gzip, but what you implemented is amazing. Do you have the intention of to add the binary to csub converter in your app? |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Hi Leo, thanks. I'm trying to use standard formats, but after I have spent almost 2 days to look over source codes for the compressors/archivers/packers..., I didn't find any usable (=not so long, slow and complicated). So I think first should we have (un)archiver, either Epsilon's MAR or tar (if you are ready to transcode it into MMBasic, I will either include it direct to NC or external). First then could be used (de)compressor, I was thinking an something from 8-bit era (LZW, LHA, ZOO...). And for binary to CSUB has Peter the code, it's not enough? Are you meaning .ELF to .BAS (or .INC)? Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
I think a plugin model would work here. define an API to launch with parameters and return control to NC when done. The welcome tape may give inspiration as the loads bunched of different programs and returns control to the menu. |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
So on the GitHub is full version of NCserver.py, that supports all 7 commands used by serial, so it works with NC on CMM2 just fine. I tried to play with serial speed and baud rate - 691200 still works on both sides pretty good (speeds between 30 and 65 kB/s, so NC.BAS is copied in less than 2 seconds). Now is supported in LOCAL/SERVER environment: FILE copy from, to and between server (last is both panes on server) MKDIR on server delete file or dir on server (folder could be full of files) Still missing: rename file or dir on server (you can do it direct on Mac or copy to CMM2, rename and copy back ) move files between local and server (or on server), you can copy and delete copy full directory (that is the worst, is on my priority list) ACTION and VIEWER on server (I thing not so much needed, as Mac tools are usually there, but anyway...) better error display on CMM2 when something happens on server Also in NC.BAS and TUI.INC are some bug fixes, newest version of NC is now 0.61. Please if it is at least partially important for you, test it... I will then add some missing functionality to server side (for example full dir copy). Enjoy! Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Just small info, tried NC on V5.06.00b4 and it looks OK... Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
News (v 0.63): speed for serial server could be set to 230400 or 691200 baud (testet as OK and fast) F9 can now create MAR archive (not compressed) and with external viewer/action (F3/ENTER) can view it/dearchive it (included as sample in VIEW.INC/ACTION.INC) some bugfixes/optimisations Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
New (v 0.72): change in main menu, now ALT displays alternate menu F2 shows also information about compressed files MOVE went to ALT+F5 (under COPY) ALT+F4 are BASIC helpers: pretty formatter for BASIC file, not finished yet, HELP NEEDED DEBUG on/off, this is simple but universal debug system, fill out space in Peter's debug: when you write ''' (3 apostrophes) on the end of any line, it marks it as potential DEBUG line, you can then with this tool comment and uncomment this line (''' on begin or end) ALT+F9 compresses file into archive, basic format .ARC: starts with header 3 characters for compression algorithm (now just RLE or HUF), original extension, original size then are data. Huffman codec is really slow (but with pretty good ratio), RLE compressor is now switched off) Could be optimally used with MAR archive (first create MAR from directory tree, then compress it into ARC) some bugfixes I'm looking for help with some basic 3D viewer for PLY files, convert raw BMP into something compressed, make compressor faster (in BASIC, but I will maybe write CSUB for it), maybe modify Peter's armcfgenV143.bas into external actions on ELF file to convert it into INC or BAS (I can do it, but maybe need is not here...) Enjoy! Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3850 |
Hi Jiri, please find a BASIC pretty printer here: https://github.com/thwill1000/sptools/tree/develop-r1b3/src/sptrans. It has a few issues that still need ironing out and is a bit slow, but you are welcome to use it. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Hi Jiri, please find a BASIC pretty printer here: https://github.com/thwill1000/sptools/tree/develop-r1b3/src/sptrans. It has a few issues that still need ironing out and is a bit slow, but you are welcome to use it. Best wishes, Tom Hi Tom, thanks, I will try it! Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Hi all NC users, with version v0.80 is NC close to finishing from my side, I will try to iron it and of course fix the bugs, but from function amount are now missing just not so important things. Also NCserver.py is updated and needed fo new functionality. What works: info for DIRs on SD and SERVER info for FILEs on SD internal viewers on SD, external skeleton also on SD DEBUG on/off on SD copy of FILEs and DIRs on/from/to SD and SERVER (so SERVER can be already used as full backup) move on SD create DIR on SD and SERVER delete DIRs and FILEs on SD and SERVER rename DIRs and FILEs on SD and SERVER create archive from directory to MAR file from SD to SD create DIR from MAR archive from SD to SD compress file to ARC file from SD to SD uncompress ARC from file on SD to SD simple configuration What's missing: move on/from/to SERVER, (replace with copy+delete), it's more because of security file info for SERVER, will be too slow viewers and actions on SERVER, will be too slow HEX editor, I will still do it, but HEXedit will be anyway better archive and compress to and from server, I'm looking for best way how to do it Enjoy it! Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
epsilon Senior Member Joined: 30/07/2020 Location: BelgiumPosts: 255 |
Hi Jiri, Sorry for the late response. I'm actually just now reading all the great advances you made with NC. I must admit that I tuned out earlier because of the beta FW dependency and I'm not tracking the beta FW versions. I will certainly start using NC with the next FW release. Until then I can only comment on what I'm reading here. Hi epsilon, I already included your MAR expander into NC (modified version), but as now NC has ability to copy over serial cable, it's maybe interesting also include MAC creator. My question is, if will make sense to go this way or include something more standard (as tar). Or could you modify MAR to have (at least limited) TAR compatibility? Or rewrite it to Python (for use on other OS), because for example on MacOS is MMBASIC not (or difficuilt) usable... It's really cool that you're integrating MAR into NC. Going the tar route certainly makes sense, but I don't have any plans port/implement tar into MAR. I think that would be a bit of a rathole. If you're still interested (and maybe also if you're not), I will make a python version of the MAR creator. I consider the Windows MMBasic version of MAC.BAS a failed experiment so I have to do something. Are you on Python3.x or Python2.x? As an aside, I also intend to add the option to create a self-extracting MAR, i.e. MAC would create a .BAS file 'around' the MAR archive. The .BAS when executed, will expand into the files and directories it's holding. I was thinking of adding lzw/lha compression as well. Should I just incorporate your .ARC implementation? Epsilon CMM2 projects |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
It's really cool that you're integrating MAR into NC. Going the tar route certainly makes sense, but I don't have any plans port/implement tar into MAR. I think that would be a bit of a rathole. If you're still interested (and maybe also if you're not), I will make a python version of the MAR creator. I consider the Windows MMBasic version of MAC.BAS a failed experiment so I have to do something. Are you on Python3.x or Python2.x? As an aside, I also intend to add the option to create a self-extracting MAR, i.e. MAC would create a .BAS file 'around' the MAR archive. The .BAS when executed, will expand into the files and directories it's holding. I was thinking of adding lzw/lha compression as well. Should I just incorporate your .ARC implementation? Hi epsilon, the I made the code for unMAR and createMAR very short: SUB NCunMAR(filePath AS STRING) CONST maxChunkSize = 128 LOCAL INTEGER fiLen, curLen = 0, chunkLen, fiPos = 0, totLen = 0 LOCAL STRING li, cmd, par, k, p = NON_PATH.NC LOCAL STRING dialog EXT_ERR.NC = 0 IF TUIquestion("EXTRACT MAR", "Extract '" + filePath + "' to '" + p + "' ?") THEN dialog = TUIwaitingON("EXTRACT MAR '" + NCgetName(filePath) + "'") totLen = MM.INFO(FILESIZE filePath) OPEN filePath FOR INPUT AS #3 DO WHILE NOT EOF(#3) LINE INPUT #3, li fiPos = fiPos + LEN(li) + 2 cmd = FIELD$(li,1,":") par = FIELD$(li,2,":") SELECT CASE cmd CASE "DIR" DO WHILE LEFT$(par,1)="." OR LEFT$(par,1)="/" par = MID$(par,2) LOOP p = p + par + "/" ON ERROR SKIP MKDIR p IF MM.ERRNO > 0 THEN CLOSE #3 EXT_ERR.NC=1 NCerror("DIR '" + p + "' ERROR") EXIT SUB ENDIF CASE "FILE" curLen = 0 LINE INPUT #3, li fiPos = fiPos + LEN(li) + 2 fiLen = VAL(li) OPEN p+par FOR OUTPUT AS #4 DO WHILE curLen < fiLen chunkLen = MIN(fiLen - curLen,maxChunkSize) curLen = curLen + chunkLen li = INPUT$(chunkLen, #3) PRINT #4,li; LOOP CLOSE #4 fiPos = fiPos + fiLen CASE "ENDDIR" p = NCparent(p) CASE "ENDARCHIVE" END SELECT TUIwaitingProgress(dialog, 100 * fiPos \ totLen) LOOP CLOSE #3 TUIwaitingOFF(dialog) ENDIF NCchangeDir(1 - ACTIVE.NC, NON_PATH.NC) NCcursor(ACTIVE.NC,1) END SUB and SUB NCmakeMAR 'create MAR achive CONST maxLen = 128 LOCAL INTEGER ind = 0, td=0, size, filePos LOCAL STRING item, path, partData LOCAL STRING pth(MAX_ITEMS.NC) LOCAL STRING toDo(MAX_ITEMS.NC) LOCAL STRING dest = NON_PATH.NC + SEL_NAME.NC + ".MAR" LOCAL STRING ccc = TUIwaitingON("MAKE MAR ARCHIVE") TUIwaitingProgress(ccc, 0) pth(ind) = ACT_PATH.NC + SEL_NAME.NC toDo(td) = pth(ind) DO WHILE ind >= 0 NCchdir pth(ind) path = pth(ind) ind = ind - 1 item = DIR$("", ALL) DO WHILE item <> "" IF LEFT$(item, 1) <> "." OR HIDDEN.NC THEN size = MM.INFO(FILESIZE item) IF size<0 THEN 'directory ind = ind + 1 pth(ind) = path + "/" + item td = td + 1 toDo(td) = path + "/" + item + "/" ELSE 'file td = td + 1 toDo(td) = path + "/" + item ENDIF ENDIF item = DIR$() LOOP LOOP TUIwaitingProgress(ccc, 10) SORT toDo(),,2,0,td+1 toDo(0) = toDo(0) + "/" path = toDo(0) OPEN dest FOR OUTPUT AS #2 FOR ind = 0 TO td TUIwaitingProgress(ccc, 10 + ind/td*90) item = toDo(ind) IF RIGHT$(item, 1) = "/" THEN DO WHILE INSTR(item, path) = 0 ?#2,"ENDDIR: " + NCgetName(LEFT$(path, LEN(path)-1)) path = NCparent(path) LOOP ?#2,"DIR: " + NCgetName(LEFT$(item, LEN(item)-1)) '" ("item")" path = item ELSE DO WHILE INSTR(item, path) = 0 ?#2,"ENDDIR: " + NCgetName(LEFT$(path, LEN(path)-1)) path = NCparent(path) LOOP ?#2,"FILE: " + NCgetName(item) '" ("item")" filePos = 0 OPEN item FOR INPUT AS #3 ?#2,LOF(#3) DO WHILE NOT EOF(#3) size = MIN(LOF(#3) - filePos, maxLen) filePos = filePos + size partData = INPUT$(size, #3) ?#2, partData; LOOP CLOSE #3 ENDIF NEXT ind ?#2,"ENDDIR: " + NCgetName(LEFT$(toDo(0), LEN(toDo(0))-1)) ?#2,"ENDARCHIVE:" CLOSE #2 TUIwaitingOFF(ccc) END SUB so I can also rewrite it into Python (now I preffer 3). Selfextracting MAR is possibility, I can modify NC so it will expand also this kind (but some specifix header needed - for example comment in first line). Here is decompression of the ARC archive, first line is header: compression kind, 3 characters, now RLE or HUF source file extension source file size SUB NCunARC(source AS STRING) 'decompress CMM2 archive file (ARC) LOCAL INTEGER arcLen = MM.INFO(FILESIZE source), srcLen = 0, rle, fiPos = 0, i LOCAL STRING header, prev LOCAL STRING dest = NON_PATH.NC + NCgetNoExtension(NCgetName(source)) IF TUIquestion("UNCOMPRESS ARC","Uncompress '" + NCgetName(source) + "' to '" + NON_PATH.NC + "' ?") THEN OPEN source FOR INPUT AS #3 LINE INPUT #3, header srcLen = VAL(FIELD$(header, 3, ",")) INC fiPos, 2 + LEN(header) CAT dest, "." + FIELD$(header, 2, ",") SELECT CASE LEFT$(header, 3) CASE "RLE" 'RLE, first archiver LOCAL STRING dialog = TUIwaitingON("UNCOMPRESS ARC") TUIwaitingProgress(dialog, 0) OPEN dest FOR OUTPUT AS #4 DO WHILE NOT EOF(#3) rle = ASC(INPUT$(1, #3)) INC fiPos IF rle < 128 THEN 'raw data INC fiPos, rle + 1 INC srcLen, rle + 1 FOR i = 1 TO rle + 1 ?#4,INPUT$(1, #3); NEXT i ELSE 'compressed data prev = INPUT$(1, #3) INC srcLen, rle - 127 INC fiPos FOR i = 1 TO rle - 127 ?#4,prev; NEXT i ENDIF TUIwaitingProgress(dialog, 100 * fiPos / arcLen) LOOP CLOSE #4 TUIwaitingOFF(dialog) CASE "HUF" 'HUFFMAN, slow :-( LOCAL STRING dialog = TUIwaitingON("UNCOMPRESS ARC") LOCAL INTEGER tLen = ASC(INPUT$(1, #3)) LOCAL STRING bit(tLen - 1), bb = "" LOCAL INTEGER ind(tLen - 1), bits TUIwaitingProgress(dialog, 0) ind(0) = ASC(INPUT$(1, #3)) bits = ASC(INPUT$(1, #3)) bit(0) = STRING$(bits, "0") '?ind(0), bit(0) FOR rle = 1 TO tLen - 1 ind(rle) = ASC(INPUT$(1, #3)) bits = ASC(INPUT$(1, #3)) bit(rle) = BIN$((VAL("&b" + bit(rle - 1)) + 1) << (bits - LEN(bit(rle - 1))), bits) '?ind(rle), bit(rle) NEXT rle INC fiPos, 1 + 2 * tLen TUIwaitingProgress(dialog, 100 * fiPos / arcLen) OPEN dest FOR OUTPUT AS #4 DO WHILE NOT EOF(#3) FOR rle = 0 TO tLen - 1 IF LEN(bb) < LEN(bit(rle)) THEN CAT bb, BIN$(ASC(INPUT$(1, #3)), 8) INC fiPos ENDIF IF LEFT$(bb, LEN(bit(rle))) = bit(rle) THEN ?#4, CHR$(ind(rle)); INC srcLen, -1 bb = MID$(bb, LEN(bit(rle)) + 1) EXIT FOR ENDIF NEXT rle TUIwaitingProgress(dialog, 100 * fiPos / arcLen) LOOP DO WHILE srcLen > 0 FOR rle = 0 TO tLen - 1 IF LEFT$(bb, LEN(bit(rle))) = bit(rle) THEN ?#4, CHR$(ind(rle)); bb = MID$(bb, LEN(bit(rle)) + 1) INC srcLen, -1 EXIT FOR ENDIF NEXT rle LOOP CLOSE #4 TUIwaitingOFF(dialog) CASE ELSE TUIwarning("UNCOMPRESS ARC", "Decompression of '" + LEFT$(header,3) + "' not implemented yet") CLOSE #3 EXIT SUB END SELECT CLOSE #3 NCchangeDir(0,PATH.NC(0)) NCchangeDir(1,PATH.NC(1)) NCcursor(ACTIVE.NC,1) ENDIF END SUB For me it will be bigger help, if we can extend ARC for more compressions, so LZW or LHA will be very welcome addition. Maybe I will try to remove beta dependencies (right now I think just CAT and INC)... Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
epsilon Senior Member Joined: 30/07/2020 Location: BelgiumPosts: 255 |
Probably not worth it. Peter just released V5.06.00RC5. It looks like we're getting very close to a V5.06 release. Woohoo! I think I'll give V5.06.00RC5 a spin (might be last chance for objections ). Epsilon CMM2 projects |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
NEWS: removed TUI.INC, can be downloaded from separate repository here (shared library for more apps) BASIC programs can be started with ENTER Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
epsilon Senior Member Joined: 30/07/2020 Location: BelgiumPosts: 255 |
Hi Jiri, I finally got NC installed today. This is a great tool! Super useful. I don't have much to add, just my compliments and thanks for creating this excellent program! Cheers, Ruben/Epsilon. Epsilon CMM2 projects |
||||
Page 2 of 5 |
Print this page |