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.


Messages - Xeda112358

Pages: 1 ... 175 176 [177] 178 179 ... 317
2641
ASM / Re: Streamlined Asm routines
« on: January 04, 2012, 02:21:31 pm »
Okay, so Runer was speculating about how to get the best speed out of a math routine, so the first challenge he gave was for 8x8 multiplication with a 16-bit output. I am not doing all that well with the challenge, but here is a variation of what I came up with that actually is a 8x16 multiplication (it requires 4 more cycles to make it 8x8).
Code: [Select]
A_Times_DE:
;Input:
;     A,DE
;Outputs:
;     A is 0
;     BC is not changed
;     DE is not changed
;     HL is the result
;     z flag is set
;     c flag is set if the input A is not 0
;Notes:
;           If A is 0, 29 cycles
;Speed: 145+6n+21b cycles
;           n=floor(log(a)/log(2))
;           b is the number of bits in the number
;           Testing over all values of A from 1 to 255:
;           313.7058824 average cycles
;           Worst: 355
;           Best  : 166 (non trivial)
;Size: 25 bytes
     ld hl,0           ;10
     or a \ ret z     ;9
     cpl \ scf        ;8
     adc a,a         ;4
     jp nc,$+7       ;10         ;45
Loop:
     add a,a          ;4
     jp c,$-1         ;10         ;14(7-n)

     add hl,de        ;11         ;11         (the rest are counted below)
     add a,a          ;4           ;4b
     ret z              ;5|11      ;5b+6
     add hl,hl         ;11         ;11b-11
     jp p,$-4         ;21|20     ;20n+b
     jp $-7
So that code is about twice as large as the following more standard routine, but it is also on average about 52 cycles faster and the worst case scenario is 35 cycles better than the worst case for the next routine. The advantage with the following code is that the speed is not all over the place:
Code: [Select]
DE_Times_A:
;Inputs:
;     DE and A are factors
;Outputs:
;     A is not changed
;     B is 0
;     C is not changed
;     DE is not changed
;     HL is the product
;Speed:
;     342+6x, x is the number of bits in A
;     Average: 366 cycles
;Size:
;     13 bytes
     ld b,8            ;7              7
     ld hl,0           ;10             10
       add hl,hl      ;11*8         88
       rlca            ;4*8           32
       jr nc,$+3     ;(12|18)*8  96+6x
         add hl,de   ;--             --
       djnz $-5      ;13*7+8      99
     ret               ;10             10

Another interesting note is that the first routine does not use a counter and so it preserves BC. For the best speed without an LUT, I still think unrolled routines are the best :)

Actually, another note-- the first routine doesn't really get a speed boost from unrolling :/

You can make a hybrid of the two codes that will cost the b register, but it will be 21 bytes and average a smidge over 320 cycles, too.

EDIT: Also, I posted here because the topic title had a nice name and I am not ready to submit it elsewhere without the scrutiny of the better asm coders, first :P

2642
News / Re: Fall activity down by 30%, but still a record year
« on: January 03, 2012, 09:43:18 pm »
Wow, that probably is why, actually. I notice that I code more on my calc and I come up with ideas better when I am in class. Jeez, I'm glad I continued school!
[psa]
--Public Service Announcement--
Dropping out of school or not continuing to college may cause a significant decrease in programming drive and creativity. Stay in school. Be great. Program.
[/psa]
:P

2643
Grammer / Re: TI 83/84 Group Files Explanation?
« on: January 03, 2012, 03:42:39 pm »
O.O
Can you add appvar support as well? ;D
What do you mean by that? As in executing appvars from a group as BASIC or assembly programs or recalling them as pictures? Or do you mean extracting appvars?

2644
News / Re: TI-84 Plus Pocket SE
« on: January 03, 2012, 01:42:07 pm »
Pocket refers to the size. It is a mini version of the original :)

2645
Grammer / Re: TI 83/84 Group Files Explanation?
« on: January 03, 2012, 01:24:25 pm »
At the "n" is where you will find it.

Also, I think we read minds, yeong :P I was working on an extractor (but written in assembly code). It was just going to let people run BASIC programs/ Assembly programs from groups and recall pictures. >:D

2646
Grammer / Re: TI 83/84 Group Files Explanation?
« on: January 03, 2012, 01:18:23 pm »
I just created a group and checked it in Calcsys. It seems to be oredered like this:
-The first byte was $FC. I have no clue why.
-Next two bytes are the size of the group (little endian)
-Next comes the VAT entry (since it is archived)
**See below for a breakdown of archived syntax**
-After this is the size bytes of the data. This is two bytes in little endian
-After that it is like reading archived variables

