Sections
Calendar
November 2019
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
             

Members
Not logged in.
 

Programming Graphics
Video outlining graphics (09:08)

This video covers many of the graphics-specific features and commands available in TI BASIC, Extended BASIC, and assembly language. The examples of the computer's variety of graphics commands are shown using a combination of a real 4A console and the Classic99 emulator.

We look at:

  • Its Video Display Processor (VDP), the TMS9918
  • Graphics commands in BASIC and Extended BASIC
  • Characters, colors, and sprites
  • Enabling an external VDP
  • System limitations
  • Rare bitmap mode
  • Super-rare multicolor mode
Code examples:

CHARDEF (TI Extended BASIC)

This program is used to draw pixels in a 16x16 area and output the value that you would use in the CALL CHAR commands.

10 CALL CLEAR 20 XOR$="89ABCDEF0123456745670123CDEF89AB23016745AB89EFCD1032547698BADCFE" 30 CALL CHAR(96,"0000000000000000") 40 CALL CHAR(97,"FFFFFFFFFFFFFFFF") 50 CALL CHAR(98,"000000000E080A00") 60 CALL CHAR(99,"FFFFFFFFF1F7F5FF") 70 CALL COLOR(9,2,16) 80 CALL COLOR(11,9,8) 90 CALL CHAR(112,"00000000000000FF") 100 CALL CHAR(113,"0101010101010101") 110 CALL CHAR(114,"8080808080808080") 120 CALL CHAR(115,"FF00000000000000") 130 CH$="0000000000000000000000000000000000000000000000000000000000000000" 140 CALL CHAR(100,SEG$(CH$,1,16)) 150 CALL CHAR(101,SEG$(CH$,17,16)) 160 CALL CHAR(102,SEG$(CH$,33,16)) 170 CALL CHAR(103,SEG$(CH$,49,16)) 180 DISPLAY AT(1,1):"CHARACTER DEFINITION" 190 FOR A=3 TO 18 200 CALL HCHAR(A,1,96,16) 210 NEXT A 220 CALL HCHAR(5,19,112,2) 230 CALL VCHAR(6,18,113,2) 240 CALL VCHAR(6,21,114,2) 250 CALL HCHAR(8,19,115,2) 260 CALL HCHAR(6,19,100) 270 CALL HCHAR(7,19,101) 280 CALL HCHAR(6,20,102) 290 CALL HCHAR(7,20,103) 300 C=0 :: R=0 310 CALL HCHAR(C+3,R+1,98) 320 FOR A=0 TO 3 330 DISPLAY AT(20+A,1):A;":";SEG$(CH$,1+A*16,16) 340 NEXT A 350 CALL GCHAR(C+3,R+1,CURR) 360 CALL KEY(0,K,S) 370 IF K<>8 THEN 440 380 CALL HCHAR(C+3,R+1,CURR-2) 390 R=R-1 400 IF R<0 THEN R=15 410 CALL GCHAR(C+3,R+1,CURR) 420 CALL HCHAR(C+3,R+1,CURR+2) 430 GOTO 810 440 IF K<>9 THEN 510 450 CALL HCHAR(C+3,R+1,CURR-2) 460 R=R+1 470 IF R>15 THEN R=0 480 CALL GCHAR(C+3,R+1,CURR) 490 CALL HCHAR(C+3,R+1,CURR+2) 500 GOTO 810 510 IF K<>10 THEN 580 520 CALL HCHAR(C+3,R+1,CURR-2) 530 C=C+1 540 IF C>15 THEN C=0 550 CALL GCHAR(C+3,R+1,CURR) 560 CALL HCHAR(C+3,R+1,CURR+2) 570 GOTO 810 580 IF K<>11 THEN 650 590 CALL HCHAR(C+3,R+1,CURR-2) 600 C=C-1 610 IF C<0 THEN C=15 620 CALL GCHAR(C+3,R+1,CURR) 630 CALL HCHAR(C+3,R+1,CURR+2) 640 GOTO 810 650 IF K<>32 OR S=-1 THEN 810 660 IF CURR<>98 THEN 690 670 CALL HCHAR(C+3,R+1,99) 680 GOTO 700 690 CALL HCHAR(C+3,R+1,98) 700 REM BLANKY 710 CHDIGA=(INT(C/8)*16+(INT(R/8))*32)+(INT(((R/8)-INT(R/8))*2)+(INT(((C/8)-INT(C/8))*8))*2) 720 CHPRV=(ASC(SEG$(CH$,CHDIGA+1,1))-48) 730 CHBIT=((INT(((R/4)-INT(R/4))*4))*16) 740 IF CHPRV<=9 THEN 760 750 CHPRV=CHPRV-7 760 CH$=SEG$(CH$,1,CHDIGA)&SEG$(XOR$,CHBIT+CHPRV+1,1)&SEG$(CH$,CHDIGA+2,63-CHDIGA) 780 CALL CHAR(100+(INT(C/8))+(INT(R/8))*2,SEG$(CH$,1+(INT(C/8)*16+(INT(R/8))*32),16)) 790 DISPLAY AT(20+(INT(C/8))+(INT(R/8))*2,5):SEG$(CH$,1+(INT(C/8)*16+(INT(R/8))*32),16) 810 REM JUMP OUT 820 GOTO 350

