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 - Xeda112358

Pages: 1 ... 5 6 [7] 8 9 ... 13
91
TI Z80 / [2012 Apocalypse Contest] Battle 4000
« on: November 23, 2012, 04:09:01 pm »
I might enter this into the competition, provided I have enough time to work on it :) I've been working at it on and off, and so far I've put in about 10 hours into it (I did a lot of staring blankly at my calculator .__.)

Anyways, it uses 4 assembly programs at the moment.
-Shift a portion of the screen up 6 pixels
-Shift a portion of the screen down 6 pixels
-Plot the tilemap for monster zones (tilemaps are 72 bytes, using this method)
-Draw the actual map

It uses 3x3 "tiles" on the graph screen (they aren't actual tiles, its just that you move 3 pixels at a time and everything is based on 3 pixels). The first two assembly programs are just to make scrolling through the item menu more visually appealing.

The battle engine is kind of lacking in almost all areas, but I plan to add to it as a build the game up a bit more. I just threw together a quick one to make sure the monsters worked and stuff. 18 monsters are programmed, the last three are bosses, though, so you can only face the first 15, normally.

37 items are currently in the item menu with plans to add more. Only the first 10 actually do anything, at the moment

There are very few graphics. There is also no way to obtain items, except for the first 5 you start with or through cheating.

Almost all of this was programmed in the three hours that I was waiting for laundry. The rest occurred between yesterday and today. Yesterday I added in the rest of the monsters and items that are there, now, today I added the two assembly programs and I made a map maker that generated assembly code (I wrote it in BASIC, too :P)

Over all, I am kind of having fun with this, programming mostly in BASIC :) I am still not doing any hardcore programming, though, so this is a nice way to ease back into stuff.

By the way, this is a continuation of a series I made and lost about 5 years ago :) Hopefully this will help me to revive it as I lost almost all desire to make RPGs since then.

Oh, also, the houses have a symbol above the door way. The symbol tells what house it is, but currently, there is no code for each of the house types. Instead, it just goes back to the main program loop.

EDIT: I have now added in the code for the merchant, so you can buy items. Not all items are for sale, though! Now on to the blacksmith stuff >.>
EDIT2: Okay, so now I have fleshed out the save file to be a 122 element list and it is 1112 bytes. Since it is also stored to L1 while the game is being run, that takes up 2222 bytes of RAM. I could write another small ASM program to save/load pieces of data, but is that too much ASM involvement? If I do that, the main save file will be 137 bytes and I can load only the pieces I need into L1, saving possibly 2000 bytes or so of RAM.

Hmm, I feel like this is my call, since it is a contest entry XD

92
Math and Science / Observations of Cellular Automata simulating particles
« on: November 18, 2012, 06:20:34 pm »
I long while ago, when I was working on Grammer and adding in the particle effects stuff, I added this particular ruleset:

Move down if the space below is unoccupied
Move left or right if the previous move was not possible
Move up if none of the other moves were possible

If you remove the last rule, the particles move kind of like a liquid. The reason that I added the last rule was to allow the particles to navigate obstacles. Otherwise, this happens:


A real liquid would have "leveled out" so to speak. My thought was that adding the ability to move up would result in more properties of a liquid, including fixing this problem. So, lets see how it worked:


I decided to try another method by letting the particles always be connected to a specific particle. This way, in order for one to move, they all had to go in the same general direction:

I called them worms and they could do some pretty cool things, such as exhibit capillary action. However, this is very clearly not working like a liquid (Well, if you got a bunch of worms together, it probably would act very much like a liquid, except that they can crawl up each other with no external support!)

However, though it isn't as fluid as the worms, the ruleset I originally gave also exhibits capillary action:


Anyways, I thought I would share this :) If you can think of other cool effects, feel free to share !

93
Grammer / Langton's Ant
« on: November 10, 2012, 05:26:45 pm »
In preparation for a presentation, I wrote a quick program to show the cellular automata rule for Langton's Ant. Basically, if the "ant" is over an ON pixel, the ant turns right, if it is on an OFF pixel, the ant turns left. Then the ant inverts the pixel and moves a pixel in the new direction. It leads to some very complex patterns and has been used to make pseudo-random number generators. I left it running for over 2.5 million iterations yesterday and it was still chaotic (with 1 ant). Try watching 2 ants over time :)

