Redefining characters for TUI

Announce and discuss the progress of your various programming-related projects...programs, games, websites, tutorials, libraries...anything!

Moderators: Pete, Mods

Post Reply
angros47
Veteran
Posts: 72
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Redefining characters for TUI

Post by angros47 » Thu Nov 19, 2009 1:16 pm

Do you remember Norton Utilities for DOS? The Text User Interface (TUI) was made with special characters, to get radio buttons, options, and much more.

I tried to do something similar in QBasic, but I abandoned it: anyway, the font is nearly complete, and I hope that some of you would be interested (it required QB PDS 7.1)

Code: Select all

DECLARE SUB CharBin ()
DECLARE FUNCTION bin2long& (a$)

TYPE RegType
	 ax    AS INTEGER
	 bx    AS INTEGER
	 cx    AS INTEGER
	 dx    AS INTEGER
	 bp    AS INTEGER
	 si    AS INTEGER
	 di    AS INTEGER
	 flags AS INTEGER
END TYPE
 SHELL "mode co80"

'OPEN "SCRN:" FOR OUTPUT AS #1          'Per scrivere sempre sullo schermo

'Def seg=&HB800 Per usare peek e poke su pagina video
' Define the type needed for INTERUPTX
'
TYPE RegTypeX
	 ax    AS INTEGER
	 bx    AS INTEGER
	 cx    AS INTEGER
	 dx    AS INTEGER
	 bp    AS INTEGER
	 si    AS INTEGER
	 di    AS INTEGER
	 flags AS INTEGER
	 ds    AS INTEGER
	 es    AS INTEGER
END TYPE
DIM SHARED inregsx AS RegTypeX
DIM SHARED outregsx AS RegTypeX


inregsx.ax = &H1003
inregsx.bx = 0
CALL interruptx(&H10, inregsx, outregsx)
COLOR 17, 7: PRINT "prova"

'END

CharBin





COLOR 15, 1: FOR i = 191 TO 224: PRINT CHR$(i); : COLOR 15, 0: PRINT " "; : COLOR 15, 1: NEXT

'END

'Non usare da 201 a 209

DIM chardata AS STRING
chardata = CHR$(0) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(96) + CHR$(111) + CHR$(96) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(0)
inregsx.ax = &H1100
inregsx.bx = &H1000
inregsx.cx = &H1
inregsx.dx = 192
inregsx.es = SSEG(chardata)
inregsx.bp = SADD(chardata)
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(3) + CHR$(251) + CHR$(3) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 190
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(255) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 194
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(255)
inregsx.dx = 195
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128)
inregsx.dx = 191
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(255) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128)
inregsx.dx = 197
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(128) + CHR$(255)
inregsx.dx = 198
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(254) + CHR$(252) + CHR$(248) + CHR$(240) + CHR$(224) + CHR$(192) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 199
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(192) + CHR$(224) + CHR$(240) + CHR$(248) + CHR$(252) + CHR$(254) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 200
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1) + CHR$(1)
inregsx.dx = 193
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(7) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8)
inregsx.dx = 193
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(240) + CHR$(8) + CHR$(24) + CHR$(24) + CHR$(56) + CHR$(120) + CHR$(120) + CHR$(248) + CHR$(248)
inregsx.dx = 128
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(8) + CHR$(8) + CHR$(9) + CHR$(9) + CHR$(11) + CHR$(11) + CHR$(15) + CHR$(7) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 210
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(240) + CHR$(8) + CHR$(24) + CHR$(24) + CHR$(56) + CHR$(120) + CHR$(120) + CHR$(248) + CHR$(248)
inregsx.dx = 187
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248)
inregsx.dx = 185
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8) + CHR$(8)
inregsx.dx = 186
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(248) + CHR$(240) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 188
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 211
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(3) + CHR$(12) + CHR$(16) + CHR$(32) + CHR$(64) + CHR$(64) + CHR$(64) + CHR$(32) + CHR$(16) + CHR$(12) + CHR$(3) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 212
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(3) + CHR$(12) + CHR$(17) + CHR$(39) + CHR$(79) + CHR$(79) + CHR$(79) + CHR$(39) + CHR$(17) + CHR$(12) + CHR$(3) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 213
CALL interruptx(&H10, inregsx, outregsx)

CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(192) + CHR$(48) + CHR$(8) + CHR$(4) + CHR$(2) + CHR$(2) + CHR$(2) + CHR$(4) + CHR$(8) + CHR$(48) + CHR$(192) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 224
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(192) + CHR$(48) + CHR$(136) + CHR$(228) + CHR$(242) + CHR$(242) + CHR$(242) + CHR$(228) + CHR$(136) + CHR$(48) + CHR$(192) + CHR$(0) + CHR$(0) + CHR$(0)
inregsx.dx = 225
CALL interruptx(&H10, inregsx, outregsx)

chardata = CHR$(0) + CHR$(0) + CHR$(63) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(63) + CHR$(31) + CHR$(0) + CHR$(0)
inregsx.dx = 214
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(63) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32) + CHR$(36) + CHR$(35) + CHR$(33) + CHR$(32) + CHR$(32) + CHR$(63) + CHR$(31) + CHR$(0) + CHR$(0)
inregsx.dx = 215
CALL interruptx(&H10, inregsx, outregsx)

CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(248) + CHR$(8) + CHR$(12) + CHR$(12) + CHR$(12) + CHR$(12) + CHR$(12) + CHR$(12) + CHR$(12) + CHR$(12) + CHR$(252) + CHR$(252) + CHR$(0) + CHR$(0)
inregsx.dx = 226
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(0) + CHR$(248) + CHR$(8) + CHR$(44) + CHR$(76) + CHR$(204) + CHR$(140) + CHR$(140) + CHR$(12) + CHR$(12) + CHR$(12) + CHR$(252) + CHR$(252) + CHR$(0) + CHR$(0)
inregsx.dx = 227
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255)
inregsx.dx = 178
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255)
inregsx.dx = 145
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 146
CALL interruptx(&H10, inregsx, outregsx)

chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(127) + CHR$(63) + CHR$(31) + CHR$(15) + CHR$(7) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 230
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(7) + CHR$(15) + CHR$(31) + CHR$(63) + CHR$(127) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 231
CALL interruptx(&H10, inregsx, outregsx)

chardata = CHR$(0) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(126) + CHR$(120) + CHR$(96) + CHR$(120) + CHR$(126) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(0)
inregsx.dx = 216
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(127) + CHR$(127) + CHR$(113) + CHR$(112) + CHR$(112) + CHR$(112) + CHR$(112) + CHR$(112) + CHR$(112) + CHR$(112) + CHR$(113) + CHR$(127) + CHR$(127) + CHR$(127) + CHR$(0)
inregsx.dx = 217
CALL interruptx(&H10, inregsx, outregsx)

chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(199) + CHR$(7) + CHR$(7) + CHR$(7) + CHR$(7) + CHR$(7) + CHR$(7) + CHR$(7) + CHR$(199) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 232
CALL interruptx(&H10, inregsx, outregsx)
chardata = CHR$(0) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(63) + CHR$(15) + CHR$(3) + CHR$(15) + CHR$(63) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(255) + CHR$(0)
inregsx.dx = 233
CALL interruptx(&H10, inregsx, outregsx)

DEFINT A-Z
FUNCTION bin2long& (a$)
    c& = 1
    FOR a = LEN(a$) TO 1 STEP -1
	IF MID$(a$, a, 1) <> "0" THEN
	    a& = a& + c&
	END IF
	c& = c& * 2
    NEXT
    bin2long& = a&
END FUNCTION

DEFSNG A-Z
SUB CharBin
CLS
a$ = "00000000": PRINT bin2long(a$)
a$ = "11111110": PRINT bin2long(a$)
a$ = "11111110": PRINT bin2long(a$)
a$ = "11111110": PRINT bin2long(a$)
a$ = "01111110": PRINT bin2long(a$)
a$ = "01111110": PRINT bin2long(a$)
a$ = "00111110": PRINT bin2long(a$)
a$ = "00011110": PRINT bin2long(a$)
a$ = "00001110": PRINT bin2long(a$)
a$ = "00000110": PRINT bin2long(a$)
a$ = "00000110": PRINT bin2long(a$)
a$ = "11111110": PRINT bin2long(a$)
a$ = "11111110": PRINT bin2long(a$)
a$ = "11111110": PRINT bin2long(a$)
a$ = "11111110": PRINT bin2long(a$)
a$ = "00000000": PRINT bin2long(a$)
END SUB

The SUB CharBin helps you to design new characters.

User avatar
burger2227
Veteran
Posts: 2431
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Thu Nov 19, 2009 1:36 pm

Suggestions; Make a SUB call like: Intx10 to make the calls. Don't even use CALL elsewhere.

Code: Select all

SUB Intx10

CALL interruptx(&H10, inregsx, outregsx) 

END SUB
You don't need the first RegType at all. Interrupt could use the X one. It just does not use DS or ES. Don't ask me why both are in QB.BI which could also be $INCLUDE:'d instead of any TYPE declarations.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

User avatar
bongomeno
Veteran
Posts: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

Post by bongomeno » Thu Nov 19, 2009 10:48 pm

holycrap! :shock:
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

Post Reply