Jump to content
IGNORED

Basic Programming Question


9640News

Recommended Posts

I am trying to convert a program to use the TIPI.

 

I have an assembly language routine passed a variable for screen location.  I need to convert this location to a row/column position in basic to use the Display At routine.

 

Without using assembly, I seem to not be able to find an approrpiate routine.

 

Ideas?

Link to comment
Share on other sites

43 minutes ago, 9640News said:

I am trying to convert a program to use the TIPI.

 

I have an assembly language routine passed a variable for screen location.  I need to convert this location to a row/column position in basic to use the Display At routine.

 

Without using assembly, I seem to not be able to find an approrpiate routine.

 

Ideas?

Well normally Assembly uses screen location from 0 to 768 if you are talking Characters of 8x8 normal characters. 

So most of the time the number divided by 32 and the left over is the column of the last row.

 

Example: 736/32=ROW 23 and COLUMN 1

 

Example: 127/32=ROW 3 and COLUMN 31

  • Thanks 1
Link to comment
Share on other sites

48 minutes ago, 9640News said:

I am trying to convert a program to use the TIPI.

 

I have an assembly language routine passed a variable for screen location.  I need to convert this location to a row/column position in basic to use the Display At routine.

 

Without using assembly, I seem to not be able to find an approrpiate routine.

 

Ideas?

 

How is the screen location passed to Basic? If as a floating point number, then

100 ROW = INT(LOC/32)
110 COL = LOC - ROW * 32

 

...lee

  • Like 2
Link to comment
Share on other sites

1 hour ago, Lee Stewart said:

How is the screen location passed to Basic? If as a floating point number, then

100 ROW = INT(LOC/32)
110 COL = LOC - ROW * 32

...lee

Almost right. BASIC and XB think the screen is from row 1 to row 24 and col 1 to col 32. But the VDP thinks the screen is from row 0 to row 23 and col 0 to col 31. So one additional instruction must be added:

For HCHAR or VCHAR

90 LOC=LOC+33

100 ROW=INT(LOC/32)

110 COL=LOC-ROW*32

or

100 ROW=INT(LOC/32)

110 COL=LOC-ROW*32

120 ROW=ROW+1::COL=COL+1

 

Just to make it interesting, DISPLAY AT starts two columns over. DISPLAY AT(3,1):"*"  is the same as CALL HCHAR(3,3,42)

So for DISPLAY AT:

100 ROW=INT(LOC/32)

110 COL=LOC-ROW*32

120 ROW=ROW+1::COL=COL-1

Edited by senior_falcon
  • Like 2
Link to comment
Share on other sites

RXB has CALL HPUT(row,col,string or numeric variable) or CALL VPUT(row,col,string or numeric variable)

 

Or if you want to stick with the Assembly Numbering system use CALL MOVES("$V",LEN(string-variable),string-variable,address)

$=type of string 

V=VDP address

LEN is the length of the string

string-variable is like A$ or X$

address is the vdp address like you see in Assembly

 

Also you could use CALL HGET(row,col,length,string-variable) or CALL VGET(row,col,length,string-variable) to get strings off of screen into a string-variable

Link to comment
Share on other sites

4 hours ago, WhataKowinkydink said:

I always thought that was an annoying feature of DISPLAY AT.  My suspicion is they did that to be sure the text on CRTs would not get cut off...

My first two displays were a black&white TV and a 13" color TV, connected via an RF modulator.  The centered, 28-column display fit snugly on the black&white TV, particularly at the two bottom corners. The color TV showed a bit more of the display, though I think it had some adjustment knobs at the back.  On both TVs (Edit: maybe it was just the color TV?), I could see graphics in columns 1,2,31,32 where the screen was widest, however, it wasn't until I obtained a composite monitor that I could see 'everything' in the 24x32 window.

 

The BASIC reference manual briefly mentions the potential screen limitation, "The graphics subprograms feature a 24-row by 32-column screen display. The 28 print positions normally used in TI BASIC correspond to columns 3 through 30. inclusive, in the graphics subprograms. Because some display screens may not show the two leftmost and two rightmost characters, your graphics may be more satisfactory if you use columns 3 through 30 and ignore columns 1 and 2 on the left and 31 and 32 on the right. Experiment with different line lengths to determine how many positions show on your screen."

 

It seems to me that some games were designed with the column 'limitation' in mind as well. 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, 99V said:

Thank you. For some reason there seems to be blank space on a monitor beyond the 32 columns on either side  too. Heck we might have space for 36 wide. This could have been an internal ROM thing to not chop stuff off. 

Actually this is due to the 9901 VDP chip. It has modes of several types and 32x24 is the most used one for menus.

Every single Cart from Texas Instruments used this mode when you get the title screen or a menu.

Thus this VDP chip mode is always the one you see the most often, and the one used by Basic and XB.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

22 minutes ago, 99V said:

So in text mode it leaves 8 bits on each side to get 240 bits for text

Text mode "robs" a two bits from character widths.  The screen is still 256 pixels wide; the 6x8 characters allow for 40 columns of text.  Also in this mode, there are only two colors available: foreground and screen color (background.) This is described on page 2-16 of the 9918A manual.

  • Like 1
Link to comment
Share on other sites

1 hour ago, tmop69 said:

There is also the Text Mode, 40x24 lines, 6x8 pixel chars, but not available in BASIC/XB. It is used in Adventure module, for example.

 

1 hour ago, 99V said:

So in text mode it leaves 8 bits on each side to get 240 bits for text

 

Effectively, you have only a 5x7 matrix for characters in Text mode because you want a 1-pixel character separation for both columns and rows. Though you can certainly define characters to fill the 6x8 matrix, they will run together if you do. Though you lose the rightmost 2 pixels of each character, you must define each character as an 8x8 matrix in the character pattern table.

 

And, indeed, the effective screen is only 240 pixels wide and, I would guess (others will know better than I), centered with an unavailable 8-pixel border on each side.

 

...lee

Edited by Lee Stewart
additional info
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...