Timex screen support

This commit is contained in:
nihirash 2019-07-19 22:59:44 +03:00
parent d189ba03b7
commit baa49128d8
7 changed files with 240 additions and 464 deletions

View File

@ -94,7 +94,7 @@ reqErr
call putStringZ
xor a
ld (connectionOpen), a
ret
jp showPage
; Load data to ram via gopher
; HL - data pointer

View File

@ -1,6 +1,7 @@
iWelcome to uGophy v.0.3 fake (NULL) 0
iWelcome to uGophy v.0.4 fake (NULL) 0
i(c) 2019 Alexander Sharikhin aka Nihirash fake (NULL) 0
iVersion 0.3 - Showing screens version fake (NULL) 0
i fake (NULL) 0
iVersion 0.4 - Timex screen version fake (NULL) 0
iThis version works on 14MHz turbo mode fake (NULL) 0
iIf you using old core - please update. fake (NULL) 0
i fake (NULL) 0
@ -9,9 +10,10 @@ i fake (NULL) 0
iNavigation keys: fake (NULL) 0
iQ - Up fake (NULL) 0
iA - Down fake (NULL) 0
iB - Hisotry back fake (NULL) 0
iB - History back fake (NULL) 0
io - Enter server name to browse(using port 70) fake (NULL) 0
iEnter - Visit page/Download file fake (NULL) 0
i fake (NULL) 0
iBookmarks: fake (NULL) 0
1Nihirash.net - BIG collection of games and nihirash's things / nihirash.net 70
1i-LogOut.cz - Gopher phlog aggregator and other things / i-logout.cz 70

View File

@ -1,6 +1,9 @@
DEVICE ZXSPECTRUM48
org 24100
Start:
Start:
jp run
ds #21d9
run:
call renderHeader
ld hl, connecting_wifi
call printZ64
@ -10,7 +13,8 @@ wSec: ld b, 50
wsLp halt
djnz wsLp
include "screen64.asm"
;include "screen64.asm"
include "tscreen.asm"
include "keyboard.asm"
include "utils.asm"
include "wifi.asm"
@ -32,8 +36,9 @@ port db '70'
defs 5
page_buffer
display "Page buffer starts here"
display $
incbin "index.pg"
db 0
eop equ $
display $
SAVEBIN "ugoph.bin", Start, eop-Start
SAVEBIN "ugoph.bin", Start, eop - Start

View File

@ -195,6 +195,10 @@ loadImage:
call makeRequest
ld hl, #4000
call loadData
ld c, #ff
xor a
out (c), a
wKey: call inkey
or a
jr z, wKey
@ -298,50 +302,21 @@ showTypePrint:
ld b, 21
ld c, 0
call gotoXY
ld a, 3
ld (attr_screen), a
pop hl
call printZ64
ld a, #7
ld (attr_screen), a
ret
showCursor:
ld a, (cursor_pos)
ld c, 0
ld b, a
call bc_to_attr
ld (hl), #C
ld de, hl
inc de
ld bc, 31
ldir
call showType
ret
hideCursor:
ld a, (cursor_pos)
ld b, a
ld c, 0
call bc_to_attr
ld (hl), #07
ld de, hl
inc de
ld bc, 31
ldir
ret
renderHeader:
call clearScreen
ld a, #0F
ld (attr_screen), a
ld bc, 0
call gotoXY
ld hl, head
call printZ64
ld a, #07
ld (attr_screen), a
ld d, 0
call inverseLine
ret
renderScreen:
@ -468,7 +443,7 @@ show_offset db 0
display $
cursor_pos db 1
head db " UGophy - ZX-UNO Gopher client v. 0.3 (c) Alexander Sharikhin ",0
head db " UGophy - ZX-UNO Gopher client v. 0.4 (c) Alexander Sharikhin", 13,0
cleanLine db " ",0

View File

