' LOADFONT.BAS - routine to modify 15 characters within the ' default ASCII set ' Purpose: * to generate a copyright symbol for use within your creditline ' (modified!!!) ' * to create a telephone symbol for use with phonenumbers ' (e.g. in a cardfile) ' * to create 'digital' digits to display the time (including ' "AM" and PM" when using the 12 hour format) ' NOTE: this demo modifies CHR$(224) through CHR$(238). After all it was ' not a good idea to alter the standard digits, because that ' would unintentionally change financial figures as well ' Author : Egbert Zijlema (The Netherlands) ' Copyright status: Public Domain DEFINT A - Z TYPE FLAGS twelve AS INTEGER ' 12 hours time vgafnt AS INTEGER ' special characters loaded? END TYPE DIM flg AS SHARED FLAGS SUB LoadFont cred$ = CHR$(126, 129, 189, 165, 161, 165, 189, 129, 126) phon$ = CHR$( 0, 0, 0, 126, 255, 153, 60, 126, 126) zero$ = CHR$( 56, 198, 198, 198, 0, 198, 198, 198, 56) one$ = CHR$( 24, 24, 24, 24, 0, 24, 24, 24, 24) two$ = CHR$( 56, 198, 6, 6, 56, 192, 192, 192, 62) thre$ = CHR$( 56, 198, 6, 6, 56, 6, 6, 198, 56) four$ = CHR$(198, 198, 198, 198, 56, 6, 6, 6, 6) five$ = CHR$( 62, 192, 192, 192, 56, 6, 6, 198, 56) six$ = CHR$(192, 192, 192, 192, 56, 198, 198, 198, 56) sevn$ = CHR$(248, 6, 6, 6, 0, 6, 6, 6, 6) eigt$ = CHR$( 56, 198, 198, 198, 56, 198, 198, 198, 56) nine$ = CHR$( 56, 198, 198, 198, 56, 6, 6, 198, 56) a$ = CHR$( 56, 198, 198, 198, 56, 198, 198, 198, 198) p$ = CHR$( 56, 198, 198, 198, 56, 192, 192, 192, 192) m$ = CHR$(126, 219, 219, 219, 0, 219, 219, 195, 195) start$ = STRING$(3, 0) tail$ = STRING$(4, 0) ' SWAP start$, tail$ ' you may unmark this for better ' bottom alignment between$ = STRING$(7, 0) ' align prev. and next char pattern$ = start$ + cred$ + between$ + phon$ + between$ + zero$ + _ between$ + one$ + between$ + two$ + between$ + thre$ + _ between$ + four$ + between$ + five$ + between$ + six$ + _ between$ + sevn$ + between$ + eigt$ + between$ + nine$ + _ between$ + a$ + between$ + p$ + between$ + m$ + tail$ REG 1, &H1100 ' function REG 2, 16 * 256 ' 16 bytes per char in BH REG 3, 15 ' 15 characters REG 4, 224 ' first char in ASCII-set to modify REG 9, STRSEG(pattern$) REG 7, STRPTR(pattern$) CALL INTERRUPT &H10 REG 1, &H1103 ' function REG 2, 0 CALL INTERRUPT &H10 END SUB FUNCTION TimeToDisplay$ hour = VAL(LEFT$(TIME$, 2)) extension$ = SPACE$(3) IF flg.twelve THEN SELECT CASE hour CASE => 12 IF hour > 12 THEN DECR hour, 12 extension$ = " PM" CASE ELSE IF hour = 0 THEN hour = 12 extension$ = " AM" END SELECT END IF temp$ = LTRIM$(RTRIM$(STR$(hour))) + MID$(TIME$, 3) + extension$ IF flg.vgafnt THEN ' use digital digits FOR count = 1 TO LEN(temp$) char$ = MID$(temp$, count, 1) SELECT CASE char$ CASE CHR$(48) TO CHR$(57) REPLACE char$ WITH CHR$(ASC(char$) + 178) IN temp$ CASE "A" REPLACE char$ WITH CHR$(236) IN temp$ CASE "P" REPLACE char$ WITH CHR$(237) IN temp$ CASE "M" REPLACE char$ WITH CHR$(238) IN temp$ END SELECT NEXT END IF TimeToDisplay$ = temp$ END FUNCTION ' demo calling module CLS IF BIT(pbvScrnCard, 4) THEN ' VGA-card only LoadFont ' load special characters flg.vgafnt = - 1 ' they have been loaded END IF IF flg.vgafnt THEN CopyRight$ = CHR$(224) : Phone$ = CHR$(225) ELSE CopyRight$ = "(C)" : Phone$ = "Tel." END IF LOCATE 4, 4 : PRINT "This shows the result: " LOCATE 7, 4 PRINT "Copyright ";CopyRight$;" 1996: Public Domain" LOCATE 8, 4 PRINT "Helpdesk: ";Phone$;" +31 50 5844275" ' now display the time in standard PC format (24 hrs): DO LOCATE 10, 4 : PRINT TimeToDisplay$ LOOP UNTIL LEN(INKEY$) ' now print it in 12 hrs format: flg.twelve = -1 ' set flag DO LOCATE 10, 4 : PRINT TimeToDisplay$ LOOP UNTIL LEN(INKEY$) SCREEN 0, 0, 0, 0 ' restore default font END