Archived syntax: (the 00 means the first byte, 01 is the second byte...)
00-type
01-reserved for future OS changes
02-archived status. This will be 0 since groups can only have vars in RAM selected
03-Address where the var was before grouping. two bytes, little endian
05-forgot, actually, but this seems to be 0
06-size of the var name followed by the name
 n-After this is two size bytes, followed by data

Does this help?

2647
ASM / Re: Inconsistencies with Keypresses?
« on: January 03, 2012, 01:02:22 pm »
I will say that I have had these kinds of problems before and I got frustrated and added a call 000Bh as the delay and that didn't work :/ I have mentioned this before, but I was told it was a delay issue. Also, I was writing $FF to the port before each write, as well. I wonder if there is a hardware issue in some models? Mine was an 84+SE without the extra RAM and a 84+BE without the extra RAM. Here is what I could do:

Press left and the plus key. Then press Enter and the down key is registered.

It was always things like that, but I could just have coded something wrong or misunderstood the documentation. I will check again later comparing WabbitEmu to my actual calc and whatnot.

2648
Axe / Re: How to use the link port
« on: January 03, 2012, 09:57:56 am »
Could you post a some of your code? I imagine if you are only using arrows, you will only need to send 4 bits, too, if that helps :) We might be able to help out!

2649
News / Re: Fall activity down by 30%, but still a record year
« on: January 03, 2012, 09:52:36 am »
Actually, I noticed that at first I made lots of games when I started TI-BASIC and I made a name for myself in my school because of the RPGs. However, by the end of highschool, I kind of stopped making games and I cannot seem to get back into the mood .__. I mean, mini games that take a minute of thought and 20 minutes of programming are fine, but a full fledged RPG just seems impossible. I wonder if it is the same for other post-highschool members? And if so, I wonder if that could cause them to be less active?

2650
ASM / Re: Constructive and Creative uses of RLD and RRD
« on: January 02, 2012, 12:12:33 pm »
That is fairly similar to how I used it in BatLib for the nibble storing and retrieving.

2651
TI Z80 / Re: Samocal
« on: January 01, 2012, 02:48:06 pm »
Thanks annoyingcalc and cool, yeong! I have since started adding in items. There is a little ball thing in the first screenie that is now a Heal Potion when you pick it up :) I have made room for 120 items, 16 special items, and 64 "events" in the save file, so far. "Events" are just things like the gate unlocking, items being picked up, and things like that.I think I will need to add a lot more, but they are marked as flags, so they each take a bit. This means by adding a byte to the save file can add 8 event flags. If I increase the size by 24 bytes, I will have a total of 256 event flags available.

EDIT: Now I have a menu item working that I think looks nice :)

2652
TI Z80 / Re: Samocal
« on: January 01, 2012, 12:51:47 pm »
Once again, I have started to re-port this, this time to Grammer x.x I now have to write the battle engine and items, but otherwise, I do actually have an event thing programmed, talking to people, walking, scrolling maps, and soft saving finished (soft saving is just keeping information in a RAM var).

I plan to work on the BatLib version, too, but here is the screenie so far with Grammer :)

EDIT: Also, some of its features:
-You can use the number keys to reorient viewing area
-The maps are in 50x50 sections with a total of 200x200 tiles
-This runs in 6MHz, so this is the speed to expect on all calc models
-Your position in the map, direction you are facing, and viewing screen orientation are saved automatically, even if you exit by pressing [ON].

2653
News / Re: Fall activity down by 30%, but still a record year
« on: January 01, 2012, 12:06:26 pm »
:P Hey, it was in the running for POTY2011... it might be over, now, but it was an accomplishment :) Though I should change something in that signature >.>

2654
TI Z80 / Re: ASMDREAM - the TI-8X+ on-calc assembler
« on: January 01, 2012, 12:04:30 pm »
Cool! Maybe you can have something in the source code that is an "Autodelete" token. So if you started with maybe AsmPrgm.NAME it would automatically delete the program NAME. I'm just throwing around ideas, but I do like this, so far! I have already had a scenario where I was without a computer and compiler, so I used this :)

2655
News / Re: Fall activity down by 30%, but still a record year
« on: January 01, 2012, 09:39:51 am »
Wow, this is great! And we can do better this year >:D I wonder if I should write a series of programs and announce the release dates-- for one week, every day, a release of a full fledged game or program!

Pages: 1 ... 175 176 [177] 178 179 ... 317