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 ... 8 9 [10] 11 12 13
136
TI Z80 / Text Compressor
« on: January 05, 2012, 06:38:42 pm »
I made this program a few years ago using Celtic3, but since BASIC is rather slow compared to assembly, I tried to port it to assembly... A year and a half ago, that attempt failed. However, yesterday on IRC when I stumbled across the project in my backups, I thought "I have the experience, now, let me give this a shot. I guess experience helps because I got it to work in a few hours of coding :)

Contained are two programs. One of them uses a compression method I came up with and the other decompresses.
Limitations are that only 46 characters are recognised (in this version).
Outputs are a compression that is at best 50% and at worst no compression. Average is just under 60%.

The program inputs are through Ans in both cases. Outputs are the same in both cases, too. Str1 contains the converted string and Ans contains the compression ratio.

If you have any questions, feel free to ask. My future plan is to make it adaptable (the Celtic3 version let the user create a key file whereas this version has a built in key).

Also, if I were to combine these programs both into one program, I could save a lot of memory as both contain similar code and data (such as the key file). My only issue is trying to find a way of input to determine if the string is to be compressed or decompressed. Maybe I can have the input and output string in Ans and the method to use in Theta and the output compression ratio in Theta...

In any event, I am not done with this program...

137
ASM / Useful Routines
« on: January 04, 2012, 11:58:17 pm »
I figured that I would start a topic like this here. These are links to a bunch of routines that I find useful and I think other will find useful
ChkFindVar is like ChkFindSym for Program, Protected Program, Appvar, Temporary Program, Group.
SearchVarBC is a routine (with several others included) for searching for the other program types.
A_Times_DE This is a non-standard routine that is 25 bytes and faster than DE_Times_A.
DE_Times_A This is a fast, straightfoward, standard DE_Times_A
C_Div_D
C_Times_D
DE_Times_BC
DEHL_Div_C
DEHL_Mul_32Stack (no SMC) this is for Apps. This multiplies DEHL by the last two entries on the stack and returns the 64-bit result.
DEHL_Mul_32Stack (SMC) this gets a decent speed boost by using SMC. It does the same thing.
DEHL_Mul_A this uses shadow registers HLDE. I need to rewrite this
GCDHL_BC computes the Greatest Common Divisor
HL_Div_BC this can probably be optimised
HL_Div_C
HLDE_Div_C
ncrHL_DE this computes "n choose r" and it uses shadow registers
RoundHL_Div_C returns the rounded value of HL/C
RoundSqrtE returns the rounded square root of E
SqrtE
SqrtHL
PixelPlot (1) is a fast pixel plotting code that uses SMC and will draw to arbitrary buffers. I usually use a different version of this.
LineSearch will search a var for a line and return the location and size. This will not search beyond the given limit.
ConvRStr will convert a string of numbers to a 16-bit value
Is_2_Byte checks if A is the start byte of a 2-byte token
TokensToASCII converts a token string to ASCII
IncHLMem1 This is an optmised routine to increment HL and port 6 as necessary
TileMap1 This draws a tilemap. Uses DrawSpriteXxY.
DrawSpriteXxY This draws a tile

Pastebin won't let me paste anymore for a while, but I have a bunch more waiting in reserve :)

EDIT: As a note, these are all codes I wrote :)

138
Grammer / Grammer Feature Requests
« on: December 29, 2011, 07:48:58 pm »
This is where y'all can drop your ideas and requests. I make no promises, but it is good to have everything in one place, right? So the first request was by yeong and that was to have a way to incorporate BASIC and Grammer together with Grammer 2 (it was possible in the first Grammer). So here is a program that should make that possible. Just start a line with .0:Asm(prgmGRAMMER and the code up until a Stop will be run as Grammer code. At the Stop, the code will be read as BASIC. You can do this as often as you like in a program, too :) Lemme know if it doesn't work .__.

139
Grammer / Grammer Font Editor
« on: November 28, 2011, 11:52:55 pm »
So for the past few days I have been making comments about a "variable size font editor for Grammer." So now it is time to explain and release :)
Pretty much, I added a variable size font to Grammer and that made me add a command to swap between the fixed font and variable size font. So while I was at it, I finally included the ability to use your own custom fonts as well! But making a font is time consuming and tedious at best and typing in all the hex could get migraine inducing. So I made a font editor :)

