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 ... 123 124 [125] 126 127 ... 153
1861
The Axe Parser Project / Re: Features Wishlist
« on: October 23, 2010, 10:15:06 pm »
is there a way you could let getKey() take a variable as an argument? so getKey(A) would be valid. it'd help if you wanted to let the user configure his controls.

I guess such a routine could exist, but because of how the keyboard hardware works, it would be fairly bulky and slow. It's probably better to just stick with preassigned keys.



EDIT: So as not to double post, I'll add the following as an edit. It is, however, entirely unrelated.

I guess this request is sort of a form of look-ahead parsing, which is generally difficult to implement, but I believe this is a very basic form that has already been similarly implemented with pre-calculation involving constants. I was wondering if statements such as A+{L1+4}r, which is currently parsed as:
Code: [Select]
ld hl,(A)
push hl
ld hl,(L?+4)
pop de
add hl,de
Could be optimized to be like normal variable addition:
Code: [Select]
ld hl,(A)
ld de,(L?+4)
add hl,de
The same goes for things like subtraction and any other things I may be forgetting that could be optimized this way.


EDIT 2: Oh, by the way, you misspelled "routines" in the fourth line of the Commands.inc file :P



EDIT 3: Man, this post is getting really big! But I promise this next feature request will be simple, I'll even give you the code for it!

Code: (Hexadecimal display (?Rect or ?Polar seems like the best choice)) [Select]
p_DispHex:
.db __DispHexEnd-$-1
ld c,h
call __DispHexByte
ld c,l
__DispHexByte:
ld a,c
rra
rra
rra
rra
call __DispHexNib
ld a,c
__DispHexNib:
or F0h
daa
add a,A0h
adc a,40h
B_CALL(_PutC)
ret
__DispHexEnd:

p_TextHex:
.db __TextHexEnd-$-1
ld c,h
call __TextHexByte
ld c,l
__TextHexByte:
ld a,c
rra
rra
rra
rra
call __TextHexNib
ld a,c
__TextHexNib:
or F0h
daa
add a,A0h
adc a,40h
B_CALL(_VPutMap)
ret
__TextHexEnd:



EDIT 4: Oh, and you haven't forgotten about this, have you? Haha sorry for swamping you. ;)

1862
TI Z80 / Re: Need help for Bomberman
« on: October 23, 2010, 08:39:09 pm »
Ahh, code in a spoiler tag! The mortal enemy of Chrome users!

1863
Axe / Re: Questions about programs and appvars
« on: October 22, 2010, 11:55:42 am »

I have 2 questions:


How would I copy an arbitrary number of programs to one giant program?
How would I read from a BASIC string variable?

Thanks in advance

Regarding your first question: are these compiled assembly programs? And would all the names already be listed somewhere in memory, or would program names be called one by one? Also, would all these programs be in RAM, or might some/all be archived?

As for BASIC strings, reading from them is much like reading from strings inside of Axe, except that Axe strings are strings of ASCII characters and BASIC string variables are strings of tokens. To find the pointer to a string variable, you would do something like the following:
Code: [Select]
GetCalc("Str1")→PAnd then you can just treat P like you would a pointer to a normal string in Axe, although taking note of the fact that it's a string of tokens and not ASCII characters.

1864
Axe / Re: Lock programs with Axe?
« on: October 21, 2010, 11:24:09 pm »
Wait, why are you going back to using programs? This isn't a problem inherent in the fact that level data is stored in appvars, it's a problem inherent in the fact that your main program is compiled as an application.

1865
Axe / Re: Lock programs with Axe?
« on: October 21, 2010, 10:19:08 pm »
Well your code has no errors, but the problem is that your program is compiled as an application. Apps exist in ROM so they can't use self-modifying code, which is what storing to internal pointers like Str9 really is, so that's why that does nothing. What you need to do is instead allocate a section of safe RAM to hold the string and copy and display the string from there.

1866
Axe / Re: Lock programs with Axe?
« on: October 21, 2010, 10:04:01 pm »
first, I notice "{P-7-X+1}->{Str9+X}" should be "{P-7-X}->{Str9+X}" since P-7 is the first entry, not P-6, which is what yyou got by adding 1 back at the end...
Youre right. I removed the mistakes from the code in the last post.
Here is a screenshot showing what happens if I output appvar names character by character with 4 pxl gaps.

Why do it character by character? Didn't you just have code for storing it and displaying it as a string?

1867
Axe / Re: a couple questions
« on: October 21, 2010, 09:26:10 pm »
Asm(EFE542) is smaller though. It also seems faster, but I'm not sure.

It's a bcall. Bcalls are slow.

1868
TI Z80 / Re: The World's Hardest Game
« on: October 21, 2010, 04:05:53 am »
Well I'm finding it pretty hard to make sense of the level loading and actual game code, so I haven't gotten around to optimizing that yet. The menu, however, I could understand and optimize. And although I don't exactly understand all the level loading code, I optimized everything before the line If A≠C or B, as well as doing something like you suggested to get rid of all the different level strings and just have two strings (one for appvars, one for programs) in which the level number changes. I also made a few other optimizations throughout the program in random places, but for the most part, everything after the If A≠C or B line is unoptimized.

