Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Zemmargorp

Pages: [1]
TI Z80 / [Axe] Small CAS program
« on: September 24, 2014, 09:30:04 am »

I was browsing files on my computer, and I suddenly saw a big project I worked on during one year...
I immediately thought "I have to share it on Omnimaga", so here it is. A small CAS program.

It's the biggest TI project I made. This "small CAS program" is small for two reasons :
It takes only 5555 bytes, and... it only supports a few operations (see below).

Note that this project could be improved : there are many optimizations to do (it could become two times faster), and some important things to add (see below). Nevertheless, I WON'T improve it. I spent so much time on thinking of algorithms, programming them, and debugging, and I don't want to spend days on it again. Additionally, the important changes to do would require to rewrite the program entirely. I therefore consider this program is finished. I made it in Axe, but I won't publish its source code, mostly because it's unreadable.

   Features :

* Download here !
* It respects the priority of operations (parenthesis are allowed)
* You can only use one unknown, which must be X.
* You can also use floating point numbers, or integers.
* Writes up to 11 digits (whereas the OS only shows 9 digits)
* Operations allowed :
  (+) additions
  (-) subtractions
  (*) multiplications
  (^) powers (of natural numbers only)
  (E) powers of 10
  (') derivatives

   Examples :

When the program is executed, it displays ":".
The user can then type the input, which will be computed.
The result is displayed on a new line, starting with the character "=".

A basic calculation to check the priority of operations.
I hope you already knew how to compute it by hand.

Another easy calculation to try the distributivity, and to see that
floats without integer part can be written without the null unit.

If you are at high school, then you should now this remarkable identity...

...but you might not know this one.

The magical effect of the derivative.

It's possible to nest parenthesis.
The result was predictable, wasn't int ?

   Limits :

* It only expands expressions
* You CAN'T use division or square root
* You CAN'T use any variable except X
* You CAN't use the constants pi or e
* Close parenthesis otherwise it'll crash
* Slower than the OS : don't use it when it's not needed
* Uses the lists LTMP1 to LTMP6 and LTEMP for computation
* Powers of X bigger than 6 are ignored (try for example (X+1)^7).

   Disclaimer :

I'm not responsible for anything, but don't worry, there's no bug known.
If you don't write incorrect instructions, it shouldn't freeze or clear the RAM.

TI Z80 / [Axe/Asm] BOULDASH
« on: August 25, 2014, 12:29:28 pm »
Hi, everyone !

Today, after approximately one month of work, I'm pleased to present you BOULDASH, a Boulderdash clone, one of my favorites games. It runs at 6 MHz, uses animated sprites, let you chose between level packs, reads levels (appvars) from archive (without unarchiving), takes less that 4000 bytes, and should be bug-free !

Quote from: Wikipedia
The game's protagonist [...] must dig through caves, [collecting diamonds to unlock the exit], while avoiding [moving creatures] as well as obstacles like falling rocks, and the constant danger of being crushed or trapped by an avalanche, or killed by an underground explosion.

Download here !

To play the game :
- use the arrow keys to move
- [ENTER] to suicide while playing
- [CLEAR] at anytime to quit

Working on a level editor... beta version here.

The game is almost finished, and already playable. I'm still working on it : I'd like to port it to assembly, to add a bar at the bottom of the screen with time and diamonds counter, to add new objects, and to change other little things. Once the game finished, I'll probably publish the code source. Currently, it's unreadable : I mixed Axe and assembly (though it's possible to make the game in pure Axe), nothing is commented, and I optimized the code everywhere.

You can ask me any question, tell me what you think of it, and send me ideas of features to add/improve.

TI Z80 / [Axe] Flappy Bird clone
« on: August 12, 2014, 12:54:15 pm »
Did you hear about Flappy Bird ?
Well, a friend of mine and I made it in Axe...
Here's my version of the game !
I know, I'm six months late, but better late than never !

I made this game because one Monday, at school, classmates challenged me to make the game in one school day. To make it quickly, I stole the sprites from the well-known Mario (like Flappy Bird's author did !), and I started coding. Here's what I came with (it's normal that the game isn't completely finished). The next day, I decided to make another version, where you move up and down using the arrow keys, and the more you keep one of these directional keys pressed, the faster you move. I called this second game "TWISTEUR", because it moves a lot  :P .

Being now an Omnimaga's user (an omnimagian ?), I decided to share these two games, with their source code. Here they are ! My best scores were around 40/50, if I remember well... I'm bad in the screenshots because it's very hard to play on emulators ! By the way, it's possible to fly from the bottom to the top, and from the top to the bottom, even if it's a bit hard, I've managed to do it in both games.

The Axe Parser Project / [Axiom] Menu( using OS's bcalls (finished !)
« on: August 02, 2014, 12:34:44 pm »
Good news, everyone !

I found a way, which is in my opinion reliable, to use the system DIALOG bcalls to make custom menus, like in TI-Basic. And it may be added to Axe ! Currently, if you want to use it, download it here  ;)

The OS does not expose a very simple way to generate menus, which is why the feature does not exist. But if any assembly wizards want to provide the majority of a solution, I'll happily include it! That is, if I can fit it.  :P

If you want to see how it works :

Spoiler For Asm code:
Here's the main part of the source code. Most of it comes from the program of Brandonw.

;Note : If the users presses [2nd] and [quit], the number returned will be the choice highlighted.

;It'd be great to find a way to backup the text screen and restore it later.
;There are other things this routine changes and doesn't restore, see the end of the code.

;The following lines backup the current "rawKeyHookPtr", which will be replaced.
;It uses the stack... it could use any RAM safe area, but they may be already used.
ld hl, rawKeyHookPtr - 1
ld b, 4
inc hl
ld a, (hl)
push af
djnz hookBackup
;Backups some settings, still using the stack
ld a, (flags+34h) ;rawKeyHook active flag
push af

ld a, (cxCurApp) ;what kind of app is currently running
push af
ld a, 58h
ld (cxCurApp), a  ;Sets value to 58h=kExtApps="External Applications."

;Copy menu structure
ld hl, structStart
ld de, ramCode
ld bc, structEnd-structStart

;Prepares dialog :

ld hl, dialogCallback
in a, (6) ;Does any of the following bcalls changes the flash page mapped ?

;Starts dialog

;End of dialog

;I discovered that the choice's index is located into RAM, at $8006. I conjecture it is always stored here.

ld hl, ($8006)
bcall(_DispHL) ;Show the chosen item's index

;Restores previous settings
res appCurWord, (iy+appFlags)pop afld (cxCurApp),a
pop af
ld (flags+34h), a
;Restores previous rawKeyHook
ld hl, rawKeyHookPtr+5
ld b, 4
dec hl
pop af
ld (hl), a
djnz hookRestore

;Some changes are not restored :

;- the indicator and the cursor are set off
;- "ramCode" and the text screen have been modified
;- appCurWord flag is reset

;Dialog's callback :
xor a

;Is it compatible with all shells (some shells might use ramCode) ?
Spoiler For Menu structure:
The menu structure is enough easy to be written by hand, but I've made a script to generate it automatically (see the download link at the beginning of this message). Here's how it works :

;To make the title, there are three $01 bytes, followed by a pointer to the string.
;Note : you can add other titles anywhere in the menu, by using the same structure.
.db 1 \ .db 1 \ .db 1 \ .dw sTitle-structStart
;Then, for the first choice, put the bytes $05, $01, $01 again, and the pointer to the string.
.db 5 \ .db 1 \ .db 1 \ .dw sChoice1-structStart
;To add other items inside the menu, continue adding the $05 and $01 bytes, but increment the third byte for each new item, as it corresponds to the choice's index. Note : You can use numbers (from 0 to 9) randomly, and use the same number twice, but the number returned by the Menu( function will be the choice's row's index.
.db 5 \ .db 1 \ .db 2 \ .dw sChoice2-structStart
.db 5 \ .db 1 \ .db 3 \ .dw sChoice3-structStart
.db 5 \ .db 1 \ .db 4 \ .dw sChoice4-structStart
;Note : You can't put more than 8 items (including the title).
;When it's done, add $00.
.db 0
;The strings must be added after the structure, and preceded by their length.
;Note : you can write them in the order you want ; you may not respect the menu's choices order.
sTitle:   .db 7, "COMPILE"
sChoice1: .db 6, "Cancel"
sChoice2: .db 7, "Noshell"
sChoice3: .db 3, "Ion"
sChoice4: .db 8, "MirageOS"
;The menu is made.

Pages: [1]