Heaven/TQA Posted September 28, 2004 Share Posted September 28, 2004 6502 maniacs... i try to improve schmutzpuppe's trackball ballcode without the use of a lookup table... he used a strange (but working... ) piece of code to mirror the bitpattern of the ballsprite... of course i could use a pre generated lookup table but i am sure you could do this with some clever bit manipulations... any help here? thomas? manuel? example 10000000 should be 00000001 of course without using any loop like schmutzpuppe's code as it will not run in VBL anymore... (wondering why atari missed out the mirror register of the 2600 or the h-v-flip registers of lynx or GB(A)) Quote Link to comment Share on other sites More sharing options...
Schmutzpuppe Posted September 28, 2004 Share Posted September 28, 2004 6502 maniacs... i try to improve schmutzpuppe's trackball ballcode without the use of a lookup table... he used a strange (but working... ) piece of code to mirror the bitpattern of the ballsprite Sorry haven't had much time and it was tired Took a short look at it and found the following: replace "ADC BITTAB,x" with ROR this is a bit faster and you don't need the table anymore. Maybe there is a more elegant way. I would be also interested in better code. Quote Link to comment Share on other sites More sharing options...
Schmutzpuppe Posted September 28, 2004 Share Posted September 28, 2004 Damn I want the "edit" button back Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted September 29, 2004 Share Posted September 29, 2004 Have a look at the Combat code I posted up recently, there's a small routine in that which creates the lookup table. Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted September 29, 2004 Author Share Posted September 29, 2004 no source code for combat found??? just the .xex... or should i go through the debugger??? Quote Link to comment Share on other sites More sharing options...
Sheddy Posted September 29, 2004 Share Posted September 29, 2004 creating a lookup table will of course be quickest in game. something like the following should create a 256 byte mirrored lookup table (this is a risk without testing or the edit button! look out for the fixes later...) ldx #0 ?1 stx mirror_this ldy #8 ?2 asl mirror_this ror a dey bne ?1 sta mirror_table,x dey bne ?1 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted September 29, 2004 Share Posted September 29, 2004 6502 maniacs... i try to improve schmutzpuppe's trackball ballcode without the use of a lookup table... Hm, where would I find that code? Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted September 29, 2004 Share Posted September 29, 2004 Hm, where would I find that code? Nevermind, found it. BTW: A compromise might be a nibble-lookup table. Quote Link to comment Share on other sites More sharing options...
DEBRO Posted September 29, 2004 Share Posted September 29, 2004 Hm, where would I find that code? Nevermind, found it. Where Quote Link to comment Share on other sites More sharing options...
Schmutzpuppe Posted September 29, 2004 Share Posted September 29, 2004 Hm, where would I find that code? Nevermind, found it. Where You can find it here: http://www.atariage.com/forums/viewtopic.php?t=56957 Quote Link to comment Share on other sites More sharing options...
Sheddy Posted September 29, 2004 Share Posted September 29, 2004 creating a lookup table will of course be quickest in game. something like the following should create a 256 byte mirrored lookup table (this is a risk without testing or the edit button! look out for the fixes later...) ldx #0 ?1 stx mirror_this ldy #8 ?2 asl mirror_this ror a dey bne [color=red]?2[/color] sta mirror_table,x dey bne ?1 knew it would like to see the combat code too Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 29, 2004 Share Posted September 29, 2004 Note: color (or any) tags do not work if preceded by Quote Link to comment Share on other sites More sharing options...
Robert M Posted September 29, 2004 Share Posted September 29, 2004 I may be going down the wrong track here, but if the data is for a sprite then why not use the TIA's buillt in ability to mirror sprite graphics? Using the REFP0 and REFP1 registers. Cheers! Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 29, 2004 Share Posted September 29, 2004 Because it doesn't exist in the 8-bits (unless I missed something?). Quote Link to comment Share on other sites More sharing options...
Schmutzpuppe Posted September 29, 2004 Share Posted September 29, 2004 Because it doesn't exist in the 8-bits (unless I missed something?). Right Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted September 29, 2004 Author Share Posted September 29, 2004 yup. "(wondering why atari missed out the mirror register of the 2600 or the h-v-flip registers of lynx or GB(A))" quote end... thanks guys... i'll double check it... still not knowing what asl mirror_this ror a is doing but if it works... who cares... (attention! demo coder alarm... demo coders doesnt care WHY it's working...just that it works... ) Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 29, 2004 Share Posted September 29, 2004 What it's doing is it's using ASL to shift the bits into carry one by one...and then the ROR pulls it back off in reverse order (shifting the existing data in the accumulator to the right) - giving a mirror image of the byte when it finishes with all 8 bits. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted September 29, 2004 Share Posted September 29, 2004 Many appologies to all, I did just send the demo and not the code because I thought I should finish it first before doing so Here's the Kernel based code anyway... I had decided that this wasn't going to quite work because of the extra cycles wasted to A8 things, so I have recoded it here with a more VBI based approach. As happens, everything is now broken and work stopped as my daytime and evening work has been taking up too much of my time. Still - my MyIDE board is now built and so next Monday it gets fitted and I should be trying it out next week. How long does a 12gig drive take to format Regards, Mark BTW, there was a similar routine to create a flip table in the Barbarian demo I did. You'd use this for 4 colour bit patterns. CreateFlipTable: LDX #0 @1: TXA LDY #3 @2: ASL A PHP ASL A ROR byte_0_A8 PLP ROR byte_0_A8 DEY BPL @2 LDA byte_0_A8 STA FlipTable,X INX BNE @1 RTS combat.zip Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 29, 2004 Share Posted September 29, 2004 BTW it eats up a good deal of cycle time tho (95 cycles in the Y loop?)...so a lookup table might be the only way for practical purpose. But what is a page of memory to the XL/XE anyway? Quote Link to comment Share on other sites More sharing options...
Schmutzpuppe Posted September 29, 2004 Share Posted September 29, 2004 creating a lookup table will of course be quickest in game. something like the following should create a 256 byte mirrored lookup table (this is a risk without testing or the edit button! look out for the fixes later...) ldx #0 ?1 stx mirror_this ldy #8 ?2 asl mirror_this ror a dey bne [color=red]?2[/color] sta mirror_table,x dey bne ?1 knew it would like to see the combat code too I have to admit that I don't know how this should work. Quote Link to comment Share on other sites More sharing options...
Schmutzpuppe Posted September 29, 2004 Share Posted September 29, 2004 Ah, get it now, very clever. Quote Link to comment Share on other sites More sharing options...
Robert M Posted September 29, 2004 Share Posted September 29, 2004 Because it doesn't exist in the 8-bits (unless I missed something?). Right Oops! My mistake. I saw the reference to Combat and I assume it was code to run on a VCS. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 30, 2004 Share Posted September 30, 2004 Actually, it shouldn't work (because the bottom DEY should be DEX...right?) Quote Link to comment Share on other sites More sharing options...
Robert M Posted September 30, 2004 Share Posted September 30, 2004 CreateFlipTable: LDX #0 @1: TXA LDY #3 @2: ASL A PHP ASL A ROR byte_0_A8 PLP ROR byte_0_A8 DEY BPL @2 LDA byte_0_A8 STA FlipTable,X INX BNE @1 RTS We can improve that routine by getting rid of the Y register: CreateFlipTable: LDX #0 @1: LDA #1 STX rotateThis @2: LSR rotateThis ROL A BCC @2 STA FlipTable,X INX BNE @1 RTS Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted September 30, 2004 Author Share Posted September 30, 2004 rob...very handy, thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.