@ -1,422 +0,0 @@
clearScreen:
ld c, #fe
ld a, 0
out (c), a
ld hl, #4000
ld (hl), 0
ld de, #4001
ld bc, #17FF
ldir
ld hl, #5800
ld a, (attr_screen)
ld (hl), a
ld de, #5801
ld bc, #2FF
ldir
ld bc, 0
call gotoXY
ret
;
; Print just one symbol
; A - symbol
putC
cp 13
jr z, mvCR
or a
cp ' '
ret c
ld hl, single_symbol
ld (hl), a
ld hl, single_symbol_print
jp print64
mvCR
ld bc, (col_screen)
inc b
ld c, 0
ld a, 0
ld (half_tile_screen), a
call gotoXY
ret
; Set console coordinates
; b = row(0..23), c = column (0..63)
;
gotoXY:
ld a, 0
ld (half_tile_screen), a
ld (col_screen), bc
ld a, 22
cp b
jp s, scrl
ret
scrl
ld b, 22
ld (col_screen) ,bc
jp scroll_up8
; Print zero-terminated string
; HL - string pointer
putStringZ:
printZ64:
ld a,(hl)
and a
ret z
push hl
call putC
pop hl
inc hl
jr printZ64
printT64:
ld b, 63
ptlp:
ld a, 0
or b
ret z
ld a, (hl)
and a
ret z
cp 09
ret z
push bc
push hl
call putC
pop hl
inc hl
pop bc
dec b
jr ptlp
printL64:
ld a, (hl)
and a
ret z
cp #0A
ret z
cp #0D
ret z
push hl
call putC
pop hl
inc hl
jr printL64
; Put string with coordinates
; b= row (0..23), c=col (0..63)
; hl - string pointer that's begins from symbol count
printAt64:
call gotoXY
; Put string
; hl - string pointer that's begins from symbol count
print64
ld a,(hl)
and a
ret z
push hl
call calc_addr_attr
ld a,(attr_screen)
ld (hl),a
pop hl
call calc_addr_scr
ld a,(half_tile_screen)
bit 0,a
ld a,(hl)
jp nz,print64_4
print64_3
push af
push hl
call calc_addr_attr
ld a,(attr_screen)
ld (hl),a
pop hl
inc hl
push hl
ld a,(hl)
sub 32
ld l,a
ld h,0
add hl,hl
ld c,l
ld b,h
add hl,hl
add hl,bc
ld bc,font64
add hl,bc
push de
ld b,6
xor a
ld (de),a
print64_1
inc d
ld a,(hl)
and #f0
ld (de),a
inc hl
djnz print64_1
inc d
xor a
ld (de),a
ld a,1
ld (half_tile_screen),a
pop de
pop hl
pop af
dec a
ret z
print64_4
push af
inc hl
push hl
ld a,(hl)
sub 32
ld l,a
ld h,0
add hl,hl
ld c,l
ld b,h
add hl,hl
add hl,bc
ld bc,font64
add hl,bc
push de
ld b,6
xor a
ld (de),a
print64_2
inc d
ld a,(hl)
and #0f
ld c,a
ld a,(de)
or c
ld (de),a
inc hl
djnz print64_2
inc d
xor a
ld (de),a
ld (half_tile_screen),a
pop de
call move_cr64
pop hl
pop af
dec a
jp nz,print64_3
ret
; move cursor
move_cr64
inc de
ld hl,col_screen
inc (hl)
ld a,(hl)
cp 32
ret c
xor a
ld (half_tile_screen),a
ld (hl),a
ld c,a
inc hl
inc (hl)
ld a,(hl)
ld b,a
cp 24
jp c,move_cr64_01
ld a,23
ld (hl),a
ld b,a
push bc
call scroll_up8
pop bc
move_cr64_01
call calc_addr_scr
ret
calc_addr_scr
ld a,b
ld d,a
rrca
rrca
rrca
and a,224
add a,c
ld e,a
ld a,d
and 24
or 64
ld d,a
ret
calc_addr_attr
ld bc,(col_screen)
bc_to_attr:
ld a,b
rrca
rrca
rrca
ld l,a
and 31
or 88
ld h,a
ld a,l
and 252
or c
ld l,a
ret
scroll_up8
ld hl,table_addr_scr
ld b,184
scroll_up8_01
push bc
ld e,(hl)
inc hl
ld d,(hl)
inc hl
push hl
ld bc,14
add hl,bc
ld c,(hl)
inc hl
ld b,(hl)
ld h,b
ld l,c
ld bc,32
ldir
pop hl
pop bc
djnz scroll_up8_01
ld b,8
scroll_up8_02
push bc
ld e,(hl)
inc hl
ld d,(hl)
inc hl
push hl
ld h,d
ld l,e
inc de
ld (hl),0
ld bc,31
ldir
pop hl
pop bc
djnz scroll_up8_02
ld de,#5800
ld hl,#5820
ld bc,736
ldir
ld a,(de)
ld hl,#5ae0
ld de,#5ae1
ld (hl),a
ld bc,31
ldir
ret
font64 incbin "font.bin"
table_addr_scr
defw #4000,#4100,#4200,#4300,#4400,#4500,#4600,#4700
defw #4020,#4120,#4220,#4320,#4420,#4520,#4620,#4720
defw #4040,#4140,#4240,#4340,#4440,#4540,#4640,#4740
defw #4060,#4160,#4260,#4360,#4460,#4560,#4660,#4760
defw #4080,#4180,#4280,#4380,#4480,#4580,#4680,#4780
defw #40a0,#41a0,#42a0,#43a0,#44a0,#45a0,#46a0,#47a0
defw #40c0,#41c0,#42c0,#43c0,#44c0,#45c0,#46c0,#47c0
defw #40e0,#41e0,#42e0,#43e0,#44e0,#45e0,#46e0,#47e0
defw #4800,#4900,#4a00,#4b00,#4c00,#4d00,#4e00,#4f00
defw #4820,#4920,#4a20,#4b20,#4c20,#4d20,#4e20,#4f20
defw #4840,#4940,#4a40,#4b40,#4c40,#4d40,#4e40,#4f40
defw #4860,#4960,#4a60,#4b60,#4c60,#4d60,#4e60,#4f60
defw #4880,#4980,#4a80,#4b80,#4c80,#4d80,#4e80,#4f80
defw #48a0,#49a0,#4aa0,#4ba0,#4ca0,#4da0,#4ea0,#4fa0
defw #48c0,#49c0,#4ac0,#4bc0,#4cc0,#4dc0,#4ec0,#4fc0
defw #48e0,#49e0,#4ae0,#4be0,#4ce0,#4de0,#4ee0,#4fe0
defw #5000,#5100,#5200,#5300,#5400,#5500,#5600,#5700
defw #5020,#5120,#5220,#5320,#5420,#5520,#5620,#5720
defw #5040,#5140,#5240,#5340,#5440,#5540,#5640,#5740
defw #5060,#5160,#5260,#5360,#5460,#5560,#5660,#5760
defw #5080,#5180,#5280,#5380,#5480,#5580,#5680,#5780
defw #50a0,#51a0,#52a0,#53a0,#54a0,#55a0,#56a0,#57a0
defw #50c0,#51c0,#52c0,#53c0,#54c0,#55c0,#56c0,#57c0
defw #50e0,#51e0,#52e0,#53e0,#54e0,#55e0,#56e0,#57e0
string_temp defb 0
dup 255
defb 32
edup
col_screen defb 0
row_screen defb 0
half_tile_screen defb 0
attr_screen defb 07
col_screen_temp defw 0
half_tile_screen_temp defb 0
single_symbol_print defb 1
single_symbol defb 0

