aboutsummaryrefslogtreecommitdiff
path: root/lib/cpcrslib/cpc_Random.s
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-11-05 11:22:55 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-11-05 11:31:28 +0000
commit2fbdf974338bde8576efdae40a819a76b2391033 (patch)
tree64d41a37470143f142344f9a439d96de3e7918c2 /lib/cpcrslib/cpc_Random.s
downloadkitsunes-curse-2fbdf974338bde8576efdae40a819a76b2391033.tar.gz
kitsunes-curse-2fbdf974338bde8576efdae40a819a76b2391033.zip
Initial import of the open source release
Diffstat (limited to 'lib/cpcrslib/cpc_Random.s')
-rw-r--r--lib/cpcrslib/cpc_Random.s34
1 files changed, 34 insertions, 0 deletions
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
+