Wednesday, April 24, 2024

Voyager Manager v0.1

I've written about seven programs for my HP 12c. I've manually combined them into a big "multiprogram" which starts with a jump table: a bunch of GTO commands, each one jumping to the entry point of one of the actual programs. The reason for that is that the HP 12c has only one contiguous program area. Fortunately, the calculator allows you to manually execute a GTO command before pressing R/S to start the execution. But instead of having to remember the starting address of each program, I just put them on the GTO instructions on the jump table so I just need to manually do GTO 003 and press R/S to start the third program, because address 003 has the GTO to the starting point of the third program. 

But managing this multiprogram is very tedious. When a program is placed in a different starting address in memory, all the GTO targets of that program need to be updated and offset correctly to continue working. So I made a program called Voyager Manager that lets me compile any number of programs into one such multiprogram, taking care of the GTOs and the jump table automatically. It works for my programs but it's still a very early version. It comes with GNU/GPLv3 source code, Lua binaries for Windows included, and a library that includes my programs for the HP 12c to get you started.

You can download Voyager Manager from here.

Saturday, January 13, 2024

A Dissonant Chord - Part 9

In part 8, Ikram, Arasen, Kendi and Indirra fled to Ikram's old campsite to recover from their injuries after escaping from jail. The next day, Indirra explained to Ikram that he must deal with the "sodden" that was pursuing him, either through combat or by offering a gift. Ikram and Indirra then went to a river, where Ikram ate wetwart to commune with the spirit and had a vision of its past life. He threatened the sodden to leave him alone and the sodden agreed to it in exchange for a pair of iron boots. Then they started preparing a trap in a area where they would attempt to fight warriors of the Cove.

2nd day of Summer, year 132

After perfecting our trap over several days and keeping watch on the road, Kendi spotted a group of warriors approaching from the direction of the city. As planned, he pulled aside the bushes we had cut from the ground, creating an opening. Seeing this, Arasen, Indirra and I ran to meet him. They then pretended to be walking away from the city but turned as if in panic when one of the warriors pointed at Kendi's group. The warriors immediately broke into a run to follow them. It was now my turn to act, making the spikes invisible just after the three had safely passed them. Visualizing something invisible took concentration, but I managed it just as the warriors passed the concealed roadside bushes. There were five in total, and three seemed familiar. As planned, Arasen, Kendi and Indirra fled toward the trees where I hid, feigning panic. The emboldened five warriors sprinted after them directly into the trap. The front three were skewered on invisible spikes as two behind, shocked and confused, tried to stop. I then jumped from cover, now certain these were the remaining men from Graycliff, and shouted, "You filthy trogs will die today for what you did!" Their mouths agape, I aimed and shot an arrow at the one that I did not recognize, striking his chest. He fell to his knees as the sole other standing rushed at me, fast as could be. He likely would have reached me before I could nock another arrow, but the area was full of spikes, and his speed caused him to fall upon one, piercing him deep. As he screamed, my arrow found its mark in his skull, silencing him instantly. The one who had taken an arrow to the chest lay unmoving just nine steps away. All that remained were the other three - two crawling away in agony while skewered on spikes, and one Kendi now approached, recognizing him as a former captor. I went after the two crawling men. I kicked one onto his back, and as he shouted expletives, quickly loosed an arrow into his face before moving to the last. I turned him over. "You and your dead buddies killed ten people in Graycliff and burned the village," I said. "So what? You attacked us!" I shot an arrow through his knee. "I attacked you? After you tried to take all I had? Was it worth it, you stupid fuck? I'm going to destroy your little band - you're the last of the boys that attacked my village. I'm coming for your leader next." "I hope they catch you and give you to the elves, you bastard!" he spat. I tied his hands and feet. "What, you won't kill me? I'll die anyway, you can't use me as leverage." "The river is near, and I see you're wearing some fine iron boots," I replied. Five minutes later, I unloaded him from Valeri beside the flowing water. "What the hell, you psycho, why aren't you finishing me off with an arrow like everyone else? Will you drown me? Hey! Were are you going?" he mumbled as I stepped away from the river. "I ain't drowning you myself," I said. "Your boots are here, plus anything else of worth you find to aid you in your revenge against your brother!" I shouted toward the river. The warrior's confusion was quickly replaced by terror as two wrinkled hands emerged from the water and pulled him under. Arasen, Indirra and Kendi had followed me and were watching from a distance but now approached. "Are you ready? Feeling alright?" Arasen asked. "Yes, much better. He was the last of..." I started to say, but my sentence was cut short by a pink light exploding from the river in a mist that weaved through the air toward me. I tried to run but it was too fast, shooting straight for my sternum. However, it wasn't aiming for me - it absorbed into my lodestone within seconds. "What's happening?" shouted Kendi. "Why did you freak out?" "There was some weird mist coming from the river that went into Ikram!" Indirra replied. "Not into me, into my lodestone," I corrected. "Didn't you see it?" I asked Kendi and Arasen, who both shook their heads. "But what was that energy? It was pink, so not the kind you usually absorb, right Ikram?" Indirra asked. "Yes, it looked and felt somewhat different. Let's move our camp elsewhere for tonight," I said. So we traveled for about an hour and found a clearing in the forest to set up camp, where I spent most of the night examining the lodestone with Indirra. We found out that it responded to my invocation attempts but not to Indirra's. It also seemed to be filled with energy after absorbing the mist but I decided not to absorb it that yet since I felt quite full.

