It has been a while...

The last post date is 9/2013
Now it is 3/2018

4 and a half years! I do no longer live in Ireland, moved to England

Mostly I use instagram now
https://www.instagram.com/hallamhitechtrading/

I dont no longer write so much software, I sell small electric parts online
http://stores.ebay.com/pic-hitechworld

time by time, there is japanese customers!

Picture from Sheffield taken in May last year (2017)

When I think about the year 2010. Fukushima was so much disruptive.
Now almost 8 years passed since 2010.

obscure and ancient graphics card for IBM PC

I wrote a small C program for this graphics card.
It is a CGA model which was used in early 1980s!

After a while it really works.

A lot of effort is required to set a single pixel.
320x200 in 4 colors...

Borland C++ is used but this program is just plain C language.

Tables are used to set and reset the bit patterns.
For sure there are more efficient ways to set pixels on CGA adapters.

I wrote it just for fun. It is so old fashion, it needs DOS to work.

CGA graphics card code
CGA graphics card code posted by (C)takao21203

For demonstration, I draw 3 distinct color bars.

16 Kilobytes are used in CGA mode.
The card in my laptop has 16 Megabytes already.

C program for CGA card
C program for CGA card posted by (C)takao21203

C language on MSDOS...

C program which I wrote.
It can set pixels, draw a circle, and draw a box.
All very primitive- technology from 30 years ago.

It is old graphics card and MSDOS (FreeDOS) which runs in a hard drive partition.
C compiler is not free but it is not sold anymore.
Software from 1992! Eventually it is Borland C++.
It can use XMS and EMS memory.


//#include
#include
#include
#include

char far* cgam = (char far*) MK_FP(0xb800,0x0000);
char shofs[]={6,4,2,0};
char clpatt[]={0x3f,0xcf,0xf3,0xfc};
char stpatt[]={0xc0,0x30,0x0c,0x03};
int cgaofs[]={0,8192};

void setpix(int x,int y,int c)
{int rx,ry,rc,rcl;

rx=x>>2;
ry=(y>>1)*80;
ry+=cgaofs[y&1];
rc=*(cgam+rx+ry);

rcl=rc&clpatt[x&3];
rcl|=stpatt[x&3]&(c<y2)goto complete;
reloopx: setpix(x++,y,c);
if(x>x2){x=x0;y++;goto reloopy;}goto reloopx;
complete:}

void main ()
{

int i,i2,x,y;

asm mov ax,0x0004
asm int 0x10

box(35,5,103,100,2);
box(55,35,123,135,1);
box(75,65,143,165,3);

circle(150,100,50,1);

while(!getch());

asm mov ax,0x0003
asm int 0x10
}

compressing filesystem (2)

Given the fact most operating system files are almost never used, essentially these files
are slack. OK they have to be there, belonging to an installation, and the software eventually is used in very few cases.

Actually this can be 10,000s of files. If a special program option is not called, they are never loaded at all. So why not, at least compress them? A gigabyte here, a gigabyte there. It makes a hudge difference on a small 30GB hard drive.

Having a Pentium III, there is little penalty decompressing some 10s of megabytes while starting a software. Uncompressed, about 15 MB/s reading, and compressed, about 10 MB or less.

Compression is of course not good for JPEG, or database, and other certain types of files.

So it is good if the file system can just turn on/off compression.

BTRFS (Linux) can do just that:

1. remount a live partition with -o remount and -o compress.
2. make a copy of the directory (with -r)
3. rename the original directory
4. rename the copy
5. delete the renamed, original copy.

If you make a mistake, it might be you have to reinstall completely.
So better double check in a file manager. Also only rename from bash (not with GUI).

You can type mount, and you'll see the remounted partition is using compression now.

Before compressing /usr/lib, 41% was used. After that, only 35%!
/opt was also compressed on a new, seperate partition.
Before of that, root (/) was actually 98% full.

It is selective compression. Most of the files are never loaded.
It makes no difference for performance. But much more stuff can be fitted!
Some file types are already compressed so it is total nonsense to try compress them.
Anyway, BTRFS will skip such files even with compression = ON.

BTRFS is still experimental, but it works good enough on a laptop to copy back and forth several gigabytes, and to compress in order to have more space available.

A 30GB disc can easily hold 50GB or more real data.
If you have 3 gigabytes of C header files, you should really compress them, if they are almost never used, just have to be there for some special case. Because a text file can compress by nearly 90%.

