My New Year’s gift to you or how I started something that should have been started a long time ago…

My New Year’s gift to you or how I started something that should have been started a long time ago…

A bit of history

I will start with the history of the question.

A long time ago, I wrote Fresh IDE – a fancy IDE for assembler programming, or rather FlatAssembler.

I was completely satisfied with Fresh IDE for many years, so I intermittently released two major versions and started just using it, sometimes making some corrections and new features.

When I switched completely to Linux, I found that Fresh IDE worked perfectly under WINE and I continued to use it without remorse. It even managed to fix a few WINE bugs in the process (here, here, and here).

Anyway, I started writing a library for porting assembly programs between Linux and Windows (and KolibriOS). At the same time, I thought about making Fresh IDE portable. Due to the architecture of the library, much of the code was already portable. Or more precisely, everything that was not related to the GUI. Unfortunately, the GUI was written entirely on the Win32 API and cannot be easily ported to other platforms.

That’s why we had to start all over again. And the third version of Fresh IDE was written almost from scratch.

But since (as I said) Fresh v2.x was generally good for me, the writing was very slow with big stops and frequent rewriting of the library code in the GUI part.

Moreover, although I knew the Win32 API quite well, the GUI under Linux was a teapot-teapot, and I had to learn everything from the very beginning.

Because of this, of course, the GUI libraries had to be rewritten again and again.

By the way, the first entry to the project repository was made on April 20, 2019.

Originally wrote everything using XLib. However, this library hides many details and prevented me from clearly understanding the essence of the GUI in Linux. When I stopped liking her, I tried switching to xcb. But I didn’t like xcb even more. After all, it essentially returns the X11 protocol without introducing any new features. Then why is it needed at all? Okay in C/C++ – the library provides the right “Syshy” kind of programs. But am I writing in assembly language? Then why do I look like this? Only ignorance of the X11 protocol stopped.

But here, at the beginning of the 23rd year, I was hospitalized for a week. I was relatively bedridden, but I wouldn’t say I was in a lot of pain and therefore bored. So, I started to read the X11 protocol and tried to write some code to figure it out.

And it worked! The code turned out to be very compact, all the features of X11 work were immediately visible, which was so lacking in XLib, which tries to hide these features from the user. By the way, after figuring it out, I really liked the X11 protocol. It is binary and will fit very well under assembly code. There are, of course, undocumented things, especially extensions written recently. But when you understand the essence, everything else is a matter of time and the right questions.

So the skeleton of the new version of the GUI library was written during this week in the hospital. As a result, on Linux, the program now uses a direct connection to the X server and direct X11 communication without using external libraries. It works even over an ssh connection and is reasonably fast.

When he got out of the hospital, things slowed down again. After all, I said – v2.x suited me. And work, family, household life…

But, she managed to manage, but with one big exception – the incredibly slow start of WINE.

Well, I don’t know why, but WINE itself takes a long time to start. 2..3..4 seconds. And after the update, the launch takes at least a minute. And it should start itself and only then starts the program.

Someone will say, 3..4 seconds is not long. But for an assembly language program, it is very long. I want my IDE to launch immediately, not after some time. Even on a slow computer.

And finally my patience broke. I can even say exactly when it happened: October 25, 2023. I don’t remember exactly what happened there. Was he angry because of something, or was there simply nothing to do, or WINE started checking the configuration after the next update, but the fact remains the fact.

Since that date, I have made 129 commits to the Fresh3 code and 121 commits to the freshlib code and finally, the Fresh3 IDE can be considered working and self-sustaining.

You can write both the code of the IDE itself and various assembler programs on it. All important IDE tools work and greatly increase the speed of writing programs. IDE crashes very rarely, and if it leaks memory, it is very slow.

At this point I have completely switched to Fresh3 IDE and am now happy. The IDE works fine, starts up instantly (and I mean instantly! – time is measured in milliseconds, I was never able to measure it somehow), I like the interface. (Write in the comments – how do you like the interface?)

Specially for the new version, I also drew a new icon in a supremacist style:

I’m a so-so artist, but I tried! (So ​​Suprematism is also at KDPV, but it was painted by II, not me. :D)

Some statistics:

The file size (for Linux) is out 351 KB.

A total of 300442 lines of code are compiled.

Decide a lot or a little yourself.

What happened as a result (screenshots)

I’ve always loved the classic dark blue “Borland-Turbo” theme, so my working setup is:

But of course the IDE allows you to change the theme of the editor. Here is a bright topic for you:

Everything is configured from here:

The editor can automatically complete variable and function names:

Can suggest some arguments in a function or method:

… show a short help about the program element (if someone wrote it):

… show how the macro is expanded into code:

And of course make a reference about the element exactly where and how it is used (cross reference):

The IDE has a help system, which through the built-in web server (if it works only on localhost!) displays help pages in the browser when you press F1 (contextual help) or you can read the help library by headings (Ctrl+F1):

If enabled in the settings, the IDE can automatically search the Internet for information by keyword if the information is not found in the built-in library. Any library functions are fine, that Win32 API, that Linux.

How to touch

If you’re still reading this article, you might want to touch the Fresh3 IDE yourself in its pre-release form, so to speak.

Today, the only option is to download and compile it yourself. To prepare releases, I wrote a simple script that automates this work.

You will need Linux (any), fossil – it must be in the program directory of your Linux, and of course FlatAssembler (fasm) – it can also be installed through the program directory.

Script text:

#!/bin/bash
#clone_and_build.sh

if [ ! -f "./fresh3.fossil" ]; then
  fossil clone https://fresh.flatassembler.net/fossil/repo/fresh3/ ./fresh3.fossil
fi

if [ ! -f "./fresh.fossil" ]; then
  fossil clone https://fresh.flatassembler.net/fossil/repo/fresh/ ./fresh.fossil
fi

mkdir -p ./FreshLibDev
cd ./FreshLibDev

if [ ! -f ".fslckout" ]; then
  fossil open ../fresh.fossil FreshLibDev
fi

fossil settings allow-symlinks 1
fossil settings manifest u
fossil revert
fossil update

cd ..

mkdir -p ./Fresh3
cd ./Fresh3

if [ ! -f ".fslckout" ]; then
  fossil open ../fresh3.fossil trunk
fi

fossil settings allow-symlinks 1
fossil settings manifest u
fossil revert
fossil update

cd ./source

env lib=../freshlib TargetOS=Linux fasm -m 262144 ./Fresh3.asm
env lib=../freshlib TargetOS=Win32 fasm -m 262144 ./Fresh3.asm

cd ..

cp -r source/IDE ./
cp IDE/themes/classic.theme IDE/themes/current.theme
mv source/Fresh3 ./
mv source/Fresh3.exe ./

Copy this text under the name “clone_and_build.sh” somewhere in an empty directory and run it. It downloads all the sources and compiles them.

Every time you run the script, it will update the version to the latest one in the repositories.

By the way, if you liked Fresh3 IDE so much that you want to install it on your Linux, then run the script install/install-fresh he will do everything for you. By the way, the interactive script will show you what it will do and ask for permission. So feel free to run it, nothing will break. And if you don’t like it, you can run it install/uninstall-fresh and he will fix everything.

If you don’t have Linux but want to touch the Fresh3 IDE, you can run all the commands in this script manually in the console. It’s completely straight forward, Fossil and FASM for Windows are there, but you have to download and install them yourself. (If anything, ask in the comments, I will help).

After compiling in the directory Fresh3/ there will be 2 executed files: Fresh3 and Fresh3.exe.
These are the Linux and Windows versions of Fresh3 IDE. This directory also contains everything necessary for assembly language programming – a copy of the Fresh3 source files, the freshlib library, reference materials, etc.

Run Fresh3 and open the file source/Fresh3.fpz; This is a Fresh3 project and should compile out of the box – Ctrl+F9

The Fresh3 repository is located at: https://fresh.flatassembler.net/fossil/repo/fresh3/
The Fresh IDE v2.x repository and concurrently freshlib is located at: https://fresh.flatassembler.net/fossil/repo/fresh3/

Reservation

While Fresh3 works great for me, don’t expect too much from such a raw product. There are definitely bugs there. There are also a lot of flaws in the graphical interface.

Some things you’re used to won’t work, and others won’t work the way you’re used to. (well, for example, from what is known – the buttons on the toolbar can be clicked with both the left and right mouse button. I will fix it, but later.)

By the way, I almost did not test the Windows version. And started it only under WINE. (I just don’t have constant access to Windows) It definitely works, but it probably has its own bugs.

What I can absolutely guarantee is that there is no malicious code in the IDE.

I think it’s because antiviruses don’t like such programs – on assembler, small and without third-party dependencies. So if something works, know that everything is a lie!

A lot of work still needs to be done and it will definitely be done. Sooner or later.

Said by a master programmer: “Even if the program consists of three lines, sooner or later it will have to be accompanied”

Write in the comments what you like, what you don’t like. Also write that after-hours is engaged in nonsense, if you so desire.

Happy New Year everyone!

Related posts