FONTEDITOR (TI Extended BASIC)

This simple program can be used to define, save, and load new definitions of characters from 32 to 127.

5 REM EXT BASIC: FONT EDITOR 10 REM INITIALIZE 20 DISPLAY AT(1,1):"NEWLINE99 FONT EDITOR" 30 DIM CH$(96) 40 FN$="" :: !FILENAME 50 ALLCMD$="ESLCQ" 60 HEX$="0123456789ABCDEF" 80 REM REFRESH SCREEN 90 CALL CLEAR 92 DISPLAY AT(1,1):"NEWLINE99 FONT EDITOR" 100 DISPLAY AT(3,1):" !""#$%&'()*+,-./" 110 DISPLAY AT(4,1):" 0123456789:;<=>?" 120 DISPLAY AT(5,1):" @ABCDEFGHIJKLMNO" 130 DISPLAY AT(6,1):" PQRSTUVWXYZ[]^_" 140 DISPLAY AT(7,1):" `abcdefghijklmno" 150 DISPLAY AT(8,1):" pqrstuvwxyz{|}~";CHR$(127) 170 DISPLAY AT(10,1):"FILE: ";FN$;" " 180 DISPLAY AT(12,1):"Edit Save Load Chgfile Quit" 190 DISPLAY AT(14,1):"CMD: " 200 ACCEPT AT(14,5)SIZE(1)VALIDATE(ALLCMD$):CMD$ 210 ON POS(ALLCMD$,CMD$,1)GOSUB 300,500,700,900,1100 220 GOTO 170 300 DISPLAY AT(14,1):"EDIT..." 310 DISPLAY AT(16,1):"CHAR (HEX): " 320 ACCEPT AT(16,13)VALIDATE(HEX$)SIZE(2):CODE$ 330 IF CODE$="" THEN 480 340 CHARNUM=((POS(HEX$,SEG$(CODE$,1,1),1)-1)*16)+(POS(HEX$,SEG$(CODE$,2,1),1)-1) 350 DISPLAY AT(16,1):"CHAR ";CHARNUM;"""";CHR$(CHARNUM);"""" 360 DISPLAY AT(17,1):"DEF: " 362 IF CH$(CHARNUM-32)="" THEN 370 365 DISPLAY AT(18,1):"PREV ";CH$(CHARNUM-32) 370 ACCEPT AT(17,6)VALIDATE(HEX$)SIZE(16):CHVAL$ 380 DISPLAY AT(17,1):RPT$(" ",32) 390 IF CHVAL$="" THEN 480 400 CALL CHAR(CHARNUM,CHVAL$) 410 CH$(CHARNUM-32)=CHVAL$ 470 DISPLAY AT(18,1):RPT$(" ",32) 480 DISPLAY AT(16,1):RPT$(" ",32) 490 RETURN 500 DISPLAY AT(14,1):"SAVE..." 505 DISPLAY AT(16,1):"OPENING... " 510 OPEN #1:FN$,OUTPUT,SEQUENTIAL,VARIABLE(80) 515 DISPLAY AT(16,1):"SAVING... " 520 FOR I=0 TO 95 530 PRINT #1:CH$(I) 540 NEXT I 550 DISPLAY AT(16,1):"CLOSING... " 560 CLOSE #1 570 DISPLAY AT(16,1):" " 690 RETURN 700 DISPLAY AT(14,1):"LOAD..." 705 DISPLAY AT(16,1):"OPENING... " 710 OPEN #1:FN$,INPUT ,SEQUENTIAL,VARIABLE(80) 715 DISPLAY AT(16,1):"LOADING... " 720 FOR I=0 TO 95 730 INPUT #1:CH$(I) 740 NEXT I 750 DISPLAY AT(16,1):"CLOSING... " 760 CLOSE #1 770 DISPLAY AT(16,1):"SETTING CHARACTERS..." 780 FOR I=0 TO 95 790 IF CH$(I)="" THEN 810 800 CALL CHAR(I+32,CH$(I)) 810 NEXT I 820 DISPLAY AT(16,1):"COMPLETE. " 830 DISPLAY AT(16,1):RPT$(" ",32) 840 RETURN 900 DISPLAY AT(14,1):"CHANGEFILE..." 910 DISPLAY AT(16,1):"FILENAME:" 920 ACCEPT AT(16,11)SIZE(15):NFN$ 930 DISPLAY AT(16,1):RPT$(" ",32) 940 IF NFN$="" THEN 960 950 FN$=NFN$ 960 RETURN 1100 DISPLAY AT(14,1):"QUIT..." 1110 DISPLAY AT(16,1):"ARE YOU SURE? (Y/N) " 1120 ACCEPT AT(16,21)VALIDATE("YN")SIZE(1):Q$ 1125 DISPLAY AT(16,1):RPT$(" ",32) 1130 IF Q$="Y" THEN 1300 1290 RETURN 1300 CALL CLEAR 1310 END

TRAFFIC (TI Extended BASIC)

