uGophy v.0.7 - stack issue fixed

This commit is contained in:
nihirash 2019-07-30 21:59:22 +03:00
parent f6562d3da0
commit 7ed9b7dc2f
7 changed files with 69 additions and 29 deletions

View File

@ -61,9 +61,12 @@ makeRequest:
call uartWriteStringZ
ld hl, cmd_open3
call okErrCmd
pop hl
cp 1
jp nz, reqErr
push hl
ld hl, cmd_send ; Send request
call uartWriteStringZ
pop hl
@ -79,9 +82,11 @@ makeRequest:
call uartWriteStringZ
ld hl, crlf
call okErrCmd
call okErrCmd
pop hl
cp 1
jp nz, reqErr
push hl
wPrmt:
call uartReadBlocking
call pushRing

View File

@ -88,6 +88,7 @@ cleanIBuff:
ldir
ret
iRet:
pop hl
ld b, 20
ld c, 0
call gotoXY

View File

@ -1,19 +1,26 @@
DEVICE ZXSPECTRUM128
org 24100
Start:
di
xor a
call changeBank
ld sp, #5aff
ld de, #4000
ld bc, eop - page_buffer
ld hl, page_buffer
ldir
ei
call renderHeader
ld hl, connecting_wifi
call printZ64
call initWifi
call wSec
ld de, path
ld hl, server
ld bc, port

View File

@ -3,24 +3,25 @@ showPage:
ld (show_offset), a
ld a, 1
ld (cursor_pos), a
backToPage:
call renderScreen
call showCursor
showLp:
call controls
xor a
call changeBank
jp controls
dup 5
halt
edup
jr showLp
controls:
call inkey
cp 0
ret z
jr z, showLp
cp 'q'
jr z, pageCursorUp
@ -36,7 +37,8 @@ controls:
cp 'o'
jp z, openURI
ret
jp showLp
historyBack:
ld hl, server
@ -56,7 +58,7 @@ pageCursorUp:
pop af
ld (cursor_pos), a
call showCursor
ret
jp showLp
pageCursorDown:
ld a, (cursor_pos)
@ -69,7 +71,7 @@ pageCursorDown:
pop af
ld (cursor_pos), a
call showCursor
ret
jp showLp
pageScrollDn:
ld hl, (show_offset)
@ -80,7 +82,7 @@ pageScrollDn:
ld (cursor_pos), a
call renderScreen
call showCursor
ret
jp showLp
pageScrollUp:
ld a, (show_offset)
@ -96,7 +98,7 @@ pageScrollUp:
ld (cursor_pos), a
call renderScreen
call showCursor
ret
jp showLp
selectItem:
ld a, (cursor_pos)
@ -123,7 +125,7 @@ selectItem:
cp '7'
jr z, userInput
ret
jp showLp
userInput:
call cleanIBuff
@ -172,32 +174,44 @@ downPg:
cp '0'
jp z, showText
ret
jp showLp
downFl:
call extractInfo
call clearRing
call cleanIBuff
ld hl, file_buffer
call findFnme
jp isOpenable
dfl:
ld hl, file_buffer
call findFnme
ld de, iBuff
ld bc, 65
ldir
call input
ld hl, iBuff
call showTypePrint
ld hl, server_buffer
ld de, file_buffer
ld bc, port_buffer
call makeRequest
xor a
call changeBank
ld hl, iBuff
call downloadData
call hideCursor
call showCursor
ret
jp showLp
isOpenable:
ld a, (hl)
@ -259,7 +273,7 @@ wKey: call inkey
xor a
call changeBank
jp showPage
jp backToPage
playMusic:
ld hl, hist
@ -278,6 +292,8 @@ playMusic:
xor a
call changeBank
call setNoTurboMode
ld hl, page_buffer
call #4003
playLp:
@ -289,6 +305,8 @@ playLp:
and 15
jr z, playLp
call #4008
call setTurbo4Mode
jp historyBack
findFnme:
@ -539,7 +557,7 @@ show_offset db 0
display $
cursor_pos db 1
head db " UGophy - ZX-UNO Gopher client v. 0.6 (c) Alexander Sharikhin", 13,0
head db " UGophy - ZX-UNO Gopher client v. 0.7 (c) Alexander Sharikhin", 13,0
cleanLine db " ",0
playing db "Playing... Hold <SPACE> to stop!", 0

View File

@ -54,7 +54,16 @@ ringCmpLp
djnz ringCmpLp
ld a, 1
ret
clearRing:
xor a
ld hl, ring_buffer
ld de, ring_buffer + 1
ld bc, 32
ld (hl), a
ldir
ret
ring_buffer dup 33
defb 0
edup

View File

@ -22,18 +22,6 @@ uartBegin:
in A, (c)
ret
; Pushes to UART zero-terminated string
; HL - string poiner
uartWriteStringZ:
ld a, (hl)
and a
ret z
push hl
call uartWriteByte
pop hl
inc hl
jp uartWriteStringZ
; Blocking read one byte
uartReadBlocking:
call uartRead

View File

@ -43,6 +43,18 @@ setTurbo4Mode:
pop af
ret
; Pushes to UART zero-terminated string
; HL - string poiner
uartWriteStringZ:
ld a, (hl)
and a
ret z
push hl
call uartWriteByte
pop hl
inc hl
jp uartWriteStringZ
; Print zero-terminated string
; HL - string pointer
putStringZ: