Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

188 Excellent

About bogax

  • Rank

Profile Information

  • Gender
  1. 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
  2. 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
  3. 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
  4. temp1 = rand/2 : temp1 = (temp1/2 + temp1)/32
  5. how about sta lo lda #0 sta hi asl lo rol hi asl lo rol hi
  6. 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
  7. 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)
  8. 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
  9. 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
  10. bogax

    Text Minikernel

    this uses fewer lines/cycles but probably a lot more ROM I have no idea how it would get along with other than the standard kernel I think it uses every possible free variable
  11. here's one I flickered the pixel if you hold the fire button for couple seconds you cycle NUSIZE when the fire button is released (unless you hold it too long then the timer will roll over ) other wise you flip the pixel sprite_in_RAM.bas sprite_in_RAM.bas.bin
  12. player8x = (rand&123)+16 player8y = (rand&100)+40 will have similar issues in the case of rand & 123 you might be happy with rand & 124 which will produce mutiples of 4 0..124
  13. you can nest subroutines you just have to be mindfull of the limitations you've only got a few stack locations to work with and it varies with kernel options (I think its 6 for the standard kernel, 12 bytes, each gosub takes 2 bytes) functions, including bB's built in functions, are subroutines (and they may be nested) the (standard) kernel (drawscreen) goes 3 deep (if I recall correctly) complex expressions also use the stack (especially if you don't use parenthesis) while I agree with RT's specific example, if you were jumping around a hundred lines of code I think you'd be better off giving them a name and using a subroutine unless you're really really squeezed for cycles it will make your code much easier to read and follow and possibly tweak (more modular)
  14. rand & 6 will produce only even numbers 0..6 (inclusive) you'll never get 1,3,5
  • Create New...