15th of October 2018 – Strings revisted

A while ago I did a first blog entry on Strings – see: Print String.

Today I like to add a few lines (both entries can also be found in the Vide help).

If your Vectrex has only the slightest “drift” – String output will be “italic“.

Every vectrex has drift – even with a completely new cap kit – there is no way arround it – the hardware is not “good” enough to be completely drift free. Due to technical reasons – (see below) the drift in combination with the BIOS raster print routines result in text output being italic.
(Vide emulates drift, you can change the drift in the configuration)

Look at the picture above. It is printed with exactly the same routine, namely:

LDU #shortText    ; address of string
LDA #$20          ; Text position relative Y
LDB #-$20         ; Text position relative X
JSR Print_Str_d   ; Vectrex BIOS print routine

LDU #longText     ; address of string
LDA #-$20         ; Text position relative Y
LDB #-$7f         ; Text position relative X
JSR Print_Str_d   ; Vectrex BIOS print routine
BRA main          ; and repeat forever

shortText:
DB "HELLO"    ; only capital letters
DB $80        ; $80 is end of string
longText:
DB "HELLO WORLD, MALBAN HERE!"  ; only capital letters
DB $80        ; $80 is end of string

 

The drift “in” strings is in direct relation to the number of characters of the string. Long strings always are more italic. Depending on the drift of your vectrex – it may even be, that you can not discern long strings anymore.

Vec_Text_Width
Is the STRENGTH of a string, each string is printed with a strength of Vec_Text_Width and with a scale (if you want to call it that where strings are concerned) of #OfChars*18.

The “scale” of a string relates ALWAYS directly to the count of characters! No matter how big or small the characters printed, the scale is always 18*#characters.

The large string above consists of 25 letters. 25 * 18 = 450 (or $1c2).

The scale in vectrex is always the “time” needed for the line to be completely drawn. Each vectrex string consists of 7 lines, but you also have to go back to draw the next line (6 times) – and have a little overhead, since you are not really drawing all the time.

What it come down to is that you need about CONST+(7*2*18)*(#Characters) cycles for a string to be drawn. The CONST is ~ 1000 and denotes the overhead of the BIOS print_str_d routine (“d” being an internal MoveTo_d routine, which takes some additional time). In the above example the exact cycles are 7243 cycles (calculated by the simplyfied formular would be: 7300)

If you want to print strings without flicker (lower 50Hz) you can print about 4 “sentences” of the above kind, or said differently: about 100 characters.

Drift → italic
The “drift” can be seen as a tiny movement of the electron beam position. Always, all the time (except when zeroing). Something fascinating is happening over at the other side – the beam always wants to go there – even if you tell him not to!

Time:
1 cycle = 1 / 1500000s = 0,66 micro seconds
One line of above large string takes (450 cycles) about 0,0003s = 0,3 ms to print.
A bad – but not really uncommon – drift could be 1mm to the left each 0,5ms.

Note:
It appears the drift is (at most) only slightly influenced by the “strength”, meaning in general the drift only is in one direction!

A BIOS printed string is actually a GIGANTIC (in timing terms) single vector list of the following format:
One line left to right (to right always outputting a pattern)
One line right to left (to left always invisble go back)
One line left to right
One line right to left
One line left to right
One line right to left
One line left to right
One line right to left
One line left to right
One line right to left
One line left to right
One line right to left
One line left to right

Each of these lines – as above said – takes (for the large string) 450 cycles! For our “example drift” this means, while printing the complete string the drift moves the beam about 12mm to the left! You can see that in 7 “steps” of about 2mm with each line of the string. This is what makes it italic!

Since there are many Vectrex out there, which are due to age reasons not in perfect shape – nowadays quite a lot of drift happens – it is in general a bad idea to display really long strings with the standard BIOS methods. There certainly will be Vectri out there where the text WILL be unreadable!

Malban

Tagged on: ,

3 thoughts on “15th of October 2018 – Strings revisted

    1. Malban Post author

      I wouldn’t go as far as every word – but depending on the stuff you want to output, it does make sense to split it up a little.
      An additional note on that matter:
      a) The BIOS routines need a minimum of (if I remember correctly) 3 characters – otherwise they display incorrectly!

      String printing in general is really slow and prone to flicker very soon.
      If one choses to print lots of text, I would probably chose some sort of scrolling, where at most 4-5 lines are visible at a time.

      Also an (or a couple of) own string printing routines can quite easily be done.
      a) chosing a smaller font (only five lines high), saves a couple of the lines to be printed.
      b) “synced” String routines – if you know that you will often print long lines.
      (synced here meaning, not going back the line, but zeroing and repositioning the beam)
      For long lines it might even be the faster variant. But using “synced” routines ensures you do not have ANY italcs.

      Another alternative are vector fonts – for short messages they are ok, but in general they are not faster, since each and every character also consists of quite a few lines.

      Doing “massive” text output in an eye friendly manner is really hard (on a vectrex)…

  1. Philip Eaton

    This is why I think a Vectrex is best suited to games with lots of movement, i.e. sprites and viewports, and minimal static background vectors. If you want lots of text, use a computer with a buffered raster screen! 🙂

Leave a Reply to Malban Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.