aboutsummaryrefslogtreecommitdiff
path: root/lib/cpcrslib/cpc_Random.s
blob: 2f2916e96ac11d1be646630ca65276fe9c6d96c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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