-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttpsd64.asm
More file actions
241 lines (184 loc) · 3.44 KB
/
httpsd64.asm
File metadata and controls
241 lines (184 loc) · 3.44 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
if .p
t "TopSym"
t "TopMac"
:scrnbase = $0400
:scrnbuf1 = $0500
:scrnbuf2 = $0600
; BUILD_MODES:
:BUILD_HTTP = %00010000
:BUILD_HTTPS = %00100000
:BUILD_MODE = BUILD_HTTPS
endif
if BUILD_MODE = BUILD_HTTP
n "VIEWD64-25H"
endif
if BUILD_MODE = BUILD_HTTPS
n "VIEWD64-25S"
endif
c "VIEWKOALA V1.0",NULL
o $0801 -2
f BASIC
:basic w $0801
w $080c
w $000a
b $9e,$20,$32,$30,$36,$34,$00
w $0000
w $0000
; Bildschirm löschen
:MAININIT lda #$0e ; Screen colors
sta $d020
sta $02
lda #$06
sta $d021
lda #$0e ; Text color
sta $0286
jsr $e544 ; Clr screen
:startfile00 lda #"0" ; Auf erstes Bild zurücksetzen
sta scrnbase +0
sta scrnbase +1
sta scrnbase +2
:loader jsr LoadHTTP
cmp #$00
beq loaded ; Server meldet keinen Ladefehler
ldy #$80
:whirl1 ldx #$ff
:whirl2 inc $d020 ; Ladefehler optisch anzeigen
dex
bne whirl2
dey
bne whirl1
lda $02
sta $d020
:loaded jmp $a474
:LoadHTTP lda #$ff ; Datenrichtung Port B Ausgang
sta $dd03
lda $dd00
ora #$04 ; PA2 auf HIGH = ESP im Empfangsmodus
sta $dd00
jsr send_string ; http://irgendwas an den ESP Senden
lda #$00 ; Datenrichtung Port B Eingang
sta $dd03
lda $dd00
and #251 ; PA2 auf LOW = ESP im Sendemodus
sta $dd00
jsr read_byte ; Dummy Byte
; um IRQ im ESP anzuschubsen
; $25 = LARGE/GET: 4 Bytes
jsr read_byte
sta 1020
sta $fa
jsr read_byte
sta 1021
sta $fb ; Laenge Datenuebertragung Byte 1 und 2
jsr read_byte
sta 1022
sta $68
jsr read_byte
sta 1023
sta $69 ; Laenge Datenuebertragung Byte 3 und 4
:loaderrorcheck lda $fa
cmp #$00
bne noloaderror
lda $fb
cmp #$02
bne noloaderror
lda $69
cmp #"0"
bne noloaderror
lda $68
cmp #"!"
bne noloaderror
; LoadHTTP/Ende
lda #$01 ; Ladefehler
rts
:noloaderror
:setloadadress lda #< scrnbuf1
sta $fc
lda #> scrnbuf1
sta $fd
lda #< scrnbuf2
sta $fe
lda #> scrnbuf2
sta $ff
:startload ldy #$00
:goread jsr read_byte
sta ($fc),y
eor scrnbase +2
sta ($fe),y
iny
bne goread
inc scrnbase +2 ; Blockzaehler im Bildschirm +1
lda scrnbase +2
cmp #"9" +1
bne :1
lda #"0"
sta scrnbase +2
inc scrnbase +1
lda scrnbase +1
cmp #"9" +1
bne :1
lda #"0"
sta scrnbase +1
inc scrnbase +0
::1 dec $68 ; Anzahl Bloecke -1
lda $68
cmp #$ff
bne next
dec $fb
lda $fb
cmp #$ff
bne next
dec $fa
:next lda $fa ; Alle Blocks empfangen?
ora $fb
ora $68
; ora $69 ; Low-Byte ignorieren, nur 256B-Blocks
bne goread ; => Weiterlesen...
ldx #0
ldy #0
::0 dey
bne :0
dex
bne :0
:cleanup lda #$ff ; ESP in Lesemodus schalten
sta $dd03 ; Datenrichtung Port B Ausgang
lda $dd00
ora #$04 ; PA2 auf HIGH = ESP im Empfangsmodus
sta $dd00
; LoadHTTP/Ende
lda #$00 ; Kein Ladefehler
rts
:send_string ldy #$00
:string_next iny
lda httpcommand-1,y
jsr write_byte
cpy httpcommand+1
bne string_next
rts
:write_byte sta $dd01 ; Bit 0..7: Userport Daten PB 0-7 schreiben
:dowrite lda $dd0d
and #$10 ; Warten auf NMI FLAG2 = Byte wurde gelesen vom ESP
beq dowrite
rts
:read_byte
:doread lda $dd0d
and #$10 ; Warten auf NMI FLAG2 = Byte wurde gelesen vom ESP
beq doread
lda $dd01
rts
; HTTP/HTTPS
:httpcommand b "W"
b < httpnamelen
b > httpnamelen
b $25 ; HTTP/LARGE
:httpname
; HTTP
if BUILD_MODE = BUILD_HTTP
b "http://www.zimmers.net/anonftp/pub/cbm/demodisks/cmd/cmd-hard.d64"
endif
; HTTPS
if BUILD_MODE = BUILD_HTTPS
b "https://www.lyonlabs.org/commodore/onrequest/geos/geos-plain.d64"
endif
:httpnameend
:httpnamelen = httpnameend - httpcommand