• Ben Avison's avatar
    Added compile-time support for full-resolution teletext characters in teletext... · e87eeeca
    Ben Avison authored
    Added compile-time support for full-resolution teletext characters in teletext emulation mode (MODE 7) for that authentic BBC Micro feel.
    
      Also introduced a few useful teletext control features via VDU 23,18.
      Unrelatedly, fixed *ScreenLoad to work for interlaced displays.
    
    Detail:
      The new typeface is designed on a 16x20 grid (previously we had used 8x10),
      so it uses a screen resolution of 640x500 pixels (rather than 320x250).
      Since we have been unable to source a genuine teletext font, and since
      examination of a BBC Micro suggests that the genuine font may not have been
      a power-of-2 pixels wide, I have designed one specially, based upon the one
      supplied in Zap distributions (a 12x20 font). Rather than increase the
      amount of workspace that the kernel requires for cacheing graphic
      characters, it now generates them on the fly, as they are required; this
      should only add about 25% to their rendering time.
    
      The new VDU 23 sequences are as follows:
    
      VDU 23,18,0,mode,0,0,0,0,0,0
        Switch transparency mode
          mode = 0: "Text" mode: the whole display is set opaque
          mode = 1: "Mix" mode: foreground colours, and both foreground and
            background of boxed text are opaque; non-boxed background colours are
            all transparent
          mode = 2: "Box" mode: boxed regions are opaque, others are transparent
          mode = 3: "TV" mode: the whole display is set transparent
        Default is mode = 0.
    
      VDU 23,18,1,suspend,0,0,0,0,0,0
        Suspend or resume bitmap updates
        This call allows an application to request that the kernel suspends
        updates to the framebuffer bitmap. This allows for a significant speed
        increase in the rendering time for a large amount of text, for example
        when redrawing a complete teletext page, because each time you plot a
        single character, it can cause the whole of the rest of the line to be
        re-rendered. When you switch out of suspend mode, the whole screen is
        refreshed in a single pass. Note that the appearance of the display is
        undefined is you cause a hardware scroll while in suspend mode.
          suspend = 0: screen update is enabled
          suspend = 1: screen update is suspended
        Default is suspend = 0.
    
      VDU 23,18,2,reveal,0,0,0,0,0,0
        Reveal/conceal
          reveal = 0: characters between the Conceal control code and the next
            colour control code are replaced by spaces
          reveal = 1: all characters are displayed
        Default is reveal = 0.
    
      VDU 23,18,3,black_emable,0,0,0,0,0,0
        Enable/disable black foreground colour control codes
          black_enable = 0: control codes &80 and &90 do nothing
          black_enable = 1: control code &80 selects black text, control code
            &90 selects black graphics
        Default is black_enable = 0.
    
      I have performed some timing tests on the rendering of complete teletext
      pages grabbed from the teletext server. These show that the new code
      generally imposes a 2x speed hit. However, when using the VDU 23,18,1
      suspend function, this improves to a 20% speed increase when compared to
      the old low-resolution code. Better still, because the framebuffer is only
      being updated for the final stage of this process, the screen *appears* to
      be updated some 3x faster than with the old code!
    
      A comment on the VDU variable Log2BPC is in order: in previous kernels,
      this was able unambiguously to refer to both the framebuffer width of a
      character in bytes, and the framebuffer width of an "addressable pixel" in
      bits; this no longer works with the 16-pixel wide teletext font. Bearing
      in mind that future kernels may support Unicode system fonts where the
      width varies from character to character, I have chosen to fix Log2BPC to
      the "addressable pixel" definition.
    
    Admin:
      Requires HdrSrc 0.89 and (for non-desktop builds) Interlace 0.61. A monitor
      definition file containing a definition for a 640x500 screen mode is also
      required; version 0.40 of ModeFiles contains a suitable mode for STB-400.
    
      Tested fairly rigourously on an Ursula build, a Lazarus build and an
      STB-400 build, using genuine teletext pages and Yellow River Kingdom.
    
    Version 5.30. Tagged as 'Kernel-5_30'
    e87eeeca
vdugrafk 15.6 KB