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

Pages: 1 ... 105 106 [107] 108 109 ... 153
1591
Axe / Re: Online Axe command index
« on: December 18, 2010, 03:40:57 pm »
Can you just paste in the actual characters? Like ° and ►?

1592
Axe / Re: Appvariables for Highscores
« on: December 18, 2010, 02:12:43 pm »
I'm playing civilization V so it will be later  :D

Hum... OK.

It didn't work, the appvar is created, but the HS is always 0, both for easy and hard.

Code: [Select]
!If GetCalc(NAME)→H
Fill(0→{GetCalc(NAME,SIZE)→H},SIZE-1)
End

I gotta try that too :)

Runner always optimizing :D

That leaves the pointer in the Fill( statement at zero, so you're basically copying size-1 bytes starting at address $0000, instead of the address of your appvar, which is definitely not what you want.

Try
Code: [Select]
!If GetCalc(NAME)
0→{GetCalc(NAME,SIZE)→H}
Fill(H,SIZE-1)
End
instead.

Storing the value to a static pointer would return 0, but storing it to a variable pointer returns the pointer. For example, whereas 0→{Str1} would return 0, 0→{A} would return A.

EDIT: And just a side note, storing a two-byte value to a variable pointer, like 0→{A}r, would return A+1.

1593
Axe / Re: Full Normal Slow?
« on: December 18, 2010, 01:50:20 pm »
The processor can only run at 6MHz or 15MHz (with 15MHz not being available on the 83PBE). There is no "Slow" speed mode available.

1594
Axe / Re: Appvariables for Highscores
« on: December 18, 2010, 10:15:28 am »
Instead of a For() loop, you can use the Fill() command to fill a section of memory with a value. That, and a few other optimizations:

Code: [Select]
!If GetCalc(NAME)→H
Fill(0→{GetCalc(NAME,SIZE)→H},SIZE-1)
End

It might be a good idea to check whether or not creating the appvar was successful, though. You wouldn't want the game to proceed, thinking that the appvar exists when it really doesn't.

1595
TI Z80 / Re: Pokemon TI
« on: December 17, 2010, 09:21:10 pm »
Did someone say optimize? ;D

1596
ASM / Re: [z80] 16-bit * 16-bit = 32-bit Signed Multiplication
« on: December 17, 2010, 08:59:27 pm »
Yeah, I already stole borrowed your routine for the fact that it can output a 32-bit result. ;)

1597
ASM / Re: [z80] 16-bit * 16-bit = 32-bit Signed Multiplication
« on: December 17, 2010, 08:21:16 pm »
I LOVE YOU GOPLAT

EDIT: Well I don't really love you, that would just be creepy since I don't know you. But still, that's a pretty nice method you pointed out.

1598
TI Z80 / Re: YAAR (Yet Another Assembly/Axe Raycaster)
« on: December 17, 2010, 06:53:45 pm »
Yes, the textures have a lot to do with it. Even if you don't know assembly, you can probably guess that drawing an untextured wall slice:
Code: [Select]
ld de,12
DrawWallSliceLoop:
ld a,c
or (hl)
ld (hl),a
add hl,de
djnz DrawWallSliceLoop

Will run a bit faster than drawing a textured wall slice:
Code: [Select]
DrawWallSliceLoop:
ld de,(var_N)
ld bc,(var_R)
WallSpriteShiftLoop:
ld a,d
or a
jr nz,WallSpriteShiftEnd
ld hl,var_S
ld a,(hl)
or a
jr z,WallSpriteShiftEnd
dec (hl)
ld hl,(var_T)
add hl,hl
ld (var_T),hl
ex de,hl
add hl,bc
ex de,hl
jr WallSpriteShiftLoop
WallSpriteShiftEnd:
dec d
ld (var_N),de
DrawFirstWallPixel:
ld hl,(var_P)
push hl
ld bc,-plotSScreen
add hl,bc
pop hl
jr nc,DrawWallPixelSkip
ld a,(var_T+1)
rla
jr nc,DrawWallPixelSkip
ld a,(var_M)
or (hl)
ld (hl),a
DrawWallPixelSkip:
ld de,12
add hl,de
ld (var_P),hl
ld hl,(var_U)
dec hl
ld (var_U),hl
ld a,h
or l
jr nz,DrawWallSliceLoop


Because of this, my primary optimization goal is to try to do something about this.

EDIT: I already have some ideas about how to try to normalize the time drawing a wall slice takes.

1599
TI Z80 / Re: YAAR (Yet Another Assembly/Axe Raycaster)
« on: December 17, 2010, 06:17:15 pm »
An update:

The assembly version mostly works now! I say mostly because the raycasting engine works just like the Axe engine, but sometimes it crashes, which I need to look into before releasing it.

In the assembly version, I made a lot of optimizations, especially in areas where the full 16-bit spectrum is not needed. The assembly version is about 500 bytes smaller than the Axe version, so it is about 70% of the size of the Axe engine. And by my quick test, it appears that the assembly engine runs about 30% faster than the Axe engine. Unfortunately, by my math, SLOW * 1.3 = STILL SLOW. At 6MHz, I would need about a 100% speed increase for this to run at a decent framerate. And that's with fairly low standards for "decent framerate."

I'll be constantly looking into optimizations.

(How ever did you do it Peter Bucher...)



Just for speed comparison, here are two GIFs of the two engines rendering the same 32 frames at 6MHz with no pixel doubling. As you can see, closer (and thus taller) walls have a habit of killing the FPS.

YAAXER
YAASMR
~3.1 FPS
~4.0 FPS
~3.8 FPS
~5.0 FPS

