-
Notifications
You must be signed in to change notification settings - Fork 0
/
serial.s
107 lines (91 loc) · 1.04 KB
/
serial.s
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
PSV_FOPEN = $11
PSV_FREAD = $12
PSV_FWRITE = $13
PSV_FCLOSE = $1F
PSV_HEX = $F0
PSV_ASCII = $F1
PSV = $df93
PSV_CONFIG = $df94
BUFFER = $0200
*=$c000
begin:
; Set video mode
; [HiRes Invert S1 S0 RGB LED NC NC]
LDA #%10000100
STA $df80
; Set mode OPEN
LDY #PSV_FOPEN
STY PSV_CONFIG
; Send filename
.(
LDX #$61
loop:
STX PSV
INX
CPX #$65
BNE loop
.)
; Set mode WRITE
LDY #PSV_FWRITE
STY PSV_CONFIG
; Write to file
.(
LDX #$41
loop:
STX PSV
INX
CPX #$5B
BNE loop
.)
; Set mode CLOSE
LDY #PSV_FCLOSE
STY PSV_CONFIG
; Set mode OPEN
LDY #PSV_FOPEN
STY PSV_CONFIG
; Send filename
.(
LDX #$61
loop:
STX PSV
INX
CPX #$65
BNE loop
.)
; Read from file
.(
; Set mode READ
LDY #PSV_FREAD
LDX #$00
loop:
; Send read
STY PSV_CONFIG
; Read data
LDA PSV
STA BUFFER,X
INX
CPX #26
BNE loop
.)
; Set mode CLOSE
LDY #PSV_FCLOSE
STY PSV_CONFIG
; Set mode HEX output
LDY #PSV_ASCII
STY PSV_CONFIG
; Print data
LDX #$00
.(
loop:
LDA BUFFER,X
STA PSV
INX
CPX #26
BNE loop
.)
STP
.dsb $fffa-*, $ff ; filling
* = $fffa
.word begin
.word begin
.word begin