?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.     IFDEF PROXY    
  2.     MODULE Wifi
  3. ; Same singature as wifi.openTCP
  4. ; HL - host pointer in gopher row
  5. ; DE - port pointer in gopher row
  6. openTCP:
  7.     push de
  8.     push hl
  9.    
  10.     xor a : ld hl, hostBuff, de, hostBuff + 1, bc, 102, (hl), a : ldir
  11.  
  12.     EspCmdOkErr "AT+CIPCLOSE"
  13.     EspCmdOkErr 'AT+CIPSTART="TCP","138.68.76.243",6912' // Replace here for yourown proxy. If you wish
  14.     jr c, .error
  15.     pop hl : ld de, hostBuff
  16. .copyHost
  17.     ld a, (hl) : and a : jr z, 1F : and a : jr z, 1F
  18.     ld (de), a : inc hl, de
  19.     jr .copyHost
  20. 1   xor a : ld (de), a
  21.     pop hl : ld de, portBuff
  22. .copyPort
  23.     ld a, (hl) : and a : jr z, 1F : and a : jr z, 1F
  24.     ld (de), a : inc hl, de
  25.     jr .copyPort
  26. 1   ld hl, hostBuff : call tcpSendZ
  27.     ld hl, portBuff : call tcpSendZ
  28.     xor a : ld (closed), a
  29.     ret
  30. .error
  31.     pop hl : pop de
  32.     ret
  33.  
  34. continue:
  35.     EspCmdOkErr "AT+CIPSEND=1"
  36.     ret c
  37. .wait
  38.     call Uart.read : cp '>' : jr nz, .wait
  39.     ld a, 'c' : call Uart.write
  40.     jp checkOkErr
  41.  
  42. hostBuff ds 96
  43. portBuff ds 7
  44.     ENDMODULE
  45.     ENDIF