Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:31 02 Aug 2025 Privacy Policy
Jump to

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 : Need Basic language compression code

     Page 2 of 2    
Author Message
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 09:01am 17 Oct 2018
Copy link to clipboard 
Print this post

  lizby said  
Cap'n--I chose LF because in Linux mode, LF is used in place of what in DOS is CRLF. I don't know why that would be relevant here, but that was my rationale.


yep, hateful isn't it - the mixture of standards.

very often CR is used with LF but it is a hangover from teletypes (spooky) that you would home the carriage but then have to issue a separate line feed to prevent over-printing.

if you only want a single "newline" then either LF or CR will do - as you are interpreting the codes anyway either will do fine. I just wanted to note that &B00001101 will fit in four bits while &B00010000 will not - it might have helped with the mapping - i.e. if it's &h0D, you don't need to do a lookup and the code to output is the same as the input.

Small point. It would simplify your SELECT ... CASE when translating a tiddly bit.


I'll get my coat


was it four bits or five you wanted??? in which case ignore my ramblings aboveEdited by CaptainBoing 2018-10-18
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 11:32am 17 Oct 2018
Copy link to clipboard 
Print this post

  CaptainBoing said  ... was it four bits or five you wanted??? in which case ignore my ramblings above

4 bits for the translation to nybbles of numerals + comma, period, space, colon, LF|CR, and one more if useful.

PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1593
Posted: 01:36pm 17 Oct 2018
Copy link to clipboard 
Print this post

Just for comparisations purposes:

WikiBaudot.txt = 12.903 bytes
WikiBaudot_encoded.txt = 8.890 bytes (lizbys 5 bit-encoding)
WikiBaudot.lzw = 7.507 bytes (LZW-compressor)
WikiBaudot.rar = 5.448 bytes (RAR-file)



causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 03:06pm 17 Oct 2018
Copy link to clipboard 
Print this post

  Quote  I'm looking for MMBasic (or any variety basic) code to compress a text file.


Can you give more information about the text? Is it simple English as in from a novel? Does it contain numbers or is all numbers? Does it have repeated sequences of letters or whitespace?

Depending on the answers an algorithm could be developed that could be far more efficient than any generic solution.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 04:32pm 17 Oct 2018
Copy link to clipboard 
Print this post

  matherp said  
  Quote  I'm looking for MMBasic (or any variety basic) code to compress a text file.


Can you give more information about the text? Is it simple English as in from a novel? Does it contain numbers or is all numbers? Does it have repeated sequences of letters or whitespace?

Depending on the answers an algorithm could be developed that could be far more efficient than any generic solution.


I originally intended a generic ascii file with only the codes 0x20-0x7f, plus LF. I have found out that one specific file I might look to encode is only numerals plus space, comma, period, colon, CRLF, so I plan to do simple 4-bit encoding.



PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025