home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / dse-src5.dms / in.adf / demo0.s < prev    next >
Encoding:
Text File  |  2010-02-27  |  16.8 KB  |  907 lines

  1. mainloop:
  2.         jsr    music
  3.         jsr    s
  4.         jsr    scrolly
  5.         jsr    end2
  6.         jsr    stop_muzak
  7.         rts
  8.  
  9. scrolly:
  10.     move.l    $04,a6
  11.     lea    gfxname,a1
  12.     jsr    -408(a6)    ;OldOpenLibrary
  13.     move.l    d0,gfxbase
  14.     move.l    d0,a0
  15.     move.l    50(a0),oldclist        ;remember CList
  16.     move.l    #newclist,50(a0)    ;setnew CList
  17.     move.l    gfxbase,a6
  18.     lea    bitmap,a0
  19.     move.l    #$01,d0        ;bitplanes
  20.     move.l    #336,d1        ;width
  21.     move.l    #200,d2        ;hight
  22.     jsr    -390(a6)    ;InitBitMap
  23.     move.l    #$60000,plane1
  24.     lea    rastport,a1
  25.     jsr    -198(a6)    ;InitRastPort
  26.     move.l    #bitmap,r_bitmap
  27.     lea    rastport,a1
  28.     jsr    -48(a6)        ;ClearScreen
  29.     move.l    #scrollm,zeiger
  30.     move.l    $6c,oldirq+2    ;set backjump
  31.     move.l    #newirq,$6c    ;set new to jump
  32. wait2:    btst    #6,$bfe001
  33.     bne.s    wait2
  34.     move.l    oldirq+2,$6c    ;restore to jump
  35.     move.l    gfxbase,a0
  36.     move.l    oldclist,50(a0)    ;restore old CList
  37.     move.l    $04,a6
  38.     move.l    gfxbase,a1
  39.     jsr    -414(a6)    ;CloseLibrary
  40.     move.l    #0,d0
  41.     rts
  42.  
  43. newirq:
  44.     movem.l    d0-d7/a0-a6,-(sp)    ;store registers
  45.     move.l    gfxbase,a6
  46.     lea    rastport,a1
  47.     move.l    #01,d0        ;delta X
  48.     move.l    #00,d1        ;delta Y
  49.     move.l    #000,d2        ;minX
  50.     move.l    #000,d3        ;minY
  51.     move.l    #336,d4        ;maxX
  52.     move.l    #200,d5        ;maxY
  53.     jsr    -396(a6)    ;ScrollRaster
  54.     sub.b    #$01,rows
  55.     bne.s    exit        ;branch if no new char
  56.     move.b    #$08,rows
  57.     lea    rastport,a1
  58.     move.l    #320,d0        ;Xpos
  59.     move.l    #110,d1        ;Ypos
  60.     jsr    -240(a6)    ;Move
  61.     lea    rastport,a1
  62.     move.l    zeiger,a0    ;pointer to tekst
  63.     move.l    #$01,d0        ;# of chars
  64.     jsr    -60(a6)        ;Text
  65.     addq.l    #$01,zeiger
  66.     cmp.l    #end,zeiger
  67.     blt.s    exit        ;do not zero ZEIGER
  68.     move.l    #scrollm,zeiger
  69. exit:    movem.l    (sp)+,d0-d7/a0-a6
  70. oldirq:    jmp    $00000000
  71.  
  72. newclist:
  73.     dc.w    $008e,$2c81,$0090,$f4f0,$0092,$0038,$0094,$00d0
  74.     dc.w    $0102,$0000,$0104,$0000,$0108,$0002,$010a,$0002
  75.     dc.w    $0100,$1200,$0180,$0000,$0182,$0fff
  76.     dc.w    $00e0,$0006,$00e2,$0000
  77.     dc.w    $900f,$fffe,$0180,$0f00,$910f,$fffe,$0180,$000f
  78.     dc.w    $9e0f,$fffe,$0180,$0f00,$9f0f,$fffe,$0180,$0000
  79.     dc.w    $ffff,$fffe
  80.  
  81. zeiger:        dc.l    0
  82. oldclist:    dc.l    0
  83. gfxbase:    dc.l    0
  84. bitmap:        blk.l    2,0
  85. plane1:        blk.l    20,0
  86. rastport:    dc.l    0
  87. r_bitmap:    blk.l    30,0
  88. rows:        dc.b    2
  89. gfxname:    dc.b    "graphics.library",0
  90. scrollm:    dc.b    " TEAM'89 HE HE HE "
  91. end:
  92.  
  93.  
  94. music:    bne.s    start_muzak
  95.  
  96. main:    btst    #6,$bfe001
  97.     bne.s    main
  98.  
  99.     bsr.L    stop_muzak
  100.     moveq    #0,d0
  101.     rts
  102.  
  103. start_muzak:
  104.     move.l    #data,muzakoffset    ;** get offset
  105.  
  106. init0:    move.l    muzakoffset,a0        ;** get highest used pattern
  107.     add.l    #472,a0
  108.     move.l    #$80,d0
  109.     clr.l    d1
  110. init1:    move.l    d1,d2
  111.     subq.w    #1,d0
  112. init2:    move.b    (a0)+,d1
  113.     cmp.b    d2,d1
  114.     bgt.s    init1
  115.     dbf    d0,init2
  116.     addq.b    #1,d2
  117.  
  118. init3:    move.l    muzakoffset,a0        ;** calc samplepointers
  119.     lea    pointers(pc),a1
  120.     lsl.l    #8,d2
  121.     lsl.l    #2,d2
  122.     add.l    #600,d2
  123.     add.l    a0,d2
  124.     moveq    #14,d0
  125. init4:    move.l    d2,(a1)+
  126.     clr.l    d1
  127.     move.w    42(a0),d1
  128.     lsl.l    #1,d1
  129.     add.l    d1,d2
  130.     add.l    #30,a0
  131.     dbf    d0,init4
  132.  
  133. init5:    clr.w    $dff0a8            ;** clear used values
  134.     clr.w    $dff0b8
  135.     clr.w    $dff0c8
  136.     clr.w    $dff0d8
  137.     clr.w    timpos
  138.     clr.l    trkpos
  139.     clr.l    patpos
  140.  
  141. init6:    move.l    muzakoffset,a0        ;** initialize timer irq
  142.     move.b    470(a0),numpat+1    ;number of patterns
  143.     move.l    $6c.w,lev3save+2
  144.     move.l    #lev3interrupt,$6c.w
  145.     rts
  146.  
  147. stop_muzak:
  148.     move.l    lev3save+2,$6c.w
  149.     clr.w    $dff0a8
  150.     clr.w    $dff0b8
  151.     clr.w    $dff0c8
  152.     clr.w    $dff0d8
  153.     move.w    #$f,$dff096
  154.     rts
  155.  
  156. lev3interrupt:
  157.     bsr.s    replay_muzak
  158. lev3save:
  159.     jmp    $0
  160.  
  161. replay_muzak:
  162.     movem.l    d0-d7/a0-a6,-(a7)
  163.     addq.w    #1,timpos
  164. speed:    cmp.w    #6,timpos
  165.     beq.L    replaystep
  166.  
  167. chaneleffects:                ;** seek effects
  168.     lea    datach0(pc),a6
  169.     tst.b    3(a6)
  170.     beq.s    ceff1
  171.     lea    $dff0a0,a5
  172.     bsr.s    ceff5
  173. ceff1:    lea    datach1(pc),a6
  174.     tst.b    3(a6)
  175.     beq.s    ceff2
  176.     lea    $dff0b0,a5
  177.     bsr.s    ceff5
  178. ceff2:    lea    datach2(pc),a6
  179.     tst.b    3(a6)
  180.     beq.s    ceff3
  181.     lea    $dff0c0,a5
  182.     bsr.s    ceff5
  183. ceff3:    lea    datach3(pc),a6
  184.     tst.b    3(a6)
  185.     beq.s    ceff4
  186.     lea    $dff0d0,a5
  187.     bsr.s    ceff5
  188. ceff4:    movem.l    (a7)+,d0-d7/a0-a6
  189.     rts
  190.  
  191. ceff5:    move.b    2(a6),d0        ;room for some more
  192.     and.b    #$f,d0            ;implementations below
  193.     tst.b    d0
  194.     beq.s    arpreggiato
  195.     cmp.b    #1,d0
  196.     beq.L    pitchup
  197.     cmp.b    #2,d0
  198.     beq.L    pitchdown
  199.     cmp.b    #12,d0
  200.     beq.L    setvol
  201.     cmp.b    #14,d0
  202.     beq.L    setfilt
  203.     cmp.b    #15,d0
  204.     beq.L    setspeed
  205.     rts
  206.  
  207. arpreggiato:                ;** spread by time
  208.     cmp.w    #1,timpos
  209.     beq.s    arp1
  210.     cmp.w    #2,timpos
  211.     beq.s    arp2
  212.     cmp.w    #3,timpos
  213.     beq.s    arp3
  214.     cmp.w    #4,timpos
  215.     beq.s    arp1
  216.     cmp.w    #5,timpos
  217.     beq.s    arp2
  218.     rts
  219.  
  220. arp1:    clr.l    d0            ;** get higher note-values
  221.     move.b    3(a6),d0        ;   or play original
  222.     lsr.b    #4,d0
  223.     bra.s    arp4
  224. arp2:    clr.l    d0
  225.     move.b    3(a6),d0
  226.     and.b    #$f,d0
  227.     bra.s    arp4
  228. arp3:    move.w    16(a6),d2
  229.     bra.s    arp6
  230. arp4:    lsl.w    #1,d0
  231.     clr.l    d1
  232.     move.w    16(a6),d1
  233.     lea    notetable,a0
  234. arp5:    move.w    (a0,d0.w),d2
  235.     cmp.w    (a0),d1
  236.     beq.s    arp6
  237.     addq.l    #2,a0
  238.     bra.s    arp5
  239. arp6:    move.w    d2,6(a5)
  240.     rts
  241.  
  242. pitchdown:
  243.     bsr.s    newrou
  244.     clr.l    d0
  245.     move.b    3(a6),d0
  246.     and.b    #$f,d0
  247.     add.w    d0,(a4)
  248.     cmp.w    #$358,(a4)
  249.     bmi.s    ok1
  250.     move.w    #$358,(a4)
  251. ok1:    move.w    (a4),6(a5)
  252.     rts
  253.  
  254. pitchup:bsr.s    newrou
  255.     clr.l    d0
  256.     move.b    3(a6),d0
  257.     and.b    #$f,d0
  258.     sub.w    d0,(a4)
  259.     cmp.w    #$71,(a4)
  260.     bpl.s    ok2
  261.     move.w    #$71,(a4)
  262. ok2:    move.w    (a4),6(a5)
  263.     rts
  264.  
  265. setvol:    move.b    3(a6),8(a5)
  266.     rts
  267.  
  268. setfilt:move.b    3(a6),d0
  269.     and.b    #1,d0
  270.     lsl.b    #1,d0
  271.     and.b    #$fd,$bfe001
  272.     or.b    d0,$bfe001
  273.     rts
  274.  
  275. setspeed:
  276.     clr.l    d0
  277.     move.b    3(a6),d0
  278.     and.b    #$f,d0
  279.     move.w    d0,speed+2
  280.     rts
  281.  
  282. newrou:    cmp.l    #datach0,a6
  283.     bne.s    next1
  284.     lea    voi1(pc),a4
  285.     rts
  286. next1:    cmp.l    #datach1,a6
  287.     bne.s    next2
  288.     lea    voi2(pc),a4
  289.     rts
  290. next2:    cmp.l    #datach2,a6
  291.     bne.s    next3
  292.     lea    voi3(pc),a4
  293.     rts
  294. next3:    lea    voi4(pc),a4
  295.     rts
  296.  
  297. replaystep:                ;** work next pattern-step
  298.     clr.w    timpos
  299.     move.l    muzakoffset,a0
  300.     move.l    a0,a3
  301.     add.l    #12,a3            ;ptr to soundprefs
  302.     move.l    a0,a2
  303.     add.l    #472,a2            ;ptr to pattern-table
  304.     add.l    #600,a0            ;ptr to first pattern
  305.     clr.l    d1
  306.     move.l    trkpos,d0        ;get ptr to current pattern
  307.     move.b    (a2,d0),d1
  308.     lsl.l    #8,d1
  309.     lsl.l    #2,d1
  310.     add.l    patpos,d1        ;get ptr to current step
  311.     clr.w    enbits
  312.     lea    $dff0a0,a5        ;chanel 0
  313.     lea    datach0(pc),a6
  314.     bsr.L    chanelhandler
  315.     lea    $dff0b0,a5        ;chanel 1
  316.     lea    datach1(pc),a6
  317.     bsr.L    chanelhandler
  318.     lea    $dff0c0,a5        ;chanel 2
  319.     lea    datach2(pc),a6
  320.     bsr.L    chanelhandler
  321.     lea    $dff0d0,a5        ;chanel 3
  322.     lea    datach3(pc),a6
  323.     bsr.L    chanelhandler
  324.     move.w    #400,d0            ;** wait a while and set len
  325. rep1:    dbf    d0,rep1            ;   of oneshot to 1 word
  326.     move.w    #$8000,d0
  327.     or.w    enbits,d0
  328.     move.w    d0,$dff096
  329.     cmp.w    #1,datach0+14
  330.     bne.s    rep2
  331.     clr.w    datach0+14
  332.     move.w    #1,$dff0a4
  333. rep2:    cmp.w    #1,datach1+14
  334.     bne.s    rep3
  335.     clr.w    datach1+14
  336.     move.w    #1,$dff0b4
  337. rep3:    cmp.w    #1,datach2+14
  338.     bne.s    rep4
  339.     clr.w    datach2+14
  340.     move.w    #1,$dff0c4
  341. rep4:    cmp.w    #1,datach3+14
  342.     bne.s    rep5
  343.     clr.w    datach3+14
  344.     move.w    #1,$dff0d4
  345.  
  346. rep5:    add.l    #16,patpos        ;next step
  347.     cmp.l    #64*16,patpos        ;pattern finished ?
  348.     bne.s    rep6
  349.     clr.l    patpos
  350.     addq.l    #1,trkpos        ;next pattern in table
  351.     clr.l    d0
  352.     move.w    numpat,d0
  353.     cmp.l    trkpos,d0        ;song finished ?
  354.     bne.s    rep6
  355.     clr.l    trkpos
  356. rep6:    movem.l    (a7)+,d0-d7/a0-a6
  357.     rts
  358.  
  359. chanelhandler:
  360.     move.l    (a0,d1.l),(a6)        ;get period & action-word
  361.     addq.l    #4,d1            ;point to next chanel
  362.     clr.l    d2
  363.     move.b    2(a6),d2        ;get nibble for soundnumber
  364.     lsr.b    #4,d2
  365.     beq.s    chan2            ;no soundchange !
  366.     move.l    d2,d4            ;** calc ptr to sample
  367.     lsl.l    #2,d2
  368.     mulu    #30,d4
  369.     lea    pointers-4(pc),a1
  370.     move.l    (a1,d2.l),4(a6)        ;store sample-address
  371.     move.w    (a3,d4.l),8(a6)        ;store sample-len in words
  372.     move.w    2(a3,d4.l),18(a6)    ;store sample-volume
  373.  
  374.     move.l    d0,-(a7)
  375.     move.b    2(a6),d0
  376.     and.b    #$f,d0
  377.     cmp.b    #$c,d0
  378.     bne.s    ok3
  379.     move.b    3(a6),8(a5)
  380.     bra.s    ok4
  381. ok3:    move.w    2(a3,d4.l),8(a5)    ;change chanel-volume
  382. ok4:    move.l    (a7)+,d0
  383.  
  384.     clr.l    d3
  385.     move.w    4(a3,d4),d3        ;** calc repeatstart
  386.     add.l    4(a6),d3
  387.     move.l    d3,10(a6)        ;store repeatstart
  388.     move.w    6(a3,d4),14(a6)        ;store repeatlength
  389.     cmp.w    #1,14(a6)
  390.     beq.s    chan2            ;no sustainsound !
  391.     move.l    10(a6),4(a6)        ;repstart  = sndstart
  392.     move.w    6(a3,d4),8(a6)        ;replength = sndlength
  393. chan2:    tst.w    (a6)
  394.     beq.s    chan4            ;no new note set !
  395.     move.w    22(a6),$dff096        ;clear dma
  396.     tst.w    14(a6)
  397.     bne.s    chan3            ;no oneshot-sample
  398.     move.w    #1,14(a6)        ;allow resume (later)
  399. chan3:    bsr.L    newrou
  400.     move.w    (a6),(a4)
  401.     move.w    (a6),16(a6)        ;save note for effect
  402.     move.l    4(a6),0(a5)        ;set samplestart
  403.     move.w    8(a6),4(a5)        ;set samplelength
  404.     move.w    (a6),6(a5)        ;set period
  405.     move.w    22(a6),d0
  406.     or.w    d0,enbits        ;store dma-bit
  407.     move.w    18(a6),20(a6)        ;volume trigger
  408. chan4:    rts
  409.  
  410. datach0:    blk.w    11,0
  411.         dc.w    1
  412. datach1:    blk.w    11,0
  413.         dc.w    2
  414. datach2:    blk.w    11,0
  415.         dc.w    4
  416. datach3:    blk.w    11,0
  417.         dc.w    8
  418. voi1:        dc.w    0
  419. voi2:        dc.w    0
  420. voi3:        dc.w    0
  421. voi4:        dc.w    0
  422. pointers:    blk.l    15,0
  423. notetable:    dc.w    856,808,762,720,678,640,604,570
  424.         dc.w    538,508,480,453,428,404,381,360
  425.         dc.w    339,320,302,285,269,254,240,226  
  426.         dc.w    214,202,190,180,170,160,151,143
  427.         dc.w    135,127,120,113,000
  428. muzakoffset:    dc.l    0
  429. trkpos:        dc.l    0
  430. patpos:        dc.l    0
  431. numpat:        dc.w    0
  432. enbits:        dc.w    0
  433. timpos:        dc.w    0
  434. data:        blk.b    00000,0
  435.  
  436.  
  437. s:
  438. execbase = 4                ;basicadresse exec.library
  439.  
  440. forbid   = -132                ;forbid task switching
  441. permit   = -138                ;permit task switching
  442. openlib  = -408                ;open a library
  443. closelib = -414                ;close a library
  444.  
  445. start:    movem.l    a0-a6,-(a7)        ;save CPU-register
  446.     lea    $70000,a0
  447.     move.w    #$2000,d0
  448. cloop:    clr.b    (a0)+
  449.     dbf    d0,cloop
  450.  
  451.     move.l    execbase,a6
  452.     jsr    forbid(a6)        ;forbid task switching
  453.     bsr    do_open            ;open graphics.library
  454.     bsr    install_bitplanes    ;write bpl-starts into coplist
  455.  
  456.     lea    $dff000,a6        ;CustomChip base
  457.     move.l    #coplist,$0080(a6)    ;activate new Coplist
  458.     clr.w    $0088(a6)
  459.     move.w    #$0020,$009a(a6)    ;disable vert.blanc IRQ
  460.     move.w    #$8010,$009a(a6)    ;enable Copper IRQ
  461.     move.l    $006c.w,irq_retter+2    ;save old IRQ vector
  462.     move.l    #irq,$6c.w        ;and point to my IRQ
  463.  
  464. main_loop:
  465.     bsr    wait_rast        ;wait for line 200
  466.     btst    #6,$bfe001        ;wait, until left mouse button
  467.     beq.W    end            ;is pressed
  468.     bra.S    main_loop
  469.  
  470. end2:    move.w    #$000f,$0096(a6)    ;stop sound
  471.     move.l    grafbase,a1        ;activate old Copperlist
  472.     move.l    $0026(a1),$0080(a6)
  473.     clr.w    $0088(a6)
  474.     move.w    #$8020,$009a(a6)    ;enable vert.Blanc IRQ
  475.     move.w    #$0010,$009a(a6)    ;disable Copper IRQ
  476.     move.l    execbase,a6        ;permit task switching
  477.     jsr    permit(a6)
  478.     bsr    do_close        ;close graphics.library
  479.     move.l    irq_retter+2(pc),$006c.w;restart old IRQ
  480.     movem.l    (a7)+,a0-a6        ;get back CPU-register
  481.     clr.l    d0            ;clear Return Code
  482.     rts                ;end of program
  483.  
  484. install_bitplanes:
  485.     move.l    #bitplane1,d0        ;1. Bpl adress to d0
  486.     move.w    d0,bitplanes+6        ;Lo-word to coplist
  487.     swap    d0            ;make Loword = Hiword
  488.     move.w    d0,bitplanes+2        ;and write to coplist
  489.     move.l    #bitplane2,d0        ;    ...
  490.     move.w    d0,bitplanes+14        ;    ...
  491.     swap    d0            ;    ...
  492.     move.w    d0,bitplanes+10
  493.     move.l    #bitplane3,d0
  494.     move.w    d0,bitplanes+22
  495.     swap    d0
  496.     move.w    d0,bitplanes+18
  497.     move.l    #bitplane4,d0
  498.     move.w    d0,bitplanes+30
  499.     swap    d0
  500.     move.w    d0,bitplanes+26
  501.     rts
  502.  
  503. do_open:lea    grafname(pc),a1        ;open graphics.library and
  504.     jsr    openlib(a6)        ;store base to 'grafbase'
  505.     move.l    d0,grafbase
  506.     rts
  507.  
  508. do_close:
  509.     move.l    grafbase(pc),a1        ;close graphics.library
  510.     jsr    closelib(a6)
  511.     rts
  512.  
  513.  
  514. irq:    movem.l    d0-d7/a0-a6,-(a7)    ;CPU-register to stack
  515.     move.b    $bfdc00,d0
  516.     move.b    $bfdc01,d0
  517.     move.w    $001e(a6),d0        ;IRQ request to d0
  518.     and.w    $001c(a6),d0        ;IRQ enabled ?
  519.     btst    #4,d0            ;If not enabled or no Copper
  520.     beq.S    endirq            ;IRQ => end of own IRQ
  521.     move.w    #$0010,$009c(a6)    ;else clear IRQ request
  522.     bsr    scrolling        ;Scrolltext moving
  523.     bsr    new_letter        ;write new letter to Bpl
  524. endirq:    
  525.     movem.l    (a7)+,d0-d7/a0-a6    ;get CPU-register from stack
  526. irq_retter:
  527.     jmp    $000000            ;IRQ handling
  528.  
  529. wait_rast:
  530.     move.w    $0006(a6),d0
  531.     and.w    #$f800,d0
  532.     cmp.w    #$f800,d0
  533.     bne    wait_rast
  534.     rts
  535.  
  536.  
  537. scrolling:                ;Scrolltext moving
  538.     lea    bitplane1,a0        ;1. move Bpl 1
  539.     lea    -$0002(a0),a1
  540.     bsr    do_scroll
  541.     lea    bitplane2,a0        ;then Bpl 2
  542.     lea    -$0002(a0),a1
  543.     bsr    do_scroll
  544.     lea    bitplane3,a0        ;and Bpl 3
  545.     lea    -$0002(a0),a1
  546.     bsr    do_scroll
  547.     lea    bitplane4,a0
  548.     lea    -$0002(a0),a1
  549. do_scroll:
  550.     move.l    a0,$0050(a6)        ;set Source A as Bpl start
  551.     move.l    a1,$0054(a6)        ;set D as Bpl - 2 (leftscroll)
  552.     clr.l    $0064(a6)        ;set modulo = 0
  553.     clr.w    $0042(a6)        ;normal mode (ascending)
  554.     move.l    #$ffffffff,$0044(a6)    ;mask = $ffffffff
  555.     move.w    #$c9f0,$0040(a6)    ;Use A,D , D = A, Shift 4
  556.     move.w    #$0626,$0058(a6)    ;hight = 31,width = 44 Byte
  557. waitblit:
  558.     btst    #14,$0002(a6)        ;wait until Blitter is ready
  559.     bne.S    waitblit
  560.     rts                ;end of scrolling
  561.  
  562. new_letter:                ;write a new letter to Bpl
  563.     subq.w    #1,scroll_count        ;counter for amount of
  564.     bpl    not_new_letter        ;left scrolling
  565.     move.w    #$0006,scroll_count    ;scroll 6 times before you
  566.                     ;take a new letter
  567.     bsr.S    clear_letter        ;clear actual Bpl-end
  568.     move.l    scroll(pc),a0        ;scroll counter (pointer to
  569.     tst.b    (a0)            ;actual letter, = 0 ?
  570.     bne.S    donot_restart        ;if letter = 0, restart
  571.     lea    scrolltext(pc),a0
  572. donot_restart:
  573.     clr.l    d0
  574.     move.b    (a0)+,d0        ;letter ASCII code to d0
  575.     move.l    a0,scroll        ;and write new pointer
  576.     cmp.b    #$20,d0            ;is it a space ?
  577.     beq.S    not_new_letter        ;if it is, end this routine
  578.     lea    realbytes(pc),a0    ;else : a0 = table of all
  579.                     ;possible codes
  580.     move.b    d0,d1            ;save d0
  581.     clr.l    d0
  582. cmp_loop:
  583.     move.b    (a0)+,d2        ;compare d1 to code no.x
  584.     cmp.b    d1,d2
  585.     beq.S    letter_found        ;until it is equal
  586.     add.l    #$1,d0            ;else continue
  587.     bra.S    cmp_loop
  588. letter_found:
  589.         lea     zeichen,a3
  590.         bsr     check
  591.         lea    bpl_pointer(pc),a2    ;table with Bpl-pointer 1-3
  592.     moveq    #3,d2            ;4 Bitplanes
  593. letter_loop2:
  594.     move.l    a3,a0
  595.     move.l    (a2)+,a1        ;a1 = bitplane start adress
  596.     move.w    #$002a,d1        ;32 lines hihg (1 letter)
  597. letter_loop:
  598.     move.b    (a0),(a1)        ;and width of 3 Byte
  599.     move.b    $1(a0),$1(a1)
  600.     move.b    $2(a0),$2(a1)
  601.     move.b    $3(a0),$3(a1)
  602.     lea    $28(a0),a0        ;next 3 Byte of Bpl X
  603.     lea    $2c(a1),a1        ;next line in bitplane
  604.     dbf    d1,letter_loop        ;30 lines
  605.     add.l    #$3520,a3        ;next bitplane
  606.     dbf    d2,letter_loop2        ;until Bpl 3
  607. not_new_letter:
  608.     rts                ;end of new letter
  609.  
  610. clear_letter:                ;clear a letter (space)
  611.     lea    bpl_pointer(pc),a2    ;same as above, but
  612.     moveq    #3,d1            ;don't copy data but clear
  613. clear_loop1:                ;it !!!
  614.     move.l    (a2)+,a0
  615.     move.w    #$002a,d0
  616. clear_loop2:
  617.     clr.l    (a0)
  618.     lea    $002c(a0),a0
  619.     dbf    d0,clear_loop2
  620.     dbf    d1,clear_loop1
  621.     rts
  622.  
  623. check:
  624.     cmp.l   #$0,d0
  625.     bne    c1
  626.     add.l    #$0,a3
  627.     rts
  628. c1:
  629.     cmp.l    #$1,d0
  630.     bne    c2
  631.     add.l    #$4,a3
  632.     rts
  633. c2:
  634.     cmp.l    #$2,d0
  635.     bne    c3
  636.     add.l    #$8,a3
  637.     rts
  638. c3:
  639.     cmp.l    #$3,d0
  640.     bne    c4
  641.     add.l    #$c,a3
  642.     rts
  643. c4:
  644.     cmp.l    #$4,d0
  645.     bne    c5
  646.     add.l    #$10,a3
  647.     rts
  648. c5:
  649.     cmp.l    #$5,d0
  650.     bne    c6
  651.     add.l    #$14,a3
  652.     rts
  653. c6:
  654.     cmp.l    #$6,d0
  655.     bne    c7
  656.     add.l    #$18,a3
  657.     rts
  658. c7:
  659.     cmp.l    #$7,d0
  660.     bne    c8
  661.     add.l    #$1c,a3
  662.     rts
  663. c8:
  664.     cmp.l    #$8,d0
  665.     bne    c9
  666.     add.l    #$20,a3
  667.     rts
  668. c9:
  669.     cmp.l    #$9,d0
  670.     bne    ca
  671.     add.l    #$690,a3
  672.     rts
  673. ca:
  674.     cmp.l    #$a,d0
  675.     bne    cb
  676.     add.l    #$694,a3
  677.     rts
  678. cb:
  679.     cmp.l    #$b,d0
  680.     bne    cc
  681.     add.l    #$698,a3
  682.     rts
  683. cc:
  684.     cmp.l    #$c,d0
  685.     bne    cd
  686.     add.l    #$69c,a3
  687.     rts
  688. cd:
  689.     cmp.l    #$d,d0
  690.     bne    ce
  691.     add.l    #$6a0,a3
  692.     rts
  693. ce:
  694.     cmp.l    #$e,d0
  695.     bne    cf
  696.     add.l    #$6a4,a3
  697.     rts
  698. cf:
  699.     cmp.l    #$f,d0
  700.     bne    c10
  701.     add.l    #$6a8,a3
  702.     rts
  703. c10:
  704.     cmp.l    #$10,d0
  705.     bne    c11
  706.     add.l    #$6ac,a3
  707.     rts
  708. c11:
  709.     cmp.l    #$11,d0
  710.     bne    c12
  711.     add.l    #$6b0,a3
  712.     rts
  713. c12:
  714.     cmp.l    #$12,d0
  715.     bne    c13
  716.     add.l    #$d20,a3
  717.     rts
  718. c13:
  719.     cmp.l    #$13,d0
  720.     bne    c14
  721.     add.l    #$d24,a3
  722.     rts
  723. c14:
  724.     cmp.l    #$14,d0
  725.     bne    c15
  726.     add.l    #$d28,a3
  727.     rts
  728. c15:
  729.     cmp.l    #$15,d0
  730.     bne    c16
  731.     add.l    #$d2c,a3
  732.     rts
  733. c16:
  734.     cmp.l    #$16,d0
  735.     bne    c17
  736.     add.l    #$d30,a3
  737.     rts
  738. c17:
  739.     cmp.l    #$17,d0
  740.     bne    c18
  741.     add.l    #$d34,a3
  742.     rts
  743. c18:
  744.     cmp.l    #$18,d0
  745.     bne    c19
  746.     add.l    #$d38,a3
  747.     rts
  748. c19:
  749.     cmp.l    #$19,d0
  750.     bne    c1a
  751.     add.l    #$d3c,a3
  752.     rts
  753. c1a:
  754.     cmp.l   #$1a,d0
  755.     bne    c1b
  756.     add.l    #$d40,a3
  757.     rts
  758. c1b:
  759.     cmp.l    #$1b,d0
  760.     bne    c1c
  761.     add.l    #$13b0,a3
  762.     rts
  763. c1c:
  764.     cmp.l    #$1c,d0
  765.     bne    c1d
  766.     add.l    #$13b4,a3
  767.     rts
  768. c1d:
  769.     cmp.l    #$1d,d0
  770.     bne    c1e
  771.     add.l    #$13b8,a3
  772.     rts
  773. c1e:
  774.     cmp.l    #$1e,d0
  775.     bne    c1f
  776.     add.l    #$13bc,a3
  777.     rts
  778. c1f:
  779.     cmp.l    #$1f,d0
  780.     bne    c20
  781.     add.l    #$13c0,a3
  782.     rts
  783. c20:
  784.     cmp.l    #$20,d0
  785.     bne    c21
  786.     add.l    #$13c4,a3
  787.     rts
  788. c21:
  789.     cmp.l    #$21,d0
  790.     bne    c22
  791.     add.l    #$13c8,a3
  792.     rts
  793. c22:
  794.     cmp.l    #$22,d0
  795.     bne    c23
  796.     add.l    #$13cc,a3
  797.     rts
  798. c23:
  799.     cmp.l    #$23,d0
  800.     bne    c24
  801.     add.l    #$13d0,a3
  802.     rts
  803. c24:
  804.     cmp.l    #$24,d0
  805.     bne    c25
  806.     add.l    #$1a40,a3
  807.     rts
  808. c25:
  809.     cmp.l    #$25,d0
  810.     bne    c26
  811.     add.l    #$1a44,a3
  812.     rts
  813. c26:
  814.     cmp.l    #$26,d0
  815.     bne    c27
  816.     add.l    #$1a48,a3
  817.     rts
  818. c27:
  819.     cmp.l    #$27,d0
  820.     bne    c28
  821.     add.l    #$1a4c,a3
  822.     rts
  823. c28:
  824.     cmp.l    #$28,d0
  825.     bne    c29
  826.     add.l    #$1a50,a3
  827.     rts
  828. c29:
  829.     cmp.l    #$29,d0
  830.     bne    c30
  831.     add.l    #$1a54,a3
  832.     rts
  833. c30:
  834.     cmp.l    #$2a,d0
  835.     bne    c31
  836.     add.l    #$1a58,a3
  837.     rts
  838. c31:
  839.     cmp.l    #$2b,d0
  840.     bne    c32
  841.     add.l    #$1a5c,a3
  842.     rts
  843. c32:
  844.     cmp.l    #$2c,d0
  845.     bne    c33
  846.     add.l    #$1a60,a3
  847.     rts
  848. c33:
  849.     cmp.l    #$2d,d0
  850.     bne    c34
  851.     add.l    #$20d0,a3
  852.     rts
  853. c34:
  854.     cmp.l    #$2e,d0
  855.     bne    c35
  856.     add.l    #$20d4,a3
  857.     rts
  858. c35:
  859.     rts
  860.  
  861. bpl_pointer:    dc.l bitplane1+40,bitplane2+40,bitplane3+40,bitplane4+40
  862. scroll:        dc.l scrolltext
  863. scroll_count:    dc.w 1
  864. realbytes:
  865.     dc.b "ABCDEFGHIJKLMNOPQRSTUVXYZ[';1234567890?!=.,@:+-"
  866. scrolltext:    
  867.     dc.b "ABCDEFGHIJKLMNOPQRSTUVXYZ[';1234567890?!=.,@:+-       "
  868.     dc.b 0
  869. even
  870.  
  871. grafname:
  872.     dc.b 'graphics.library',0
  873.     even
  874. grafbase:
  875.     dc.l 0
  876.  
  877. delay:    dc.b 0
  878.     even
  879. coplist:
  880.     dc.l $009c8010,$008e2c61,$00902cd1,$00920038,$009400d0
  881.     dc.l $01040000,$01020000,$01080004,$010a0004,$01004200
  882.     dc.l $00e00007,$00e20000,$00e40007,$00e60000,$00e80007
  883.     dc.l $00ea0000,$00ec0007,$00ee0000,$00f00007,$00f20000
  884.     dc.l $018e0c90,$01900c80,$01920b70,$01940a60,$01960950
  885.     dc.l $01980840,$019a0830,$019c0730,$019e0620
  886.     dc.l $6401fffe,$01800000,$01840f00,$01880fe0,$018a0ec0
  887.     dc.l $018c0db0
  888. ;dc.l $01900c80,$01920b70,$01940a60
  889. ;dc.l $01960950,$01980840,$019a0830,$019c0730,$019e0620
  890. bitplanes:
  891.     dc.l $00e00000,$00e20000,$00e40000,$00e60000,$00e80000
  892.     dc.l $00ea0000,$00ec0000,$00ee0000
  893.     dc.l $8e01fffe,$01800aaa
  894.     dc.l $00e00007,$00e20000,$00e40007,$00e60000,$00e80007
  895.     dc.l $00ea0000,$00ec0007,$00ee0000
  896. sprite0:
  897.     dc.l $01200000,$01220000,$01240000,$01260000,$01280000,$012a0000
  898.     dc.l $012c0000,$012e0000,$01300000,$01320000,$01340000,$01360000
  899.     dc.l $01380000,$013a0000,$013c0000,$013e0000
  900.     dc.l $fffffffe
  901.  
  902. zeichen:    blk.b 54400,0
  903. bitplane1:    blk.b 1848,0
  904. bitplane2:    blk.b 1848,0
  905. bitplane3:    blk.b 1848,0
  906. bitplane4:    blk.b 1848,0
  907.