162
tscreen.asm Normal file
View File

@ -0,0 +1,162 @@
; Timex screen routines
showCursor:
hideCursor:
call showType
ld a, (cursor_pos)
ld d, a
inverseLine:
ld e, 0
ld b, 64
ilp
push bc
push de
call findAddr
ld b, 8
iCLP:
ld a, (de)
xor #ff
ld (de), a
inc d
djnz iCLP
pop de
inc e
pop bc
djnz ilp
ret
gotoXY:
ld (coords), bc
ret
mvCR:
ld hl, (coords)
inc h
ld l, 0
ld (coords), hl
cp 24
ret c
ld hl, 0
ld (coords), hl
ret
; A - char
putC:
cp 13
jr z, mvCR
sub 32
ld b, a
ld de, (coords)
ld a, e
cp 64
ret nc
push bc
call findAddr
pop af
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld bc, font
add hl, bc
ld b, 8
pLp:
ld a, (HL)
ld (DE), A
inc hl
inc d
djnz pLp
ld hl, (coords)
inc l
ld (coords), hl
ret
; D - Y
; E - X
; OUT: de - coords
findAddr:
ld a, e
srl a
ld e, a
ld hl, 8192
jr c, fa1
ld hl, 0
fa1:
LD A,D
AND 7
RRCA
RRCA
RRCA
OR E
LD E,A
LD A,D
AND 24
OR 64
LD D,A
ADD hl, de
ex hl, de
ret
clearScreen:
ld c, #ff
ld a, #3E
out (c), a
di
ld hl,0
ld d,h
ld e,h
ld b,h
ld c,b
add hl,sp
ld sp,16384+6144
clgloop
push de
push de
push de
push de
push de
push de
push de
push de
push de
push de
push de
push de
djnz clgloop
ld b,c
ld sp,24576+6144
clgloop2:
push de
push de
push de
push de
push de
push de
push de
push de
push de
push de
push de
push de
djnz clgloop2
ld sp,hl
ei
ret
coords dw 0
; Using ZX-Spectrum font - 2K economy
font equ #3D00

View File

@ -36,6 +36,60 @@ setTurbo4Mode:
pop af
ret
; Print zero-terminated string
; HL - string pointer
putStringZ:
printZ64:
ld a,(hl)
and a
ret z
push hl
call putC
pop hl
inc hl
jr printZ64
printT64:
ld b, 63
ptlp:
ld a, 0
or b
ret z
ld a, (hl)
and a
ret z
cp 09
ret z
push bc
push hl
call putC
pop hl
inc hl
pop bc
dec b
jr ptlp
printL64:
ld a, (hl)
and a
ret z
cp #0A
ret z
cp #0D
ret z
push hl
call putC
pop hl
inc hl
jr printL64
; HL - string
; Return: bc - len
getStringLength: