home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI04.ARJ / ictari.04 / ASSEMBLY / DOCCY.S < prev    next >
Text File  |  1985-11-20  |  11KB  |  254 lines

  1. ; this is just a pre-release version of a doc displayer.
  2. ; please don't complain about the messy code or speed of it as it is not
  3. ; finished!!!!!!  I labeled it so you can follow it better.
  4. ; the text that was used origanaly was deemed unsuitable for public
  5. ; viewing so you get lots of boring stars instead.
  6.  
  7. * The problem is that it will not work properly when it is assembled like
  8. * a normal prg and run from the desktop, assemble it to memory and run it
  9. * in devpac and it works perfectly, now assemble it to disk and re-boot
  10. * the machine (med res), run the assembled prg... and watch it screw up
  11. * Why does it only work from devpac???   I found that resolution changes
  12. * (to med res) in the code make it screw up also, what does devpac do that
  13. * the desktop doesn't???
  14.  
  15. *       PLEASE HELP ME  its driving me up the wall!!!!!!    <T.S.C.>
  16.  
  17. ; Coded in Devpac v2.04 (old)  -  Tabs set to 10.
  18.  
  19. printat    macro    \1,\2,\3,\4
  20.     move.b    #\1,pr_col+2    the ink
  21.     move.b    #\2,d1
  22.     add.b    #32,d1    
  23.     move.b    d1,pr_loc+2    the row
  24.     move.b    #\3,d2
  25.     add.b    #32,d2
  26.     move.b    d2,pr_loc+3    the column    
  27.     move.l    \4,a3
  28.     move.l    a3,-(sp)
  29.     move.l    #pr_col,a3
  30.     move.l     a3,-(sp)
  31.     move.w    #9,-(sp)
  32.     trap    #1
  33.     addq.l    #6,sp
  34.     move.l    (sp)+,a3    retrieve the address of message
  35.     move.l     a3,-(sp)
  36.     move.w    #9,-(sp)
  37.     trap    #1
  38.     addq.l    #6,sp
  39.     endm
  40.  
  41. pages    equ    4        amount of pages
  42.  
  43.     pea    0.w        supervisor mode
  44.     move.w    #$20,-(sp)
  45.     trap    #1
  46.     addq.l    #6,sp
  47.     move.l    d0,oldsp
  48.  
  49.     bclr    #0,$484.w        no key click
  50.     bclr    #1,$484.w        no key repeat
  51.  
  52.     move.b    #$12,$fffffc02.w    bye bye Mr mouse
  53. ;    bsr    home        cursor home
  54.  
  55.     move.l    #1,pagecount    init stuff
  56.     bsr    clear        
  57.     lea    text,a0        a0 points to text
  58.     lea    buffer,a1        a1 points to buffer
  59.     bsr    first_p        display the first page
  60.  
  61. mainloop    cmp.b    #$48,$fffffc02.w    check for cursor up
  62.     bne.s    chk_down        no so next key check
  63.     bra.s    higher    
  64. chk_down    cmp.b    #$50,$fffffc02.w    cursor down
  65.     bne.s    chk_quit        
  66.     bra    lower
  67. chk_quit    cmp.b    #$01,$fffffc02.w    escape key
  68.     bne.s    mainloop    
  69.     bra    quit
  70.  
  71. higher    cmp.l    #1,pagecount    are we at the first page?
  72.     beq.s    mainloop        yes so cant go up anymore
  73.     sub.l    #1,pagecount   not on first page, sub 1 from page count
  74.     bsr    vsync
  75. ;    bsr    home        home position
  76.     bsr    clear        cls
  77.     lea    buffer,a1        get the buffer
  78.     sub     #3200,a0        up a page so sub 3200 bytes (20*80)
  79. ; i.e.  80 bytes per line and 20 lines
  80.     move.l    #20-1,d0        loop 20 times
  81. loop1    rept    20        handy command, saves typing a lot!
  82.     move.l    (a0)+,(a1)+    copy text to buffer
  83.     endr
  84.     dbf    d0,loop1        branch until false
  85.     clr.b    null        null terminate the text
  86.     printat    15,2,0,#buffer
  87. ;    bsr    print        print it
  88.     bra    mainloop        go back to main loop
  89.  
  90.  
  91. lower    cmp.l    #pages,pagecount    are we on the last page?
  92.     beq    mainloop        yes so cant go down no more
  93.     add.l    #1,pagecount    if going down add 1 to page count
  94.     bsr    vsync
  95. ;    bsr    home        home position
  96.     bsr    clear        cls
  97.  
  98. ;    lea    buffer,a1        down 1 line (ingnore for now)
  99. ;    add    #80,a0        
  100. ;    sub    #1840,a0        
  101.  
  102.     lea    buffer,a1        get buffer
  103.     move.l    #20-1,d0        loop 20 times
  104. loop2    rept    20
  105.     move.l    (a0)+,(a1)+    copy text to buffer
  106.     endr
  107.     dbf    d0,loop2
  108.     clr.b    null        null terminate the text
  109.     printat    15,2,0,#buffer
  110. ;    bsr.s    print        print it
  111.     bra    mainloop        back to main loop
  112.  
  113. first_p    lea    buffer,a1        come on you must get this 
  114.     move.l    #20-1,d0        by now?
  115. lop2    rept    20
  116.     move.l    (a0)+,(a1)+
  117.     endr
  118.     dbf    d0,lop2
  119.     clr.b    null
  120.     printat    15,2,0,#buffer
  121. ;    bsr.s    print
  122.     bra    mainloop    
  123.  
  124. clear    pea    robby        clear screen rout
  125.     move.w    #9,-(sp)
  126.     trap    #1
  127.     addq.l    #6,sp
  128.     rts
  129.  
  130. print    move.l    #buffer,-(sp)
  131.     move.w    #9,-(sp)
  132.     trap    #1
  133.     addq.l    #6,sp
  134.     rts
  135.  
  136. home    pea    homey        home position
  137.     move.w    #9,-(sp)
  138.     trap    #1
  139.     addq.l    #6,sp
  140.     rts
  141.  
  142. quit    move.b    #8,$fffffc02.w    mouse back
  143.     bset    #0,$484.w        key repeat and click back on
  144.     bset    #1,$484.w
  145.  
  146.     pea    oldsp        user mode
  147.     move.w    #$20,-(sp)
  148.     trap    #1
  149.      addq.l    #6,sp
  150.  
  151.     pea    0.w        exit
  152.     trap    #1
  153.  
  154. vsync    move.l    $466.w,d1        wait for next vbl
  155. vwait    cmp.l    $466.w,d1
  156.     beq.s    vwait
  157.     rts
  158.  
  159. oldsp    dc.l    0
  160. pr_col    dc.b 27,"b",15        no zero here! ,0
  161. pr_loc    dc.b 27,"Y",32,32,0,0    dynamic variables, liable to change!
  162.  
  163.     even
  164.  
  165. robby    dc.b    $1b,$45,0
  166. homey    dc.b     27,"H",0
  167.  
  168.     section bss
  169.  
  170. pagecount    ds.l    1
  171. buffer    ds.l    400
  172. null    ds.b    0
  173.  
  174.     section data
  175.  
  176.         *12345678901234567890123456789012345678901234567890123456789012345678901234567890*
  177.     
  178. text    dc.b    "   22 22 22  ******************************************************  22 22 22   "
  179.     dc.b    "  333 22 333  ****************************************************  333 22 333  "
  180.     dc.b    " 4444 22 4444  **************************************************  4444 22 4444 "
  181.     dc.b    "0******************************************************************************!"
  182.     dc.b    "********************************************************************************"
  183.     dc.b    "********************************************************************************"
  184.     dc.b    "********************************************************************************"
  185.     dc.b    "********************************************************************************"
  186.     dc.b    "********************************************************************************"
  187.     dc.b    "********************************************************************************"
  188.     dc.b    "********************************************************************************"
  189.     dc.b    "********************************************************************************"
  190.     dc.b    "********************************************************************************"
  191.     dc.b    "********************************************************************************"
  192.     dc.b    "********************************************************************************"
  193.     dc.b    "********************************************************************************"
  194.     dc.b    "********************************************************************************"
  195.     dc.b    "********************************************************************************"
  196.     dc.b    "********************************************************************************"
  197.     dc.b    "********************************************************************************"
  198.     dc.b    "********************************************************************************"
  199.     dc.b    "********************************************************************************"
  200.     dc.b    "********************************************************************************"
  201.     dc.b    "********************************************************************************"
  202.     dc.b    "********************************************************************************"
  203.     dc.b    "********************************************************************************"
  204.     dc.b    "********************************************************************************"
  205.     dc.b    "********************************************************************************"
  206.     dc.b    "********************************************************************************"
  207.     dc.b    "********************************************************************************"
  208.     dc.b    "********************************************************************************"
  209.     dc.b    "********************************************************************************"
  210.     dc.b    "********************************************************************************"
  211.     dc.b    "********************************************************************************"
  212.     dc.b    "********************************************************************************"
  213.     dc.b    "********************************************************************************"
  214.     dc.b    "********************************************************************************"
  215.     dc.b    "********************************************************************************"
  216.     dc.b    "********************************************************************************"
  217.     dc.b    "********************************************************************************"
  218.     dc.b    "********************************************************************************"
  219.     dc.b    "********************************************************************************"
  220.     dc.b    "********************************************************************************"
  221.     dc.b    "********************************************************************************"
  222.     dc.b    "********************************************************************************"
  223.     dc.b    "********************************************************************************"
  224.     dc.b    "********************************************************************************"
  225.     dc.b    "********************************************************************************"
  226.     dc.b    "********************************************************************************"
  227.     dc.b    "********************************************************************************"
  228.     dc.b    "********************************************************************************"
  229.     dc.b    "********************************************************************************"
  230.     dc.b    "********************************************************************************"
  231.     dc.b    "********************************************************************************"
  232.     dc.b    "********************************************************************************"
  233.     dc.b    "********************************************************************************"
  234.     dc.b    "********************************************************************************"
  235.     dc.b    "********************************************************************************"
  236.     dc.b    "********************************************************************************"
  237.     dc.b    "********************************************************************************"
  238.     dc.b    "t0hough!!!!!!!!..........                                                       "
  239.     dc.b    "q1                                                                              "
  240.     dc.b    "e2                                                                              "
  241.     dc.b    "g3                                                                              "
  242.     dc.b    "94                                                                              "
  243.     dc.b    "85                                                                              "
  244.     dc.b    "76                                                                              "
  245.     dc.b    "67                                                                              "
  246.     dc.b    "58                                                                              "
  247.     dc.b    "49                                                                              "
  248.     dc.b    "30                                                                              "
  249.     dc.b    "2s                                                                              "
  250.     dc.b    "1a                                                                              "
  251.     dc.b    "033000000                                                             ",0
  252.     
  253.  
  254.