home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI04.ARJ / ictari.04 / ASSEMBLY / FLIP_IT2.S < prev    next >
Text File  |  1991-07-06  |  5KB  |  190 lines

  1.     opt o+
  2. *******************************************************************
  3. ***           The Funky Screen Flipper            ***
  4. ***                                ***
  5. ***              Written by                ***
  6. ***                                ***
  7. ***        The Hitchhiker, The Tempest and Itself..!        ***
  8. ***                                ***
  9. ***          Self writing version - 9th March 1991        ***
  10. ***                                ***
  11. ***                                ***
  12. *******************************************************************
  13.  
  14.     COMMENT HEAD=1        * Set fastload bit for TOS 1.4+
  15.  
  16.     section text
  17.  
  18.     move.l    #message,-(sp)        * Print welcome message
  19.     move.w    #9,-(sp)
  20.     trap    #1
  21.     addq.l    #6,sp
  22.     move.w    #7,-(sp)        * Wait keypress
  23.     trap    #1
  24.     addq.l    #2,sp
  25.  
  26.  
  27.     lea     newscre,a0        * new screen store
  28.     move.l    a0,d0
  29.     move.l    #%11111111111111111111111000000000,d1
  30.     and.l    d0,d1        * force 512 byte border
  31.     add.l    #512,d1        * new logbase is in d1
  32.     
  33.     move.l    d1,logbase
  34.     
  35.     move.w     #-1,-(sp)    * now call setscreen
  36.     move.l     #-1,-(sp)    * to set logbase to
  37.     move.l    d1,-(sp)    * point to our screen
  38.     move.w    #5,-(sp)    * buffer.
  39.     trap    #14
  40.     add.l    #12,sp
  41.  
  42.     lea     count,a0
  43.     move.b    #0,(a0)
  44.  
  45.     move    #2,-(sp)
  46.     trap    #14
  47.     addq.l    #2,sp        * get physbase
  48.     
  49.     move.l    d0,a0
  50.     move.l    a0,phybas    *store physbase
  51.  
  52.  
  53.     move.w    #4,-(sp)    * Getrez
  54.     trap    #14
  55.     addq.l    #2,sp
  56.     
  57.     lea    scrmov,a4    * set addr of routine
  58.     
  59.     lea    phybas,a5
  60.     move.l    (a5),d7
  61.     
  62.     cmpi.w    #2,d0        * mono ?
  63.     bne.s    setcol        * no - colour setuo
  64.     
  65.     move.w    #399,d2            * number of lines
  66.     move.w    #1,d4            * (movems/line)-1
  67.     move.w    #160,d5            * bytes per line
  68.     add.l    #31920,d7        * start of end line
  69.     bra.s     skip
  70.  
  71. setcol
  72.     move.w    #199,d2            * number of lines
  73.     move.w    #3,d4            * (movems/line)-1
  74.     move.w    #320,d5            * bytes per line
  75.     add.l    #31840,d7        * start of end line
  76. skip
  77.  
  78.     move.l    d7,phybas
  79.     
  80.     lea    selfwrt,a0        *a0 points to start of move     
  81. bigloop
  82.     move    d4,d0            * number of moves less one    
  83. loopwrt
  84.     move.l    #$4cdd03ff,(a0)+    * this is movem.l (a5)+,d0-a1
  85.     move.l    #$48d603ff,(a0)+    * this is movem.l d0-a1,(a6)
  86.     move.l    #$ddfc0000,(a0)+    * this writes some of ....
  87.     move.w    #$0028,(a0)+        * add.l    #40,a6
  88.  
  89.     dbra    d0,loopwrt        * do again
  90.  
  91.     move.l    #$9dfc0000,(a0)+    * write sub.l #bytes/line,a0
  92.     move    d5,(a0)+         * ditto
  93.     dbra    d2,bigloop        * do it again 
  94.     move    #$4e75,(a0)+        * write rts 
  95.  
  96.     clr.l    -(sp)            * now lets jump into
  97.     move.w    #$20,-(sp)        * supervisor mode
  98.     trap    #1
  99.     addq.l    #6,sp
  100.     move.l    d0,supsta
  101.     
  102.     move.l    ($456).w,a0        * address of VBI queue
  103.     
  104.     move.w    #7,d0            * scan for empty VBI slot
  105. loop    move.l    (a0)+,d1
  106.     beq.s    found
  107.     dbra    d0,loop
  108.  
  109.     move.l    supsta,-(sp)        * back to user mode
  110.     move.w    #$20,-(sp)
  111.     trap    #1
  112.     addq.l    #6,sp
  113.     
  114.     move.l    #0,-(sp)        * PTERM - just in case...!
  115.     trap #1
  116.     
  117. found    subq.l    #4,a0            * Correct address
  118.     move.l    a4,(a0)            * Insert new VBL routine
  119.     
  120.     move.l    supsta,-(sp)        * back to user mode
  121.     move.w    #$20,-(sp)
  122.     trap    #1
  123.     addq.l    #6,sp
  124.     
  125.     move.w    #0,-(sp)        * terminate and stay resident
  126.     move.l    #50000,-(sp)        * keeping 50K
  127.     move.w    #$31,-(sp)
  128.     trap #1
  129.  
  130. scrmov                    * move routines
  131.     lea    count,a0
  132.     move.b (a0),d0
  133.     cmpi.b    #3,d0            * shall I update ?
  134.     beq.s cont            * yes - branch
  135.     addq.b    #1,d0            * no - increment counter
  136.     move.b d0,(a0)            * store counter
  137.     rts                * bye bye
  138.  
  139. cont     
  140.     move.b    #0,(a0)            * reset counter
  141.     lea    logbase(pc),a2
  142.     move.l    (a2),a5        * get logbase
  143.     lea    phybas(pc),a2
  144.     move.l    (a2),a6        * get physbase
  145.  
  146.     jsr    selfwrt
  147.     rts
  148.  
  149.  
  150. message    dc.b    27,"E",27,"f"
  151.     dc.b    "/==========================================\",13,10
  152.     dc.b    "|",27,"p     Mega Funky Screen Flipper! v2.0      ",27,"q|",13,10
  153.     dc.b    "\==========================================/",13,10
  154.     dc.b    13,10
  155.     dc.b    "               Written by",13,10
  156.     dc.b    "     The Tempest and The Hitchhiker",13,10
  157.     dc.b    "             Of The Revenge",13,10
  158.     dc.b    13,10
  159.     dc.b    "    Warning: This program can",13,10
  160.     dc.b    "    seriously damage your sanity.",13,10
  161.     dc.b    13,10
  162.     dc.b    "    Version 2.0 is a lot faster and",13,10
  163.     dc.b    "    was much stranger to program.  Try",13,10
  164.     dc.b    "    looking at it using MonST...!",13,10
  165.     dc.b    13,10
  166.     dc.b    "    This program was written whilst",10,13
  167.     dc.b    "    under the influence of Steve Vai's",10,13
  168.     dc.b    "    Flexable - Highly recommended.",10,13
  169.     dc.b    13,10
  170.     dc.b    "    P.S. Do not try to read the",13,10
  171.     dc.b    "    the text while standing on your",13,10
  172.     dc.b    "    head unless you have a mirror",13,10
  173.     dc.b    "    as well...!",13,10
  174.     dc.b    13,10
  175.     dc.b    "    ",27,"p Hit any key to phreak out...! ",27,"q",0
  176.  
  177.     even
  178.  
  179.  
  180.     section bss
  181.  
  182. phybas  ds.l 1             * store for physbase
  183. supsta    ds.l 1            * store for super stack pntr
  184. logbase    ds.l 1            * store for logbase
  185. newscre    ds.l 8130        * new screen
  186. count    ds.b 1            * frame coutner
  187.     even
  188.     ds.w 10
  189. selfwrt    ds.b 13000        *space for code to be written
  190.