A quick demonstration of sprites.

10 CALL CLEAR 15 CALL MAGNIFY(3) 20 CALL CHAR(96,"0000000000000000") 30 CALL CHAR(97,"1818181818181818") 40 CALL CHAR(98,"6666666666666666") 50 CALL COLOR(9,16,15) 60 CALL CHAR(104,"3982568992826395") 70 CALL CHAR(105,"983972876948A849") 80 CALL CHAR(106,"4927959735287427") 90 CALL CHAR(107,"8282647782583842") 100 CALL COLOR(10,3,13) 110 CALL CHAR(100,"000F17171F3F1F1F1F1F1F1F1F1F0F0000F0E8E8F8FCF8F8F8F8F8F8F8F8F000") 120 CALL CHAR(108,"000F1F1F1F1F1F1F1F1F3F1F17170F0000F0F8F8F8F8F8F8F8F8FCF8E8E8F000") 130 CALL CHAR(112,"000000000000000F0F0F0F0F0000000000000000000000F0F0F0F0F000000000") 140 CALL CHAR(116,"0000000F0F0F0F0F0000000000000000000000F0F0F0F0F00000000000000000") 150 FOR X=1 TO 24 STEP 4 160 CALL HCHAR(X+0,1,104,32) 170 CALL HCHAR(X+1,1,105,32) 180 CALL HCHAR(X+2,1,106,32) 190 CALL HCHAR(X+3,1,107,32) 200 NEXT X 210 CALL VCHAR(1,9,96,24*13) 220 CALL VCHAR(1,9,97,24) 230 CALL VCHAR(1,12,97,24) 240 CALL VCHAR(1,15,98,24) 250 CALL VCHAR(1,18,97,24) 260 CALL VCHAR(1,21,97,24) 270 FOR X=2 TO 24 STEP 3 280 CALL HCHAR(X,10,96,11) 290 NEXT X 300 CALL SPRITE(#15,100,10,92,145) 310 CALL SPRITE(#1,112,7,92,145) 320 CALL SPRITE(#16,100,6,1,145) 330 CALL SPRITE(#2,112,5,1,145) 340 CALL SPRITE(#17,100,16,68,121) 350 CALL SPRITE(#3,112,15,68,121) 360 CALL SPRITE(#18,108,2,96,97) 370 CALL SPRITE(#19,108,4,131,73) 380 CALL SPRITE(#4,116,13,131,73) 390 CALL SPRITE(#20,108,12,54,73) 400 CALL SPRITE(#5,116,11,54,73) 410 CALL MOTION(#15,-25,0,#1,-26,0) 420 CALL MOTION(#16,-25,0,#2,-26,0) 430 CALL MOTION(#17,-32,0,#3,-33,0) 440 CALL MOTION(#18,30,0) 450 CALL MOTION(#19,25,0,#4,31,0) 460 CALL MOTION(#20,25,0,#5,33,0) 470 CALL MOTION(#1,-25,0,#2,-25,0,#3,-32,0,#4,25,0,#5,25,0) 1000 GOTO 1000

RANDPIX2 (Assembly language)

Demonstration of the bitmap mode. Displays random pixels over the whole screen.

DEF RUN REF VMBW,VWBR,VSBW,VWTR * SEED DATA >23A3 RNDM DATA >1FB9 RNDA DATA >6EFB * INITCH DATA >0000,>0000,>0000,>0000 INITCO DATA >1F1F,>1F1F,>1F1F,>1F1F * INIT LI R0,>0002 LI R1,>0F00 BLWP @VWTR LI R0,>01C0 BLWP @VWTR LI R0,>0206 BLWP @VWTR LI R0,>03FF BLWP @VWTR LI R0,>0403 BLWP @VWTR LI R0,>05F0 BLWP @VWTR LI R0,>071F BLWP @VWTR LIMI 2 LI R0,>0000 LI R1,INITCH LI R2,8 LI R3,>1800 INCHL1 BLWP @VMBW A 2,0 C 0,3 JNE INCHL1 LI R0,>2000 LI R1,INITCO LI R3,>3800 INCHL2 BLWP @VMBW A 2,0 C 0,3 JNE INCHL2 LI R0,>1800 LI R1,>0000 LI R3,>1B00 LI R4,>0100 INCHL3 BLWP @VSBW AB 4,1 INC 0 C 0,3 JNE INCHL3 RT * RGEN MOV @SEED,R6 MPY @RNDM,6 A @RNDA,7 MOV R7,@SEED RT * RUN BL @INIT TOP LI R0,>0000 LI R1,SEED LI R2,>0002 LI R3,>1800 LI R4,>2000 LOOP BL @RGEN BLWP @VMBW A 4,0 BL @RGEN BLWP @VMBW S 4,0 MOV R0,R10 LI R8,>0009 LI R9,>0000 DIV 8,9 INC 10 LI R9,>0000 NOTHN BL @RGEN INC 9 C 9,10 JNE NOTHN INCT 0 C 0,3 JNE LOOP JMP TOP DONE JMP DONE END

Posted in Video on 2019-01-01 18:04:00.
Hits: 183