Author Topic: [Axe] Puzzle pack (for those of you who are bored in math...)  (Read 21150 times)

0 Members and 1 Guest are viewing this topic.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: [Axe] Puzzle pack (for those of you who are bored in math...)
« Reply #45 on: December 08, 2014, 03:23:19 pm »
You can bypass the 8811 byte code limit, just use an axiom like fullrene or crabcake and it will run on any 83/84+ without crashing.

And with the way Axe compiles apps vs. programs, you have to change the code a bit to work. (eg. you can't change data in GDB's in apps) I'll take a look and see if I can find anything. :)


EDIT: Just skimming through quickly, I found some stuff like this:
Code: [Select]
:Copy(GDB7NPCS,L1)
This won't work, because when you compile the app, the data in GDB7NPCS is set in stone and can't be modified because it's part of the app. My bet is if you changed everything like this to utilize free RAM areas or some temporary appvars, most of the errors would go away.
« Last Edit: December 08, 2014, 03:49:22 pm by parserp »

Offline ISSOtm

  • LV3 Member (Next: 100)
  • ***
  • Posts: 56
  • Rating: +4/-0
  • Programming or playing games I've programmed
    • View Profile
Re: [Axe] Puzzle pack (for those of you who are bored in math...)
« Reply #46 on: December 10, 2014, 07:14:54 am »
You can bypass the 8811 byte code limit, just use an axiom like fullrene or crabcake and it will run on any 83/84+ without crashing.
Yeah, I know, but aren't 16k programs a bit large ? (yes, I am planning to make RPG Lite weight 16kb)
* ISSOtm wonders how CrabCake works...

EDIT: Just skimming through quickly, I found some stuff like this:
Code: [Select]
:Copy(GDB7NPCS,L1)
This won't work, because when you compile the app, the data in GDB7NPCS is set in stone and can't be modified because it's part of the app. My bet is if you changed everything like this to utilize free RAM areas or some temporary appvars, most of the errors would go away.
No, it will work, because it copies data FROM GDB7NPCS to L1 (which is is RAM, because I sometimes edit NPC data)

And with the way Axe compiles apps vs. programs, you have to change the code a bit to work. (eg. you can't change data in GDB's in apps) I'll take a look and see if I can find anything. :)
RIGHT ! There is the bug ! It is because I didn't read Axe command list correctly <_<
Quote from: Quigibo in Axe command list
nib{EXP}    Returns the EXPth nibble in RAM. Use this to access external data in RAM. Since there are twice as many nibbles as bytes, make sure pointers are multiplied by 2.
nib{EXP}r     Returns the EXPth nibble in RAM, or ROM if compiled as an application. Use this to access internal data. Since there are twice as many nibbles as bytes, make sure pointers are multiplied by 2.
When I was using ASM programs, I used nib{}. When this code was compiled to app, it looked for data... in RAM, not the app.
Thanks for help, now it works !