3rd day of Summer, year 132

I slept very well and felt completely rejuvenated upon waking. We ate together and discussed our next steps. I still wished to move on, but as I told that warrior, I intended to go after the Cove's leader next. I swore upon my knife that I would see Namura captured or dead. Knowing the Cove was now weakened, we decided to strike swiftly. We would target the head - Namura. We would wait until nightfall and infiltrate their headquarters under cover of darkness. Indirra used invocations to dim or extinguish any lights along our path. She also allowed me to absorb some of her energy, which was quite intense. When we reached the headquarters, I spent some time searching for alternative entry points. We found an unguarded window on the side that appeared to open into some sleeping quarters. Assuming it would be empty at this late hour with so few members remaining, we entered. However, we were mistaken - someone was sleeping inside. Only once within did we realize. We tried to sneak past quietly, but the old wooden floors creaked underfoot, rousing the warrior from sleep. I quickly invoked transparency around us and felt my lodestone warming against my skin, a sign that the illusion had taken hold with its help. Moments later, the warrior returned to slumber and we exited the room, moving into another empty barracks room. Within, we heard footsteps above, likely a single person. Finding a staircase, we ascended and emerged in a workshop hall strewn with arrows, weapons and used armor. I mentally noted a few wooden armor stands that could serve as makeshift barriers if we were chased through the space. We moved away from the sound around a corner. The hallway continued a bit more narrowly ahead, ending at a door bearing both the insignia of the Cove and Greatrock. This had to be Namura's private quarters. And indeed, we could hear snoring emanating from within! I timed opening the door to coincide with Namura's snores, and after a few more, we had all entered the room standing before him. We all looked to Kendi, who gladly moved over Namura and stabbed his heart while muffling his mouth with a hand. I searched his office and found letters exchanged between Namura and someone named Kabeera. Namura had detailed plans to launch an attack on the elves and was requesting backup, stating it was time to stop serving "those monsters." The letter was dated a week past, and I wondered why it had not yet been sent. Then I discovered two additional letters apologizing for an inability to assist Namura and advising against moving against the elves, warning this would result in destruction of the entire region. It had become clear that while we had succeeded in destroying the Cove, the true heads of this operation were the elves pulling the strings from afar. We escaped the way we entered and made for Valeri, camping in the forest outside the city for the night.

4th day of summer, year 132

