home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Source / pheno.lha / pha / RitProgram.s < prev    next >
Encoding:
Text File  |  1987-12-17  |  4.6 KB  |  266 lines

  1.         ;--------------------------
  2.         ;--  Liten PrinterRutin  --
  3.         ;--------------------------
  4.  
  5. org    $20000
  6. load    $20000
  7.  
  8.  
  9. S:        movem.l    d0-d7/a0-a6,-(sp)
  10.         bsr.S    SaveAll
  11.         bsr    InitSpr
  12.         bsr    InitScreen
  13.         bsr    StartCopper
  14.         bsr    MainLoop
  15.         bsr    RestoreAll
  16.         movem.l    (sp)+,d0-d7/a0-a6
  17.         rts
  18.  
  19. SaveAll:    move.l    $4.W,a6
  20.         lea.l    GfxName(pc),a1
  21.         moveq    #0,d0
  22.         jsr    -408(a6)
  23.         move.l    d0,a0
  24.         lea    OldCop(pc),a2
  25.         move.l    $26(a0),(a2)+
  26.         move.l    a0,a1
  27.         jsr    -414(a6)
  28.         lea    $dff000,a6
  29.         move.w    2(a6),d0
  30.         bset    #15,d0
  31.         move.w    d0,(a2)+
  32.         move.w    #$4000,$9a(a6)
  33.  
  34.         lea    $bfd100,a0
  35.         move.b    #$fd,(a0)
  36.         nop
  37.         nop
  38.         move.b    #$f5,(a0)
  39.         rts
  40.  
  41. RestoreAll:    lea    OldCop(pc),a0
  42.         move.l    (a0)+,$80(a6)
  43.         tst.w    $88(a6)
  44.         move.w    (a0),$96(a6)
  45.         rts
  46.  
  47. InitSpr:    lea.l    CopperList(pc),a0
  48.         move.l    #BlindSpr,d0
  49.         moveq    #8-1,d7
  50. SprLoop1:    swap    d0
  51.         move.w    d0,2(a0)
  52.         swap    d0
  53.         move.w    d0,6(a0)
  54.         addq.l    #8,a0
  55.         dbra    d7,SprLoop1
  56.         move.l    #Pekare,d0
  57.         lea.l    CopperList(pc),a0
  58.         swap    d0
  59.         move.w    d0,2(a0)
  60.         swap    d0
  61.         move.w    d0,6(a0)
  62.         lea    OldX(pc),a0
  63.         move.b    $b(a6),(a0)+
  64.         move.b    $a(a6),(a0)+
  65.         rts
  66.  
  67. StartCopper:    lea    CopperList(pc),a0
  68.         move.l    a0,$80(a6)
  69.         tst.w    $88(a6)
  70.         move.w    #$85c0,$96(a6)
  71.         rts
  72.  
  73. InitScreen:    bsr.S    WB
  74.         moveq    #-1,d1
  75.         move.l    d1,$44(a6)
  76.         move.l    #$01000000,$40(a6)
  77.         move.l    Screen(pc),$54(a6)
  78.         clr.w    $66(a6)
  79.         move.w    #256*64+20,$58(a6)
  80.         bsr.S    WB
  81.         move.l    Screen(pc),d0
  82.         lea    BMap+6(pc),a0
  83.         move.w    d0,4(a0)
  84.         swap    d0
  85.         move.w    d0,(a0)
  86.         lea    BildPointer(pc),a0
  87.         lea    Bild(pc),a1
  88.         move.l    a1,(a0)
  89.         rts
  90.  
  91. WB:        btst    #14,2(a6)
  92.         bne.S    WB
  93.         rts
  94.  
  95. Screen:        dc.l    $70000
  96.  
  97. ;----------------------------------------------------------------------
  98.  
  99. MainLoop:    cmp.b    #-1,$6(a6)
  100.         bne.S    MainLoop
  101. W2:        cmp.b    #$38,$6(a6)
  102.         bne.S    W2
  103.         bsr.S    Pointer
  104.         btst    #6,$bfe001
  105.         bne.S    IngenPrick
  106.         bsr    GetPrick
  107. IngenPrick:    btst    #10,$16(a6)
  108.         bne.S    MainLoop
  109.         rts
  110.  
  111. Pointer:    lea.l    Pekare(pc),a0
  112.         moveq    #0,d0
  113.         moveq    #0,d1
  114.         lea    OldX(pc),a2
  115.         move.b    $b(a6),d0
  116.         move.b    $a(a6),d1
  117.         sub.b    (a2)+,d0
  118.         sub.b    (a2)+,d1
  119.         lea    2(a2),a3
  120.         ext.w    d0
  121.         ext.w    d1
  122.         add.w    d0,(a2)
  123.         add.w    d1,(a3)
  124.         cmp.w    #$128,(a3)
  125.         bmi.S    nn1
  126.         move.w    #$128,(a3)
  127. nn1:        cmp.w    #$29,(a3)
  128.         bhi.S    nn2
  129.         move.w    #$29,(a3)
  130. nn2:        cmp.w    #$a0,(a2)
  131.         bhi.S    nn3
  132.         move.w    #$a0,(a2)
  133. nn3:        cmp.w    #$1a0,(a2)
  134.         bmi.S    nn4
  135.         move.w    #$1a0,(a2)
  136. nn4:        move.w    (a2),d0
  137.         lsr.w    #1,d0
  138.         move.b    d0,1(a0)
  139.         move.w    (a2),d1
  140.         and.w    #$1,d1
  141.         move.w    (a3),d0
  142.         cmp.w    #$100,d0
  143.         blo.S    NoPal
  144.         bset    #2,d1
  145. NoPal:        addq.w    #7,d0
  146.         cmp.w    #$100,d0
  147.         blo.S    NoPal3
  148.         bset    #1,d1
  149. NoPal3:        subq.w    #$7,d0
  150.         move.b    d1,3(a0)
  151.         move.b    d0,(a0)
  152.         add.b    #$7,d0
  153.         move.b    d0,2(a0)
  154.         move.b    $b(a6),-2(a2)
  155.         move.b    $a(a6),-1(a2)
  156.         rts
  157.  
  158. GetPrick:    lea    NewX(pc),a0
  159.         move.w    (a0)+,d0
  160.         move.w    (a0),d1
  161.         sub.w    #$7c,d0
  162.         sub.w    #$29,d1
  163.  
  164.         move.l    BildPointer(pc),a1
  165.         moveq    #0,d2
  166.         moveq    #0,d3
  167.         move.b    -2(a1),d2
  168.         move.b    -1(a1),d3
  169.         sub.w    d0,d2
  170.         sub.w    d1,d3
  171.         tst.w    d2
  172.         bne.S    DrawRest
  173.         tst.w    d3
  174.         bne.S    DrawRest
  175.         rts
  176.  
  177. DrawRest:    bsr    DrawValues
  178.         rts
  179.  
  180. DrawValues:    moveq    #0,d2
  181.         moveq    #0,d3
  182.         move.b    -2(a1),d2
  183.         move.b    -1(a1),d3
  184. DrawLoop:    btst    #10,$16(a6)
  185.         beq.S    I
  186.         move.w    d0,d4
  187.         move.w    d1,d5
  188.         sub.w    d2,d4
  189.         bgt.S    NopIt
  190.         subq.w    #1,d0
  191.         bra.S    CheckY
  192. NopIt:        addq.w    #1,d0
  193. CheckY:        sub.w    d3,d5
  194.         bgt.S    NopIt2
  195.         subq.w    #1,d1
  196.         bra.S    PlotIt
  197. NopIt2:        addq.w    #1,d1
  198. PlotIt:        bsr.S    Plot
  199.         cmp.w    d0,d2
  200.         bne.S    DrawLoop
  201.         cmp.w    d1,d3
  202.         bne.S    DrawLoop
  203. I:        rts
  204.  
  205. Plot:        movem.w    d0-d2/a2,-(sp)
  206.         mulu    #40,d1
  207.         move.w    d0,d2
  208.         lsr.w    #3,d0
  209.         and.w    #$7,d2
  210.         eor.w    #$7,d2
  211.         move.l    Screen(pc),a2
  212.         add.w    d1,d0
  213.         bset    d2,(a2,d0.W)
  214.         movem.w    (sp)+,d0-d2/a2
  215.         rts
  216.  
  217. OldX:        dc.b    0
  218. OldY:        dc.b    0
  219. NewX:        dc.w    0
  220. NewY:        dc.w    0
  221.  
  222. ;------------------------------------------------------------------------
  223.  
  224. CopperList:    dc.l    $01200000,$01220000,$01240000,$01260000
  225.         dc.l    $01280000,$012a0000,$012c0000,$012e0000
  226.         dc.l    $01300000,$01320000,$01340000,$01360000
  227.         dc.l    $01380000,$013a0000,$013c0000,$013e0000
  228.  
  229.         dc.l    $008e2c71,$00902cc0,$00920038,$009400d0
  230.         dc.l    $01020000,$01040020,$01080000,$010a0000
  231.         dc.l    $01800000,$01820311
  232.         dc.l    $01a20008,$01a4000c,$01a60fff
  233. BMap:        dc.l    $01001000,$00e00000,$00e20000
  234.  
  235.         dc.l    $2b07fffe,$01800fff
  236.         dc.l    $2c07fffe,$01800632
  237.  
  238.         dc.l    $ffddfffe,$2c07fffe,$01800fff
  239.         dc.l    $2d07fffe,$01800000
  240.  
  241.         dc.l    -2
  242.  
  243. ;------------------------------------------------------------------------
  244.  
  245. OldCop:        dc.l    0
  246. OldDma:        dc.w    0
  247. BlindSpr:    dc.l    0
  248. GfxName:    dc.b    'graphics.library',0
  249.         even
  250.  
  251. Pekare:
  252. dc.w    $2c40,$3300
  253. dc.w    %0001000000000000,%0000000000000000
  254. dc.w    %0000000000000000,%0001000000000000
  255. dc.w    %0001000000000000,%0000000000000000
  256. dc.w    %1011101000000000,%0101010000000000
  257. dc.w    %0001000000000000,%0000000000000000
  258. dc.w    %0000000000000000,%0001000000000000
  259. dc.w    %0001000000000000,%0000000000000000
  260. dc.l    0,0,0,0
  261.  
  262. BildPointer:    dc.l    0
  263.  
  264. Bild:
  265.  
  266.