Some directories like /var dont compress well especially the repository. Guess why- these files are already highly compressed. Before you reinstall, you should backup the repository, and then copy back directly after reinstallation. It can take quite a while to download again.

By the way I edited the screenshot with GIMP directly after compressing /usr/lib, so actually it works without any change to the /usr/lib structure.

If you don't understand the copy command, really think two times what you are doing, and double check before removing the old structure. There is no easy undelete on LINUX like as for Windows. If you ROOT, and remove some essential files, it will not startup again next time, and it can be nearly impossible to repair, even if you know what is wrong now.

But it is worth it. I have my root partition from 98% full back to 35%, and all files still there.

There was also a free chunk at the end of the hard drive- about 5 Gigabyte. I booted with live DVD, resized the extended partition, and created a new logical partition, then moved /opt to this place.

Remember there are often 20 to 30 individual steps, and they all must be exactly right. Even if there is more than one way sometimes. It is not so hard after a while, and not impossible. But if you try an idea for the first time, there is always a risk. You could end up with not booting laptop...

OK. I finished writing. The same moment...a message appears. Your browser has been updated and need to be restarted. Wow. Really the same moment!!! What can I say. Press that japanese "save" button, and then Restart...I mean, don't press the wrong button or all your writing goes to nowhere.

Compressing file system

Compressing file system - LINUX

When I installed MPLABX + all the C compilers, about 98% of the hard drive partition was used. There are about 20000 files or more!

1. I created a new partition, and moved 4.1 Gigabytes installation there.

2. I copied back to another partition, and deleted.
Then I simply remounted the partition as compressed, and again, copied back the files.

The result is pretty good, because these are mostly text files. Most are never used at all.

The laptop hard drive has only 30 gigabytes all together. So about 1/10 of total size is saved.

The other partitions are not compressed. Also I can mount again as uncompressed.

I use BTRFS (a new kind of file system).

3. In recent days I installed various old softwares for MSDOS. More in another new post.

linux nightmare

today was Linux nightmare day.

linux installation
linux installation posted by (C)takao21203

1. It was broken somehow 10AM. I did not power down correctly because it crashed.

2. Reinstall.

3. Broken again by installing Virtualbox. Bad! Another reinstall.

I have now developed a way to save downloading packages again and again. I boot with a CD, then copy the packages to a USB stick (800 megabytes), then later after installing, I copy them back to the hard drive.

Result: Zero downloads needed for fresh install.

It is 0.22 AM now. I completed installing all the softwares I need.

Also I want to turn the write cache off. It is really bad because corruption can happen easily, and the only way is a total reinstall.

I tried partititions as well with little luck during the evening.

This is why I spent so much time also the USB is very slow. Need a PCMCIA USB2 adapter.

I wrote all application names into a text file so next time I just copy&paste. Takes a while to reinstall even if the packages are already on the hard drive.

As for Windows...once you have to reinstall, you have to use automated downloader for all the updates and it takes hours and results in 2 gigabytes or so. It takes much longer. But it is not required very often.

This laptop only has 512 megabytes so it can run XP or Win98 or maybe even Windows 3.1
I really downloaded some old compilers for Win3.1 but they are not so much comfortable to use. Dosbox is slow, and buggy, I can run Turbo C but not Windows Visual C++ or Borland C++. They need a small utility program which does not run under DOS.

I want to try QEMU now.

Tokyo, May 2013

A few days ago I copied 802 Megabytes on my laptop hard drive.
Photos from my stay in Japan May 2013.

Some of them were never added to internet.

I want to increase using Hatena again by the way (wrong grammar english?).
By the way, I want to use Hatena again, and increase it.

I will almost stop using facebook but eventually write a post now and then.

1. Tama river Tokyo. Near Fuchu bridge.
It is actually the line between Tokyo and Kawasaki.

2. Larger view from the Fuchu bridge

3. Daimaru building, near Tokyo station. I did not find time to walk for the palace garden.

4. Many japanese people...but can not be seen directly or identified. In Tokyo.

5. LED matrix project. Electrical wiring is completed now. More chips are added for buffering,
and to generate patterns. There is still a lot of work to do.

8 controllers run at once. 16 brightness levels for each LED. 768 LEDs all individually soldered.

More entries here soon!