Skip to content

mvac7/SDCC_test_Z80PRNG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Z80 8 bits Pseudo-Random Number Generator

Author: mvac7/303bcn

Architecture: MSX

Format: 8k ROM

Programming language: C and Z80 inline assembler (SDCC)

WEB:

mail: mvac7303b@gmail.com

1. Introduction:

This project is an opensource.

Developed using Small Device C Compiler (SDCC).

Programs for test a Z80 8 bits Pseudo-Random Number Generator (PRNG).

  • test_R - Displays screens with a list of 230 consecutive numbers provided by the R register of the Z80.

test_R screen

  • test_PRNG - Displays screens with a list of 230 consecutive numbers provided by a PRNG routine.

test_PRNG screen

  • test_PRNG_GFX - Graphically displays a list of 32768 numbers provided by a PRNG routine, distributed in 256 horizontal columns with the repetitions of each value (0 to 255).

test_PRNG_GFX screen

2. Acknowledgments

Thanks for Info & help, to:

3. Requirements:

4. PRNG Function Code

char SEED;


char Random(char mask)
{
mask;
__asm
  push IX
  ld   IX,#0
  add  IX,SP
  
  ld   C,4(ix)    ;get the Mask

  ld   A,(_SEED)  ;get the Seed
    			
  ld   B,A	
  ld   A,R  
  add	 A,B        ;add the value of R to the Seed
  
  ld   B,A
  ld   A,R
  rlca            ;rotation to the left
  sub	 A,B        ;and subtracts it from the value 
  
  ld   (_SEED),A  ;save as Seed 
  
  and  C          ;apply the Mask
  
  ld   L,A        ;return L
  
  pop  IX    
__endasm;
} 

About

Test a Z80 8 bits Pseudo-Random Number Generator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published