An 8 bit fantasy computer
Instruction set | 8-bit AVR |
RAM | 64k |
ROM | 128k |
Display | 240x180 (hires mode 480x360) |
Colours | 16† |
Speed | 8Mhz (probably) |
Audio | 8 synth voices |
Storage | None yet,planned |
This section gives you an overview of the capabilities. For specific port numbers of the described capabilities, refer to https://github.com/Lerc/kwak-8/blob/master/IOMapping.txt
The Kwak-8 has two display resolutions. Standard resolution is 240x180, hires mode is twice that at 480x360. Display frames are assembled in a write only-display buffer that is 512x392.
Writing 0x80 to port 0x40 places a portion of the buffer onscreemn in lowres mode;
Writing 0x81 to port 0x40 places a portion of the buffer onscreemn in hirres mode;
There are 3 basic forms of writing to the display .An alternative method would be to simply host a framebuffer in RAM and do a single 240x180 Blit to place it onscreen. At 2 bytes per pixel a blit of 120 bytes wide and 180 high would fill the display but would also require a third of the RAM to hold the image.
Choosing the right combination of display methods requires weighing up the pros and cons. Displays that take up less RAM mean there will be less data that needs to be manipulated, possibly making them faster, but they are also less flexible, which in turn might make them slower. Clever use within the constraints is where much of the lasting appeal of 8-bit development lies.
There are 8 synth voices available on the Kwak-8.
This asm example shows how simple it is to play a sound from 8 bytes of data stored in memory
ldi r16,3 //play on voice 3
out voice_Select,r16
ldi XL, low(SoundData) // SoundData holds the 8 bytes of the sound effect.
ldi XH, high(SoundData)
ld r0,X+
out voice_Freq_L,r0
ld r0,X+
out voice_Freq_H,r0
ld r0,X+
out voice_Volume,r0
ld r0,X+
out voice_WaveShape,r0
ld r0,X+
out voice_BendWave,r0
ld r0,X+
out voice_BendAmplitude,r0
ld r0,X+
out voice_NoiseHold,r0
ld r0,X+
out voice_AttackRelease,r0 //writing to this port triggers the Attack-hold-release cycle
The eight ports for input reside at the same port addresses as the display. The display registers are write-only registers. The input registers are read-only registers at the same location.
The Kwak-8 has 16 bits directly mapped to buttons. These provideX and Y mouse coordinates are provided in a range of 0...255 measured in low-res pixels. Mouse buttons map to the same bits as Z, X, and BackSpace
There are two 8-bit time inputs.
Finally, there is a console input. This port reads from a buffer that can hold 10 ascii characters, the port returns zero when the buffer is empty
C development is well supported by avr-gcc. A good backgrounder can be fount at the AVR Microcontrollers in Linux HOWTO. There is preliminary support for AVR in development builds of Free Pascal. patches to add a Kwak-8 target and library functions are in the works.
In general anything that builds for the AVR has the potential to be used. Things should work as long as the tool does not assume particular hardware traits of Microcontrollers such as timers and interrupts.
The truly keen will want to develop in assember. AVR assembly resources can be found at http://www.avr-asm-tutorial.net/avr_en/index.html
The only thing you need to remember is that the Microcontroller Port numbers do not apply. The Kwak-8 port numbers are specified in