Tag Archives: wallabag — all feed

A RISC-V Operating System Instruction Manual

estimated reading time: 1 min

To some, an operating system is a burden or waste of resources, like those working on embedded systems and other low-power applications. To others it’s necessary, abstracting away hardware so that higher-level programming can be done. For most people it’s perhaps not thought of at all. But for a few, the operating system is the most interesting piece of software running on a computer and if you’d like to investigate what makes this often overlooked aspect of computer science interesting, take a look at this course on operating systems from Cornell University.

The operating system itself is called Earth and Grass Operating System because it splits the functionality of the operating system into three separate parts. The Earth layer involves dealing with hardware, the Grass layer involves hardware-independent aspects, and a third application layer implements other key operating system features. It’s built for a RISC-V processor, since that instruction set is completely open source and transparent about what it’s doing. It’s also incredibly small, coming in at around 2000 lines of code. The course covers nine areas, with the first six being core operating system functions and the remaining three covering more advanced operating system concepts.

For understanding the intricacies and sometimes mysterious ways that operating systems work, a course like this can go a long way into unraveling those mysteries and developing a deeper understanding of how it brings the hardware to work for higher-level software. We actually featured this operating system two years ago, before this course was created, which covers this project for those who like to take a more self-directed approach, or simply want a lightweight OS for a RISC-V system.

from wallabag — all feed https://ift.tt/Qebro9I

Reverse Engineering LEGO Island

estimated reading time: 2 min

While LEGO themed video games have become something of a staple, in 1997 they were something of an odity. LEGO Island became the first LEGO video game released outside of Japan in 1997 and become something of a hit with over one million copies sold. The game was beloved among fans and set the stage for more LEGO video games to come. In an effort of love, [MattKC] put together a team to reverse engineer the game.

The team set out with the intent to create a near perfect recreation of the codebase, relying on custom made tools to run byte checks on the rewrite compilation and the original binary. While the project is functionally complete, [MattKC] believes it is impossible to get a byte accurate codebase. This is because of what the team called “compiler entropy.” Strange behaviors exists inside of Microsoft’s Visual C++ compiler of the era, and small changes in the code have seemingly random effects to unrelated parts of the binary. To mitigate this issue would likely require either partially reverse engineering Visual C++ or brute forcing the code, both of which would take a large amount of effort and time for no real benefit.

Another interesting step the team had to work out was how the game handled graphics. In the version of Direct X used, the developers could chose between immediate mode and retained mode. The difference largely boils down to how models and assets are handled. In immediate mode, Direct X is largely just a render engine and everything else is handled by the developer. With retained mode, Direct X works more similarly to a game engine where all the model and asset management is handled by Direct X. Almost all developers ended up using immediate mode to the point that Microsoft deprecated support for retained mode. For this reason, if you were to download and run LEGO island on a modern Windows PC, it would yell at you for not having the proper libraries. There is debate about how best to handle this moving forward. The team could rely on an unsupported library from Microsoft, reverse engineer that library only making the functions needed, or using leaked source code.

With the completion of the reverse engineering, engineering can commence. For example, an annoying and persistent bug caused the game to crash if you tried to exit. While it was effective in closing the game, it also caused progress to be lost. That particular bug was fixed simply by initializing a variable in the game’s fronted. Interestingly, that bug was not present in the late betas of the game that had been dug up from the depths of the internet leading to questions as to why a rewrite of the fronted was necessary so late in the development. Now efforts are commencing to port the game to other platforms which bring with it fresh headaches including rewriting for OpenGL and the balance of keeping a historically accurate game with the needs of modern development.

from wallabag — all feed https://ift.tt/ANGM9OQ

Cute Tamagotchi Cow

estimated reading time: 2 min

Supplies

  1. ESP32 CYD (cheap yellow display) (2432S028R)
  2. suitable power source / power bank
  3. 3D printed parts. or some wood for the barn

or

  1. wood / plywood and color
  1. Arduino IDE software

(Basic experience with Arduino is required)

Step 1: The Cow Graphics

For our cow, we need a stage/barn with a feeding station and water trough, each of which displays different levels.

The cow should

  1. stand, smile, chew, look sad
  2. eat, drink
  3. lying down ruminating , smile, sleep

These images are stored as code on an extra file named “cow-all.h” and loaded when needed.

The images are self made, you are free to use them.

Step 2: The Cow Software

The CYD is a fantastic combination of ESP32 and Touchschreeen. It saves you the annoying soldering and cables.

My programming is admittedly a bit amateurish. You can certainly get more out of the CYD in terms of design or give the cow more functions. But at least the program steps are easy to follow.

The library can be used to simulate a wide variety of working surfaces. We don’t show a background, but concentrate on the cow, watering place and feeding place. Three click areas are integrated in a hidden manner, i.e. they are not visible but can be clicked in three places: Water and feed place for refilling and the cow itself for stroking.

The cow’s status is (soon) saved on the ESP32 so that the device can be switched off at any time and you keep the food/mood status.

The values of hunger and thirst change randomly. The ESP32 counts the milliseconds. These values can be set according to your personal preferences.

The file “cow-all.h” contains all the different cow images in code and must be stored in the same folder as “demo.ino” or “tamagotchi_cow.ino”!

Attachments

Step 3: Speaker and LDR Sensor

The speaker for ‘Mooh’ is optional. Unfortunately, I have not yet been able to get the sound function to work without complications with the screen. Every time the SD card is online the touchscreen is not working properly. Any idea?

The mp3 file(s) could be saved on the SD card. The connection pins are on the back of the CYD. I got the speaker from an old fixed line telephone.

The built-in LDR sensor (GPIO 34) tells the cow when to sleep. When it is dark, she lies down. During this time, water and food are not consumed.

Attachments

Step 4: The Barn

For the ambience, I quickly designed a stable with tinkercad.com and turned it into reality with the 3D printer. Of course, you can also build a wonderful miniature stable out of wood here. Don’t forget good ventilation at the back side.

Hay_Barn

Attachments

Step 5: Moooh

Function:

The cow eats and drinks when its internal water and feed levels drop (= hunger, thirst). If the water or feed container is empty, the cow is hungry, unhappy and mooing.

If you tap on water or feed, the supplies are replenished and the cow can eat. If you tap on the cow (= stroking), it is also happy and moos comfortably.

When the LDR notices darkness the cow is going to sleep. She does not eat and does not develop much hunger or thirst.

Have fun with your new pet!

from wallabag — all feed https://ift.tt/vS3d0Wc