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 ... 81 82 [83] 84 85 ... 153
1231
« on: May 27, 2011, 08:55:58 am »
I believe the reason computer languages introduced the ++ function is because it produced more optimized code. However, on the z80, incrementing a 2-byte value with C+1→C is already the most optimized way to do so. I guess it could be added to produce slightly smaller source code, but it wouldn't be adding any optimization.
1232
« on: May 27, 2011, 08:51:32 am »
Almost. Z is x and θ is y. Note how I paired the two x coordinates and the two y coordinates together in the If statement.
1233
« on: May 26, 2011, 08:42:33 pm »
Yeah it was more optimized, but I don't think it worked. It would've screwed up normal 16/16 division because of how I reordered the initialization in p_Div to destroy hl before loading hl into ac.
1234
« on: May 26, 2011, 08:37:17 pm »
Yeah, I actually had a routine written for that which hijacked the 16/16 division routine, but deleted it in favor of the 8.8 division routine. However I realized that the 8.8 division routine doesn't work, so I'll try to recreate what I had before:
p_Inverse: .db __InverseEnd-1-$ xor a bit 7,h push af jr z,$+8 sub l ld l,a sbc a,a sub h ld h,a xor a ex de,hl ld bc,16<<8 ld hl,1 call $0000 ;sub_Div+10 pop af ret z sub l ld l,a sbc a,a sub h ld h,a ret __InverseEnd: .db rp_Ans,12
1235
« on: May 26, 2011, 08:28:41 pm »
But the logical way to get the inverse is to divide, is it not?
1236
« on: May 26, 2011, 06:40:23 pm »
Yes, an infinite loop. The check in a For() loop consists of checking if the variable's value is greater than the upper bound. However, because a 16-bit number can never be greater than 65535, the condition will never be met and the loop will never end.
EDIT: If you need a loop with those bounds, use this instead. It's smaller, faster, and stronger too! (Well, maybe not stronger)
0 While 1 →Q
;Put your code here
End!If Q+1
1237
« on: May 26, 2011, 05:03:20 pm »
Touching? Or overlapping? Here's overlapping:
If (X-Z+3≤6) and (Y-θ+3≤6) .Sprites are overlapping End
And here's touching:
If (X-Z+4≤8) and (Y-θ+4≤8) .Sprites are touching End
1238
« on: May 26, 2011, 04:35:58 pm »
I don't know of any speed-optimized function specific to taking the inverse. But that definitely doesn't mean one doesn't exist. However, you could easily implement it if you added 8.8 fixed point division:
p_Inverse: .db 7 ex de,hl ld hl,$100 call $0000 ;sub_88Div .db rp_Ans,2
p_88Div: .db __88DivEnd-1-$ ld a,h xor d push af bit 7,h jr z,$+8 xor a sub l ld l,a sbc a,a sub h ld h,a bit 7,d jr z,$+8 xor a sub e ld e,a sbc a,a sub d ld d,a ld b,24 call $0000 ;sub_Div+2 pop af add a,a ret nc xor a sub l ld l,a sbc a,a sub h ld h,a ret __88DivEnd: .db rp_Ans,12
EDIT: Just kidding, that hijacking of the 16/16 division routine to make an 8.8 division routine doesn't work. But it's definitely possible to hijack the 16/16 division routine at least for an 8.8 inverse.
1239
« on: May 26, 2011, 01:10:48 pm »
This should work:
StorePic 0+128 While 1 -128-2→θ !If +64 DrawInv ʳ End cos(θ)+129/2/2→Y +(≥32)-(=0)*256→Z ClrDraw 64 While 1 -1→I If Z/256≠((31+(Y<32)-Y)→H*8+Z→Z/256) Copy(I*12+L₃,Z/256*12+L₆,12) End End!If I DispGraph End!If θ+128
1240
« on: May 26, 2011, 12:48:37 am »
Here Darl181, I wrote this just for you! (Although other people can feel free to use it too!) http://ourl.ca/4129/212961
1241
« on: May 26, 2011, 12:38:01 am »
A lovely animated vertical screen flipping routine! It requires a buffer to store the image to be flipped, and by default uses L3. You could change this to use any 768-byte section of RAM by replacing the StorePic and instead copying your original buffer image (probably in L6) somewhere else.
The code is both pasted below and attached as VFLIPLIB.8xp. The easiest way to include this code in your program would be to just include prgmVFLIPLIB in the subroutine section of your program and call sub(VF) to use it.
StorePic 0+128 While 1 -128-2→θ cos()+129/2/2→Y +(≥32)-(=0)*256→Z ClrDraw 64 While 1 -1→I If Z/256≠((31+(Y<32)-Y)→H*8+Z→Z/256) Copy(I*12+L₃,Z/256*12+L₆,12) End End!If I DispGraph End!If θ+128
1242
« on: May 25, 2011, 11:48:29 pm »
I don't quite understand why it would be hard to make passes optional. Could you make normal parsing the 4-pass system that moves data to the end? But if this option is turned off, start parsing with a pass outside the normal 4-pass system that acts like the first two passes combined and then resumes with/jumps to the final two passes as usual? This "fifth" pass would probably share a lot of redundant code with the first two passes, but you're not exactly tight on space in the application, are you?
1243
« on: May 25, 2011, 11:22:27 am »
That would be pretty awesome too. I'm always a fan of more features at the cost of being a little slower.
1244
« on: May 25, 2011, 11:15:39 am »
The only case when this new 4-level grayscale routine should have noticeable problems is when it's alone in a loop with no other delay, simply because it's faster than the old routine. In most real situations that it would be used in, there would probably be much larger delay between display calls, like rendering a frame, in which case you want the routine to be as fast as possible. I would leave the 3-level grayscale routine in column-major but use the 4-level grayscale routine in row-major order, because they are both faster than their alternatives. Although this will allow for 4-level grayscale to draw from arbitrary buffers and not allow for it in 3-level grayscale, I wouldn't worry too much about the incongruity. Being able to call 4-level grayscale with arbitrary buffer arguments would be quite awesome.
1245
« on: May 24, 2011, 11:00:47 pm »
No worries, I compiled it as an Axiom, sent that to wabbitemu, and am debugging it as we speak. I'm also asking the master of grayscale (thepenguin77) if he sees anything obviously wrong with it.
EDIT: Quigibo, try putting something like a Pause 10-12 in your loop. I think the new routine is actually going too fast and is running at 1.5x your LCD's refresh rate, near-perfectly skipping every third frame.
Pages: 1 ... 81 82 [83] 84 85 ... 153
|