home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / dse-src5.dms / in.adf / gold1.s < prev    next >
Encoding:
Text File  |  1990-05-07  |  9.2 KB  |  490 lines

  1. ;Do this to start the program:
  2. ;r <ret> df1:gold1 <ret>
  3. ;a <ret> <ret>
  4. ;ri <ret> df1:goldfont2 <ret> zeichen <ret> <ret>
  5. ;j <ret> 
  6.  
  7. ;To start after pressing the mouse without assembling it again
  8. ;type: js <ret>
  9. ;If you change the program then you MUST assemble the program again.
  10.  
  11. ;<ret> = return
  12.  
  13. s:
  14. execbase = 4                ;basicadresse exec.library
  15.  
  16. forbid   = -132                ;forbid task switching
  17. permit   = -138                ;permit task switching
  18. openlib  = -408                ;open a library
  19. closelib = -414                ;close a library
  20.  
  21. start:    movem.l    a0-a6,-(a7)        ;save CPU-register
  22.     lea    $70000,a0
  23.     move.w    #$2000,d0
  24. cloop:    clr.b    (a0)+
  25.     dbf    d0,cloop
  26.  
  27.     move.l    execbase.w,a6
  28.     jsr    forbid(a6)        ;forbid task switching
  29.     bsr    do_open            ;open graphics.library
  30.     bsr    install_bitplanes    ;write bpl-starts into coplist
  31.  
  32.     lea    $dff000,a6        ;CustomChip base
  33.     move.l    #coplist,$0080(a6)    ;activate new Coplist
  34.     clr.w    $0088(a6)
  35.     move.w    #$0020,$009a(a6)    ;disable vert.blanc IRQ
  36.     move.w    #$8010,$009a(a6)    ;enable Copper IRQ
  37.     move.l    $006c.w,irq_retter+2    ;save old IRQ vector
  38.     move.l    #irq,$6c.w        ;and point to my IRQ
  39.  
  40. main_loop:
  41.     bsr    wait_rast        ;wait for line 200
  42.     btst    #6,$bfe001        ;wait, until left mouse button
  43.     beq.S    end            ;is pressed
  44.     bra.S    main_loop
  45.  
  46. end:    move.w    #$000f,$0096(a6)    ;stop sound
  47.     move.l    grafbase,a1        ;activate old Copperlist
  48.     move.l    $0026(a1),$0080(a6)
  49.     clr.w    $0088(a6)
  50.     move.w    #$8020,$009a(a6)    ;enable vert.Blanc IRQ
  51.     move.w    #$0010,$009a(a6)    ;disable Copper IRQ
  52.     move.l    execbase.w,a6        ;permit task switching
  53.     jsr    permit(a6)
  54.     bsr    do_close        ;close graphics.library
  55.     move.l    irq_retter+2(pc),$006c.w;restart old IRQ
  56.     movem.l    (a7)+,a0-a6        ;get back CPU-register
  57.     clr.l    d0            ;clear Return Code
  58.     rts                ;end of program
  59.  
  60. install_bitplanes:
  61.     move.l    #bitplane1,d0        ;1. Bpl adress to d0
  62.     move.w    d0,bitplanes+6        ;Lo-word to coplist
  63.     swap    d0            ;make Loword = Hiword
  64.     move.w    d0,bitplanes+2        ;and write to coplist
  65.     move.l    #bitplane2,d0        ;    ...
  66.     move.w    d0,bitplanes+14        ;    ...
  67.     swap    d0            ;    ...
  68.     move.w    d0,bitplanes+10
  69.     move.l    #bitplane3,d0
  70.     move.w    d0,bitplanes+22
  71.     swap    d0
  72.     move.w    d0,bitplanes+18
  73.     move.l    #bitplane4,d0
  74.     move.w    d0,bitplanes+30
  75.     swap    d0
  76.     move.w    d0,bitplanes+26
  77.     rts
  78.  
  79. do_open:lea    grafname(pc),a1        ;open graphics.library and
  80.     jsr    openlib(a6)        ;store base to 'grafbase'
  81.     move.l    d0,grafbase
  82.     rts
  83.  
  84. do_close:
  85.     move.l    grafbase(pc),a1        ;close graphics.library
  86.     jsr    closelib(a6)
  87.     rts
  88.  
  89.  
  90. irq:    movem.l    d0-d7/a0-a6,-(a7)    ;CPU-register to stack
  91.     move.b    $bfdc00,d0
  92.     move.b    $bfdc01,d0
  93.     move.w    $001e(a6),d0        ;IRQ request to d0
  94.     and.w    $001c(a6),d0        ;IRQ enabled ?
  95.     btst    #4,d0            ;If not enabled or no Copper
  96.     beq.S    endirq            ;IRQ => end of own IRQ
  97.     move.w    #$0010,$009c(a6)    ;else clear IRQ request
  98.     bsr    scrolling        ;Scrolltext moving
  99.     bsr    new_letter        ;write new letter to Bpl
  100. endirq:    
  101.     movem.l    (a7)+,d0-d7/a0-a6    ;get CPU-register from stack
  102. irq_retter:
  103.     jmp    $000000            ;IRQ handling
  104.  
  105. wait_rast:
  106.     move.w    $0006(a6),d0
  107.     and.w    #$f800,d0
  108.     cmp.w    #$f800,d0
  109.     bne    wait_rast
  110.     rts
  111.  
  112.  
  113. scrolling:                ;Scrolltext moving
  114.     lea    bitplane1,a0        ;1. move Bpl 1
  115.     lea    -$0002(a0),a1
  116.     bsr    do_scroll
  117.     lea    bitplane2,a0        ;then Bpl 2
  118.     lea    -$0002(a0),a1
  119.     bsr    do_scroll
  120.     lea    bitplane3,a0        ;and Bpl 3
  121.     lea    -$0002(a0),a1
  122.     bsr    do_scroll
  123.     lea    bitplane4,a0
  124.     lea    -$0002(a0),a1
  125. do_scroll:
  126.     move.l    a0,$0050(a6)        ;set Source A as Bpl start
  127.     move.l    a1,$0054(a6)        ;set D as Bpl - 2 (leftscroll)
  128.     clr.l    $0064(a6)        ;set modulo = 0
  129.     clr.w    $0042(a6)        ;normal mode (ascending)
  130.     move.l    #$ffffffff,$0044(a6)    ;mask = $ffffffff
  131.     move.w    #$c9f0,$0040(a6)    ;Use A,D , D = A, Shift 4
  132.     move.w    #$0626,$0058(a6)    ;hight = 31,width = 44 Byte
  133. waitblit:
  134.     btst    #14,$0002(a6)        ;wait until Blitter is ready
  135.     bne.S    waitblit
  136.     rts                ;end of scrolling
  137.  
  138. new_letter:                ;write a new letter to Bpl
  139.     subq.w    #1,scroll_count        ;counter for amount of
  140.     bpl    not_new_letter        ;left scrolling
  141.     move.w    #$0006,scroll_count    ;scroll 6 times before you
  142.                     ;take a new letter
  143.     bsr.S    clear_letter        ;clear actual Bpl-end
  144.     move.l    scroll(pc),a0        ;scroll counter (pointer to
  145.     tst.b    (a0)            ;actual letter, = 0 ?
  146.     bne.S    donot_restart        ;if letter = 0, restart
  147.     lea    scrolltext(pc),a0
  148. donot_restart:
  149.     clr.l    d0
  150.     move.b    (a0)+,d0        ;letter ASCII code to d0
  151.     move.l    a0,scroll        ;and write new pointer
  152.     cmp.b    #$20,d0            ;is it a space ?
  153.     beq.S    not_new_letter        ;if it is, end this routine
  154.     lea    realbytes(pc),a0    ;else : a0 = table of all
  155.                     ;possible codes
  156.     move.b    d0,d1            ;save d0
  157.     clr.l    d0
  158. cmp_loop:
  159.     move.b    (a0)+,d2        ;compare d1 to code no.x
  160.     cmp.b    d1,d2
  161.     beq.S    letter_found        ;until it is equal
  162.     add.l    #$1,d0            ;else continue
  163.     bra.S    cmp_loop
  164. letter_found:
  165.         lea     zeichen,a3
  166.         bsr     check
  167.         lea    bpl_pointer(pc),a2    ;table with Bpl-pointer 1-3
  168.     moveq    #3,d2            ;4 Bitplanes
  169. letter_loop2:
  170.     move.l    a3,a0
  171.     move.l    (a2)+,a1        ;a1 = bitplane start adress
  172.     move.w    #$002a,d1        ;32 lines hihg (1 letter)
  173. letter_loop:
  174.     move.b    (a0),(a1)        ;and width of 3 Byte
  175.     move.b    $1(a0),$1(a1)
  176.     move.b    $2(a0),$2(a1)
  177.     move.b    $3(a0),$3(a1)
  178.     lea    $28(a0),a0        ;next 3 Byte of Bpl X
  179.     lea    $2c(a1),a1        ;next line in bitplane
  180.     dbf    d1,letter_loop        ;30 lines
  181.     add.l    #$3520,a3        ;next bitplane
  182.     dbf    d2,letter_loop2        ;until Bpl 3
  183. not_new_letter:
  184.     rts                ;end of new letter
  185.  
  186. clear_letter:                ;clear a letter (space)
  187.     lea    bpl_pointer(pc),a2    ;same as above, but
  188.     moveq    #3,d1            ;don't copy data but clear
  189. clear_loop1:                ;it !!!
  190.     move.l    (a2)+,a0
  191.     move.w    #$002a,d0
  192. clear_loop2:
  193.     clr.l    (a0)
  194.     lea    $002c(a0),a0
  195.     dbf    d0,clear_loop2
  196.     dbf    d1,clear_loop1
  197.     rts
  198.  
  199. check:
  200.     cmp.l   #$0,d0
  201.     bne    c1
  202.     add.l    #$0,a3
  203.     rts
  204. c1:
  205.     cmp.l    #$1,d0
  206.     bne    c2
  207.     add.l    #$4,a3
  208.     rts
  209. c2:
  210.     cmp.l    #$2,d0
  211.     bne    c3
  212.     add.l    #$8,a3
  213.     rts
  214. c3:
  215.     cmp.l    #$3,d0
  216.     bne    c4
  217.     add.l    #$c,a3
  218.     rts
  219. c4:
  220.     cmp.l    #$4,d0
  221.     bne    c5
  222.     add.l    #$10,a3
  223.     rts
  224. c5:
  225.     cmp.l    #$5,d0
  226.     bne    c6
  227.     add.l    #$14,a3
  228.     rts
  229. c6:
  230.     cmp.l    #$6,d0
  231.     bne    c7
  232.     add.l    #$18,a3
  233.     rts
  234. c7:
  235.     cmp.l    #$7,d0
  236.     bne    c8
  237.     add.l    #$1c,a3
  238.     rts
  239. c8:
  240.     cmp.l    #$8,d0
  241.     bne    c9
  242.     add.l    #$20,a3
  243.     rts
  244. c9:
  245.     cmp.l    #$9,d0
  246.     bne    ca
  247.     add.l    #$690,a3
  248.     rts
  249. ca:
  250.     cmp.l    #$a,d0
  251.     bne    cb
  252.     add.l    #$694,a3
  253.     rts
  254. cb:
  255.     cmp.l    #$b,d0
  256.     bne    cc
  257.     add.l    #$698,a3
  258.     rts
  259. cc:
  260.     cmp.l    #$c,d0
  261.     bne    cd
  262.     add.l    #$69c,a3
  263.     rts
  264. cd:
  265.     cmp.l    #$d,d0
  266.     bne    ce
  267.     add.l    #$6a0,a3
  268.     rts
  269. ce:
  270.     cmp.l    #$e,d0
  271.     bne    cf
  272.     add.l    #$6a4,a3
  273.     rts
  274. cf:
  275.     cmp.l    #$f,d0
  276.     bne    c10
  277.     add.l    #$6a8,a3
  278.     rts
  279. c10:
  280.     cmp.l    #$10,d0
  281.     bne    c11
  282.     add.l    #$6ac,a3
  283.     rts
  284. c11:
  285.     cmp.l    #$11,d0
  286.     bne    c12
  287.     add.l    #$6b0,a3
  288.     rts
  289. c12:
  290.     cmp.l    #$12,d0
  291.     bne    c13
  292.     add.l    #$d20,a3
  293.     rts
  294. c13:
  295.     cmp.l    #$13,d0
  296.     bne    c14
  297.     add.l    #$d24,a3
  298.     rts
  299. c14:
  300.     cmp.l    #$14,d0
  301.     bne    c15
  302.     add.l    #$d28,a3
  303.     rts
  304. c15:
  305.     cmp.l    #$15,d0
  306.     bne    c16
  307.     add.l    #$d2c,a3
  308.     rts
  309. c16:
  310.     cmp.l    #$16,d0
  311.     bne    c17
  312.     add.l    #$d30,a3
  313.     rts
  314. c17:
  315.     cmp.l    #$17,d0
  316.     bne    c18
  317.     add.l    #$d34,a3
  318.     rts
  319. c18:
  320.     cmp.l    #$18,d0
  321.     bne    c19
  322.     add.l    #$d38,a3
  323.     rts
  324. c19:
  325.     cmp.l    #$19,d0
  326.     bne    c1a
  327.     add.l    #$d3c,a3
  328.     rts
  329. c1a:
  330.     cmp.l   #$1a,d0
  331.     bne    c1b
  332.     add.l    #$d40,a3
  333.     rts
  334. c1b:
  335.     cmp.l    #$1b,d0
  336.     bne    c1c
  337.     add.l    #$13b0,a3
  338.     rts
  339. c1c:
  340.     cmp.l    #$1c,d0
  341.     bne    c1d
  342.     add.l    #$13b4,a3
  343.     rts
  344. c1d:
  345.     cmp.l    #$1d,d0
  346.     bne    c1e
  347.     add.l    #$13b8,a3
  348.     rts
  349. c1e:
  350.     cmp.l    #$1e,d0
  351.     bne    c1f
  352.     add.l    #$13bc,a3
  353.     rts
  354. c1f:
  355.     cmp.l    #$1f,d0
  356.     bne    c20
  357.     add.l    #$13c0,a3
  358.     rts
  359. c20:
  360.     cmp.l    #$20,d0
  361.     bne    c21
  362.     add.l    #$13c4,a3
  363.     rts
  364. c21:
  365.     cmp.l    #$21,d0
  366.     bne    c22
  367.     add.l    #$13c8,a3
  368.     rts
  369. c22:
  370.     cmp.l    #$22,d0
  371.     bne    c23
  372.     add.l    #$13cc,a3
  373.     rts
  374. c23:
  375.     cmp.l    #$23,d0
  376.     bne    c24
  377.     add.l    #$13d0,a3
  378.     rts
  379. c24:
  380.     cmp.l    #$24,d0
  381.     bne    c25
  382.     add.l    #$1a40,a3
  383.     rts
  384. c25:
  385.     cmp.l    #$25,d0
  386.     bne    c26
  387.     add.l    #$1a44,a3
  388.     rts
  389. c26:
  390.     cmp.l    #$26,d0
  391.     bne    c27
  392.     add.l    #$1a48,a3
  393.     rts
  394. c27:
  395.     cmp.l    #$27,d0
  396.     bne    c28
  397.     add.l    #$1a4c,a3
  398.     rts
  399. c28:
  400.     cmp.l    #$28,d0
  401.     bne    c29
  402.     add.l    #$1a50,a3
  403.     rts
  404. c29:
  405.     cmp.l    #$29,d0
  406.     bne    c30
  407.     add.l    #$1a54,a3
  408.     rts
  409. c30:
  410.     cmp.l    #$2a,d0
  411.     bne    c31
  412.     add.l    #$1a58,a3
  413.     rts
  414. c31:
  415.     cmp.l    #$2b,d0
  416.     bne    c32
  417.     add.l    #$1a5c,a3
  418.     rts
  419. c32:
  420.     cmp.l    #$2c,d0
  421.     bne    c33
  422.     add.l    #$1a60,a3
  423.     rts
  424. c33:
  425.     cmp.l    #$2d,d0
  426.     bne    c34
  427.     add.l    #$20d0,a3
  428.     rts
  429. c34:
  430.     cmp.l    #$2e,d0
  431.     bne    c35
  432.     add.l    #$20d4,a3
  433.     rts
  434. c35:
  435.     rts
  436.  
  437. bpl_pointer:    dc.l bitplane1+40,bitplane2+40,bitplane3+40,bitplane4+40
  438. scroll:        dc.l scrolltext
  439. scroll_count:    dc.w 1
  440. realbytes:
  441.     dc.b "ABCDEFGHIJKLMNOPQRSTUVXYZ[';1234567890?!=.,@:+-"
  442. scrolltext:
  443. dc.b "ABCDEFGHIJKLMNOPQRSTUVXYZ[';1234567890?!=.,@:+-       "
  444. ;dc.b "THIS ZZ ACID FONT ZZ WORKS PRETTY GOOD??!!! "
  445. ;dc.b "PRINCE PRESENTS 1  66 BAT DANCE 66! HE DO NOT"
  446. ;DC.B " LIKE 77 SUPERMAN 77?? I WONDER IF HE PLAYS"
  447. ;DC.B " 88 TENNIS 88 OR MAYBE 99 DART 99 2I DO NOT THINK"
  448. ;DC.B " SO3!! WHAT DO YOU THINK SUCKER??00 I THINK"
  449. ;DC.B " HE LIKES TO 44 SWIM 55 AND LISTEN TO ZZ ACID ZZ!"
  450. ;DC.B " THIS TEXT WILL NOW RESTART ZZZZZZZZZZZZZZZZZZZZ "
  451. dc.b 0
  452. even
  453.  
  454. grafname:
  455.     dc.b 'graphics.library',0
  456. even
  457. grafbase:
  458.     dc.l 0
  459.  
  460. delay:    dc.b 0
  461. even
  462. coplist:
  463. dc.l $009c8010,$008e2c61,$00902cd1,$00920038,$009400d0
  464. dc.l $01040000,$01020000,$01080004,$010a0004,$01004200
  465. dc.l $00e00007,$00e20000,$00e40007,$00e60000,$00e80007
  466. dc.l $00ea0000,$00ec0007,$00ee0000,$00f00007,$00f20000
  467. dc.l $018e0c90,$01900c80,$01920b70,$01940a60,$01960950
  468. dc.l $01980840,$019a0830,$019c0730,$019e0620
  469. dc.l $6401fffe,$01800000,$01840f00,$01880fe0,$018a0ec0
  470. dc.l $018c0db0
  471. ;dc.l $01900c80,$01920b70,$01940a60
  472. ;dc.l $01960950,$01980840,$019a0830,$019c0730,$019e0620
  473. bitplanes:
  474. dc.l $00e00000,$00e20000,$00e40000,$00e60000,$00e80000
  475. dc.l $00ea0000,$00ec0000,$00ee0000
  476. dc.l $8e01fffe,$01800aaa
  477. dc.l $00e00007,$00e20000,$00e40007,$00e60000,$00e80007
  478. dc.l $00ea0000,$00ec0007,$00ee0000
  479. sprite0:
  480. dc.l $01200000,$01220000,$01240000,$01260000,$01280000,$012a0000
  481. dc.l $012c0000,$012e0000,$01300000,$01320000,$01340000,$01360000
  482. dc.l $01380000,$013a0000,$013c0000,$013e0000
  483. dc.l $fffffffe
  484.  
  485. zeichen:    blk.b 54400,0
  486. bitplane1:    blk.b 1848,0
  487. bitplane2:    blk.b 1848,0
  488. bitplane3:    blk.b 1848,0
  489. bitplane4:    blk.b 1848,0
  490.