-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVDP.asm
67 lines (63 loc) · 1.09 KB
/
VDP.asm
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
DEF VDPREG,VDPUPD,VDPADR,VDPWRT
*
REF LBR0 "
COPY 'CPUADR.asm'
BIT0 DATA >8000
BIT1 DATA >4000
*
* Write to a VDP register
*
* Input:
* R0
* Output:
* R0
VDPREG
* Specify that we are changing a register
SOC @BIT0,R0
SZC @BIT1,R0
* Write new value to copy byte
SWPB R0
* Write new value to VDP register
MOVB R0,@VDPWA
* Specify VDP register to change
SWPB R0
MOVB R0,@VDPWA
*
RT
*
* Set VDP write address
*
* Input:
* R0 - VDP address
* Output:
* R0 - bits 0 and 1 changed
VDPADR
* Set most signficant two bits for writing
SZC @BIT0,R0
SOC @BIT1,R0
* Write address to system
VDPAD1 SWPB R0
MOVB R0,@VDPWA
SWPB R0
MOVB R0,@VDPWA
*
RT
*
* Write multiple bytes to VDP
*
* Input:
* R0 - Address of text to copy
* R1 - Number of bytes
* Output:
* R0 - original value + R1's value
* R1 - 0
VDPWRT
* Don't write if R1 = 0
MOV R1,R1
JEQ VWRT2
* Write as many bytes as R1 specifies
VWRT1 MOVB *R0+,@VDPWD
DEC R1
JNE VWRT1
*
VWRT2 RT