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

Pages: 1 ... 14 15 [16] 17 18 ... 62
226
TI Z80 / Re: Harry Potter sprites
« on: January 23, 2012, 10:46:39 am »
So, the best option here would be, im assuming, to just make a separate sprite for each directional position?

227
TI Z80 / Harry Potter sprites
« on: January 23, 2012, 09:26:42 am »
Can anyone with some spare time on their hands make a few Harry Potter sprites. 8x8. I'd like each of the main characters of hp7, but I suppose just a Harry and then one generic will suffice. Also, is there a way, when moving a sprite to memory, to rotate it by some degree?

228
ASM / Chemical Formula Input Routine
« on: January 18, 2012, 02:14:40 pm »
Can someone write me up one if they have the time? I started to write one myself, but got confused. Below is what I have so far. Can someone please help me out with this. I'm looking for the routine to prompt for an equation, allow you to press the down arrow for subscripts, make the second character of a two-character symbol lower-case, and make the y= button give the arrow.

Code: [Select]
ReceiveEquation:
    bcall(_ClrLCDFull)
    ld  a,0
    ld  (penCol),a
    ld  (penRow),a
    ld  de,saferam1+1
    ld  a,0
    ld  (saferam1),a
    ld  a,0
getKloop:
    bcall(_getCSC)
    jr  z,getKloop
    cp  $01
    jr  z,switchnumeric
    cp  $04
    jr  z,switchalpha
    cp  $02
    jr  z,backspace
    cp  $09
    jr  z,done


switchnumeric:
    bit 0,(TextInputFlag)
    jr  z,getKloop
    ld  hl,NumericCharMap
    ld  a,(penRow)
    add a,3
    ld  (penRow),a
    res 0,(TextInputFlag)
    jr  getKloop

switchalphaup:
    bit 0,(TextInputFlag)
    jr  nz,getKloop
    ld  hl,AlphaCharMap
    ld  a,(penRow)
    sub 3
    ld  (penRow),a
    set 0,(TextInputFlag)
    jr  getKloop

backspace:
    ld  a,(saferam1)
    cp  0
    jr  z,getKloop
    dec a
    ld  (saferam1),a
    dec de
    ld  a,(penCol)
    sub 5
    ld  (penCol),a
    jr  getKloop

done:
       
AlphaUpCharMap:
    .db 0,0,0,0,0,0,0,0,0,0
    .db "WRMH"
AlphaLowCharMap:

NumericCharMap:

229
General Calculator Help / Re: Rref Algorithm
« on: January 15, 2012, 08:47:20 pm »
How would you do an rref in z80?

230
TI Z80 / Re: Chess
« on: December 13, 2011, 06:54:17 pm »
thepenguin, a great job. However, one issue of convenience.

I lose the game (or win). I then get the cursor, but am unable to move. The game should automatically quit and return you to the main menu. At current, you need to exit manually, then it asks you if you are sure you want to exit a game that is already over.

231
ASM / Re: 24 bit multiplication
« on: December 12, 2011, 02:35:39 pm »
Yeah, all I need is 16-bit subtraction (which 'sub' supports, I think), 16-bit squaring, 32-bit addition, then 32-bit square rooting (or will I need to go up to 40-bit?).

232
ASM / Re: 24 bit multiplication
« on: December 11, 2011, 02:23:11 pm »
Code: [Select]
// Multiply a times b
temp = 0
repeat for each bit in a
temp <<= 1
if (high bit of a set)
temp += b
a <<= 1
return temp
if a and b are 2 bytes, temp is 4 bytes, and you loop 16 times.
Spoiler For for code:
stolen from Axe
p_MulFull:
   ; Input in hl, result in cahl
   ld   c,h
   ld   a,l
   ld   hl,0   ;11
   ld   b,16   ;7
