-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
137 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
IFDEF PROXY | ||
MODULE Wifi | ||
; Same singature as wifi.openTCP | ||
; HL - host pointer in gopher row | ||
; DE - port pointer in gopher row | ||
openTCP: | ||
push de | ||
push hl | ||
EspCmdOkErr "AT+CIPCLOSE" | ||
//EspCmdOkErr 'AT+CIPSTART="TCP","192.168.0.208",6912' // Replace here for yourown proxy. If you wish | ||
EspCmdOkErr 'AT+CIPSTART="TCP","138.68.76.243",6912' // Replace here for yourown proxy. If you wish | ||
jr c, .error | ||
pop hl : ld de, hostBuff | ||
.copyHost | ||
ld a, (hl) : cp 9 : jr z, 1F : and a : jr z, 1F | ||
ld (de), a : inc hl, de | ||
jr .copyHost | ||
1 xor a : ld (de), a | ||
pop hl : ld de, portBuff | ||
.copyPort | ||
ld a, (hl) : cp 9 : jr z, 1F : and a : jr z, 1F | ||
ld (de), a : inc hl, de | ||
jr .copyPort | ||
1 ld hl, hostBuff : call tcpSendZ | ||
ld hl, portBuff : call tcpSendZ | ||
xor a : ld (closed), a | ||
ret | ||
.error | ||
pop hl : pop de | ||
ret | ||
|
||
continue: | ||
EspCmdOkErr "AT+CIPSEND=1" | ||
ret c | ||
.wait | ||
call Uart.read : cp '>' : jr nz, .wait | ||
ld a, 'c' : call Uart.write | ||
jp checkOkErr | ||
|
||
hostBuff ds 96 | ||
portBuff ds 6 | ||
ENDMODULE | ||
ENDIF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
MODULE Downloader | ||
; HL - gopher row | ||
go: | ||
ld hl, .msg : call DialogBox.msgNoWait | ||
ld de, historyBlock.locator | ||
ld hl, de | ||
.findFileName | ||
ld a, (de) : inc de | ||
cp '/' : jr nz, .skip | ||
ld hl, de | ||
.skip | ||
and a : jr nz, .findFileName | ||
.copy | ||
;; HL - filename pointer | ||
ld de, filename | ||
.copyFileName | ||
ld a, (hl) : and a : jr z, 1F | ||
|
||
ld (de), a : inc hl, de | ||
jr .copyFileName | ||
|
||
1 ld (de), a | ||
|
||
call Fetcher.sendGopherRequest | ||
|
||
ld hl, filename, B, Dos.FMODE_CREATE | ||
call Dos.fopen : ld (fp), a | ||
|
||
; Downloading started | ||
.loadPackets | ||
ld hl, buffer, (Wifi.buffer_pointer), hl | ||
call Wifi.getPacket | ||
ld a, (Wifi.closed) : and a : jr nz, .closedCallback | ||
ld bc, (Wifi.bytes_avail), a, (fp), hl, buffer | ||
call Dos.fwrite | ||
call Wifi.continue | ||
jr .loadPackets | ||
.closedCallback | ||
ld a, (fp) : call Dos.fclose | ||
jp History.back | ||
|
||
.msg db "Downloading file! Wait a bit - eveything will happens now!",0 | ||
fp db 0 | ||
filename ds 64 | ||
ENDMODULE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ nameBuffer ds #ff, 0 | |
db 0 | ||
hostName ds 64 | ||
include "downloader.asm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters