• entries
222
606
• views
592201

# Text viewports and sprites

1193 views

Back to work on the TI-83 Plus port of BBC BASIC! To complement the graphics viewport I've added support for text viewports -- this lets you define the area the text console uses. The following VDU commands are now supported:
• VDU 24,;;;;
Define a graphics viewport.
• VDU 28,,,,
Define a text viewport.
• VDU 26
Reset both viewports to their default settings (full screen).
• VDU 29,;;
Defines the graphics origin.

The above screenshots defines the graphics viewport to fill the left hand side of the screen and shunts the text viewport over to the right half, using the following code:
VDU 24,0;0;47;63; VDU 28,12,0,23,9 VDU 29,24;32;
I've also added simple sprite drawing to BBC BASIC's PLOT command. PLOT usually takes a shape type and two coordinates, but for sprites (shapes 208..215) I've added an extra parameter - the address of the sprite data to use.

   10 DIM ball 7    20 ball?0=&3C    30 ball?1=&5E    40 ball?2=&8F    50 ball?3=&DF    60 ball?4=&FF    70 ball?5=&FF    80 ball?6=&7E    90 ball?7=&3C   100 *REFRESH OFF   110 REPEAT   120   CLG   130   T=TIME/100   140   FOR P=0 TO 5   150     A=P/3*PI+T   160     X=16*SIN(A)+44   170     Y=16*COS(A)+28   180     PLOT 213,X,Y,ball   190   NEXT   200   *REFRESH   210 UNTIL INKEY(0)<>-1   220 *REFRESH ON

The above code allocates 8 bytes of memory (DIM ball 7) then copies the sprite data to it by use of the ? indirection operator. This is a little laborious, so in reality you'd probably store your sprites in a binary file external to the main program, and might load them like this:
   10 ball%=FN_loadSprite("SPRITES",0)    20 face%=FN_loadSprite("SPRITES",1)    30 *REFRESH OFF    40 REPEAT    50   CLG    60   T=TIME/100    70   FOR P=0 TO 5    80     A=P/3*PI+T    90     X=16*SIN(A)+44   100     Y=16*COS(A)+28   110     PLOT 213,X,Y,ball%   120   NEXT   130   PLOT 213,44,28,face%   140   *REFRESH   150 UNTIL INKEY(0)<>-1   160 *REFRESH ON   170 END   180 DEF FN_loadSprite(f$,i%) 190 fh%=OPENIN(f$)   200 PTR#fh%=i%*8   210 DIM spr 7   220 FOR j%=0 TO 7   230   spr?j%=BGET#fh%   240 NEXT j%   250 CLOSE#fh%   260 =spr   270 ENDPROC

(Note FN_loadSprite() at the end of the program). The result is the following:

Next up: drawing text at the graphics cursor position (as sprites).

I've always been meaning to ask this, how long does it take you to make these journal entries? I assume you have some sort of automatic way of making all these animated gifs, but it still looks like they took a while.

I'm not complaining, I like them. It makes this journal unique as you usually don't see so much animation in the others.

##### Link to comment
Quote:
 Original post by Scet I assume you have some sort of automatic way of making all these animated gifs, but it still looks like they took a while.
There are a number of tools to capture GIFs from emulators, either being external applications (such as TISShot for VTI) or built in (such as in PindurTI or Wabbitemu). It's just a case of hitting a button when you want to start recording and hitting it again when you're done, with the optional extra stage of further trimming or optimising in the GIF animation software of your choice. [smile]

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account