Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

193 Excellent

About bogax

  • Rank

Profile Information

  • Gender
  1. here's one. not perfect temp1 = rand/2: temp1 = (((((temp1/2 + temp1)/2 + temp1)/2 +temp1)/2 + temp1)/4 + temp1)/8 + temp1 + 4
  2. perhaps you could keep the sprites in the same page and just flip the lo byte of the pointer something like AreWeChanging: lda P0FrameCounter cmp #10 bne SkipFlip FlipSpritePointer: lda #0 sta P0FrameCounter lda P0SpritePtr; lo byte pointer for P0 Sprite eor #<P0Sprite1 ^ <P0Sprite2 sta P0SpritePtr SkipFlip: or if a power of 2 will do for the count let the counter run and AND with a 2**n - 1 and bne
  3. tay and #%000000111 tax tya lsr lsr lsr tay lda dis_solid,y and number_to_bit,x rts
  4. I would expect that you'll find it easiest to maintan a seperate variable for your velocity One, the player positions are in increments of a pixel and that's probably too coarse. Your velocities would be 1 pixel, 2 pixels, 3 pixels etc per frame ie speed across the screen in the x direction in (rougly) 3 seconds, 1.5 seconds, 1 second You'll probably want fractional velocities (and acceleration). And two you will need to remember your velocities for your inertia effects You could probably contrive something with flags and counters but you would still be using extra variables (but they might serve additional purposes) If you are willing to unravel the bits yourself you dont need to use bBs built in 8.8 math, you might eg pack two 1.3 (4 bit) variables into a byte which would give you velocities 0..2 (0..1.875 actually) pixels/frame and velocities in increments of 1/8 pixel/frame
  5. also the lda temp1 it's not as accurate as [similar] asm could be here's some javascript ranged rand generator the asm it produces asm jsr randomize sta temp1 lsr adc temp1 ror lsr lsr lsr lsr lsr sta temp1 end
  6. another possibility temp1 = rand & 63 : temp1 = temp1 * 3 / 32 produces jsr randomize AND #63 STA temp1 ; complex statement detected LDA temp1 asl clc adc temp1 lsr lsr lsr lsr lsr STA temp1
  7. Yes. this is the asm result jsr randomize lsr STA temp1 ; complex statement detected LDA temp1 lsr CLC ADC temp1 lsr lsr lsr lsr lsr STA temp1
  8. temp1 = rand/2 : temp1 = (temp1/2 + temp1)/32
  9. how about sta lo lda #0 sta hi asl lo rol hi asl lo rol hi
  10. You're using a Fibonacci LFSR Here's the Galois LFSR from Batari BASIC randomize lda rand lsr bcc noeor eor #$B4 noeor sta rand rts
  11. I didn't try to work it out but.. 1/3 is 1/4 + 1/16 + 1/64 + 1/256 ... You're multiplying by reciprocal 3 $15 is the first three of those That will (roughly) have the effect of rounding up if the fractional part is > .66 ie you're multiplying by .3333... and adding .333 (approximately, I've not accounted for truncation and rounding)
  12. Can't say I've studied on it any, but I'd just add an lsr at the end, that way you keep the most bits for the divide by 3
  13. I'm thinking it would be useful to have the facility to (optionally) jump out of the kernel. So eg you might have a construct like this at the end of the kernel ifconst .kernel_exit jmp .kernel_exit .never_mind endif so you could jump to your minikernel and thence back to where you goto'd drawscreen (or back to .nevermind if you were so minded) and free up a couple of stack locations for those tricky text minikernels where you cant find enough pointers
  • Create New...