As far as I know, everything still functions correctly. Please tell me if this is not the case! If anything doesn't work correctly any more, it would probably be the level loading code, as I couldn't actually test it because I don't have a level with which to test it!

Total savings so far: 865 bytes (89% original size).


Maybe I'll try optimizing the level editor next. If I can somehow manage to shave off like 2000 bytes it will fit in a program.

1869
TI Z80 / Re: The World's Hardest Game
« on: October 21, 2010, 01:18:03 am »
I see that you posted the source for all this Darl, want me to try to help optimize it?

1870
Axe / Re: Seeing Through Sprites
« on: October 20, 2010, 02:35:56 pm »
Sorry for the confusion, my last post was directed towards ASBAD_ALVIN, not you DJ.

Yes, you can use the Pt-Mask() routine for masking monochrome sprites, but you didn't quite define the logic of how things are drawn correctly. You got how to draw white and transparent pixels correctly, but black pixels need to have their corresponding bit be on in both buffers, not just the front buffer. Having the bit on in just the front buffer was designed for gray, which turns the pixel on in the back buffer (not used in black and white displaying) but turns the pixel off in the front buffer.

Not true, runer.  If you use Dispgraph with no r at the end it does it with only black on the first buffer...


Take the following program for example:
Code: [Select]
.TEST
[FFFFFFFF00000000]→Pic1
[FFFF0000FFFF0000]
ClrDraw
DrawInv
Pt-Mask(0,0,Pic1)
DispGraph
Repeat getKey
End

That sprite has both bits set for the first two lines of data, only the first buffer bits set for the third and fourth lines, only the second buffer bits set for the fifth and sixth lines, and all of the bits unset for the seventh and eighth lines. You get the result displayed in the attached picture. The first two lines are black, because both bits are set in the sprite data, but when only the first buffer bit is set in the sprite (lines three and four), the result is white. This is because the Pt-Mask() command is doing what would be gray, which means the back buffer pixels are on but the front buffer pixels are off.

EDIT by DJ: post was messed up due to additional code tag at beginning. Fixed :P

EDIT by me: I think I might have fixed it first, in which case you would have been edit ninja'd :P

1871
Axe / Re: Seeing Through Sprites
« on: October 20, 2010, 02:08:43 pm »
Yes, you can use the Pt-Mask() routine for masking monochrome sprites, but you didn't quite define the logic of how things are drawn correctly. You got how to draw white and transparent pixels correctly, but black pixels need to have their corresponding bit be on in both buffers of sprite data, not just the first buffer. Having the bit on in just the first buffer was designed for gray, which turns the pixel on in the back buffer (not used in black and white displaying) but turns the pixel off in the front buffer.

1872
Axe / Re: Routines
« on: October 20, 2010, 01:24:36 pm »
Now go make a raycaster in Axe ;)

1873
Axe / Re: Routines
« on: October 20, 2010, 11:23:50 am »
Although if you wanted to get the highest speed you would prerender a sin table into somewhere in memory to get high accuracy and high speed ^^

Well that's the point of the library called "TRIGLIB - Fast 512-byte LUT.8xp" :P

1874
Web Programming and Design / Re: Pure, pure epicness
« on: October 20, 2010, 09:36:20 am »
I think he means the javascript effect itself isn't working, he isn't trying to record it or aything.

1875
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: October 20, 2010, 08:56:30 am »
Oops, necropost, oh well :P

I don't know if this approach was purposely left out, as it's 15 bytes larger than the current routine and sometimes slower. I'm referring to the square root routine. Whereas the current routine (14 bytes) takes 37n+38 T-states (linear time), where n is the result+1 (1-256), the following routine (29 bytes) takes 5n+800 T-states (near constant time), where n is the number of set bits in the result (0-8). The existing routine is faster for values that would yield results of 0-19, but this routine would be faster for values that would yield results of 20-255, which is a much broader range of the 8-bit spectrum. Also, it would be much more reliable to run at a near constant speed in programs which rely on that to run smoothly themselves. The existing routine would take only a few hundred T-states for low inputs, but would take up to OVER NINE THOUSAND T-states to calculate the square roots for the highest inputs. So it's up to you if this is something you want to use.

Code: [Select]
p_Sqrt:
.db __SqrtEnd-1-$
ld a,l
ld l,h
ld de,$0040
ld h,d
ld b,8
or a
__SqrtLoop:
sbc hl,de
jr nc,__SqrtSkip
add hl,de
__SqrtSkip:
ccf
rl d
rla
adc hl,hl
rla
adc hl,hl
djnz __SqrtLoop
ld h,0
ld l,d
ret
__SqrtEnd:

Pages: 1 ... 123 124 [125] 126 127 ... 153