Good news !
I updated my program (now simply named SEGMENTS) in order to get it available from Basic, thanks to ANS !
(Yes, I went back to 16bpp mode)
I searched for variables we rarely use in Basic.
So, I chose the variables O (for cOlumn) and L (for Line) dedicated to define the output coordinates
(With O from 0 to 11 , and L from 0 to 5)
I also chose the variable Theta for the color value from 0 (=black) to 7 (this also set minuscule letters mode ON : you know, when double pressing [alpha]!)
NB: this value is a modulo 8 : to leave minuscule letters mode , just put the same color value +8
There is also a "Disp mode" you can activate by simply putting value >11 in O
If you want to clear the screen (all black) , just put an empty string in Ans
Here's an example to see what it looks like:
Code: DEC
"":Asm(prgmSEGMENTS
0→O:3→L:4→ɵ
"It's a test":Asm(prgmSEGMENTS
12→O
1984+2000:Asm(prgmSEGMENTS
π:Asm(prgmSEGMENTS
Another example (screenshot):
Here's the source:
Code:
.nolist
#include "ti84pce.inc"
.list
.org userMem-2
.db tExtTok,tAsm84CeCmp
.assume ADL=1
ld hl,$e0000b ; variable Y du mode "Disp"
ld a,(hl) ; Si on lance pour la toute 1ère fois la routine,
cp 6 ; il faut l'initialiser à 5 si >5
jr c,CestOk
ld (hl),5
CestOk: call _RclAns ; Que contient Ans ?..
ld a,(hl)
cp 4 ; C'est une chaîne ?
jr z,ItsStr ; Oui!..Alors on va en ItsStr
ld a,12 ; Sinon on converti le nb en 1 chaîne (long.max=12)
call _FormEReal ; et c'est parti!
ld hl,OP3 ; hl = pointe sur la chaîne
ld a,c ; BC=longueur de la chaîne, mis dans A
jr ScrutV ; Passons aux variables...
ItsStr: call _RclVarSym ; inspecte la chaîne...
ld a,(de) ; sa longueur dans A
or a ; à zéro?
jr nz,NoClr ; non! on passe...
dec a ; autrement, met à -1 coord.Y
ld ($e0000b),a ; du mode "Disp"
ld hl,$e40000
ld de,$d40000 ; effaçage rapide de l'écran
ld bc,153600
ldir ;
ret ; Enfin, on repart vers le TI-OS
NoClr: ex de,hl ;
inc hl ; De sorte qu' HL pointe
inc hl ; sur le 1er caractère.
ScrutV: push hl ; on préserve HL (=pointe sur la chaîne)
push af ; également A (=long.de chaîne)
ld b,a
ld a,$bb ; mini-routine pour savoir
ld c,12 ; combien il y a de tokens "double-octets" $bb,$xx
combb: cp (hl) ; C'est afin de réajuster (si nécessaire)
jr nz,pasdbb ; car à cause de ces tokens,
inc c ; longueur de châine à traiter et
pasdbb: inc hl ; longueur de chaîne à afficher
djnz combb ; ne correspondront plus tout-à-fait
ld hl,adjust+1 ; alors on ajuste!
ld (hl),c
call _ZeroOP1 ; On va lire les variables theta, O et L
ld a,tTheta ; variable BAsic theta
ld (OP1+1),a
call _RclVarSym
call _ConvOP1 ; Après un _ConvOP1, on retrouve
ld hl,$d000a4 ; theta dans DE (et A=E)
ld de,0 ; on s'assure d'être entre 0 et 7
set 3,(hl)
bit 3,a
jr z,modmin
res 3,(hl)
modmin: and 7 ; en fonction de theta,
add a,a ; on va...
ld e,a
ld hl,SgCols
add hl,de ; initialiser la couleur de segment éteint
ld a,(hl)
ld (SegOffCol+1),a
inc hl
ld a,(hl) ; ainsi que celle de segment allumé
ld (SegOnCol+1),a
call _ZeroOP1
ld a,tL ; variable Basic L (=ordonnée Y)
ld (OP1+1),a
call _RclVarSym
call _ConvOP1 ; On ne dépasse pas 5 ?
cp 6
jr c,padepa ; ok!
ld e,5 ; sinon, on met à 5
padepa: push de
call _ZeroOP1
ld a,tO ; variable Basic O (=abscisse X)
ld (OP1+1),a
call _RclVarSym
call _ConvOP1
cp 12 ; O inf. à 12 ?
jr c,prSgCh ; non? Alors on continue plus loin...
ld a,($e0000b) ; Oui? On est donc en mode d'affichage "Disp"
inc a ; on incrémente alors la variable Y interne de ce mode
cp 6 ; Dans ce mode "Disp", on est arrivé tout en bas?
jr c,itsok ; Non?.. alors on passe....
ld hl,$d40000+26240 ; Oui? Alors on fait scroller
ld de,$d40000 ; l'écran d'une ligne
ld bc,127360 ; vers le haut
ldir ; Puis on efface la ligne du bas
ld hl,$e40000 ; Tant qu'à faire...
ld de,$d40000+127360 ; le plus vite possible !
ld bc,26240
ldir
dec a
itsok: ld ($e0000b),a ; mets à jour la variable interne Y
inc sp ; En mode "Disp", DE (qui contenait O&L) ne nous sert plus à rien
inc sp ; alors plus besoin de "POPer" DE PUSHé en ligne padepa:
inc sp ; (et comme 3 "inc sp" sont + rapides qu'un POP !..)
ld e,a ;
adjust: ld a,12 ; (d'autres comentaires plus tard)
pop bc
sub b
jr pSgCh
prSgCh: pop de
pop bc
pSgCh: ld d,a
pop hl
SgCh: ld ix,Chrs
ld a,(hl) ; D,E = position X,Y
cp $bb
jr nz,OneBT
dec b
inc hl
ld a,(hl)
sub $60
ld ix,Chrs2
OneBT: push bc
push hl
ld l,54
ld h,d
mlt hl
ld bc,$d40000-25598
add hl,bc
ld b,e
inc b
push de
ld de,26240
_: add hl,de
djnz -_
push hl ; position en mémoire-écran
ld d,b
ld e,a
add ix,de
add ix,de ; ix= adresse où est codé le caractère (16bits)
ld hl,filt
SegOffCol: ld d,64
SegOnCol: ld e,224
ld c,2
_: ld b,8
ld a,(ix+1)
l0op: inc hl
ld (hl),d ; couleur du segment off
rla
jr nc,_
ld (hl),e ; couleur du segment on
_: djnz l0op
dec ix
dec c
jr nz,--_
pop hl ; position en mémoire-écran
ld de,SgDat
ld ix,filt
ld b,33
SegH: push bc
ld b,21
SegW: ld a,(de)
ld (_+2),a
_: ld a,(ix+0)
ld (hl),a
inc hl
ld (hl),a
inc hl
inc de
djnz SegW
ld bc,598
add hl,bc
pop bc
djnz SegH
pop de
pop hl
pop bc
djnz kont
ret
kont: inc hl
inc d
ld a,12
cp d
jr nz,SgCh
ld d,0
inc e
rrca
cp e
jp nz,SgCh
ret
SgCols: .db 0,0,8,24,32,224,40,248,1,7,33,231,9,126,41,255
; One-Byte Tokens :
Chrs: .dw 0,0,0,0
.dw %0001000100100000 ; →
.dw 0
.dw %0100100000010001 ; [
.dw %1000100000010010 ; ]
.dw %0100100100010001 ; {
.dw %1000100010010010 ; }
.dw %0000000101000000 ; r (bas)
.dw %1010100100000000 ; °
.dw %0000001100000000 ; -1
.dw %0100010010000000 ; 2 (petit)
.dw %1100100000010000 ; T
.dw %0100010010000101 ; 3 (petit)
.dw %0000010000001000 ; (
.dw %0001000000100000 ; )
.dw 0,0,0,0,0,0,0,0,0,0,0,0
.dw 0,0,0,0,0,0,0,0,0,0,0,0
.dw %0000101000000000 ; "
.dw %0000000000010010 ; ,
.dw %0000000000010000 ; i
.dw %0000100000000001 ; !
.dw %0000000000010000 ; .
.dw 0
.dw %1110011001100111 ; 0
.dw %0000011000000100 ; 1
.dw %1100001111000011 ; 2
.dw %1100001010000111 ; 3
.dw %0010001110000100 ; 4
.dw %1110000110000111 ; 5
.dw %1010000111000111 ; 6
.dw %1100001000000100 ; 7
.dw %1110001111000111 ; 8
.dw %1110001110000101 ; 9
.dw %0000000000010000 ; .
.dw %1110000101000011 ; E
.dw 0,0
.dw %0000100000010000 ; :
.dw 0,0
.dw %1110001111000100 ; A
.dw %1100101010010111 ; B
.dw %1110000001000011 ; C
.dw %1100101000010111 ; D
.dw %1110000101000011 ; E
.dw %1110000101000000 ; F
.dw %1110000011000111 ; G
.dw %0010001111000100 ; H
.dw %1100100000010011 ; I
.dw %0000001001000111 ; J
.dw %0010010101001000 ; K
.dw %0010000001000011 ; L
.dw %0011011001000100 ; M
.dw %0011001001001100 ; N
.dw %1110001001000111 ; O
.dw %1110001111000000 ; P
.dw %1110001001001111 ; Q
.dw %1110001111001000 ; R
.dw %1110000110000111 ; S
.dw %1100100000010000 ; T
.dw %0010001001000111 ; U
.dw %0010010001100000 ; V
.dw %0010001001101100 ; W
.dw %0001010000101000 ; X
.dw %0010001110000111 ; Y
.dw %1100010000100011 ; Z
.dw %1010100111010010 ; theta
.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0
.dw %0000000110000011 ; =
.dw %0000010010000000 ; <
.dw %0001000100000000 ; >
.dw %0000010010000001 ; ≤
.dw %0001000100000010 ; ≥
.dw %0000010110100001 ; ≠
.dw %0000100110010000 ; +
.dw %0000000110000000 ; -
.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0
.dw 0,0
.dw %0001010110101000 ; *
.dw %0000010000100000 ; /
.dw 0,0,0,0,0,0,0,0,0,0,0,0
.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.dw 0,0,0,0,0,0,0,0,0,0,0,0
.dw %0000000110101000 ; π
.dw 0
.dw %0000010000000000 ; '
.dw %1110001010010000 ; ?
.dw %0000000110000000 ; -
.dw 0,0,0,0,0,0,0,0,0,0,0
.dw %0100100001100000 ; √
.dw 0,0,0
.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.dw 0,0,0,0,0,0,0,0,0,0,0
.dw %0010000110000000 ; ∟
.dw 0,0,0,0
.dw %0000011000000000 ; ^
.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
; 2-Byte Tokens ($bb,$xx) :
Chrs2: .dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0
.dw %1110001111000100 ; A
.dw %1110001111000100 ; A
.dw %1110001111000100 ; A
.dw %1110001111000100 ; A
.dw %0000000101010011 ; a
.dw %0000000101010011 ; a
.dw %0000000101010011 ; a
.dw %0000000101010011 ; a
.dw %1110000101000011 ; E
.dw %1110000101000011 ; E
.dw %1110000101000011 ; E
.dw %1110000101000011 ; E
.dw %0000000101100010 ; e
.dw %0000000101100010 ; e
.dw %0000000101100010 ; e
.dw %0000000101100010 ; e
.dw 0
.dw %1100100000010011 ; I
.dw %1100100000010011 ; I
.dw %1100100000010011 ; I
.dw %0000000000010000 ; i
.dw %0000000000010000 ; i
.dw %0000000000010000 ; i
.dw %0000000000010000 ; i
.dw %1110001001000111 ; O
.dw %1110001001000111 ; O
.dw %1110001001000111 ; O
.dw %1110001001000111 ; O
.dw %0000000101010010 ; o
.dw %0000000101010010 ; o
.dw %0000000101010010 ; o
.dw %0000000101010010 ; o
.dw %0010001001000111 ; U
.dw %0010001001000111 ; U
.dw %0010001001000111 ; U
.dw %0010001001000111 ; U
.dw %0000000001010011 ; u
.dw %0000000001010011 ; u
.dw %0000000001010011 ; u
.dw %0000000001010011 ; u
.dw %1110000001000011 ; C
.dw %0000000101000010 ; c
.dw %0011001001001100 ; N
.dw %0000000101010000 ; n
.dw %0000010000000000 ; ´
.dw %0001000000000000 ; `
.dw 0,0,0
.dw %0011010001101000 ; α
.dw %1100101010010111 ; β
.dw %0001010000010000 ; γ
.dw %0000000000101011 ; Δ
.dw %1001000101010010 ; δ
.dw %1110000101000011 ; ε
.dw %0001000000101000 ; λ
.dw %0010100101000000 ; μ
.dw %0000000110101000 ; π
.dw %0011000101000000 ; ρ
.dw %1101000000100011 ; Σ
.dw 0
.dw %0110101110010000 ; φ
.dw %0010101001101100 ; Ω
.dw %0011000101000000 ; p
.dw %0001010000101000 ; X
.dw %1110000101000000 ; F
.dw %0000000101010011 ; a
.dw %0010000101010010 ; b
.dw %0000000101000010 ; c
.dw %0000100101010010 ; d
.dw %0000000101100010 ; e
.dw %0100100010010000 ; f
.dw %1010100100010010 ; g
.dw %0010000101010000 ; h
.dw %0000000000010000 ; i
.dw %0000100001010010 ; j
.dw %0000110000011000 ; k
.dw 0 ; unused
.dw %0000100000010000 ; l
.dw %0000000111010100 ; m
.dw %0000000101010000 ; n
.dw %0000000101010010 ; o
.dw %1010100101000000 ; p
.dw %1010100100010000 ; q
.dw %0000000101000000 ; r
.dw %0000000010001001 ; s
.dw %0010000101000010 ; t
.dw %0000000001010011 ; u
.dw %0000000001100000 ; v
.dw %0000000001101100 ; w
.dw %0001010000101000 ; x
.dw %0001010000100000 ; y
.dw %0000000100100010 ; z
.dw %0000000111010010 ; σ
.dw %1100100000001000 ; τ
.dw %0000010110010011 ; Í
.dw 0 ; GarbageCollect
.dw %1010110000000000 ; ~
.dw 0 ; reserved
.dw %1100001101010111 ; @
.dw %0000101110010111 ; #
.dw %1110100110010111 ; $
.dw %1001100101011010 ; &
.dw %0001000000000000 ; `
.dw %0000100000100000 ; ;
.dw %0001000000001000 ; \
.dw %0000001000000100 ; |
.dw %0000000000000011 ; _
.dw %1010110110110101 ; %
.dw %0000000001010100 ; ...
.dw %0000010010000000 ; ∠
.dw %1100101010010111 ; ß
.dw %0001010000101000 ; x
.dw %1100100000010000 ; T
.dw %1010100001010010 ; 0 (mini)
.dw %0000100000010000 ; 1
.dw %1000100101000010 ; 2
.dw %0001000100010010 ; 3
.dw %0010100100010000 ; 4
.dw %1010000100010010 ; 5
.dw %1010000101010010 ; 6
.dw %1000100000100000 ; 7
.dw %1010100101010010 ; 8
.dw %1010100100010010 ; 9
.dw %0110101001010101 ; 10
.dw %0000010010001000 ; ←
.dw %0001000100100000 ; →
.dw %0000000000111000 ; ↑
.dw %0001110000000000 ; ↓
.dw 0 ; unused
.dw %0001010000101000 ; x
.dw %0100100000010010 ; ∫
.dw %0000000000111011 ; ↑
.dw %1101110000000000 ; ↓
.dw %0100100001100000 ; √
.dw %0000000110000011 ; =
.dw 0,0,0,0,0,0,0,0,0,0
BackGrCol:
filt: .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; =17 ... (couleur de fond +16 segments)
SgDat .db 0,1,1,1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,2,2,0
.db 0,0,1,1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,2,0,0
.db 3,0,0,1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,0,0,7
.db 3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7
.db 3,3,3,0,4,4,0,0,0,5,5,5,0,0,0,6,6,0,7,7,7
.db 3,3,3,0,4,4,0,0,0,5,5,5,0,0,0,6,6,0,7,7,7
.db 3,3,3,0,4,4,4,0,0,5,5,5,0,0,6,6,6,0,7,7,7
.db 3,3,3,0,4,4,4,0,0,5,5,5,0,0,6,6,6,0,7,7,7
.db 3,3,3,0,0,4,4,4,0,5,5,5,0,6,6,6,0,0,7,7,7
.db 3,3,3,0,0,4,4,4,0,5,5,5,0,6,6,6,0,0,7,7,7
.db 3,3,3,0,0,0,4,4,4,5,5,5,6,6,6,0,0,0,7,7,7
.db 3,3,3,0,0,0,4,4,4,5,5,5,6,6,6,0,0,0,7,7,7
.db 3,3,3,0,0,0,0,4,4,5,5,5,6,6,0,0,0,0,7,7,7
.db 3,3,3,0,0,0,0,4,4,0,5,0,6,6,0,0,0,0,7,7,7
.db 3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7
.db 3,0,0,8,8,8,8,8,8,8,0,9,9,9,9,9,9,9,0,0,7
.db 0,0,8,8,8,8,8,8,8,8,0,9,9,9,9,9,9,9,9,0,0
.db 10,0,0,8,8,8,8,8,8,8,0,9,9,9,9,9,9,9,0,0,14
.db 10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,14
.db 10,10,10,0,0,0,0,11,11,0,12,0,13,13,0,0,0,0,14,14,14
.db 10,10,10,0,0,0,0,11,11,12,12,12,13,13,0,0,0,0,14,14,14
.db 10,10,10,0,0,0,11,11,11,12,12,12,13,13,13,0,0,0,14,14,14
.db 10,10,10,0,0,0,11,11,11,12,12,12,13,13,13,0,0,0,14,14,14
.db 10,10,10,0,0,11,11,11,0,12,12,12,0,13,13,13,0,0,14,14,14
.db 10,10,10,0,0,11,11,11,0,12,12,12,0,13,13,13,0,0,14,14,14
.db 10,10,10,0,11,11,11,0,0,12,12,12,0,0,13,13,13,0,14,14,14
.db 10,10,10,0,11,11,11,0,0,12,12,12,0,0,13,13,13,0,14,14,14
.db 10,10,10,0,11,11,0,0,0,12,12,12,0,0,0,13,13,0,14,14,14
.db 10,10,10,0,11,11,0,0,0,12,12,12,0,0,0,13,13,0,14,14,14
.db 10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,14
.db 10,0,0,15,15,15,15,15,15,15,0,16,16,16,16,16,16,16,0,0,14
.db 0,0,15,15,15,15,15,15,15,15,0,16,16,16,16,16,16,16,16,0,0
.db 0,15,15,15,15,15,15,15,15,15,0,16,16,16,16,16,16,16,16,16,0
(more info on https://tiplanet.org/forum/viewtopic.php?f=12&t=17878#p199906 )