Loading ...
Sorry, an error occurred while loading the content.

[intvprog] EXEC Print routines

Expand Messages
  • Merrick J. Stemen
    RE: EXEC Routines at $1867, $186C, $1871, $187B: ;*************************************************************** ; PRINT.ASCIZ.TEXT
    Message 1 of 4 , Feb 5, 2000
    View Source
    • 0 Attachment
      RE: EXEC Routines at $1867, $186C, $1871, $187B:

      ;***************************************************************
      ; PRINT.ASCIZ.TEXT
      ;***************************************************************
      Write to @ R4 from @ R1 using R3 colour:
      ;***************************************************************
      $1867 -- print asciz text
      $186C -- print asciz text with R0 prefill
      ;***************************************************************
      Write to @ R4 from @ R5 using R3 colour:
      ;***************************************************************
      $1871 -- print asciz text with R0 prefill
      $187B -- print asciz text
      ;***************************************************************

      The 'prefill' versions of these commands use R0 to clear
      a field width using the attribute bits set in R3.

      ;***************************************************************
      For Colour Stack mode (CS) the R3 attribute takes the form:
      [??aF tnnn nnnn nfff] where 'Ffff' is the foreground colour.

      When using Colour Stack (CS) mode, I noticed that a CS Advance
      affects the remainder of the screen until another CS advance
      counteracts it. This makes it difficult to use the 'prefill'
      versions of the commands if one wants to change the background
      colour for a specific print area because the CS advance will
      paint the remainder of the screen beyond the specified R0 width.

      ;***************************************************************
      For Fore/Back mode (FB) the R3 attribute takes the form:
      [??bB tbbn nnnn nfff] where 'Bbbb' is the background colour.

      FB mode worked well with both the normal and prefill versions
      of these commands.

      *Notice that the HI bit of the background color is reversed!*
      ( e.g., one might expect the colour 'Grey' [1000] to go into the
      attribute as [??10 t00n nnnn nfff], but it does not; it goes in
      as [??01 t00n nnnn nfff] )

      ( see De Re Intellivision, Part 2 for more details. )
      ;***************************************************************

      It is easy to try these out in the HelloWorld program on
      Michael Hayes' site. >:-)
    • Not Your Average Joe
      Merrick, Care to put up a web page as you work out documentation? It could be useful resource, I think. ... Yes. As far as the Color Stack is concerned,
      Message 2 of 4 , Feb 5, 2000
      View Source
      • 0 Attachment
        Merrick,

        Care to put up a web page as you work out documentation? It could
        be useful resource, I think.

        > ;***************************************************************
        > For Colour Stack mode (CS) the R3 attribute takes the form:
        > [??aF tnnn nnnn nfff] where 'Ffff' is the foreground colour.
        >
        > When using Colour Stack (CS) mode, I noticed that a CS Advance
        > affects the remainder of the screen until another CS advance
        > counteracts it.

        Yes. As far as the Color Stack is concerned, cards are processed
        in normal reading order, left to right, top to bottom. A typical
        use is to set up a horizontal field by setting the CS advance
        bits on the first card of the field and the first card after the
        field.

        In "FOOTBALL", this is how they define the colors for the playing
        field. The color stack is advanced once at the top of the playing
        field, and once after the bottom.

        For a vertical column, you need to set the CS bits on the left edge
        and just to the right of the right edge of the column. I do this
        in "Tetris" for the well, since I use the Color Stack to set color
        7 for the colored squares. You end up being restricted to 2 colors
        repeated twice in the color-stack this way though.

        > This makes it difficult to use the 'prefill'
        > versions of the commands if one wants to change the background
        > colour for a specific print area because the CS advance will
        > paint the remainder of the screen beyond the specified R0 width.

        One useful thing to note: These routines return with R4 pointing
        just to the right of the string. This means you can do a "MVO@ ..., R4"
        to set the CS advance bit on the word just after the string pretty
        easily.

        Also, the display routines will clear the color-stack advance bit
        for you as long as the EXEC thinks you're in color-stack mode. If
        it didn't do this, then the entire string would have a different
        background color for each character, which is rarely useful.

        The EXEC stores the Color Stack vs. Foreground/Background flag in
        the least sigificant bit of location $105. This flag is set
        correctly for you if you use the bits in cartridge header to control
        display mode. If you control the display mode yourself by
        reading/writing location $21, you'll have to be careful about what's
        in $105.


        > ;***************************************************************
        > For Fore/Back mode (FB) the R3 attribute takes the form:
        > [??bB tbbn nnnn nfff] where 'Bbbb' is the background colour.
        >
        > FB mode worked well with both the normal and prefill versions
        > of these commands.

        Again, be careful to manage location $105 if you're using this
        routines, since this routine clears the color-stack advance bit
        after the first character. Incidentally, that bit corresponds to
        the "out of place" bit for the background color in FB mode. :-)

        Here's the code which does the magic:

        $1889: SUBI #$0020,R0 ; Adjust ASCII to card #.
        $188B: SLL R0,2 ; Shift left by 3.
        $188C: SLL R0 ; ....
        $188D: XORR R3,R0 ; Merge with format word
        $188E: MVO@ R0,R4 ; Store to display
        $188F: MVI $0105,R0 ; Get display mode flag
        $1891: RRC R0 ; Put bit 0 in carry
        $1892: BC $187f ; If set, do nothing for FB mode.
        $1894: SDBD ; Otherwise, clear CS advance bit
        $1895: ANDI #$dfff,R3 ; in the screen format word.
        $1898: B $187f ; Do next character.

        Happy programming everyone!

        Regards,

        --Joe

        --
        ------------------------------------------------------------------------------
        Joseph Zbiciak http://www.primenet.com/~im14u2c/ Not your average "Joe"
        R$+@$=W <-- sendmail.cf {$/{{.+ <-- modem noise
        !@#!@@! <-- Mr. Dithers swearing Zbiciak <-- Joe's last name
        ---------------------- Member of the Intellivisionaries ----------------------
      • Mr. Merrick J. Stemen
        Hello Joe! ... But, if someone wants to output a string in a field of width R0 with a background colour wider than the string (like a title bar), he would not
        Message 3 of 4 , Feb 6, 2000
        View Source
        • 0 Attachment
          Hello Joe!

          > > This makes it difficult to use the 'prefill'
          > > versions of the commands if one wants to change the background
          > > colour for a specific print area because the CS advance will
          > > paint the remainder of the screen beyond the specified R0 width.

          > One useful thing to note: These routines return with R4 pointing
          > just to the right of the string. This means you can do a "MVO@ ..., R4"
          > to set the CS advance bit on the word just after the string pretty
          > easily.

          But, if someone wants to output a string in a field of width R0 with a
          background colour wider than the string (like a title bar), he would not
          want to use R4 to advance the colour stack until he advanced it past the end
          of his field area.

          > The EXEC stores the Color Stack vs. Foreground/Background flag in
          > the least sigificant bit of location $105. This flag is set
          > correctly for you if you use the bits in cartridge header to control
          > display mode. If you control the display mode yourself by
          > reading/writing location $21, you'll have to be careful about what's
          > in $105.
          >

          Here's the cartridge header code that does the magic: :-)

          ;;-----------------------------------------------------------------------
          ROMHDR:
          WORD MOVOBJECTS ; Movable Object Data Pointer
          WORD RTAB ; RTAB
          WORD START ; START of program
          WORD BKGRAPHICS ; Background graphics pointer
          WORD CARDTAB ; CARDTAB
          WORD TITLE ; Pointer to ASCIIZ Title String

          BYTE $80 ; Bit 7 SET -- Run code after title
          BYTE $00 ; H/V offset (bit 0=Hz; bit 1=Vt)
          >>>> BYTE $00 ; Graphic mode select (0=CS; 1=F/B) [$105]
          BYTE 1, 1, 1, 1 ; Color Stack data (All blue)
          BYTE $02 ; Red Border

          Enjoy!
        • Not Your Average Joe
          ... Howdy! ... True. Basically, if I m understanding correctly, you d want to advance the color stack on the first character of the field and the first
          Message 4 of 4 , Feb 6, 2000
          View Source
          • 0 Attachment
            > Hello Joe!

            Howdy!

            > But, if someone wants to output a string in a field of width R0 with a
            > background colour wider than the string (like a title bar), he would not
            > want to use R4 to advance the colour stack until he advanced it past the end
            > of his field area.

            True. Basically, if I'm understanding correctly, you'd want to
            advance the color stack on the first character of the field and
            the first character after the field, so that the field used a
            different color stack entry than the text before and after it.
            And, the text itself may or may not be shorter than the field
            width.

            In this case, it'd be easier to go set that bit in the first card
            after the field the "hard way". With direct addressing, of course
            it's not that hard, it just costs you a couple more decles.
            Depending on what you're doing, you might be able do it once while
            you're setting up the display at the start of the game. That's
            how Tetris works with its color-stack advance bits.

            Regards,

            --Joe

            --
            ------------------------------------------------------------------------------
            Joseph Zbiciak http://www.primenet.com/~im14u2c/ Not your average "Joe"
            R$+@$=W <-- sendmail.cf {$/{{.+ <-- modem noise
            !@#!@@! <-- Mr. Dithers swearing Zbiciak <-- Joe's last name
            ---------------------- Member of the Intellivisionaries ----------------------
          Your message has been successfully submitted and would be delivered to recipients shortly.