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 ... 56 57 [58] 59 60 ... 317
856
TI Z80 / Re: [z80 ASM] Unnamed set of 3D routines
« on: July 04, 2013, 06:44:59 am »
Hmm, what were you passing and what was it returning? It was definitely working for me.

857
TI Z80 / Re: [z80 ASM] Unnamed set of 3D routines
« on: July 04, 2013, 06:41:07 am »
Oh, the signed division wasn't working? It worked for me when I tested it and it was faster than regular division (sometimes a lot faster)

858
Casio Calculators / Re: [Prizm C] Mandelbrot Set
« on: July 04, 2013, 06:38:05 am »
I don't have an 84C yet, but I have been thinking about writing a language similar to Grammer for the Prizm :) I make no promises, though :P

859
TI Z80 / Re: CopyProg
« on: July 03, 2013, 03:18:38 pm »
This should fix it. There was a line of code checking for the parity of a result instead of whether it was positive or negative. Essentially, I used jp pe, instead of jp p,.

Oops.

860
TI Z80 / Re: IES: online Axe, BASIC, and Grammer editor
« on: July 03, 2013, 01:51:56 pm »
I'm working on integrating it into the program editor as well so you can evaluate a constant expression inline without having to pull up a calculator.
I am so glad that this feature is being worked on o.o

861
That is excellent, thanks !

862
Is there a way that we can view our previously uploaded images? I always worried that I was uploading duplicates on RFG because I could not remember the name of the image.

863
TI Z80 / Re: CopyProg
« on: July 03, 2013, 12:21:00 pm »
In particular, do you mean empty lines, or is it on lines that actually have data? I only encountered a problem with that on newlines, but if you could give an example of it failing on lines with data, that could be helpful (before I release another update).

864
ASM / Re: [z80] 16 by 16 signed division
« on: July 03, 2013, 08:27:26 am »
Wait, but does the first routine work?

Maybe I made a typo with the second one...

EDIT: Hmm, both seem to work for me, but there could be certain vales that cause problems. What values did you use?

For example, I did -16/3 and it returned -5 (65531) with a remainder of 1.

865
ASM / Re: [z80] 16 by 16 signed division
« on: July 02, 2013, 11:33:59 am »
EDIT: Fixed a problem for when HL=8000h.
I have this routine that is larger, but faster than my other division routines:
Code: [Select]
;===============================================================
HL_Div_BC_Signed:
;===============================================================
;Performs HL/BC
;Speed: 1350-55a-2b
;         b is the number of set bits in the result
;         a is the number of leading zeroes in the absolute value of HL, minus 1
;         add 24 if HL is negative
;         add 19 if BC is negative
;         add 28 if the result is negative
;Size:    68 bytes
;Inputs:
;     HL is the numerator
;     BC is the denominator
;Outputs:
;     DE is the quotient
;     HL is the remainder
;     BC is not changed
;Destroys:
;     A
;===============================================================
     ld a,h
     xor b
     push af
;absHL
     xor b
     jp p,$+9
     xor a \ sub l \ ld l,a
     sbc a,a \ sub h \ ld h,a
;absBC:
     bit 7,b
     jr z,$+8
     xor a \ sub c \ ld c,a
     sbc a,a \ sub b \ ld b,a

     ld de,0
     adc hl,hl
     jr z,EndSDiv
     ld a,16

     add hl,hl
     dec a
     jp nc,$-2
     ex de,hl
     jp jumpin
Loop1:
     add hl,bc     ;--
Loop2:
     dec a         ;4
     jr z,EndSDiv  ;12|23
     sla e         ;--
     rl d          ;--
jumpin:            ;
     adc hl,hl     ;15
     sbc hl,bc     ;15
     jr c,Loop1    ;23-2b     ;b is the number of bits in the absolute value of the result.
     inc e         ;--
     jp Loop2      ;--
EndSDiv:
     pop af \ ret p
     xor a \ sub e \ ld e,a
     sbc a,a \ sub d \ ld d,a
     ret
So at its slowest, it is 1396 clock cycles and at its fastest (for non-trivial division) it is can get as low as 572 t-states for non-trivial division.

EDIT: I think I messed up the clock cycle count (but not by much). Anyways, here is a cleaner version that is smaller and more predictable. 1315-2b t-states where b is the number of bits set in the absolute value of the result:
EDIT2: The timings above are correct, now.
Code: [Select]
;===============================================================
HL_Div_BC_Signed:
;===============================================================
;Performs HL/BC
;Speed:   1315-2b cycles
;         **same cycles as the regular HL_Div_BC
;         add 24 if HL is negative
;         add 24 if BC is negative
;         add 28 if only one is negative
;Size:    60 bytes
;Inputs:
;     HL is the numerator
;     BC is the denominator
;Outputs:
;     DE is the quotient
;     HL is the remainder
;     BC is not changed
;     A is 0
;     z flag is set
;     c flag is reset
;===============================================================
     ld a,h
     xor b
     push af
;absHL
     xor b
     jp p,$+9
     xor a \ sub l \ ld l,a
     sbc a,a \ sub h \ ld h,a
;absBC:
     xor b
     jp p,$+9
     xor a \ sub c \ ld c,a
     sbc a,a \ sub b \ ld b,a

     add hl,hl
     ld a,15
     ld de,0
     ex de,hl
     jp jumpin
;89+15*80+26 = 1315-2b
Div_Loop_1:
     add hl,bc   ;--
Loop2:
     dec a       ;4
     jr z,EndSDiv ;12|7
jumpin:
     sla e       ;8
     rl d        ;8
     adc hl,hl   ;15
     sbc hl,bc   ;15
     jr c,Loop1  ;23-2b
     inc e       ;--
     jp Loop2    ;--
EndSDiv:
     pop af \ ret p
     xor a \ sub e \ ld e,a
     sbc a,a \ sub d \ ld d,a
     ret

866
TI Z80 / Re: CopyProg
« on: July 01, 2013, 10:10:38 pm »
Sorry, my computer died (bad battery, off the charger for about a minute). Anyways, GroupRead can be found on TICalc here and LblRW can be found here.

867
TI Z80 / Re: CopyProg
« on: July 01, 2013, 09:40:37 pm »
Awesome, have you seen my GrpRead, TPROG, and LblRW programs, too ? Those are also pretty powerful for BASIC games like RPGs. The first is like CopyProg for groups (it allows you to access data from the groups and extract variables, read lines from variables, and recall pictures from groups). The other is like a simplified CopyProg that is designed specifically for loading archived subprograms to RAM and cleaning them up (it is also tiny). LblRW is rather epic since it allows you to edit data inside your program by overwriting lines or reading lines starting at a label. This lets you keep user data directly in the program (for example, you can make a label called Lbl SV and store the user name and any string data to the lines following). I used that to store monster data, item data such as prices and descriptions, and all sorts of similar code that way.

868
TI Z80 / Re: CopyProg
« on: July 01, 2013, 09:31:28 pm »
Sorry for the long wait, I share the internet :P Anyways, thanks for notifying me of the bug! As said on IRC, there was a snippet of code deleted that saved the flash page of the data. I fixed that and tested a few more functions to make sure they worked (though there could still be bugs).

Hopefully I didn't leave in any bad code.

869
ASM / Re: [z80] 16 by 16 signed division
« on: July 01, 2013, 01:06:09 pm »
The easiest way to do it, probably, is to just use a regular division routine and check for the sign of the input:
Code: [Select]
     ld a,d
     xor h       ;now the sign flag is set if the result needs to be negative or positive.
     push af
     xor h       ;now a=d again, but we have the sign flag set appropriately
     jp p,$+9    ;if the sign is minus, negate DE
       xor a
       sub e
       ld e,a
       sbc a,a  ;c flag is set, so this makes A=$FF
       sub d
       ld d,a
     ld a,h
     or a
     jp p,$+9
       xor a
       sub l
       ld l,a
       sbc a,a  ;c flag is set, so this makes A=$FF
       sub h
       ld h,a
     call HL_Div_DE    ;return the result in HL
     pop af
     ret p
     xor a
     sub l
     ld l,a
     sbc a,a
     sub h
     ld h,a
     ret
In the worst case, it is 141 t-states + however long it takes for the regular division.

141 t-states extra if one input is negative
137 t-states extra if both are negative
89 t-states extra if both inputs are positive

870
Casio Calculators / [Prizm C] Mandelbrot Set
« on: July 01, 2013, 11:34:31 am »
This is my first working Prizm C program and it is much faster and prettier than my BASIC version. As the title implies, this draws the Mandelbrot set and currently does not do much. You have to wait for it to draw the whole thing and it isn't very fast (it takes about 1 minute 15 seconds to render), but once it is done it looks cool:

Press [MENU] to exit.

I really don't suggest downloading it since all it amounts to is what you see in the still screenshot. My plan is to make an explorer and see if I can possibly make it faster, but I thought I would share with anybody that is curious. Also, the code:
Code: [Select]
#include <fxcg/display.h>
#include <fxcg/keyboard.h>
void plot(int x0, int y0, int color) {
   char* VRAM = (char*)0xA8000000;
   VRAM += 2*(y0*LCD_WIDTH_PX + x0);
   *(VRAM++) = (color&0x0000FF00)>>8;
   *(VRAM++) = (color&0x000000FF);
   return;
}
int main() {
  Bdisp_AllCr_VRAM();
  Bdisp_EnableColor(1);
  double CxMin=-2.0;
  double CyMax=1.5;
  double delta=3.0/192;
  double Zy2,Zx2,Zy,Zx,Cx,Cy;
  int x,y,iter,a,itermax=50;
  Cx=CxMin;
  for(x=0;x<384;x++)
  {
    Cy=CyMax;
    for(y=0;y<192;y++)
    {
      Zx=Cx;
      Zy=Cy;
      Zx2=Cx*Cx;
      Zy2=Cy*Cy;
      for(iter=0;iter<itermax && ((Zx2+Zy2)<=4);iter++)
      {
        Zy=2*Zx*Zy +Cy;
        Zx=Zx2-Zy2 +Cx;
        Zx2=Zx*Zx;
        Zy2=Zy*Zy;
      }
      a=iter-itermax;
      a=2048*(a%32) + 32*(a % 64) + (a % 32);
      plot(x,y+32,a);
      Cy-=delta;
    }
  Cx+=delta;
  Bdisp_PutDisp_DD();
  }

  int key;
  while(1)
  GetKey(&key);
  return 0;
}

I also have no Icon made yet x.x

Pages: 1 ... 56 57 [58] 59 60 ... 317