File tree Expand file tree Collapse file tree
src/arch/zx48k/library-asm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ TAKE_FRAMES:
2929FRAMES EQU 23672
3030 ENDP
3131
32- RANDOM_SEED_HIGH EQU RAND + 6 ; RANDOM seed, 16 higher bits
33- RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
32+ RANDOM_SEED_HIGH EQU RAND + 6 ; RANDOM seed, 16 higher bits
33+ RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
3434
3535
3636RAND:
@@ -54,18 +54,17 @@ RAND_LOOP:
5454 rra ; t = t ^ (t >> 1) ^ w
5555 xor d
5656 xor e
57- ld h , l ; y = z
58- ld l , a ; w = t
59- ld (RANDOM_SEED_HIGH) , hl
57+ ld d , l ; y = z
58+ ld e , a ; w = t
59+ ld (RANDOM_SEED_HIGH) , de
6060 push af
6161 djnz RAND_LOOP
62- pop af
63- pop af
64- ld d , a
62+ pop de
6563 pop af
6664 ld e , a
65+ pop hl
6766 pop af
68- ld h , a
67+ ld l , a
6968 ret
7069 ENDP
7170
8988 ; We already have a random 32 bit mantissa in ED CB
9089 ; From 0001h to FFFFh
9190
92- ld l , 81h ; Exponent
91+ ld l , 81h ; Exponent
9392 ; At this point we have [0 .. 1) FP number;
9493
9594 ; Now we must shift mantissa left until highest bit goes into carry
You can’t perform that action at this time.
0 commit comments