-
CORDIC on the Moncky
10/26/2023 at 14:12 • 0 commentsCurrently looking at CORDIC algorithms for calculating sin, cos, tan, exp, log, ... Very interesting! This algorithm was invented in 1957!!! It is still used in a lot of hardware. I hope to implement it soon so I can show it of with some 3D graphics or so :-)
-
Documentation updated
08/17/2022 at 14:16 • 0 commentsI updated the documentation. It is now split into different parts. You can find all files on:
https://gitlab.com/big-bat/moncky/-/tree/master/documentation
-
Pacman
07/27/2022 at 11:22 • 0 commentsYes, finally. You can play pacman on the Moncky computer!
This game was written in the Moncky programming language and compiled to Moncky-3 machine code. It is about 20KiB. So plenty of memory left!
You can see a video on:
-
Code for the first game
07/04/2022 at 18:12 • 0 commentsThis is the Moncky code for the game I created as a proof of concept:
const CANON_WIDTH = 10 const CANON_HEIGHT = 10 const ALIEN_WIDTH = 4 const ALIEN_HEIGHT = 8 const BULLET_HEIGHT = 5 const LEFT_KEY = 0x16B const RIGHT_KEY = 0x174 const SPACE = 0x29 var score : uint8 = 0 var canonX : uint16 = 160 var alienX : int16 = 4 var bulletX : int16 = 160 var bulletY : int16 = -1 fun drawScore() { call graphics_setCol(0xFF) call text_setCursor(0 0) call text_printString("score: ") call text_printHex(score) } fun drawCanon() { if ((canonX >= CANON_WIDTH) & (canonX <= (319 - CANON_WIDTH))) { call graphics_setCol(0xFF) call graphics_line((canonX - CANON_WIDTH) 199 canonX (199 - CANON_HEIGHT)) call graphics_line(canonX (199 - CANON_HEIGHT) (canonX + CANON_WIDTH) 199) } } fun drawAlien() { if ((alienX >= ALIEN_WIDTH) & (alienX <=(319 - ALIEN_WIDTH))) { call graphics_setCol(0x0F) call text_drawChar((alienX - ALIEN_WIDTH) 8 'O') } } fun drawBullet() { if ((bulletY >= BULLET_HEIGHT) & (bulletY < (199- BULLET_HEIGHT))) { call graphics_setCol(0xF0) call graphics_line(bulletX (bulletY - BULLET_HEIGHT) bulletX (bulletY + BULLET_HEIGHT)) } } fun checkKeyCode(keycode: uint16): uint16 { if (keycode == LEFT_KEY) { let canonX = (canonX - 5) if (canonX < CANON_WIDTH) { let canonX = CANON_WIDTH } } if (keycode == RIGHT_KEY) { let canonX = (canonX + 5) if (canonX > (319 - CANON_WIDTH)) { let canonX = (319 - CANON_WIDTH) } } if (keycode == SPACE) { let bulletX = canonX let bulletY = ((199 - CANON_HEIGHT) - BULLET_HEIGHT) } } fun animateBullet() { if (bulletY > ((BULLET_HEIGHT + ALIEN_HEIGHT) + 8)) { let bulletY = (bulletY - 1) } else { if (bulletY > 0) { if ((bulletX >= (alienX - ALIEN_WIDTH)) & (bulletX <= (alienX + ALIEN_WIDTH))) { let score = (score + 1) } let bulletY = -1 } } } fun animateAlien() { if (alienX >= ALIEN_WIDTH) { let alienX = (alienX + 1) if (alienX > (319 - ALIEN_WIDTH)) { let alienX = ALIEN_WIDTH } } } main keycode : uint16 drawBuffer : uint8 { let drawBuffer = 0 call graphics_setBgCol(0) while true { call graphics_setScreenBuffer((1 - drawBuffer)) call graphics_setDrawBuffer(drawBuffer) call graphics_clrscr() call drawScore() call drawCanon() call drawAlien() call drawBullet() let keycode = call keyboard_readKeyCode() call checkKeyCode(keycode) call animateBullet() call animateAlien() let drawBuffer = (1 - drawBuffer) call util_enableInterrupts() call graphics_waitVertRetrace() call util_disableInterrupts() } }
-
Moncky programming language ready
07/04/2022 at 18:03 • 0 commentsThe moncky programming language is ready. It still needs to be documented :-)
I programmed a simple game in it and it works!!!
-
Moncky compiler
06/22/2022 at 17:51 • 0 commentsI abbandoned the C-compiler project since it has been too long since I worked on it and it got too complicated.
But all the experience has made me want to create my own programming language.
So I started that. You can follow the progress on Gitlab. The EBNF specification is rather stable and is made to be easily parsed. I hope to be able to finish it somewhere in the summer. Because then I can start coding on a nice game for the Moncky-computer. My partner has been asking for a packman so I'll see what I can do :-)
-
C compiler enhanced
09/15/2021 at 12:48 • 0 commentsThe C compiler now also knows external functions (from firmware), while, if, and return statements. See the file "testje.c" on gitlab. It will compile and execute on the Moncky computer.
-
Initial C compiler ready
09/10/2021 at 11:58 • 0 commentsA first implementation of the C compiler is available on gitlab.
The code can use some refactoring, and comments.
The compiler can already parse a lot of C-files but code generation is not implemented for a lot of constructions. However, the basic structure is there and just needs extra code.
Still a lot of work :-)