[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

851.0. "screen base address" by COMICS::DSMMGR () Thu Apr 26 1990 14:13

    It had to happen sooner or later !!!
    
    I am venturing into the world of Assembler for the 68000.
    
    So I have a really basic question and please don't laugh because at the
    moment all I have for instuction are a few tutorials out of some old 
    issues of my ST magazine.
    
    My question is where do I find the base address for the screen ?
    
    The tutorial says that the following code should clear the screen
    
            MOVEA.L A5,A0 get screen base address
            MOVE #32000,D0 repeat 32000 times
    LOOP    MOVE.B #0,(A0)+ clear byte and post increment
            SUB #1,D0 count down
            BNE LOOP loop round until D0=0
    
    I realise this is pretty basic (sic) and can be refined to be more
    efficient, but the thing is I coded and assembled it into a .PRG
    and it crashed with four bombs (I think) 
    
    The only thing I could think that was wrong is that address register 5 
    was not pointing to the screen base address and therefore I splatted
    memory at wherever it was pointing.
    
    So, where is the screen base address held ?
    
    Sorry for the trivial question but thanks for the answer
    
    Jonathan_who_knows_nothing_about_68000_assembly_language_programming___yet
    
T.RTitleUserPersonal
Name
DateLines
851.1Get it from XBIOS function code 3PRNSYS::LOMICKAJJeffrey A. LomickaThu Apr 26 1990 15:5122
You should do all of your drawing to the 32K block of memory whose
starting address is returned by the XBIOS call "Logbase()".  This is
XBIOS function 3.  This could be anywhere, depending on how much memory
your ST has, and what you have installed in the auto folder, etc.

The screen memory actually begins at Physbase().  These two are usually
equal, but there are several important cases where they differ:

- Multi-frame smooth animation will allocate two screenfuls of memory,
and draw to one off-screen while displaying the previous frame.  At video
interrupt time (right after a call to Vsync()) it will swap the two.

- The various 19" monitors will put you in a situation where Logbase()
is correct fo rht e19" tube, but Physbase() will still be pointing to
the display on the 12" monitor.

so for those reasons, you should always DRAW to Logbase(), and that's
what the ROMs do.

(Also, in general, you can't hard-code 32000, but computing the correct
value for all cases is a more advanced topic that can wait until you
have more experience with this.)
851.2...huh...??...COMICS::DSMMGRThu Apr 26 1990 16:2119
    Wow... I feel dizzy.... huh ??????
    
    Thanks Jeff, I thought you might answer this one for me, but what in
    the world are you talking about 8^) 8^)
    
    Like I said in the first entry, I know NOTHING and am only working from 
    an example ASSEMBLY language code segment that was given in an article
    I was reading.
    
    All I want to do is to write a program in assembler to clear the screen
    by zeroing out the relevant screenm memory bits. Maybe I need to, but
    I know nothing about XBIOS etc and so your reply is double-dutch to me.
    
    Can you perhaps supply me a little Assembler routine to do this...
    liberally commented please.
    
    Still confused but grateful anyway,
    
    Jonathan
851.3Perhaps the caller can provide itPRNSYS::LOMICKAJJeffrey A. LomickaThu Apr 26 1990 18:073
What is your "parent" language, that is, how are you invoking this
assembly routine?  C, Basic?

851.4ASDS::POWERSI Dream Of Wires - G. NumanMon Apr 30 1990 11:2960
  re: .0

     Here is a couple of examples for you to play with.  There are other ways
  to do this, as well as variations on these.  These are left as an exercise
  to the reader. 8-)  Hopefully I haven't made any typo's in these, they are
  untested.

  Bill Powers

------------------------------------------------------------------------------


*
* several examples of clearing the screen
*

*
* example 1: This first example gets the logical screen base, and clears the
* next 32000 bytes of memory, thus clearing the screen.  This is *NOT* a
* recomended way to clear the screen, as there are atari systems which need
* a larger value. ie - moniterm, and any system which has made the overscan
* mod.
*
*
* get the logical screen base
*
                move.w      #3,-(sp)      * xbios function - logbase()
                trap        #14           * call xbios
                addq.l      #2,sp         * cleanup stack
*
* at this point, a0 now points to the logical screen base in memory
* the next piece of code taken from base note.
*
                move.l      #32000,d0     * repeat 32000 times
loop            move.b      #0,(a0)+      * clear byte and post increment
                subq.l      #1,d0         * count down
                bne         loop          * loop round until D0=0

*
* example 2: This next example is not the best way to clear the screen, but
* is probably the most intuitive.  It simply write to the display the vt52
* escape codes to clear the display.  This would be better than example 1
* because gemdos should handle all size screens.
*
                move.l      #esc_seq,-(sp) * push ptr to string on stack
                move.l      #$09,-(sp)     * gemdos function - printline()
                trap        #1             * call gemdos
                addq.l      #6,sp          * cleanup stack
*
* the escape sequence below should be located in the data section of the 68000
* assembly language program not in the instruction stream as it appears here.
*
esc_seq
                dc.b        27             * escape seq to clear screen and
                dc.b        'E'            * leave cursor in upper left.
                dc.b        0


                
851.5thanksCOMICS::DSMMGRTue May 01 1990 09:275
    thank you very much indeed. that was just what I needed.
    
    The novice 68000 programmer,
    
    Jonathan