Pretty much, you can cycle forward through the characters, change their sizes, edit their appearance, et cetera. The characters can be 0 to 9 pixels wide and 1 to 16 pixels tall. The readme explains the controls and how to use your brand new font :) There is a sample fontset included that is currently used by Grammer (so it isn't too tedious). I should eventually add an option to create new fixed size fonts, but the current 4x6 font has a weird syntax as it is stored as nibbles for extra compression.

140
ASM / bcall(_DelMem), pointers
« on: November 19, 2011, 07:12:13 pm »
I was using DelMem inside a parser hook and directly after that, I tried finding the updated position of a program. For some reason, bcall(_CheckFindSym) returned the old pointer (even though I watched the program data get shifted down in Wabbit's debugger).

So does anybody have any insight as to why this is and how it can be fixed?

EDIT: The code:
Code: [Select]
     bcall(_DelMem)
     ld hl,9652h          ;This is the pointer to the name of a currently executing program
     rst 20h               ;Copies 9 bytes at HL to OP1
     bcall(_CheckFindSym)   ;
     inc de \ inc de
     ld hl,(965Bh)       ;start of the currently executing program
     ld (965Bh),de
     ex de,hl
     sbc hl,de
     ld de,(progPtr)     ;a pointer inside the program
     add hl,de
     ld (progPtr),hl
     ret

EDIT2: Problem fixed :)

141
TI Z80 / Grammer Sprite Editor
« on: November 17, 2011, 05:45:21 pm »
I was requested earlier to make a new example program and was then suggested to make a sprite editor. So here we are :)
Code: [Select]
*Indents are here solely for viewability

.0:Return                ;The header
"USprite→A               ;Stores the string location to A (used for optimisation since the string is used several times)
Get(A                    ;Gets the location of the appvar named Sprite
If =0                    ;Zero is returned if the var does not exist
Then
  ClrDraw                  ;Clears the draw buffer (graph screen) and resets text coordinates
  Text(º"How many sprites? ;º means draw to the last text coordintate
  DispGraph                ;Displays the draw buffer
  expr(Input →N            ;Allows the user to input a string and expr( turns it to a number
  Text(6,0,"Width?         ;
  DispGraph                ;
  expr(Input →W            ;
  Text(12,0,"Height?       ;
  DispGraph                ;
  expr(Input →H            ;
  Send(4+N*W*H,A→Z         ;Creates the appvar :)
  int(Z,W                  ;Stores the Width to the first byte of the var
  int(Z+1,H                ;Stores the Height to the second byte of the var
  iPart(Z+2,N              ;Stores the Number of sprites (stores it as a 2-byte word)
End
Unarchive A
Get(A→Z                  ;
IS>(Z→W                  ;reads the byte at Z, then increme,nts Z
IS>(Z→H
{Z→N
Z+2→Z
ClrDraw
0→X →Y →B                ;X will be X pixel Coord, Y=Ypixel coord, B=sprite number
π87EC→θ                  ;This is the location of the clipboard (256 bytes)
Line(0,0,1+H,1+W*8,3     ;Draws the boundaries for the sprite
Repeat A=55              ;55 is the [mode] key
Z+B*W*H→V                ;Used multiple times, so why not store it to a var?
Pt-On(0,V,0,0,W,H        ;Draws the sprite
Repeat A=55 +getKey(10 +getKey(11
  pxl-Test(Y,X→C
  9→D
    Repeat A
    D+1
    If >9                    ;Checks if the previous result is >9. This is the timer for blinking
    Pxl-Change(Y,X 0         ;Changes the pixel state at Y,X and then returns 0 in Ans
    →D
    getKey→A
    End
  Pxl-Off(Y,X
  C
  If getKey(56           ;56=Delete
  0
  If getKey(9            ;9=Enter
  1
  If getKey(54           ;54=2nd
  !C
  If Ans
  Pxl-On(Y,X
  If A=15
  Line(0,0,H,W*8,0       ;Draws a white rectangle to erase the sprite data
  Y+H+getKey(1
  -getKey(4
  /H θ'→Y                ;θ' is the remainder from the division. This lets the cursor loop :)
  X+getKey(3
  -getKey(2
  +W*8 /W*8 θ'→X
End
Pt-On(4,Z+B*W*H,0,0,W,H   ;Swaps the sprite data from on screen to the sprite set (saves the changes)
B+N+getKey(10
-getKey(11
/N θ'→B
End
Stop
That is working code (without the clipboard).

The program here allows you to create a sprite set if appvar Sprite does not exist, it prompts for the number of sprites to include as well as their size. There is clipboard functionality as well as a kind of "Undo" for mistakes. Have fun?

Oh, also, I was also told to make it work with the map editor, so that should happen soon >:D But I have to go to work now...

Oh, and for those who plan to use the sprite sets, the offset into the appvar data is 4 to get to the sprite data (the first 4 bytes tell the number of sprites and size).

142
TI Z80 / Map Editor (Grammer)
« on: November 11, 2011, 10:11:17 am »
I looked at an old Grammer program that I wrote as a concept program and I decided I would modify it a bit with new Grammer commands et voila! I have a map editor that is worth showing :D

This is still only a concept program, but you can edit a map with 96 tiles (one screen) and it remains saved to the appvar Maps. There are 16 tiles, currently, but feel free to submit more XD . Hopefully I can end up getting it to edit much larger maps, too, but even better will be when I make an actual Tilemap command XD (it is going to be Pt-Change( I just haven't gotten to it).

Anywho, I digress, so here are the commands:
+/- will toggle through the tiles
[Enter] will set the tile
[Clear] will exit the editor
Arrows move the tile

143
Grammer / Grammer Q&A
« on: November 08, 2011, 11:27:59 am »
I figured a Questions and Answers topic for Grammer might be useful now that Grammer is picking up new programmers :)
So if anybody has questions, feel free to ask! I will try to be on often enough to answer questions with code or comments :D

144
TI Z80 / GrayDraw (Grammer)
« on: November 03, 2011, 11:12:59 pm »
GrayDraw is currently a very simple grayscale drawing program. You just input the name of the file to open and if it doesn't exist, it is created, otherwise, it is used. Note that this version does not check if the var is archived or not and it won't check if it is the right size (in case the var already existed).

You can do some simple drawing in 4-level gray that works best on models with 15MHz.

I might end up adding the ability to draw other shapes such as lines, rectangles, and circles, in the future.
I should also add in error checking XD

In any event, it looks better on a real calc than it does in the screenie, but I have this one anyway :D

EDIT: Uploaded correct version XD

145
TI Z80 / LytsOut
« on: November 01, 2011, 04:59:27 pm »
First: The name is spelled this way because LIGHTSOUT is 9 chars and programs must be 8 chars
Second: This is a Grammer program

So pretty much, this is a spinoff of the classic Lights Out game. With this version, you select a location with the cursor and by pressing enter, you invert the location as well as those around it. The goal is to color the whole board black.

Things I can add:
Turning the board one color is a win (all black or all white)
Adding a score (The board is made in 17 steps, so this will grade based on best time)
Adding a highscore
Adding difficulties (larger playing board, for example, or a block that doesn't change)

So what do y'all think? I should also note that the program is currently 352 bytes

Controls:
Enter inverts surrounding blocks
Clear exits the program
Arrows move the cursor

146
TI Z80 / Pipes
« on: October 26, 2011, 09:34:23 am »
So after working on Wormy for a bit, I decided to give a pipe game a try! Right now, you can only draw the pipe system and test it, but hopefully more gets added in the future, like saving data and turning it into a game.

The controls are:
[ + ] tests the worm through the tunnel
[ - ] ends the test
[2nd] and [alpha] cycle through tiles
[Enter] sets the tile
[mode] exits

EDIT: This is how fast it runs at 6MHz, so this works nicely on a TI-83+, hopefully

147
TI Z80 / Wormy!
« on: October 24, 2011, 08:19:09 am »
So I was fooling around with Grammer when I made this little proggy ^-^

It is pretty much a little wormy that follows a set of rules. The head moves down if there is a way to move down. If there isn't, it then tries left and right (it selects the first direction to try, randomly). if that still doesn't work, it moves up.

And with that, you get a wormy!

I wonder if I can add this as a type of particle in Grammer...

148
TI Z80 / Partex 2
« on: October 23, 2011, 03:13:47 am »
So the Grammer coders are probably familiar with Partex (or at least the screenies) by now, but it is turning into some cool stuff, I think. So, this is  why I am posting it here. It is a slow moving project (there won't be 3 updates a day XD ), but it is one that will probably continue for a little bit. Right now, it is like a powder toy. You can do basic pixel drawing and particle dropping, but it is pretty fun!

Right now the controls are:
Arrows are for movement (including diagonal)
[mode] exits
[Clear] freezes all pixels on the screen, permanently
[Alpha] clears all drawing
[2nd] draws a pixel on
[del] draws a pixel off
+/- toggles between particles
[ / ] pauses the particles
[ * ] unpauses the particles

One nice thing is that this program is 314 bytes, so if you have the app version of Grammer, this is really doable! And with the latest app version, you can even keep Partex archived!

149
Grammer / Grammer 2-The APP
« on: October 20, 2011, 09:32:11 pm »
Latest Major Release Grammer v2.24.02.12 This may not be up to date (24 February, 2012), but includes documentation.
Latest Minor Release In this case, same as the Latest Major Release. Normally does not include updated documentation

This is Grammer 2-- the App. When you first start it, there isn't much. The menu is by no means pretty and doesn't even give any useful hints for how to use it, but it does get the job done. The real beauty, however, comes in what it provides.

Grammer 2 provides a programming language much like others, but with key differences making it fairly unique. It is an interpreted language with tons of support for graphics and math that results in games and math programs alike. If you have questions, feel free to ask :)

Also, I made a new example for this release :) Enjoy!

(As a note, I haven't actually tested every single command to see if they survived the conversion from program to app, so please report bugs!)
EDIT: First bug found by Awalden: Bad signature. Something went awry with compiling, so the new update should work

150
ASM / Interrupt Questions
« on: October 12, 2011, 05:36:19 pm »
Okay, I have this code that is causing a crash for me and I am trying to figure out why:
Code: [Select]
interrupt:
     push af
     push bc
     push de
     push hl
     ld hl,(progPtr)
     push hl
     .db 21h
IprogPtr:
     .dw 0
     ld a,h \ or l
     ld (progPtr),hl
     call nz,ParserNext
EndExec:
     pop hl
     ld (progPtr),hl
     pop hl
     pop de
     pop bc
     pop af
     ret
interrupt_end:
This is for Grammer which is why I am asking. (progPtr) is the program counter and calling ParserNext will parse the data at progPtr.

I also disable interrupts and switch it back to mode 1 before exiting the program in case I need to do that

Pages: 1 ... 8 9 [10] 11 12 13