I awoke refreshed. Once more, we discussed what was next. Kendi cared deeply about Greatrock, so he wanted to stay there underground for a while and hopefully expunge any remaining Cove members before organizing a militia against the elves. Indirra agreed that they should stay and help. Arasen was the only one who suggested they move away before things with the elves became worse, but eventually gave in. I told them that I'd move on with my trip around the world. I promised them that I'd visit again as soon as possible. I gave them instructions on how to find the library of old-world books in the frozen cavern under the shack and suggested they go see Padma in Mournwood if they need to sell more of these books. Then I showed Indirra the tablets I copied from the abandoned house in the Deep Wilds. Before I even explained anything, she ran and brought her magic mirror. She partially uncovered the edge and showed me an inscription on it. It was definitely the same script, but, alas, she knew what neither meant. Neither did her mother. But since the mirror was probably made by the same people as the ones in the abandoned house, we discussed its origin. Her mother told her that she was once led to a ruin by a glimmer. A child-like glimmer. We speculated that maybe that glimmer was once one of these humans. Maybe all glimmers were once such humans. We kept talking till midday. Then we exchanged hugs with each other and I left towards the Havens to the east. I reached an opening and camped for the night.

This marks the end of the first act of A Dissonant Chord. I have played enough to post another three parts from the second act, which follows Ikram on a trip to another plane of reality and back. But I will post the next three slowly over the next half a year or so. Without providing any more spoilers, I have had to pause playing that campaign because I am currently playing a prequel campaign with some people. This prequel campaign will determine exactly what Ikram is going to discover when I continue playing his campaign. Till then, if you feel like playing in a campaign within this universe, leave a comment.

A Dissonant Chord - Part 8

In part 7, Ikram, Arasen, Indirra, and their rescued friend Kendi successfully break Kendi out of jail using Indirra's enchanted mirror. However, as they flee, a drunk warrior spots Ikram and alerts others. A fight ensues and Ikram is able to kill one, but they are injured in the process. They escape to Ikram's old campsite to recover from their injuries.

36th day of spring, year 132

We woke feeling somewhat more energized this morning. Arasen treated me like a brother and was very upbeat in his outlook about everything. Indirra and Kendi, however, were not so optimistic. They were worried about an infected wound on Kendi's foot, which seemed to be getting worse, and asked if I had any knowledge of how to treat it now that we could no longer return to Greatrock. I gave Kendi some alcohol to numb the pain and took a close examination of his wound. I discovered a piece of wood buried deep inside and removed it. I then applied some healing herbs before rebandaging his foot. Once Kendi had calmed down, I noticed that Indirra had begun drinking the remaining alcohol. So we lent a helping hand as she finished it off. The rest of the day was spent swapping stories about our pasts to take our minds off our troubles.

37th day of spring, year 132

We awoke feeling rested, miraculously without hangovers. Kendi's wound seemed somewhat better. I asked what our next steps would be, but Indirra reminded me of the sodden that was pursuing me. "Soddens are said to grow stronger over time, so you must act swiftly. Defeating them in combat usually prevents further attacks, though such fights are never fair. You can't evade them forever either - as spirits, they haunt you whether emerging from the water or not. The other option is to offer a gift, but for that you must discover what they cherished in life," she explained. "But how will I know?" I began to ask, when she interrupted, "You commune with them. Go to water with friends during daylight and eat some wetwart - two or three should suffice. Then you may see their past." I replied, "Very well, will you help me with this? Today even, the river is near." Indirra agreed and we set off. Along the way, she advised that avoiding soddens in future meant not approaching water alone or ensuring attacks would be ineffective. We left Kendi resting back at camp and Arasen to care for him and guard our supplies and Valeri. A half hour later, we reached the riverbank. Indirra tied a rope around us both, making it virtually impossible for either of us to be dragged into the water. After finding some wetwart sprouts, she asked, "Ready?" "Yes," I answered, and lay down by the flowing water. I munched three wetwart sprouts and swallowed them, though the taste was horrible. We chatted for less than an hour before the effects of the warts began to take hold. At first, I started seeing movement in the water and among the trees. Indirra told me it was merely a hallucination and advised me to close my eyes. I did so, and after a minute I opened them again to see the trees as before. I felt myself starting to move towards them, unsure if I was actually walking or merely observing myself from a distance. Then I saw Valeri with no saddle. She looked at me briefly before turning and moving into the trees. I followed her silently, feeling no need to call out for her to wait. We walked through the forest as the trees began to glow with a dim blue light and that familiar smell surrounded me once more. I closed my eyes, took a deep breath and allowed it to envelop me. When I opened my eyes again, I felt sated but Valeri was no longer in front of me. The trees had stopped flowing and I found myself standing at the entrance of a cave, carrying the carcass of a deer which I knew I must bring it inside before something attacked. As I headed into the cave, a family was waiting - my brother, wife, uncle and infant daughter, whom I recognized at that moment. Everyone seemed glad to see the deer, except my brother - he was jealous as always. "That's why he drowned me," I thought. "That's why I need this power." But some small part of myself knew, "This isn't real." I tried to remind myself. "I need control. I saw this cave the same day you decided to attack me. You won't get my power. Let me go or I'll go straight to your family, and it won't be just your brother I kill." I thought to myself. Now I was breathing deeply and rapidly. "At least bring me iron boots so that I can walk the land myself," a voice rang in my head. I thought I would do so and tried to stand up and walk back to Indirra. It took some time "walking" and slowly coming back to myself. When I finally did, it was almost evening. On the way back to camp, I recounted the whole experience and the sodden's request to Indirra. She agreed we needed to fulfill it but warned me about returning to Greatrock. I spent the rest of the day hunting, though I still felt somewhat slowed by the lingering effects of the wetwart.

