From c3b0fa04a663fe233765b83d3be41a42aa08c25d Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 3 May 2021 08:21:10 +0100 Subject: Initial import for public release --- lib/cpcrslib/cpc_Random.s | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/cpcrslib/cpc_Random.s (limited to 'lib/cpcrslib/cpc_Random.s') diff --git a/lib/cpcrslib/cpc_Random.s b/lib/cpcrslib/cpc_Random.s new file mode 100644 index 0000000..2f2916e --- /dev/null +++ b/lib/cpcrslib/cpc_Random.s @@ -0,0 +1,34 @@ +.globl _cpc_Random + +_cpc_Random:: + + + ; LD A,(#valor_previo) + ; LD C,A +; LD L,A +; LD A,R; +; ADD L +; AND #0xB8 +; SCF +; JP PO,NO_CLR +; CCF +;NO_CLR: LD A,C + ; RLA + ; LD C,A + ; LD A,R + ; ADD C + ; LD (#valor_previo),A + ; LD L,A +; RET + + LD A,(#valor_previo) + LD L,A + LD A,R + ADD L ;LOS 2 ÚLTIMOS BITS DE A DIRÁN SI ES 0,1,2,3 + LD (#valor_previo),A + LD L,A ;SE DEVUELVE L (CHAR) + LD H,#0 + RET +valor_previo: + .db #0xFF + -- cgit v1.2.3