__MulFullNext:
   add   hl,hl   ;11
   rla      ;4
   rl   c   ;8
   jr   nc,__MulFullSkip   ;12/7
   add   hl,de   ;11
   adc   a,0   ;7
   jr   nc,__MulFullSkip
   inc   c
__MulFullSkip:
   djnz   __MulFullNext
   ret
__MulFullEnd:

Code: [Select]
// Sqrt a
temp = high byte of a
a <<= 8
b = 0
repeat for every 2 bits in a
test = b << 8 + 0x40
b <<= 1
if (temp >= test)
temp -= test
set low bit of b
temp += high 2 bits of a
a <<= 2
return b
If a is 4 bytes, then b and temp are 2 bytes, and you loop 16 times.
Spoiler For code:
stole my own routine from axe (and modified it)
p_Sqrt88:
   ; input in hlde, result in de
   ld   b,16
   ld   a,h
   ld   c,l
   push   de ; ld ixh,d
   pop   ix ; ld ixl,e
   ld   de,0
   ld   h,d
   ld   l,e
__Sqrt88Loop:
   sub   $40
   sbc   hl,de
   jr   nc,__Sqrt88Skip
   add   a,$40
   adc   hl,de
__Sqrt88Skip:
   ccf
   rl   e
   rl   d
   add   ix,ix
   rl   c
   rla
   adc   hl,hl
   add   ix,ix
   rl   c
   rla
   adc    hl,hl
   djnz   __Sqrt88Loop
   ret
__Sqrt88End:

Kool. Thanks. But, shouldn't the first one have two inputs?

233
ASM / Re: 24 bit multiplication
« on: December 11, 2011, 01:41:47 pm »
Ok. I am particularly interested now in 2-byte multiplication and 4-byte square rooting. How would they be done?

234
ASM / Re: 24 bit multiplication
« on: December 11, 2011, 12:47:33 pm »
Ok, I think I get it.

You move through the second register. If the current bit is 1, you add 1 x a to a, then rla a. If the current bit is 0, just rla a.

235
ASM / Re: 24 bit multiplication
« on: December 11, 2011, 11:31:56 am »
Ok, so let me just get something straight...

 00100110
x11011001
-------------
1. 00100110
2. 0,01001100
3. 00,10011000
4. 001,00110001
5. 0010,01100011
6. 00100,11000110
7. 001001,10001101
8. 0010011,00011011

Thus, the answer is %00010011 %00011011

Now, let's check: 38 x 217 = 4891  XX it's wrong??

236
ASM / Re: 24 bit multiplication
« on: December 10, 2011, 09:24:34 am »
Ok, I'm actually going to be sticking with just two bytes for position and scrapping the sector. That means I'll need to do 2-byte subtraction (no problem), square a 2-byte (rendering a max 4-byte), then add three 4-bytes (do you only need a 4-byte output or should you go up to 5), then square root that. That should be easier.

√( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)

√( (16bit-16bit)^2 + (16bit-16bit)^2 + (16bit-16bit)^2)


Can someone explain to me the theory behind multiplying/dividing/sqrt'ing numbers? Is there a standard theorem, regardless of the bit-size of the number?

237
ASM / Re: 24 bit multiplication
« on: December 08, 2011, 03:57:06 pm »
Ok, I'm confused. I'll leave this to the more advanced programmers for now.

238
General Calculator Help / Re: Disable Press-To-Test
« on: December 08, 2011, 03:12:49 pm »
use thepenguin's patch. What is your OS #?

239
ASM / Re: 24 bit multiplication
« on: December 08, 2011, 03:11:20 pm »
Well I am almost positive that using my algorithm would require the use of RAM, even if you used all the shadow registers, too.
Can you help me, conceptually with doing math higher than 2 bytes? Maybe I'll write it myself.

240
ASM / Re: 24 bit multiplication
« on: December 08, 2011, 11:31:05 am »
Ideas? Anyone willing to have "fun" with this?

Pages: 1 ... 14 15 [16] 17 18 ... 62