1600
ASM / [z80] 16-bit * 16-bit = 32-bit Signed Multiplication
« on: December 17, 2010, 04:59:42 pm »
This is a somewhat challenging routine I've been trying to develop for z80 assembly. I'm trying to find a way to multiply two signed 16-bit operands together and get a signed 32-bit result.

I already have one working method, although it's fairly hacky. Its general structure is as follows:
  • Xor the high bytes of the two operands and push af
  • Convert the operands into their absolute values
  • Multiply these two values with the normal restoring multiplication algorithm
  • Pop af and return if sign flag is unset
  • Negate the result of the multiplication and return

Somehow, I get the feeling there are faster and/or more elegant solutions than this.

The most elegant solution would just be a modified restoring multiplication algorithm that deals with signed numbers correctly. After having stared down the restoring multiplication algorithm for about the past hour, I don't know how reasonable this is, though. And unless there's some simple change I'm not seeing that would suddenly make this work, any solution of this form would probably consume a lot of extra cycles in each iteration.

Something that has occurred to me as a more achievable and probably faster solution, albeit larger, consists of a test that branches into one of three different versions of the restoring multiplication algorithm. Which algorithm to use would be determined based on whether neither, one, or both of the operands are negative. This is the method I am currently trying to develop. After a bit of messing around with the restoring multiplication algorithm, though, I'm still fairly confused about how to form the two modified algorithms that would be needed.


Any ideas?

1601
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 17, 2010, 01:11:47 am »
Some constant equality checking optimizations. Feel free to extrapolate these optimizations to values that previously weren't optimized because the code would have been too large.

Code: (Current code) [Select]
p_EQN256:
.db 9
inc h
ld a,l
or h
jr z,$+5
ld hl,255
inc l
p_EQN2:
.db 10
inc hl
inc hl
ld a,l
or h
jr z,$+5
ld hl,255
inc l
p_EQN1:
.db 9
inc hl
ld a,l
or h
jr z,$+5
ld hl,255
inc l
p_EQ0:
.db 8
ld a,l
or h
jr z,$+5
ld hl,255
inc l
p_EQ256:
.db 9
dec h
ld a,l
or h
jr z,$+5
ld hl,255
inc l

       
Code: (Optimized code) [Select]
p_EQN256:
.db 8
inc h
ld a,l
or h
add 255
sbc hl,hl
inc hl
p_EQN2:
.db 8
inc l
ld a,l
and h
sub 255
sbc hl,hl
inc hl

p_EQN1:
.db 7
ld a,l
and h
sub 255
sbc hl,hl
inc hl

p_EQ0:
.db 7
ld a,l
or h
add 255
sbc hl,hl
inc hl
p_EQ256:
.db 8
dec h
ld a,l
or h
add 255
sbc hl,hl
inc hl



Also, p_Div32768 can be optimized to be the same as p_SLT0 and p_GetBit0.

1602
ASM / Re: F**king stacks! How do they work?
« on: December 16, 2010, 11:16:07 pm »
You know ld h,d / ld l,e is faster than push de / pop hl, right?

1603
I got:
Code: [Select]
Connected
DispGraph

EDIT: This command alone will always display and redraw the graph screen:
Code: [Select]
ZoomSto

1604
Axe / Re: 24*24 sprites?
« on: December 16, 2010, 03:16:05 pm »
Oh, I thought you wanted to split it up into 8x8 sprites so you could then use the built-in sprite routine to draw an array of 8x8 sprites. If you're fine with just copying the 24x24 sprites aligned to byte boundaries on the buffer, then may I suggest a routine like the following:

Syntax: sub(24S, Column (0-9), Row (0-40), Sprite pointer)

Code: (Size optimized, 59 bytes, ~0.0014 seconds at 6MHz) [Select]
Lbl 24S
  24+1
  Lbl 24L
  Return!If -1→r₄
  Copy(-1*3+r₃,r₄+r₂*12+r₁-12+L₆,3)
  r₄
Goto 24L

Code: (Speed optimized, 76 bytes, ~0.0011 seconds at 6MHz) [Select]
Lbl 24S
  +72→r₄
  ⁻()→r₅
  r₂*12+r₁-12+L₆→r₆
  r₃
  Lbl 24L
  Return!If +r₅
  Copy(+r₄,r₆+12→r₆,3)
Goto 24L

1605
Axe / Re: 24*24 sprites?
« on: December 16, 2010, 11:47:22 am »
There would be a way to shuffle around the sprite data at runtime, although that would result in unnecessary code bloating. The best thing to do is to just change the hex code yourself.

How many 24x24 sprites do you have? If it's only a few, you can probably just rearrange it manually. Alternatively, if you post the hex here, I'm sure someone can help you out with rearranging the hex. I would certainly try to help.

EDIT: If you have bitmaps of the sprites, those would probably provide the easiest way to convert the sprite into multiple 8x8 sprites.

EDIT 2: If you would rather shuffle around the sprite data at runtime, I wrote a routine to do this. The following code will take a 24x24 sprite at Pic1, form its equivalent 8x8 sprites at L₁, and then copy these back to Pic1. The resulting 9 sprites will occur in this order:
  • Top-left
  • Middle-left
  • Bottom-left
  • Top-center
  • Middle-center
  • Bottom-center
  • Top-right
  • Middle-right
  • Bottom-right

Code: [Select]
Pic1-3→P
L₁-1→O
3+1
While -1→A
24+1
While -1→B
{P+3→P}→{O+1→O}
B
End
P-72+1→P
A
End
conj(L₁,Pic1,72)

The routine is 99 bytes. Although it isn't too large, I myself would pre-rearrange the data and avoid the need for it.

Pages: 1 ... 105 106 [107] 108 109 ... 153