Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - vidaddr() return the address of the first video page http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 vidaddr()           Return the address of the first video page
------------------------------------------------------------------------------
 Declaration
   screen.hdr

 Syntax
   func ulong vidaddr extern

 Arguments
   None.

 Return
   Address of top of video memory.

 Description
   This function returns the address of the first screen position (top
   left) in video memory (page 0). Consecutive direct screen accesses should
   be based on that address.

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   func ptr( byte ) ScrPtr
   param value uint nRow, value uint nCol
   // Return address of a screen position in video memory
   return( ( vidaddr() + ;
      longshiftleft( ( nRow * ( __max_col + 1 ) + nCol ), 1 ) ) )
   endfunc
   
   proc DirectWrite
   param value uint nRow, value uint nCol, const char cString
   // Write a string directly into the video memory
   vardef
      ptr( byte ) pScr
      ptr( byte ) pChar
   enddef
   pScr := ScrPtr( nRow, nCol )
   pChar := &cString
   do while *pChar
      *pScr := *pChar
      pScr += 2
      pChar++
   enddo
   endproc
   
   proc Test_vidaddr
   DirectWrite( 10, 20, "Force compiler" )
   endproc

   proc main
   Test_vidaddr()
   endproc

See Also: scrseg() videotype()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson