-
Hack it back!
07/23/2022 at 03:27 • 0 commentsI entered the Clockboy project for the "Hack it back" contest.
It kind of fits the requirements : even if I love it, my good old Gameboy was just collecting dust, now with this project, it is displaying time for me an my guests!
The Ikea hack version runs 24/7 on my desk, and the real Gameboy version is only running when friends are visiting, without this project, it would just sit in a drawer.
-
GBcompo21 version
12/14/2021 at 20:53 • 0 commentsMy quick hack to play LSDJ songs didn't work, so I decided to fully rewrite Clockboy in assembly. As it was a bit frightening to start from scratch a new project in assembly, I disassembled the existing one and started to modify bits here and there until I rewrote most of it and enter GBcompo21 with this new version. I struggled a bit with the DMA and the timings but at the end it now works on the emulators AND the real hardware. I added a little sprite animation when the tune is playing.
I published the code on Github, the assembly is not pretty, but the goal is to allow people to recompile the project to include their own chiptune.
You can download the new version here.
I have a few ideas I might implement if I find the time and motivation, but otherwise I consider this project to be finished!
-
Playing Lsdj songs on a gameboy
06/28/2021 at 18:54 • 0 commentsLSDJ is a popular music tracker for Gameboy, and lsdpack allows playing lsdj songs from a custom application.
The project is developed in assembler using RGBDS while I used another Gameboy SDK for my project, GBDK.
Unfortunately, both SDK are incompatible, they use a different assembler syntax and a different obj file format...So I tried a quick hack :
- Using assembler directives in lsdpack I forced the code to be at located at higher addresses, leaving the bottom of the memory map empty
SECTION "setup",ROM0[$3000]
- Then I compiled the lsdpack example and kept only the upper part of the binary
- And I compiled my alarm clock project and cut the end of the file
- Then I merged both files
dd if=alarm_clock.gb of=alarm_bottom.bin count=24 dd if=lsdpack_test.gb of=lsdpack_top.bin skip=24 cat alarm_bottom.bin > fullrom.gb cat lsdpack_top.bin >> fullrom.gb
- In my code, I use inline assembly to call the addresses of lsdjpack functions I need
void play_lsdj_song() { __asm call 0x3D07 __endasm; }
So far, it doesn't work yet, I will insist a bit more to get my hack working and if it doesn't, I will probably convert my code from C to assembly, it will give me more control for the tight timings lsdpack requires.
-
Custom RTC dongle
06/28/2021 at 11:22 • 0 commentsIn order to avoid having to set the time every time I switch my Gameboy on, I wanted to make use of an RTC clock.
Certain expensives flash cartridges do have an embedded RTC but mine hasn't. So I decided to add a RTC feature through the link port.
ArduinoBoy is an existing project that allows you to control by sending MIDI instructions through the link port, it happens to support the Teensy 3, which is quite nice because the Teensy3 has an embedded RTC, so no need to add an external component, just an external battery. Or at least that what I thought, because when I read carefully the Teensy 3.1 spec, it requires an oscillator, unlike the 3.5 and 3.6.
I struggled a bit to get the link port to work. I wanted to use other ports that those used by ArduinoBoy, but I hadn't noticed that ArduinoBoy access the pins through port commands, and not digitalWrite()!
So, currently my Teensy code works with the GBDK Comm example, but I'll wait to have receive the oscillator to make modifications on my alarm_clock GB code.
The schematic is quite simple :
The implementation is a bit more messy ;-)
At first I tried to do a home made link connector but as I was debugging my Teensy software, I wanted a reliable hardware to only fix one bug at a time, so I ended up using an old gba cable connector.
My plan is to do some more soldering and fit everything in a Mario candy box
-
Konami code
06/23/2021 at 22:17 • 0 commentsI uploaded a new version of the alarm_clock cartridge, and I also uploaded the source to a github repo
One of the new features is that now there is a mode where you need to enter a Konami code to stop the alarm ;-)
On my TODO list:
- Use the RTC of the cartridge if present, so I don't need to set the date everytime
- Make some kind of RTC dongle for the Link port, because my flash cartridge doesn't have a RTC
-
Running on the real thing
06/20/2021 at 22:22 • 0 commentsAfter finishing the simple hardware version I started coding on a Gameboy emulator to try to display time and play "a-russian-tune-that-looks-like-a-famous-game-music-that-gets-a-lot-of-copyright-complaints"
The controls are :
- button A : set time
- button B : set alarm
- up/down : select hours or minutes
- left/right : increase/decrease time (minutes or seconds, choose with up and down)
I wrote the code in C and use GBDK to compile it. I will put the source code on Github soon, for now you can find the .gb file in the files section.
I contacted Eric from The Other Days and he pointed me to Lsdpack which would allow me to play proper LSDJ chiptunes on my "gameboy alarm clock" so I will try it soon.