This is a Grammer program and the world is 64x64 pixels, and is toroidal (basically, the world wraps in all directions, so if you go off the edge of the screen, it wraps around to the other side).

94
Grammer / MSet (Grammer)
« on: October 25, 2012, 07:28:25 pm »
I've been trying to make the Mandelbrot Set program in Grammer code for a little while (I made my first attempt in August), but something kept bugging out. It turns out, that all I had to do was add in a colon :P Anyways, this version I threw together yesterday after carefully writing out the code in a notebook :)

All it does at the moment is show a scaled down view of the MSet. You just run it and it computes the set appropriately. I plan to make it better for exploring the MSet zoomed in (where you can scroll the viewing area dynamically). It isn't nearly as fast as it would be in Axe or Assembly, but it is quite a bit faster than TI-BASIC which is what I was using before :P

Here is the code:
Code: [Select]
Repeat !!I: and I<999
ClrDraw
Text(0,0,"ITERATIONS:
expr(Input→I
End
Full
ClrDraw
For(A,0,111
A-64→C
For(B,0,95
B-48→D→H
C→G
For(E,0,I
G-H:*G+H:/ 32:+C→F   ;The space after the / is for using signed division
G*H
+Ans:/ 32:+D→H
If F→G2:+H2:>4096    ;This is G^2 and H^2, respectively, using the squared token
999→E
End
If E<999
Pxl-On(8+B/2,20+A/2
Is>(B
End
Is>(A
DispGraph
End
Stop

95
ASM / RAM Used in graphing
« on: September 29, 2012, 12:02:47 pm »
As was noted by Sorunome and I am sure others, BatLib's introduction of GroupHook caused a mysterious bug with graphing. It seemed to cause undesired shading of graphs causing some interesting effects. After chasing through the code, I found that it was caused by copying the GroupHook code to the end of TempSwapArea. I had never seen documentation of this anywhere, so as I experiment further, I hope I can provide the information. Until then, i need to find some other 65 byte chunk of free ram that I'm not already using.

96
ASM / Arbitrary Precision Multiplication (z80)
« on: September 17, 2012, 09:22:38 am »
In case anybody else wanted some arbitrary precision multiplication, here is a routine :)
Code: [Select]
;===============================================================
AP_Mul_AP:
;===============================================================
;Inputs:
;     HL points to the first number (little-endian, size prefix 2 bytes)
;     DE points to the second number (little-endian, size prefix 2 bytes)
;     BC points to the output location
;Output:
;     The RAM at HL contains the product (little-endian with
;     size prefix). Size is adjusted so there won't be zeroes
;     at the end.
;Notes:
;     This will erase bytes of RAM at (HL) equal to the
;     size of the first number plus the size of the second.
;     So if you use saveSScreen:
;         First number uses 2+M bytes
;        Second number uses 2+N bytes
;        Output number uses 2+M+N bytes
;     At most, 2+N+2+M+2+M+N=768.
;        2+N+2+M+2+M+N = 768
;              6+2M+2N = 768
;               2(M+N) = 762
;                  M+N = 381
;     In otherwords, you can multiply two, 190 byte numbers. In
;     Decimal, this comes out to roughly two 457 digit numbers
;     to get up to 915 digit number. It requires 14952 bytes of
;     RAM to use two numbers >9000 digits
;===============================================================
     di
;First, we get the size
     ld (output),bc   ;4 bytes, save the output location
     ld c,(hl)
     inc hl
     ld b,(hl)
     inc hl
     ld (Num1Loc),hl  ;3 bytes, save the location of the first number
     ld (Num1Size),bc ;4 bytes, save the size
     ex de,hl
     ld e,(hl)
     inc hl
     ld d,(hl)
     add hl,de
     ld (Num2Loc),hl  ;3 bytes, save the location
     ld (Num2Size),de ;4 bytes, save the size
     ex de,hl
     add hl,bc        ;size of the output RAM
;Now we clear out the bytes for the output
     ld b,h
     ld c,l
     ld hl,(output)
     ld (hl),c
     inc hl
     ld (hl),b
     inc hl
     ld (output),hl
     ld (Num3Size),bc
     xor a
       ld (hl),a
       cpi
       jp pe,$-3
;Now we start multiplying stuff
;We need to do:
;     hl=(Num2Loc)
;     de=(Num1Loc)
;     ix=(output)
;     bc=(Num2Size)
;(hl)_Times_(de)_To_(ix)
   exx
   ld bc,(Num3Size)
   exx
   ld bc,(Num2Size)
;   ld hl,(Num2Loc)
   ex de,hl
Loop1:
   push bc
   ld b,8
Loop2:
;===============================================================
;   rl (output)
;===============================================================
     exx
     ld hl,(output)
     ld d,b
     ld e,c
     dec de
     inc d
     inc e
     or a
       rl (hl)
       inc hl
       dec e
       jr nz,$-4
       dec d
       jr nz,$-7
     exx
;===============================================================


   rlc (hl)
   jr nc,NoAdd
;add (output),(Num1Loc)
     exx
     ld de,(Num1Loc)
     push bc
     ld bc,(Num1Size)
     dec bc
     inc c
     inc b
     ld hl,(output)
     or a
AddLoop:
       ld a,(de)
       adc a,(hl)
       ld (hl),a
       inc hl
       inc de
       dec c
       jr nz,AddLoop
       dec b
       jr nz,AddLoop
       jr nc,$+3
       inc (hl)
     pop bc
     exx
NoAdd:
   djnz Loop2
   pop bc
   cpd
   jp pe,Loop1
   ld hl,(output)
   ld bc,(Num3Size)
   add hl,bc
   dec hl
   inc bc
   xor a
     cpd
     jp po,$+5
     jr z,$-5
   ld hl,(output)
   dec hl
   ld (hl),b
   dec hl
   ld (hl),c
   ret
I used this in a test app and wrote a routine to multiply two base 10 integers in Str1 and Str2 respectively (I had to convert the base 10 string to hex data, then multiply, then convert back to base 10). I then used this routine in BatLib to make the routine for base conversion that handles large numbers (hundreds of digits). Feel free to supply other routines or optimisations, too! (I know some of you will find some :P)

97
TI Z80 / EnG
« on: August 14, 2012, 01:59:33 pm »
A few years ago, I was approached with a program idea. The programmer wanted a few special functions that seemed best fit for an assembly program. I finally got the motivation to really work hard at it and in the past week I totally rewrote it implementing some really cool features.

  • First, BASIC programmers will have access to as many as 10 drawing buffers.
  • There are also a handful of drawing commands that can be done on these buffers
  • None of the buffers use User RAM
  • All calc models have access to at least 3 buffers
  • The TI-83+SE, and all TI-84+ models have access to all 10
  • The models with access to all 10 buffers also have access to all of there extra RAM pages, not normally accessible
  • Strings, sprites, pictures, and other types of data can be backed up to this extra RAM (ranging from almost 9000 bytes to >90 000 bytes of extra RAM)


I am not going to release this program until I have been given the go ahead by the person who made the request, but one important thing that I do want to leave with you all is this:

I have put the Grammer project on hold for a bit. I wanted to try out other projects and ideas before I try to go further. I plan to use much of the code from this program in the next Grammer version. I have a file system, data retrieval, and data storage that works fully with all the available RAM. I plan for the final Grammer OS to give programmers access to everything on their calculators, including their RAM, whether it is 32KB, 48KB, or 128KB.

Also, here is a screenie :)

As a note, the variables STRING0 and STRING1 are stored as strings because of the .1, not because of their names. I could name a string "GUYScheckTh1sOwt.It's a string!" When it returns 1, it means it was stored successfully, when it returns 5, it means the variable already exists.

EDIT:

I was given the okay to release. For those that want to just give it a try, I will upload some info and the program. Since it is still being developed, nothing has been finalised, so syntax will likely change. In other words, don't make any super awesome programs that rely on this version! Playing with it should be enough.

98
TI Z80 / GamePack
« on: July 23, 2012, 09:28:45 am »
I don't think I will get to really work on this much, but I figured I could give people ideas and a concept :)
What I want it to be if I finish it:
-A game pack featuring some mini games, such as solitaire, minesweeer, tic-tac-toe, Invasion and tunnel.
-Featuring background music, sound effects

Currently, all I have finished is setting up the board in tic-tac-toe, generating a tunnel, shuffling decks for solitaire and black jack, and displaying cards. Oh, and also the background music :)

Here is what the Readme says so far:
Quote

No games work yet
Background music works :)
Background music slows stuff down :[
Press [ON] to disable background music
Press [ON]+[^] to reenable background music
You need headphones for it to work (or turn on sound in WabbitEmu)
Clear exits places
Select Tic-Tac-Toe to listen to the tic-tac-toe "music"
Go to "Next ->" to see more games
Select Tunnel to watch the tunnel move and listen to music
Select Music Board to listen to some tracks. They are very simple, usually between 4 notes.


Because background music can slow down games a lot, I use short beeps for
actual games. I think it sounds okay, though.

If you want to test it out, here it is. It is an app, by the way
EDIT: Screenie added

99
Grammer / Grammer 3-Concepts, ideas, requests
« on: April 26, 2012, 04:52:00 pm »
As I mentioned int he Grammer 2 topic, I should be starting Grammer 3 in about two weeks if I am on schedule (1 year after Grammer 1 was started). Because this is the time that I will be without internet, if you have any ideas, post them here, I will make a copy of it, and I will reference it while I am working on the program. In the plans for Grammer 3 since the start:

It will be a two page app
It will have a legacy mode for older Grammer programs
It will have a built in program editor
It will allow for custom command sets (up to 16 packages that contain their own functions).
  • This will mean you can have a floating point math command set, linking command set, and others
  • I might bring this down to 8 possible sets at a time
  • These will be defined at the beginning

Source code will be "tokenised" like on the TI-89. This will help speed it up massively.
There will be specific variable types like sprites, fonts, and strings

I am thinking of adding in standard 32-bit math.
4-level grayscale and 3-level gray
More tile map options
Proper sprite clipping (I've already got the code planned)

If you guys can think of any good ideas, please post. For the editor, what would make things easier? I will be writing a menu system, so I will probably include customisable menus, quick keys, and other things. Maybe I should make a search function? Search and replace? Since Grammer will have so much control, errors will be completely handled by Grammer, so if you press ON for example, Grammer will take it to the Grammer editor, not the program editor.

100
TI Z80 / SetUpVar
« on: April 25, 2012, 08:58:09 pm »
SetUpEditor is one of the most useful commands to BASIC programmers and I have always griped that I could not use it for other variable types like strings and matrices. Guess what I did?

What does it do?
Like the SetUpEditor does for lists, this will check for variables. If the variable doesn't exist, it gets created, or if it is archived, it gets unarchived.

How do I use it?
The line directly after calling this program contains a string of variables. The variable types that work are:
-Strings
-Pictures
-Equations
-Programs
-Matrices
So in practice, what you would do:
Code: [Select]
:Asm(prgmSETUPVAR
:[B],prgmALPHA,Pic2,Pic3,Str1,Str7,[C]
:<<rest of code>>

Notes:
Size? 208 bytes
This will try to work for other variables, but it will fail most likely and it will make you lose RAM and crash.

101
TI Z80 / TPROG
« on: April 25, 2012, 08:36:28 pm »
I feel like I have made a topic about this before, but I am not sure... I cannot find it anywhere.

Anyways, jsj795 had a great idea for a program back in January that will prove useful to others, too, I am sure.

What it does:
At its core, it copies a program in RAM or Archive to a temp program. Temp programs get automatically cleaned up by the OS (deleted) when all programs are finished running. it also has the functionality to delete programs and temprograms, just in case.

Notes:
When you copy to the temp program, any existing program or temp program with the same name will get deleted!

How to use it:
All arguments are passed in Ans. Currently, there are no outputs. The syntax for copying a var is:
"<<original>>:<<copy>>":Asm(prgmTPROG
So for example, say you want to copy prgmRAWR to prgmZZTEMP1:
Code: [Select]
"RAWR:ZZTEMP1
Asm(prgmTPROG
Notice that unlike some of my other programs, you don't need a type byte for these. Also note that a colon separates the names.
To delete a program, put a minus sign before the name:
Code: [Select]
"-ZZTEMP1
Asm(prgmTPROG
But that isn't all! Say you want to do a bunch of things at once. Simply put them all in one string and run the program:
Code: [Select]
"RAWR:ZZTEMP1:-HELLO:WORLD:MEOW:-BRIDGE:-THEGAME
Asm(prgmTPROG
That copies RAWR tot he temp prog ZZTEMP1, deletes prgmHELLO, copies prgmWORLD to temp prog MEOW, deletes prgmBRIDGE, and deletes prgmTHEGAME.

So what is the size of this lovely program? 172 bytes. That's it. Have fun.

More notes:
If you try to copy a program that doesn't exist, those two arguments get ignored. If you try to delete a variable that doesn't exist, that argument also gets ignored.

EDIT: Uploaded a faulty version, originally. This version is fixed.

102
ASM / MenuHook Findings
« on: April 24, 2012, 10:37:21 pm »
I was playing with an idea that I found on TIBD. I thought that it would be really cool if we could open the string menu or Pic menu and have access to all 256 tokens. Sorry if I got your hopes up, because that has failed (so far). To get it to work, I might have to do a hackjob, but I did uncover a random tidbit of info.

When the OS calls your hook, if it is sending A=1, then you will want to exit with the z flag set. I do this with xor a \ ret. What I found was that we can change the token to be displayed from here without having to write a whole table. How do we do this? DE contains a extended keycode that maps to a token. All you have to do is change this value and the token that will be displayed gets changed. What I did, since my tokens were based on the menu item number and the token was arbitrary:
Code: [Select]
;E contains the Pic number
     ld d,60h            ;Start of a Pic token
     bcall(_TokToKey)    ;4A0Bh   Stores the extended key code to 8446h, A has the rest
     ld de,(8446h)       ;E know has the extended value
     ld d,a              ;DE now has the whole keycode
     xor a
     ret
I don't know where else this might prove useful, but have fun :)

103
ASM / Key Code hacking
« on: April 08, 2012, 02:13:35 pm »
When I first discovered the ti83plus.inc file provided by TI, I went through and played with all the RAM equates that I thought would do something. For the newer folks that don't know me well, I started my assembly programming days by programming in hex, so I had a knack for playing with hex codes. Anyways, I saw a few peculiar gaps in RAM and then one that gave me the most reward was the one between 843Fh and 8445h. What struck me as odd was the fact that there were 4 bytes unaccounted for, so I played with them and I made a very fun program:

So what was in the secrets of these bytes? These bytes were counters, but the one at 8442h was the one that you could really take advantage of. When a key is not being pressed, it has a value of 50. As you hold a key down, that decrements until zero. If it is a repeating key and the counter hits zero, it "presses again" so to speak and resets the counter to ten and repeats in this way. The above example is a getkey hook that checks the counter and updates it itself. This is also a feature I put in several programs including BatLib.

However, that ws not the only thing I discovered in playing around. I also made a program to simulate keypresses. The user passes a value through Ans and that key is simulated. For example, Enter has a key code of 9 (these are the same keycodes that you use in Grammer, Axe, and a number of other programs). So to simulate Enter, you do 9:Asm(prgmKS. unfortunately, that just causes the program to be executed over and over (until you press some other key). However, this also lets you open up menus and whatnot, too. What I figured out is that when you add 56 to the keycode, that is like pressing [2nd] and then the key and add another 56, you get [alpha] press. Some of these codes are also replaced with things to clear your RAM, display prgmA (even if you don't have it) and others.


So why did I make this topic now? To be honest, I was looking for a way to redraw the homescreen because I couldn't find a bcall to do it. I just simulated [2nd][mode] on my way out which costs 5 bytes and only 20 cycles XD

EDIT: Added the proggies seen in the screenshot. Also, I would like to note that I added the RAM equate 8442h on WikiTI a while ago and called it keyDelay if anybody is interested.

104
ASM / Font Hook Hacking
« on: April 06, 2012, 05:21:49 pm »
When using the Font Hook, you cannot do special things on your own. For example, you cannot use your own drawing routines to speed things up. About a year and a half ago, I introduced an 8x8 font hook in BatLib and this is something I had never seen elsewhere. I had to do some semi-hacky things to display fonts in a custom way as opposed to just changing the data displayed and I figured this might be useful for others to use. Pretty much, if you want to use your own routine to display the font when the OS wants to draw a char, try adding this to the end of your hook:
Code: [Select]
   ld hl,18
    add hl,sp
    ld sp,hl
    pop hl
    ld a,l
    out (6),a
    pop hl
    pop ix
    pop hl
    pop de
    pop bc
    pop af
    ret
I am not sure if that works across all OSes, but I don't have access to them all :/ The main scary part that could cause a crash is the fact that this readjusts the stack. If other OSes makes other calls or pushes/pops, this will likely cause a crash.

I used that to let me draw the fonts directly to the LCD and make sure the OS didn't try to mess that up. Plus, it skips over tons of OS code XD You will need to handle inverted text on your own, though, too. I just check the flag and use CPL on the data if it is supposed to be inverted.
Screenie:

As you can see, my actual hook needs help, too, because menus don't work, but the main part is that 8x8 fonts can work XD
EDIT: I have tested some OSes:
1.03 fail
1.10 fail
1.12 fail
1.13 good
1.14 good
1.15 good
1.17 good
1.18 good
1.19 good
2.30 good
2.40 good
2.41 good
2.43 good
2.53 works except in MathPrint, but doesn't crash
2.55 works except in MathPrint, but doesn't crash

105
Math and Science / Tic-Tac-Toe algorithm
« on: March 26, 2012, 11:43:57 am »
A few are curious about my Tic-Tac-Toe algorithm, so here it is :) First, I would like to give credit as well to Michael Macie. We designed this last year for a linear algebra project and it is very beautiful indeed :) I have modified it a bit to make it work even better with matrix row operations.

First: In Tic-Tac-Toe, there are 9 positions and 8 wins. What we did is something that we have seen nowhere else and makes things amazingly less complex. As in, a child with rudimentary math skills might be able to get it. Each position we label as a to i like this:
a  b  c
d  e  f
g  h  i

We then assigned a matrix of win contributions to each position. I changed this to using a row of 8 elements. So, in my example, we can do:
[[D1,H1,H2,H3,V1,V2,V3,D2]] where D1 is the main diagonal, H1~H3 or horizontal wins, V1~V3 are vertical wins, and D2 is the other diagonal. If a position corresponds to a win, give it a 1, like so:

[a]=[[1,1,0,0,1,0,0,0]]
[b]=[[0,1,0,0,0,1,0,0]]
...
Et cetera. Now, reform this into a giant 9x8 matrix. This matrix remains constant. Here is where the actual algorithm come in :D Get ready...

Now, the game matrix starts clean, with 0s: [[0,0,0,0,0,0,0,0]]. These are the wins. Now, say player one selects position [a]. Add its matrix to the game matrix and you get [[1,1,0,0,1,0,0,0]]. Player two will subtract from the game matrix, so it tries to:
1) Make a -3
2) Make as many -2s as possible without leaving any 2s. If you leave 2 -2s, this will make a trap for next turn. If you leave a 2, then X will win next turn.
3) Make as many 2s into 1s if you cannot do any of that. Remember, a 2 now will turn into a 3 the next move and 3 means X got 3 in a row!

See how beautiful that is? For X, it follows the same algorithm, but use the negative of any of the numbers :) The really nice part is that:
-You can easily include random choices of moves  that fit the highest criterion.
-When the game is over, use the winning matrix and any 3s or -3s are wins, so you will know exactly where to strike through for wins!

Now, I would post my tic-tac-toe program, but I apparently never saved my final version (which was in english instead of french and had the bugs fixed). Instead, I will show you a screenie :)

Pages: 1 ... 5 6 [7] 8 9 ... 13