#9872 - Omega81 - Wed Aug 20, 2003 7:33 pm
Hello I was wondering if any of you guys/gals can take a look at this piece of code and tell me if there is anything wrong with.
it is surpose to generate a random number which I feed to my plot pixel and RGB functions which should give me the old random pixel screen plotter. but I get a blank screen. So if anyone can see what I am doing wrong. please let me know. Also it is based on the C function "tepples" gave at this post : http://forum.gbadev.org/viewtopic.php?t=873
Charles
_________________
Keep it real, keep it Free, Keep it GNU
Code: |
@using Congruential Random Number Generator routine seed+1 = (A*seed + C) % M @ r0 = A, r3 = seed (defined in calling fucntion) r2 = C and r3 = M @ save result in r3 .global Rand .arm .align 4 Rand: stmfd sp!, {r0-r2} @ push these registers on the stack ldr r0, =69069 ldr r2, =1 mul r2,r3,r0 @ A*seed+C add r2,r2,#1 mov r3,r0,lsr#17 @ loss lower 17bits ldr r1,=1 mov r1,r1,lsl#15 @ shift 1 <<15 and r3,r1,r3 @ and (1<<15) with (r3>>17) ldr r2,=160 @ 160 is the limit mul r1,r3,r2 @ mov r3,r1,lsr#15 @ losse last 15bit ldmfd sp!, {r0-r2} @ pop the registers off the stack mov pc,lr @ return to calling function |
it is surpose to generate a random number which I feed to my plot pixel and RGB functions which should give me the old random pixel screen plotter. but I get a blank screen. So if anyone can see what I am doing wrong. please let me know. Also it is based on the C function "tepples" gave at this post : http://forum.gbadev.org/viewtopic.php?t=873
Charles
_________________
Keep it real, keep it Free, Keep it GNU