CHANGELOG :
 ! Now compiled as a 16kb app !
 + Added a pickaxe and a breakable wall !
 + Added a maze !  :w00t: < Where am I ?? |
 + Added an option to "Fast-Forward" the game (actually uses Axe's Full function)
 + Added an option to reset the save while in-game (before, it needed either save hacking or to manually delete the save fie)
 + Added some kind of tutorial level
 + Now with ladders ! :o
 * Fixed a bug with the "dig landmark" cross not appearing upon resetting save, but appearing when re-starting the game.
 * Fixed a bug with the save text not being cleared when cancelling save procedure
 * Introduced bugs, I think  ;D

The files are coming as soon as the pickaxe and ladders are fully implemented and (mostly) debugged.

[EDIT] Done, but I'm currently adding the inventory. It is almost finished, I just need help from a friend to finalize the item sprites
« Last Edit: December 14, 2014, 02:13:26 pm by ISSOtm »
Programmer ("always start, never finish")

Currently owning :
 - TI 84+SE (crashed by zStart :P )
 - Computer for life



Voir aussi la version française.

Puzzle Master (if you hate mathemathics...)

Also on codewalr.us !

Offline ISSOtm

  • LV3 Member (Next: 100)
  • ***
  • Posts: 56
  • Rating: +4/-0
  • Programming or playing games I've programmed
    • View Profile
Re: [Axe] Puzzle pack (for those of you who are bored in math...)
« Reply #47 on: December 22, 2014, 01:25:04 pm »
Development is being slowed down during holidays, because I want to spend some time with my family.

I think I'm going to use a custom sprite routine (written in a combo of Axe and Hex) to display NPCs.
Here is the code ; I don't know :
1. Is it faster than Pt-Mask()r ?
2. Same question for size ?

Here is an example program, will display a chest which will be used in a near future version :
Code to write
Assembly equivalent (when possible)
What does it mean
SPRITE(0,,Pic5PRITE)
DispGraphClrDraw
getKey r
Return
Just the main code to see what happens
[00000000000000001FF820042004281427E43E7C27E4281420043FFC00000000]->Pic5PRITE
[0000000000000000000000000000000000000000000000000000000000000000]
Note : maybe I made a mistake, this should be exactly 4 lines filled with zeros
Lbl SPRITE
Now correct stuff
r2 *3*2*2*2*2*2+ r1 *2
ld hl, ...
Hl is now the offset to where the sprite should be drawn at
Asm(114093)
ld de, $9340
L6 .equ $9340, so de points to the beginning of the buffer
Asm(19)
add hl, de
hl is now the pointer to the sprite destination
Asm(EB)
ex hl, de
because de must be the destination and hl the source, swap these (hl will be set later)
Asm(DD)
r3
ld ix, r3
ix will be the source, so it points to the sprite
Asm(0610)
ld b, $10
There are 16 lines, so 16 iterations
11
ld hl, 11


spriteloop:
Now the main loop
Asm(1A)
ld a, (de)
Load the current pixels to apply masks
Asm(DDA620)
and (ix + $20)
Apply transparency first
That's also why I use ix and not hl
Asm(DDB600)
or (ix + 0)
And now put sprite pixels.
Asm(12)
ld (de), a
And put it on the buffer.
Asm(13)
inc de
Go to the next byte both on destination...
Asm(DD23)
inc ix
... and source.
Asm(1A)
ld a, (de)
Load the current pixels to apply masks :
Asm(DDA620)
and (ix + $20)
Apply transparency first ;
That's also why I use ix and not hl, I can't give a fixed offset with hl.
Asm(DDB600)
or (ix + 0)
Now, add sprite pixels
Asm(12)
ld (de), a
And put it on the buffer.
Asm(DD23)
inc ix
Go to the next byte on source...
Asm(EB)
ex de, hl
... but destination is a little bit trickier.
Asm(19)
add hl, de
We need to change de but not hl ; we should then swap these.
Asm(EB)
ex de, hl
Swap both again, and de now points to the next line.
Asm(10E6)
djnz PC + $E6
that's to spriteloop
Nothing
ret
Axe automatically add a Return at the end of the program.
Saves 1 byte.
« Last Edit: December 25, 2014, 01:03:35 pm by ISSOtm »
Programmer ("always start, never finish")

Currently owning :
 - TI 84+SE (crashed by zStart :P )
 - Computer for life



Voir aussi la version française.

Puzzle Master (if you hate mathemathics...)

Also on codewalr.us !

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [Axe] Puzzle pack (for those of you who are bored in math...)
« Reply #48 on: December 23, 2014, 10:24:48 am »
I can't help you here, as I don't know assembly well at all. If I may make a suggestion about posting, though, you should put your code in a [ code ] tag next time. It looks nicer, uses monospace font, and I believe has less space in between lines.
On that note, glad to see this coming along! It looks like it will be fun when it is complete!
I am Bach.

Offline ISSOtm

  • LV3 Member (Next: 100)
  • ***
  • Posts: 56
  • Rating: +4/-0
  • Programming or playing games I've programmed
    • View Profile
Re: [Axe] Puzzle pack (for those of you who are bored in math...)
« Reply #49 on: December 25, 2014, 01:45:04 pm »
I didn't know that forgetting a comma could corrupt entire memory areas. <-- Yes, that was the bug  :thumbsup:
But there is another (graphical only) glitch : when NPC render, sometimes a copy of the player's front sprite appears at an apparently random position (depending little on the NPC position).
Also, when it is in the bottom right quadrant of the screen, the cross NPC doesn't render. At all.

I'm also converting the sprites to the new format ; anyway, because I don't use Pt-Mask( anymore, sometimes I don't anymore need the mask = optimization !
11326 bytes used on a 16384 large app : any suggestions for new features ?

Also, merry Christmas !
Programmer ("always start, never finish")

Currently owning :
 - TI 84+SE (crashed by zStart :P )
 - Computer for life



Voir aussi la version française.

Puzzle Master (if you hate mathemathics...)

Also on codewalr.us !

Offline ISSOtm

  • LV3 Member (Next: 100)
  • ***
  • Posts: 56
  • Rating: +4/-0
  • Programming or playing games I've programmed
    • View Profile
Re: [Axe] Puzzle pack (for those of you who are bored in math...)
« Reply #50 on: January 13, 2015, 04:10:13 am »
This project is not dead, I am just near an exam, so I can't really work on it.
I am currently fixing the NPC bug which causes render errors, and also working on a pre-implementation of battle systems.
The NPC bug isn't apparently linked to my new custom sprite routine (which is more useful but less general-purpose than the Axe's default one), but instead to wrong data being read. I still wonder why.

The battle system currently only displays the enemy stats and sprite, but the only interaction is displaying a "Hurry, get away !" (<-- Reference to this) unless you have the hidden FIGHTING KIT item.

Screens ? Maybe one day.
Programmer ("always start, never finish")

Currently owning :
 - TI 84+SE (crashed by zStart :P )
 - Computer for life



Voir aussi la version française.

Puzzle Master (if you hate mathemathics...)

Also on codewalr.us !