38th day of Spring, year 132

I awoke feeling a bit less tired. I headed out to collect resources and found we were missing only the iron boots. I had the idea to steal the boots from the Cove, as it would be very risky to show up in the market and buy them. While stealing them carried its own dangers, at least it would also cause a small amount of damage to the Cove, and perhaps I could find other useful items. I suggested going alone and asked where their headquarters were located. Arasen confirmed what I partly already knew - their main building with a tall watchtower atop was on the east side of town, where they kept all their supplies, though it was guarded. "Could I hire mercenaries to help us?" I asked the others, explaining I had at least 900 arrowheads to spend on destroying the Cove. They were surprised by this revelation, and we began discussing our options. All thought finding enough trustworthy mercenaries would be risky, as a single betrayal could lead us into a trap. Hiring a mercenary group would be ideal, but the Cove had ensured none were available locally. I then suggested we set a trap along the road, using sharpened stakes concealed in a thicket, to ambush the next large Cove party we saw entering or leaving the city. We worked on this through the night.

39th day of Spring, year 132

After a restful sleep, we spent another day further preparing our trap. Kendi, who was still somewhat tired, mostly kept watch over the road.

In the next and last part of the first act of A Dissonant Chord, a climactic confrontation awaits as plans come to fruition. Danger and revelation loom as our heroes spring their trap and even enter enemy territory. But will all go as expected, and what new factors may yet emerge from shadows unseen?

To be continued...

Wednesday, January 3, 2024

Cryptsetup basic cheatsheet

To format a partition (e.g. sda1) as LUKS with an HMAC integrity layer:

cryptsetup luksFormat --type=luks2 --integrity hmac-sha256 /dev/sda1

Or without an integrity layer: (you probably want this for most usecases)

cryptsetup luksFormat --type=luks2 /dev/sda1

To open the encrypted partition:

cryptsetup open /dev/sda1 sda1_crypt

Alternative was to open it while permanently marking the LUKS device to accept discard (TRIM) operations:

cryptsetup open /dev/sda1 sda1_crypt --allow-discards --persistent 

This will create a decrypted device for the same partition which you can format like so: (-i 4M for storing files around 4MiB each, -m 0 to avoid reserving space for the root user, change the Label to whatever you like)

mkfs.ext4 -i 4M -m 0 -L Label /dev/mapper/sda1_crypt

Then close it:

cryptsetup close /dev/mapper/sda1_crypt

Disconnect the device and reconnect it (or mount it however you normally do) to see if everything works.

Parallelizing LAME MP3 conversions

In Linux, the P4 parameter below will launch 4 LAME instances in parallel to process all the FLAC files into MP3 with the given LAME settings.

find . -name '*.flac' -print0 | xargs -P4 -0 -I{} lame -q0 -V6 {}

Popular Posts