home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / invite.lha / Invitat.s < prev    next >
Encoding:
Text File  |  1994-01-02  |  64.0 KB  |  3,533 lines

  1. ;---------------T-------T-----------------------T-----------------------T
  2.  
  3.  
  4. ; Source by Genie / The Studio. December 1993.
  5. ; Assembled with Trash'm ONE V1.6.
  6.  
  7. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  8. ; Switches
  9.  
  10. test:    equ    0
  11.  
  12. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  13. ; Constants
  14.  
  15. bpllen:    equ    44*283
  16.  
  17. dep_msc:    equ    4
  18. wid_msc:    equ    40
  19. hei_msc:    equ    256
  20.  
  21. dep_anm:    equ    5
  22. wid_anm:    equ    40
  23. hei_anm:    equ    256
  24.  
  25. dep_txt:    equ    5
  26. wid_txt:    equ    44
  27. hei_txt:    equ    283
  28.  
  29. hold_mtxt:    equ    3*50+10
  30. hold_sibanim:    equ    80
  31. hold_glbanim:    equ    40
  32. hold_access:    equ    20*50
  33.  
  34. patt_sibanim:    equ    0
  35. patt_glbanim:    equ    1
  36. patt_area:    equ    3
  37. patt_bonus:    equ    2
  38. patt_howto:    equ    7
  39. patt_whyto:    equ    48
  40. patt_facis:    equ    29
  41. patt_rules:    equ    12
  42. patt_event:    equ    72
  43. patt_craze:    equ    40
  44. patt_movie:    equ    22
  45. patt_conts:    equ    55
  46. patt_access:    equ    64
  47.  
  48. col_howto:    equ    $fff
  49. col_whyto:    equ    $ccc
  50. col_facis:    equ    $ccc
  51. col_rules:    equ    $fff
  52. col_event:    equ    $f80
  53. col_craze:    equ    $bdf
  54. col_movie:    equ    $ff0
  55. col_conts:    equ    $484
  56.  
  57. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  58. ; Baseregisters
  59.  
  60. CB:    equr    a4
  61. BR:    equr    a5
  62.  
  63. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  64. ; Macros
  65.  
  66. wblit:    macro
  67. .wb\@:    btst    #6,2(CB)
  68.     bne.s    .wb\@
  69.     endm    
  70.  
  71. wraslin:    macro
  72.     if    \1>1
  73.     moveq    #\1-1,d3
  74.     endc
  75. .wl\@:    move.b    6(CB),d4
  76. .w\@:    cmp.b    6(CB),d4
  77.     beq.s    .w\@
  78.     if    \1>1
  79.     dbf    d3,.wl\@
  80.     endc
  81.     endm
  82.  
  83. d_one:    macro
  84.     lsr.l    d4
  85.     bne.s    .get\@
  86.     move.l    -(a0),d4
  87.     roxr.l    d4
  88. .get\@:    mexit
  89.     endm
  90.  
  91. d_more:    macro
  92.     moveq    #0,\1
  93. .get\@:    lsr.l    d4
  94.     bne.s    .gt\@
  95.     move.l    -(a0),d4
  96.     roxr.l    d4
  97. .gt\@:    roxl.l    \1
  98.     dbf     d0,.get\@
  99.     endm
  100.  
  101. copper:    macro
  102.     section    Cop\1,data_c
  103. hi_\1:    equ    $ac-\3/2
  104. lo_\1:    equ    $ac+\3/2
  105. str_\1:    equ    $88-\2*2
  106. stp_\1:    equ    str_\1+\2*4-8
  107. copper_\1:    dc.w    $8e,hi_\1<<8+(str_\1+8)*2
  108.     if    lo_\1>$ff
  109.     dc.w    $90,(lo_\1-$100)<<8+((stp_\1+16)*2)&$ff
  110.     else
  111.     dc.w    $90,((stp_\1+16)*2)&$ff
  112.     endc
  113.     dc.w    $92,str_\1,$94,stp_\1
  114.     dc.w    $120,0,$122,0,$124,0,$126,0,$128,0,$12a,0,$12c,0,$12e,0
  115.     dc.w    $130,0,$132,0,$134,0,$136,0,$138,0,$13a,0,$13c,0,$13e,0
  116. colors_\1:    equ    *+2
  117.     dc.w    $180,0,$182,0
  118.     if    \4>1
  119.     dc.w    $184,0,$186,0
  120.     endc
  121.     if    \4>2
  122.     dc.w    $188,0,$18a,0,$18c,0,$18e,0
  123.     endc
  124.     if    \4>3
  125.     dc.w    $190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
  126.     endc
  127.     if    \4>4
  128.     dc.w    $1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
  129.     dc.w    $1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
  130.     endc
  131. bpl1pth_\1:    equ    *+2
  132. bpl1ptl_\1:    equ    *+6
  133.     dc.w    $e0,0,$e2,0
  134.     if    \4>1
  135. bpl2pth_\1:    equ    *+2
  136. bpl2ptl_\1:    equ    *+6
  137.     dc.w    $e4,0,$e6,0
  138.     endc
  139.     if    \4>2
  140. bpl3pth_\1:    equ    *+2
  141. bpl3ptl_\1:    equ    *+6
  142.     dc.w    $e8,0,$ea,0
  143.     endc
  144.     if    \4>3
  145. bpl4pth_\1:    equ    *+2
  146. bpl4ptl_\1:    equ    *+6
  147.     dc.w    $ec,0,$ee,0
  148.     endc
  149.     if    \4>4
  150. bpl5pth_\1:    equ    *+2
  151. bpl5ptl_\1:    equ    *+6
  152.     dc.w    $f0,0,$f2,0
  153.     endc
  154.     if    \4>5
  155. bpl6pth_\1:    equ    *+2
  156. bpl6ptl_\1:    equ    *+6
  157.     dc.w    $f4,0,$f6,0
  158.     endc
  159. bplcon0_\1:    equ    *+2
  160. bplcon1_\1:    equ    *+6
  161.     dc.w    $100,\4<<12+$200,$102,0,$104,0
  162.     dc.w    $108,\5,$10a,\5
  163.     if    lo_\1<$100
  164.     dc.l    lo_\1<<24+$07fffe
  165.     dc.w    $100,$200
  166.     endc
  167.     dc.l    -2,-2
  168.     mexit
  169.     endm
  170.  
  171. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  172. ; Code
  173.  
  174.     section    Global,code
  175.  
  176. s:    basereg    s,BR
  177.     lea    s(pc),BR
  178.     lea    $dff000,CB
  179.  
  180.     move.l    a7,adr_stack(BR)
  181.  
  182.     move.l    4.w,a6
  183.     sub.l    a1,a1
  184.     jsr    -294(a6)    ;findtask
  185.     move.l    d0,adr_thistask(BR)
  186.  
  187.     ifeq    test
  188.     move.l    d0,a3
  189.     tst.l    172(a3)    ;pr_cli
  190.     bne.s    .fromcli
  191.     lea    92(a3),a0    ;pr_msgport
  192.     jsr    -384(a6)    ;waitport
  193.     lea    92(a3),a0    ;pr_msgport
  194.     jsr    -372(a6)    ;getmsg
  195.     move.l    d0,msg_workbench(BR)
  196. .fromcli:    endc
  197.  
  198.     bsr.w    openlibraries
  199.     bra.s    prepare
  200.  
  201. adr_stack:    dc.l    0
  202. adr_thistask:    dc.l    0
  203. msg_workbench:    dc.l    0
  204.  
  205. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  206.  
  207. prepare:    move.l    adr_copper_msc(BR),a0
  208.     move.l    adr_bpla(BR),d0
  209.     moveq    #wid_msc,d1
  210.     move    d0,bpl1ptl_msc-copper_msc(a0)
  211.     swap    d0
  212.     move    d0,bpl1pth_msc-copper_msc(a0)
  213.     if    dep_msc>1
  214.     swap    d0
  215.     add.l    d1,d0
  216.     move    d0,bpl2ptl_msc-copper_msc(a0)
  217.     swap    d0
  218.     move    d0,bpl2pth_msc-copper_msc(a0)
  219.     endc
  220.     if    dep_msc>2
  221.     swap    d0
  222.     add.l    d1,d0
  223.     move    d0,bpl3ptl_msc-copper_msc(a0)
  224.     swap    d0
  225.     move    d0,bpl3pth_msc-copper_msc(a0)
  226.     endc
  227.     if    dep_msc>3
  228.     swap    d0
  229.     add.l    d1,d0
  230.     move    d0,bpl4ptl_msc-copper_msc(a0)
  231.     swap    d0
  232.     move    d0,bpl4pth_msc-copper_msc(a0)
  233.     endc
  234.     if    dep_msc>4
  235.     swap    d0
  236.     add.l    d1,d0
  237.     move    d0,bpl5ptl_msc-copper_msc(a0)
  238.     swap    d0
  239.     move    d0,bpl5pth_msc-copper_msc(a0)
  240.     endc
  241.  
  242.     move.l    adr_copper_txt(BR),a0
  243.     move.l    adr_bpla(BR),d0
  244.     move.l    #hei_txt*wid_txt,d1
  245.     move    d0,bpl1ptl_txt-copper_txt(a0)
  246.     swap    d0
  247.     move    d0,bpl1pth_txt-copper_txt(a0)
  248.     if    dep_txt>2
  249.     swap    d0
  250.     add.l    d1,d0
  251.     move    d0,bpl2ptl_txt-copper_txt(a0)
  252.     swap    d0
  253.     move    d0,bpl2pth_txt-copper_txt(a0)
  254.     endc
  255.     if    dep_txt>3
  256.     swap    d0
  257.     add.l    d1,d0
  258.     move    d0,bpl3ptl_txt-copper_txt(a0)
  259.     swap    d0
  260.     move    d0,bpl3pth_txt-copper_txt(a0)
  261.     endc
  262.     if    dep_txt>4
  263.     swap    d0
  264.     add.l    d1,d0
  265.     move    d0,bpl4ptl_txt-copper_txt(a0)
  266.     swap    d0
  267.     move    d0,bpl4pth_txt-copper_txt(a0)
  268.     endc
  269.     if    dep_txt>5
  270.     swap    d0
  271.     add.l    d1,d0
  272.     move    d0,bpl5ptl_txt-copper_txt(a0)
  273.     swap    d0
  274.     move    d0,bpl5pth_txt-copper_txt(a0)
  275.     endc
  276.  
  277.     lea    window_choice,a0
  278.     bsr.w    openwindow
  279. .choice:    bsr.w    getkey
  280.     cmp    #$45,d0    ;escape
  281.     beq.w    quit
  282.     cmp    #$40,d0    ;spacebar
  283.     beq.w    full
  284.     bsr.w    getgadget
  285.     cmp    #1,d0
  286.     beq.w    full
  287.     cmp    #2,d0
  288.     beq.b    brief
  289.     bra.b    .choice
  290.  
  291. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  292.  
  293. brief:    bsr.w    closewindow
  294.     lea    window_lang,a0
  295.     bsr.w    openwindow
  296. .choice:    bsr.w    getkey
  297.     cmp    #$45,d0    ;escape
  298.     beq.w    quit
  299.     bsr.w    getgadget
  300.     lea    name_duma(BR),a0
  301.     cmp    #1,d0
  302.     beq.b    .prepare
  303.     lea    name_chat(BR),a0
  304.     cmp    #2,d0
  305.     beq.b    .prepare
  306.     bra.b    .choice
  307.  
  308. .hei:    equ    30    ;num of lines
  309. .wid:    equ    150    ;gadget width
  310.  
  311. .gadget:    dc.l    0    ;nextgadget
  312.     dc.w    440    ;leftedge
  313. .topedge:    dc.w    12    ;topedge
  314.     dc.w    .wid,11    ;width,height
  315.     dc.w    0,3,1    ;flags,activation,gadgettype
  316.     dc.l    render    ;gadgetrender
  317.     dc.l    0    ;selectrender
  318. .adr_itext:    dc.l    0    ;gadgettext
  319.     dc.l    0,0    ;mutualexclude,specialinfo
  320. .id:    dc.w    1    ;gadgetid
  321.     dc.l    0    ;userdata
  322.  
  323. .itext:    dc.b    1,0    ;frontpen,backpen
  324.     dc.b    1,0    ;drawmode,kludgefill
  325. .leftedge:    dc.w    0,2    ;leftedge,topedge
  326.     dc.l    attr_font    ;itextfont
  327. .adr_text:    dc.l    0    ;itext
  328.     dc.l    0    ;nexttext
  329.  
  330.  
  331. .prepare:    bsr.w    closewindow
  332.     bsr.w    load
  333.     move.l    a0,adr_text(BR)
  334.     move.l    d0,len_text(BR)
  335.     bsr.w    freshentext
  336.  
  337.     move.l    adr_text(BR),a0
  338.     move.l    adr_bpla(BR),a2
  339.     move.l    adr_bplb(BR),a3
  340.     move.l    a0,d7
  341.     add.l    len_text(BR),d7
  342. .searchblock:    cmp.b    #"@",(a0)+
  343.     bne.s    .noblock
  344.  
  345.     move.l    a0,.adr_text(BR)
  346.     bsr.w    .skipline    ;skip gadget name
  347.     move.l    a0,d0
  348.     sub.l    .adr_text(BR),d0
  349.     subq.l    #1,d0
  350.     lsl    #3,d0
  351.     sub    #.wid,d0
  352.     neg    d0
  353.     lsr    d0
  354.     move    d0,.leftedge(BR)
  355.     bsr.w    .skipline    ;skip file name
  356.  
  357.     move.l    a0,(a3)+    ;text start
  358. .findeot:    cmp.b    #"@",(a0)+
  359.     beq.s    .eot
  360.     cmp.l    d7,a0
  361.     blo.s    .findeot
  362. .eot:    subq    #1,a0
  363.     move.l    a0,(a3)+    ;text end
  364.  
  365.     lea    .itext-.gadget(a2),a1
  366.     move.l    a1,.adr_itext(BR)
  367.     lea    .prepare-.gadget(a2),a1
  368.     move.l    a1,.gadget(BR)
  369.     lea    .gadget(BR),a1
  370.     moveq    #(.prepare-.gadget)/2-1,d0
  371. .copygadget:    move    (a1)+,(a2)+
  372.     dbf    d0,.copygadget
  373.     addq    #1,.id(BR)
  374.     add    #16,.topedge(BR)
  375.     cmp    #256-12,.topedge(BR)
  376.     bhs.w    quit
  377.     bra.b    .searchblock
  378.  
  379. .noblock:    cmp.l    d7,a0
  380.     blo.s    .searchblock
  381. .eof:    cmp.l    adr_bpla(BR),a2
  382.     beq.w    quit
  383.     clr.l    -(.prepare-.gadget)(a2)
  384.  
  385.     lea    window_brief,a0
  386.     bsr.w    openwindow
  387.  
  388. .ask:    bsr.w    getkey
  389.     cmp    #$45,d0    ;escape
  390.     beq.w    quit
  391.     cmp    #$4c,d0
  392.     beq.s    .keyup
  393.     cmp    #$4d,d0
  394.     beq.s    .keydown
  395.     bsr.w    getgadget
  396.     cmp    #$1000,d0
  397.     bne.s    .noup
  398. .keyup:    moveq    #9,d7
  399. .up:    bsr.w    .stepup
  400.     dbf    d7,.up
  401.     bra.s    .ask
  402. .noup:    cmp    #$2000,d0
  403.     bne.s    .nodown
  404. .keydown:    moveq    #9,d7
  405. .down:    bsr.w    .stepdown
  406.     dbf    d7,.down
  407.     bra.s    .ask
  408. .nodown:    cmp    #$3000,d0
  409.     bne.b    .noquit
  410.     bsr.w    .cls
  411.     bra.w    quit
  412. .noquit:    subq    #1,d0
  413.     bmi.b    .ask
  414.     lsl    #3,d0
  415.     move.l    adr_bplb(BR),a0
  416.     move.l    0(a0,d0.w),.beg_txt(BR)
  417.     move.l    4(a0,d0.w),.end_txt(BR)
  418.     move.l    4(a0,d0.w),.dsp_txt(BR)
  419.  
  420.     bsr.w    .cls
  421.     clr    .pos(BR)
  422.     clr    .lines(BR)
  423. .print:    bsr.w    wras
  424.     move.l    adr_gralib(BR),a6
  425.     move.l    adr_rastport(BR),a1
  426.     moveq    #0,d0
  427.     moveq    #-8,d1
  428.     movem    .scroll(BR),d2-d3/d4-d5
  429.     jsr    -396(a6)    ;scrollraster
  430.     move.l    adr_rastport(BR),a1
  431.     movem    .scroll(BR),d0/d1
  432.     addq    #6,d1
  433.     jsr    -240(a6)    ;move
  434.     move.l    adr_rastport(BR),a1
  435.     moveq    #2,d0
  436.     jsr    -342(a6)    ;setapen
  437.     move.l    .dsp_txt(BR),a0
  438.     subq    #1,a0
  439. .findprev:    tst.b    -(a0)
  440.     bne.s    .findprev
  441.     addq    #1,a0
  442.     move.l    a0,d0
  443.     sub.l    .dsp_txt(BR),d0
  444.     neg.l    d0
  445.     subq.l    #1,d0
  446.     move.l    a0,.dsp_txt(BR)
  447.     move.l    adr_rastport(BR),a1
  448.     jsr    -60(a6)    ;text
  449.  
  450.     addq    #1,.lines(BR)
  451.     move.l    .beg_txt(BR),d0
  452.     cmp.l    .dsp_txt(BR),d0
  453.     blo.s    .print
  454.  
  455.     move    .lines(BR),d0
  456.     sub    #.hei,d0
  457.     bpl.s    .bigger
  458.     moveq    #0,d0
  459. .bigger:    move    d0,.lines(BR)
  460.  
  461.     bra.w    .ask
  462.  
  463. .skipline:    tst.b    (a0)+
  464.     beq.s    .skipped
  465.     cmp.l    d7,a0
  466.     blo.s    .skipline
  467.     subq    #1,a0
  468. .skipped:    rts
  469.  
  470. .findline:    move.l    .beg_txt(BR),a0
  471.     move.l    .end_txt(BR),d7
  472.     add.l    a0,d7
  473. .find:    subq    #1,d0
  474.     bmi.s    .found
  475.     bsr.s    .skipline
  476.     bra.s    .find
  477. .found:    move.l    a0,a1
  478.     bsr.s    .skipline
  479.     exg    a0,a1
  480.     move.l    a1,d0
  481.     sub.l    a0,d0
  482.     subq.l    #1,d0
  483.     rts
  484.  
  485. .cls:    moveq    #wid_txt/4-1,d7
  486. .cl:    bsr.w    wras
  487.     move.l    adr_gralib(BR),a6
  488.     move.l    adr_rastport(BR),a1
  489.     moveq    #32,d0
  490.     moveq    #0,d1
  491.     movem    .scroll(BR),d2-d3/d4-d5
  492.     jsr    -396(a6)    ;scrollraster
  493.     dbf    d7,.cl
  494.     rts
  495.  
  496. .stepup:    move    d7,-(a7)
  497.     tst    .pos(BR)
  498.     beq.s    .sux
  499.     bsr.w    wras
  500.     move.l    adr_gralib(BR),a6
  501.     move.l    adr_rastport(BR),a1
  502.     moveq    #0,d0
  503.     moveq    #-8,d1
  504.     movem    .scroll(BR),d2-d3/d4-d5
  505.     jsr    -396(a6)    ;scrollraster
  506.     move.l    adr_rastport(BR),a1
  507.     movem    .scroll(BR),d0/d1
  508.     addq    #6,d1
  509.     jsr    -240(a6)    ;move
  510.     subq    #1,.pos(BR)
  511.     move    .pos(BR),d0
  512.     bsr.b    .findline
  513.     move.l    adr_rastport(BR),a1
  514.     jsr    -60(a6)    ;text
  515. .sux:    move    (a7)+,d7
  516.     rts
  517.  
  518. .stepdown:    move    d7,-(a7)
  519.     move    .pos(BR),d0
  520.     cmp    .lines(BR),d0
  521.     bhs.s    .sdx
  522.     bsr.w    wras
  523.     move.l    adr_gralib(BR),a6
  524.     move.l    adr_rastport(BR),a1
  525.     moveq    #0,d0
  526.     moveq    #8,d1
  527.     movem    .scroll(BR),d2-d3/d4-d5
  528.     jsr    -396(a6)    ;scrollraster
  529.     move.l    adr_rastport(BR),a1
  530.     move    .scroll(BR),d0
  531.     move    .scroll+6(BR),d1
  532.     subq    #1,d1
  533.     jsr    -240(a6)    ;move
  534.     addq    #1,.pos(BR)
  535.     move    .pos(BR),d0
  536.     add    #.hei-1,d0
  537.     bsr.w    .findline
  538.     move.l    adr_rastport(BR),a1
  539.     jsr    -60(a6)    ;text
  540. .sdx:    move    (a7)+,d7
  541.     rts
  542.  
  543. .pos:    dc.w    0
  544. .lines:    dc.w    0
  545. .beg_txt:    dc.l    0
  546. .end_txt:    dc.l    0
  547. .dsp_txt:    dc.l    0
  548. .scroll:    dc.w    48,12,wid_txt*8+47,.hei*8+11 ;minx,miny,maxx,maxy
  549.  
  550. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  551.  
  552. full:    bsr.w    closewindow
  553.     lea    window_load,a0
  554.     bsr.w    openwindow
  555.  
  556.     lea    name_chat(BR),a0    ;load text
  557.     bsr.w    load
  558.     move.l    a0,adr_text(BR)
  559.     move.l    d0,len_text(BR)
  560.     bsr.w    freshentext
  561.  
  562.     lea    name_music(BR),a0    ;load music
  563.     bsr.w    loadchip
  564.     move.l    a0,adr_music(BR)
  565.     move.l    d0,len_music(BR)
  566.  
  567.     lea    name_mfont(BR),a0    ;load mfont
  568.     bsr.w    loadfile
  569.     bsr.w    decode_ilbm
  570.     cmp    #dep_msc,iff_depth(BR)
  571.     bne.w    error_ilbm
  572.     move    iff_imagew(BR),wid_mfont(BR)
  573.     move    iff_imagey(BR),hei_mfont(BR)
  574.     cmp    #40,hei_mfont(BR)
  575.     bhi.w    error_ilbm
  576.     lea    iff_palette(BR),a1
  577.     lea    msc_palette(BR),a2
  578.     moveq    #2^dep_msc-1,d0
  579. .copymp:    move    (a1)+,(a2)+
  580.     dbf    d0,.copymp
  581.     move.l    a0,-(a7)
  582.     bsr.w    getifflen
  583.     bsr.w    alloc
  584.     move.l    a0,adr_mfont(BR)
  585.     move.l    d0,len_mfont(BR)
  586.     move.l    (a7)+,a0
  587.     move.l    adr_mfont(BR),a1
  588.     moveq    #dep_msc,d0
  589.     mulu    wid_mfont(BR),d0
  590.     bsr.w    extract_ilbm
  591.     bsr.w    unloadfile
  592.  
  593.     lea    name_sfont(BR),a0    ;load sfont
  594.     bsr.w    loadfile
  595.     bsr.w    decode_ilbm
  596.     cmp    #1,iff_depth(BR)
  597.     bne.w    error_ilbm
  598.     move    iff_imagew(BR),wid_sfont(BR)
  599.     move    iff_imagey(BR),hei_sfont(BR)
  600.     cmp    #20,hei_sfont(BR)
  601.     bhi.w    error_ilbm
  602.     move.l    a0,-(a7)
  603.     bsr.w    getifflen
  604.     bsr.w    alloc
  605.     move.l    a0,adr_sfont(BR)
  606.     move.l    d0,len_sfont(BR)
  607.     move.l    (a7)+,a0
  608.     move.l    adr_sfont(BR),a1
  609.     move    wid_sfont(BR),d0
  610.     bsr.w    extract_ilbm
  611.     bsr.w    unloadfile
  612.  
  613.     lea    name_sibanim(BR),a0    ;load sib anim
  614.     bsr.w    load
  615.     move.l    a0,adr_sibanim(BR)
  616.     move.l    d0,len_sibanim(BR)
  617.  
  618.     lea    name_january(BR),a0    ;load january logo
  619.     bsr.w    load
  620.     move.l    a0,adr_january(BR)
  621.     move.l    d0,len_january(BR)
  622.  
  623.     bsr.w    sethighpri
  624.     bsr.w    initreplay
  625.  
  626. main:    bsr.b    sibanim
  627.     bsr.w    january
  628.     bsr.w    meeting
  629.     bsr.b    glbanim
  630.     bsr.w    thearea
  631.     bsr.w    howtogetthere
  632.     bsr.w    whytocome
  633.     bsr.w    facilities
  634.     bsr.w    globalrules
  635.     bsr.w    events
  636.     bsr.w    contest
  637.     bsr.w    fullcraze
  638.     bsr.w    movies
  639.     bsr.w    access
  640.     bra.w    quit
  641.  
  642. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  643.  
  644. sibanim:    bsr.w    blankscreen
  645.     moveq    #50,d0
  646.     bsr.w    wait
  647.     lea    adr_sibanim(BR),a2
  648.     move    #hold_sibanim,d0    ;hold
  649.     moveq    #patt_sibanim,d1    ;pattern
  650.     bsr.w    playanim
  651.     bsr.w    unload
  652.     move    #150,d0
  653.     bsr.w    wait
  654.     lea    iff_palette(BR),a0
  655.     move.l    adr_copper_anm(BR),a1
  656.     lea    colors_anm-copper_anm(a1),a1
  657.     bsr    darken
  658.     rts
  659.  
  660. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  661.  
  662. glbanim:    bsr.w    blankscreen
  663.     bsr    clearscreena
  664.     bsr    clearscreenb
  665.     lea    adr_glbanim(BR),a2
  666.     move    #hold_glbanim,d0    ;hold
  667.     moveq    #patt_glbanim,d1    ;pattern
  668.     bsr.w    playanim
  669.     bsr.w    unload
  670.     moveq    #50,d0
  671.     bsr    wait
  672.     lea    iff_palette(BR),a0
  673.     move.l    adr_copper_anm(BR),a1
  674.     lea    colors_anm-copper_anm(a1),a1
  675.     bsr    darken
  676.     rts
  677.  
  678. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  679.  
  680. january:    movem.l    a0-a2/d0,-(a7)
  681.     bsr.w    blankscreen
  682.     bsr.w    clearscreena
  683.     move.l    adr_bpla(BR),d0
  684.     bsr.w    setscreen
  685.  
  686.     move.l    adr_january(BR),a0
  687.     bsr.w    decode_ilbm
  688.     cmp    #dep_anm,iff_depth(BR)
  689.     bhi.w    error_ilbm
  690.     cmp    #wid_anm,iff_imagew(BR)
  691.     bne.w    error_ilbm
  692.     cmp    #hei_anm,iff_imagey(BR)
  693.     bne.w    error_ilbm
  694.     move.l    adr_bpla(BR),a1
  695.     move    #dep_anm*wid_anm,d0
  696.     bsr.w    extract_ilbm
  697.     lea    adr_january(BR),a2
  698.     bsr.w    unload
  699.  
  700.     move.l    adr_copper_anm(BR),a2
  701.  
  702.     lea    colors_anm-copper_anm(a2),a0
  703.     moveq    #2^dep_anm-1,d0
  704. .clrc:    clr    (a0)
  705.     addq    #4,a0
  706.     dbf    d0,.clrc
  707.  
  708.     move.l    a2,$80(CB)
  709.     clr    $88(CB)
  710.  
  711.     lea    iff_palette(BR),a0
  712.     lea    colors_anm-copper_anm(a2),a1
  713.     bsr.w    lighten
  714.  
  715.     move    #hold_mtxt,timer_vblank(BR)
  716.  
  717.     lea    name_glbanim(BR),a0    ;load glob anim
  718.     bsr.w    load
  719.     move.l    a0,adr_glbanim(BR)
  720.     move.l    d0,len_glbanim(BR)
  721.  
  722.     tst    sign_vblank(BR)
  723.     beq.s    .x
  724. .vwait:    tst    timer_vblank(BR)
  725.     bne.s    .vwait
  726.     lea    iff_palette(BR),a0
  727.     lea    colors_anm-copper_anm(a2),a1
  728.     bsr.w    darken
  729.  
  730. .x:    movem.l    (a7)+,a0-a2/d0
  731.     rts
  732.  
  733. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  734.  
  735. meeting:    lea    head_meeting(BR),a1
  736.     bsr.w    mtext
  737.     bsr.w    fademtext
  738.     rts
  739.  
  740. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  741.  
  742. thearea:    moveq    #patt_area,d0
  743.     bsr    startplayer
  744.     lea    head_area(BR),a1
  745.     bsr.w    mtext
  746.     bsr.w    fademtext
  747.     lea    head_earth(BR),a1
  748.     bsr.w    mtext
  749.     bsr.w    fademtext
  750.     lea    head_eur(BR),a1
  751.     bsr.w    mtext
  752.     bsr.w    fademtext
  753.     lea    head_hun(BR),a1
  754.     bsr.w    mtext
  755.     bsr.w    fademtext
  756.     lea    head_bp(BR),a1
  757.     bsr.w    mtext
  758.     bsr.w    fademtext
  759.     rts
  760.  
  761. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  762.  
  763. howtogetthere:    lea    name_howto(BR),a0
  764.     lea    head_howto(BR),a1
  765.     moveq    #patt_howto,d1
  766.     move    #col_howto,d2
  767.     bra.w    announce
  768.  
  769. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  770.  
  771. whytocome:    lea    name_whyto(BR),a0
  772.     lea    head_whyto(BR),a1
  773.     moveq    #patt_whyto,d1
  774.     move    #col_whyto,d2
  775.     bra.w    announce
  776.  
  777. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  778.  
  779. facilities:    lea    name_facis(BR),a0
  780.     lea    head_facis(BR),a1
  781.     moveq    #patt_facis,d1
  782.     move    #col_facis,d2
  783.     bra.w    announce
  784.  
  785. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  786.  
  787. globalrules:    lea    name_rules(BR),a0
  788.     lea    head_rules(BR),a1
  789.     moveq    #patt_rules,d1
  790.     move    #col_rules,d2
  791.     bra.w    announce
  792.  
  793. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  794.  
  795. events:    lea    name_event(BR),a0
  796.     lea    head_event(BR),a1
  797.     moveq    #patt_event,d1
  798.     move    #col_event,d2
  799.     bra.w    announce
  800.  
  801. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  802.  
  803. fullcraze:    lea    name_craze(BR),a0
  804.     lea    head_craze(BR),a1
  805.     moveq    #patt_craze,d1
  806.     move    #col_craze,d2
  807.     bra.w    announce
  808.  
  809. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  810.  
  811. contest:    lea    name_conts(BR),a0
  812.     lea    head_conts(BR),a1
  813.     moveq    #patt_conts,d1
  814.     move    #col_conts,d2
  815.     bra.w    announce
  816.  
  817. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  818.  
  819. movies:    lea    name_movie(BR),a0
  820.     lea    head_movie(BR),a1
  821.     moveq    #patt_movie,d1
  822.     move    #col_movie,d2
  823.     bra.w    announce
  824.  
  825. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  826.  
  827. access:    lea    head_finally(BR),a1
  828.     bsr.w    mtext
  829.     lea    name_cred1(BR),a0
  830.     bsr.w    load
  831.     move.l    a0,adr_cred1(BR)
  832.     move.l    d0,len_cred1(BR)
  833.     bsr    fademtext
  834.     lea    head_access(BR),a1
  835.     bsr.w    mtext
  836.     lea    name_cred2(BR),a0
  837.     bsr.w    load
  838.     move.l    a0,adr_cred2(BR)
  839.     move.l    d0,len_cred2(BR)
  840.     lea    name_cred3(BR),a0
  841.     bsr.w    load
  842.     move.l    a0,adr_cred3(BR)
  843.     move.l    d0,len_cred3(BR)
  844.     bsr.w    fademtext
  845.  
  846.     move.l    adr_copper_txt(BR),a2
  847.     lea    colors_txt-copper_txt(a2),a0
  848.     moveq    #2^dep_txt-1,d0
  849. .clrc:    clr    (a0)
  850.     addq    #4,a0
  851.     dbf    d0,.clrc
  852.  
  853.     bsr.w    clearscreenb
  854.  
  855.     moveq    #patt_access,d0
  856.     bsr.w    startplayer
  857.  
  858.     move.l    a2,$80(CB)
  859.     clr    $88(CB)
  860.  
  861. .dothat:    move.l    adr_cred1(BR),a0
  862.     bsr.b    .show
  863.     move.l    adr_cred2(BR),a0
  864.     bsr.b    .show
  865.     move.l    adr_cred3(BR),a0
  866.     bsr.b    .show
  867.     bra.s    .dothat
  868.  
  869. .show:    bsr.w    clearscreena
  870.     bsr.w    decode_ilbm
  871.     cmp    #dep_txt-1,iff_depth(BR)
  872.     bhi.w    error_ilbm
  873.     cmp    #wid_txt,iff_imagew(BR)
  874.     bne.w    error_ilbm
  875.     cmp    #hei_txt,iff_imagey(BR)
  876.     bne.w    error_ilbm
  877.     move.l    adr_bpla(BR),a1
  878.     bsr.w    extract_raw
  879.  
  880.     lea    iff_palette(BR),a0
  881.     lea    colors_txt-copper_txt(a2),a1
  882.     bsr.w    lighten
  883.  
  884.     move    #hold_access,timer_vblank(BR)
  885.  
  886.     tst    sign_vblank(BR)
  887.     beq.s    .x
  888.  
  889. .vwait:    btst    #2,$16(CB)
  890.     beq.s    .out
  891.     btst    #6,$bfe001
  892.     beq.s    .x
  893.     tst    timer_vblank(BR)
  894.     bne.s    .vwait
  895.  
  896. .x:    lea    iff_palette(BR),a0
  897.     lea    colors_txt-copper_txt(a2),a1
  898.     bsr.w    darken
  899.     rts
  900.  
  901. .out:    clr    s_destv(BR)
  902.     lea    iff_palette(BR),a0
  903.     lea    colors_txt-copper_txt(a2),a1
  904.     bsr.w    darken
  905.     tst    sign_vblank(BR)
  906.     beq.w    quit
  907. .wvol:    tst    s_volum(BR)
  908.     bne.s    .wvol
  909.     bra.w    quit
  910.  
  911. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  912.  
  913. announce:    bsr.w    mtext
  914.     bsr.w    loadfile
  915.     bsr.w    fademtext
  916.     bsr.w    standardbg
  917.     bsr.w    doscroller
  918.     rts
  919.  
  920. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  921.  
  922. freshentext:    move.b    (a0),d1
  923. ;    and    #$7f,d1
  924.     cmp.b    #10,d1
  925.     bne.s    .ncr
  926.     moveq    #0,d1
  927.     bra.s    .nctrl
  928. .ncr:    cmp.b    #32,d1
  929.     bhs.s    .nctrl
  930.     moveq    #" ",d1
  931. .nctrl:    move.b    d1,(a0)+
  932.     subq.l    #1,d0
  933.     bne.s    freshentext
  934.     rts
  935.  
  936. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  937.  
  938. mtext:    movem.l    a0-a2/d0-d2,-(a7)
  939.     bsr.w    blankscreen
  940.     bsr.w    clearscreena
  941.  
  942.     move.l    a1,a0
  943.     moveq    #1,d0
  944. .getlines:    cmp.b    #" ",(a1)
  945.     bne.s    .nospace
  946.     addq    #1,d0
  947. .nospace:    tst.b    (a1)+
  948.     bne.s    .getlines
  949.     mulu    hei_mfont(BR),d0
  950.     sub    #hei_msc,d0
  951.     neg    d0
  952.     lsr    d0
  953.     mulu    #dep_msc*wid_msc,d0
  954.     add.l    adr_bpla(BR),d0
  955.     move.l    d0,a2
  956.  
  957. .newline:    move.l    a2,-(a7)
  958.     move.l    a0,a1
  959.     moveq    #0,d0
  960. .getlinelen:    move.b    (a1)+,d1
  961.     beq.s    .render
  962.     cmp.b    #" ",d1
  963.     beq.s    .render
  964.     addq    #1,d0
  965.     cmp.b    #"I",d1
  966.     beq.s    .getlinelen
  967.     addq    #3,d0
  968.     bra.s    .getlinelen
  969.  
  970. .render:    sub    #wid_msc,d0
  971.     neg    d0
  972.     lsr    d0
  973.     add    d0,a2
  974. .drawnext:    move.l    adr_mfont(BR),a1
  975.     moveq    #0,d0
  976.     move.b    (a0)+,d0
  977.     beq.s    .eof
  978.     cmp    #" ",d0
  979.     beq.s    .eol
  980.     sub    #"A",d0
  981.     add    d0,d0
  982.     add    d0,d0
  983.     add    d0,a1
  984.     moveq    #dep_msc,d1
  985.     mulu    hei_mfont(BR),d1
  986.     subq    #1,d1
  987.     move    #dep_msc*wid_msc,d2
  988.     mulu    hei_mfont(BR),d2
  989.     cmp    #("I"-"A")*4,d0
  990.     beq.s    .letteri
  991. .letter:    move.b    (a1),(a2)
  992.     move.b    1(a1),1(a2)
  993.     move.b    2(a1),2(a2)
  994.     move.b    3(a1),3(a2)
  995.     add    wid_mfont(BR),a1
  996.     lea    wid_msc(a2),a2
  997.     dbf    d1,.letter
  998.     sub.l    d2,a2
  999.     addq    #4,a2
  1000.     bra.s    .drawnext
  1001. .letteri:    move.b    (a1),(a2)
  1002.     add    wid_mfont(BR),a1
  1003.     lea    wid_msc(a2),a2
  1004.     dbf    d1,.letteri
  1005.     sub.l    d2,a2
  1006.     addq    #1,a2
  1007.     bra.s    .drawnext
  1008.  
  1009. .eol:    move.l    (a7)+,a2
  1010.     move    #dep_msc*wid_msc,d0
  1011.     mulu    hei_mfont(BR),d0
  1012.     add.l    d0,a2
  1013.     bra.w    .newline
  1014.  
  1015. .eof:    move.l    (a7)+,a2
  1016.     move.l    adr_copper_msc(BR),a1
  1017.     move.l    a1,$80(CB)
  1018.     clr    $88(CB)
  1019.  
  1020.     lea    msc_palette(BR),a0
  1021.     lea    colors_msc-copper_msc(a1),a1
  1022.     bsr.w    lighten
  1023.     move    #hold_mtxt,timer_vblank(BR)
  1024.     movem.l    (a7)+,a0-a2/d0-d2
  1025.     rts
  1026.  
  1027. fademtext:    movem.l    a0-a1,-(a7)
  1028.     tst    sign_vblank(BR)
  1029.     beq.s    .nvbl
  1030. .wait:    tst    timer_vblank(BR)
  1031.     bne.s    .wait
  1032. .nvbl:    lea    msc_palette(BR),a0
  1033.     move.l    adr_copper_msc(BR),a1
  1034.     lea    colors_msc-copper_msc(a1),a1
  1035.     bsr.w    darken
  1036.     movem.l    (a7)+,a0-a1
  1037.     rts
  1038.  
  1039. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1040.  
  1041. doscroller:    movem.l    a0-a3/d0-d3,-(a7)
  1042.     move    d1,.patt(BR)
  1043.     move    d2,.color(BR)
  1044.     bsr.w    clearscreenb
  1045.  
  1046.     move.l    a1,a0
  1047.     move.l    adr_text(BR),a1
  1048.     move.l    a1,d3
  1049.     add.l    len_text(br),d3
  1050. .search:    cmp.b    #"@",(a1)+
  1051.     beq.s    .try
  1052.     cmp.l    d3,a1
  1053.     blo.s    .search
  1054.     movem.l    (a7)+,a0-a3/d0-d3
  1055.     rts
  1056.  
  1057. .try:    move.l    a0,a2
  1058.     move.l    a1,a3
  1059. .compare:    move.b    (a2)+,d1
  1060.     beq.s    .match
  1061.     cmp.b    (a3)+,d1
  1062.     beq.s    .compare
  1063.     bra.s    .search
  1064. .match:    tst.b    (a3)
  1065.     bne.s    .search
  1066.     lea    1(a3),a0
  1067.  
  1068.     move.l    adr_bplb(BR),a1
  1069.     lea    2*wid_txt(a1),a1
  1070. .newline:    move.l    a1,-(a7)
  1071. .print:    move.b    (a0)+,d0
  1072.     cmp.l    d3,a0
  1073.     bhs.s    .eof
  1074.     and    #$7f,d0
  1075.     bne.s    .ncr
  1076.     move.l    (a7)+,a1
  1077.     move    hei_sfont(BR),d0
  1078.     addq    #2,d0
  1079.     mulu    #wid_txt,d0
  1080.     add.l    d0,a1
  1081.     neg.l    d0
  1082.     add.l    adr_eplb(BR),d0
  1083.     cmp.l    d0,a1
  1084.     bls.s    .newline
  1085.     move.l    adr_eplb(BR),.limit(BR)
  1086.     bra.s    .eoff
  1087. .ncr:    cmp    #"@",d0
  1088.     beq.s    .eof
  1089.     sub    #" ",d0
  1090.     move.l    adr_sfont(BR),a2
  1091.     add    d0,a2
  1092.     move    wid_sfont(BR),d2
  1093.     moveq    #wid_txt,d1
  1094.     move    hei_sfont(BR),d0
  1095.     subq    #1,d0
  1096.     move.l    a1,-(a7)
  1097. .draw:    move.b    (a2),(a1)
  1098.     add    d1,a1
  1099.     add    d2,a2
  1100.     dbf    d0,.draw
  1101.     move.l    (a7)+,a1
  1102.     addq    #1,a1
  1103.     bra.s    .print
  1104.  
  1105. .eof:    move.l    (a7)+,a1
  1106.     move    hei_sfont(BR),d0
  1107.     mulu    #wid_txt,d0
  1108.     add.l    a1,d0
  1109.     move.l    d0,.limit(BR)
  1110.  
  1111. .eoff:    move.l    .limit(BR),a0
  1112.     lea    -wid_txt*hei_txt(a0),a0
  1113.     cmp.l    adr_bplb(BR),a0
  1114.     bhs.s    .canmove
  1115.     move.l    adr_bplb(BR),a0
  1116. .canmove:    move.l    a0,.limit(BR)
  1117.  
  1118.     move.l    adr_copper_txt(BR),a2
  1119.     lea    colors_txt-copper_txt(a2),a0
  1120.     moveq    #2^dep_txt-1,d0
  1121. .dark:    clr    (a0)
  1122.     addq    #4,a0
  1123.     dbf    d0,.dark
  1124.  
  1125.     lea    iff_palette+2^dep_txt(BR),a0
  1126.     moveq    #2^dep_txt/2-1,d0
  1127. .fcol:    move    .color(BR),(a0)+
  1128.     dbf    d0,.fcol
  1129.     st    (a0)
  1130.  
  1131.     move.l    adr_bplb(BR),d1
  1132.     bsr.b    .setbplp
  1133.  
  1134.     move.l    a2,$80(CB)
  1135.     clr    $88(CB)
  1136.  
  1137.     move    .patt(BR),d0
  1138.     bsr.w    startplayer
  1139.  
  1140.     lea    iff_palette(BR),a0
  1141.     lea    colors_txt-copper_txt(a2),a1
  1142.     bsr.w    lighten
  1143.  
  1144.     move.b    10(CB),.last(BR)
  1145.     move.l    adr_bplb(BR),d0
  1146. .scroll:    move.b    10(CB),d1
  1147.     sub.b    .last(BR),d1
  1148.     move.b    10(CB),.last(BR)
  1149.     ext    d1
  1150.     muls    #wid_txt,d1
  1151.     add.l    d0,d1
  1152.     cmp.l    adr_bplb(BR),d1
  1153.     bhs.s    .lok
  1154.     move.l    adr_bplb(BR),d1
  1155. .lok:    cmp.l    .limit(BR),d1
  1156.     bls.s    .uok
  1157.     move.l    .limit(BR),d1
  1158. .uok:    move.l    d1,d0
  1159.     bsr.s    .setbplp
  1160.     btst    #6,$bfe001
  1161.     bne.s    .scroll
  1162.  
  1163.     moveq    #patt_bonus,d0
  1164.     bsr.w    startplayer
  1165.  
  1166. ;    clr    s_destv(BR)
  1167.  
  1168.     lea    iff_palette(BR),a0
  1169.     lea    colors_txt-copper_txt(a2),a1
  1170.     bsr.w    darken
  1171.  
  1172. ;    tst.b    s_speed(BR)
  1173. ;    beq.s    .x
  1174. ;    tst.b    sign_vblank(BR)
  1175. ;    beq.s    .x
  1176. ;.wfade:    tst    s_volum(BR)
  1177. ;    bne.s    .wfade
  1178.  
  1179. .x:    movem.l    (a7)+,a0-a3/d0-d3
  1180.     rts
  1181.  
  1182. .setbplp:    if    dep_txt=2
  1183.     move    d1,bpl2ptl_txt-copper_txt(a2)
  1184.     swap    d1
  1185.     move    d1,bpl2pth_txt-copper_txt(a2)
  1186.     endc
  1187.     if    dep_txt=3
  1188.     move    d1,bpl3ptl_txt-copper_txt(a2)
  1189.     swap    d1
  1190.     move    d1,bpl3pth_txt-copper_txt(a2)
  1191.     endc
  1192.     if    dep_txt=4
  1193.     move    d1,bpl4ptl_txt-copper_txt(a2)
  1194.     swap    d1
  1195.     move    d1,bpl4pth_txt-copper_txt(a2)
  1196.     endc
  1197.     if    dep_txt=5
  1198.     move    d1,bpl5ptl_txt-copper_txt(a2)
  1199.     swap    d1
  1200.     move    d1,bpl5pth_txt-copper_txt(a2)
  1201.     endc
  1202.     if    dep_txt=6
  1203.     move    d1,bpl6ptl_txt-copper_txt(a2)
  1204.     swap    d1
  1205.     move    d1,bpl6pth_txt-copper_txt(a2)
  1206.     endc
  1207.     rts
  1208.  
  1209. .limit:    dc.l    0
  1210. .last:    dc.w    0
  1211. .patt:    dc.w    0
  1212. .color:    dc.w    0
  1213.  
  1214. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1215.  
  1216. playanim:    movem.l    a0-a3/d0-d6,-(a7)
  1217.     tst.l    (a2)
  1218.     beq.w    error_notread
  1219.     move.l    (a2),a0
  1220.  
  1221.     move    #1,.cnt_frame(BR)
  1222.     move    d0,.cnt_hold(BR)
  1223.     move    d1,.patt(BR)
  1224.  
  1225.     move.l    adr_bpla(BR),a1
  1226.     move.l    adr_bplb(BR),a2
  1227.     movem.l    a1/a2,.adr_work(BR)
  1228.  
  1229.     cmp.l    #"FORM",(a0)+
  1230.     bne.w    error_ilbm
  1231.     addq    #4,a0
  1232.     cmp.l    #"ANIM",(a0)+
  1233.     bne.w    error_ilbm
  1234.  
  1235.     bsr.w    decode_ilbm
  1236.     tst    iff_depth(BR)
  1237.     beq.w    error_ilbm
  1238.     cmp    #dep_anm,iff_depth(BR)
  1239.     bhi.w    error_ilbm
  1240.     cmp    #wid_anm*8,iff_imagex(BR)
  1241.     bne.w    error_ilbm
  1242.     cmp    #hei_anm,iff_imagey(BR)
  1243.     bne.w    error_ilbm
  1244.     move.l    adr_bpla(BR),a1
  1245.     move    #dep_anm*wid_anm,d0
  1246.     bsr.w    extract_ilbm
  1247.     move.l    adr_bplb(BR),a1
  1248.     move    #dep_anm*wid_anm,d0
  1249.     bsr.w    extract_ilbm
  1250.  
  1251.     add.l    (a0)+,a0
  1252.     addq    #1,a0
  1253.     move.l    a0,d0
  1254.     and    #$fffe,d0
  1255.     move.l    d0,a0
  1256.  
  1257.     moveq    #60,d0
  1258.     divu    iff_rate(BR),d0
  1259.     move    d0,.cnt_delay(BR)
  1260.  
  1261.     move.l    .adr_disp(BR),d0
  1262.     bsr.w    setscreen
  1263.  
  1264.     lea    iff_palette(BR),a1
  1265.     lea    colors_anm,a2
  1266.     moveq    #2^dep_anm-1,d0
  1267. .fillp:    move    (a1)+,(a2)
  1268.     addq    #4,a2
  1269.     dbf    d0,.fillp
  1270.  
  1271.     bsr.w    wras
  1272.     move.l    adr_copper_anm(BR),$80(CB)
  1273.     clr    $88(CB)
  1274.  
  1275.     move    .patt(BR),d0
  1276.     bsr.w    startplayer
  1277.  
  1278.     move    .cnt_hold(BR),d0
  1279.     beq.s    .play
  1280.     bsr.w    wait
  1281.  
  1282. .play:    bsr.b    .showframe
  1283.     move    .cnt_frame(BR),d0
  1284.     cmp    iff_frames(BR),d0
  1285.     blo.s    .play
  1286.  
  1287.     movem.l    (a7)+,a0-a3/d0-d6
  1288.     rts
  1289.  
  1290. .showframe:    cmp.l    #"FORM",(a0)+
  1291.     bne.w    error_ilbm
  1292.     addq    #4,a0
  1293.     cmp.l    #"ILBM",(a0)+
  1294.     bne.w    error_ilbm
  1295. .finddelta:    cmp.l    #"ANHD",(a0)
  1296.     bne.s    .noanhd
  1297.     addq    #4,a0
  1298.     cmp.b    #5,4(a0)    ;?
  1299.     bne.w    error_ilbm
  1300.     add.l    (a0)+,a0
  1301.     bra.s    .finddelta
  1302. .noanhd:    cmp.l    #"DLTA",(a0)+
  1303.     beq.s    .framefound
  1304.     add.l    (a0)+,a0
  1305.     bra.s    .showframe
  1306.  
  1307. .framefound:    move.l    .adr_work(BR),a2
  1308.  
  1309.     moveq    #0,d0
  1310.     move    #dep_anm*wid_anm,d1
  1311.     move    iff_depth(BR),d2
  1312.     subq    #1,d2
  1313. .nextplane:    ;move.l    a2,-(a7)
  1314.     move    iff_imagew(BR),d3
  1315.     subq    #1,d3
  1316.     lea    4(a0),a1
  1317.     move.l    (a1,d0),d4
  1318.     beq.s    .noplane
  1319.     add.l    d4,a1
  1320. .nextbyte:    move.l    a2,a3
  1321.     moveq    #0,d4
  1322.     move.b    (a1)+,d4
  1323.     beq.s    .nochange
  1324.     subq    #1,d4
  1325. .nextcmd:    moveq    #0,d5
  1326.     move.b    (a1)+,d5
  1327.     beq.s    .packed
  1328.     bmi.s    .unpacked
  1329.     mulu    d1,d5
  1330.     add.l    d5,a3
  1331.     bra.s    .goon
  1332.  
  1333. .packed:    move.b    (a1)+,d5
  1334.     subq    #1,d5
  1335.     move.b    (a1)+,d6
  1336. .fill:    move.b    d6,(a3)
  1337.     add    d1,a3
  1338.     dbf    d5,.fill
  1339.     bra.s    .goon
  1340.  
  1341. .unpacked:    and    #$7f,d5
  1342.     subq    #1,d5
  1343. .copy:    move.b    (a1)+,(a3)
  1344.     add    d1,a3
  1345.     dbf    d5,.copy
  1346.  
  1347. .goon:    dbf    d4,.nextcmd
  1348.  
  1349. .nochange:    addq    #1,a2
  1350.     dbf    d3,.nextbyte
  1351. .noplane:    ;move.l    (a7)+,a2
  1352.     ;lea    wid(a2),a2
  1353.     addq    #4,d0
  1354.     dbf    d2,.nextplane
  1355.  
  1356.     move    .cnt_delay(BR),d0
  1357.     bsr.w    wait
  1358.  
  1359.     movem.l    .adr_work(BR),a1-a2
  1360.     exg    a1,a2
  1361.     movem.l    a1-a2,.adr_work(BR)
  1362.     move.l    a2,d0
  1363.     bsr.b    setscreen
  1364.  
  1365.     add.l    (a0)+,a0
  1366.     addq    #1,a0
  1367.     move.l    a0,d0
  1368.     and    #$fffe,d0
  1369.     move.l    d0,a0
  1370.  
  1371.     addq    #1,.cnt_frame(BR)
  1372.     rts
  1373.  
  1374. .patt:    dc.w    0
  1375. .adr_work:    dc.l    0
  1376. .adr_disp:    dc.l    0
  1377. .cnt_frame:    dc.w    0
  1378. .cnt_hold:    dc.w    0
  1379. .cnt_delay:    dc.w    0
  1380.  
  1381. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1382.  
  1383. setscreen:    movem.l    a1/d1,-(a7)
  1384.     move.l    adr_copper_anm(BR),a1
  1385.     moveq    #wid_anm,d1
  1386.     move    d0,bpl1ptl_anm-copper_anm(a1)
  1387.     swap    d0
  1388.     move    d0,bpl1pth_anm-copper_anm(a1)
  1389.     if    dep_anm>1
  1390.     swap    d0
  1391.     add.l    d1,d0
  1392.     move    d0,bpl2ptl_anm-copper_anm(a1)
  1393.     swap    d0
  1394.     move    d0,bpl2pth_anm-copper_anm(a1)
  1395.     endc
  1396.     if    dep_anm>2
  1397.     swap    d0
  1398.     add.l    d1,d0
  1399.     move    d0,bpl3ptl_anm-copper_anm(a1)
  1400.     swap    d0
  1401.     move    d0,bpl3pth_anm-copper_anm(a1)
  1402.     endc
  1403.     if    dep_anm>3
  1404.     swap    d0
  1405.     add.l    d1,d0
  1406.     move    d0,bpl4ptl_anm-copper_anm(a1)
  1407.     swap    d0
  1408.     move    d0,bpl4pth_anm-copper_anm(a1)
  1409.     endc
  1410.     if    dep_anm>4
  1411.     swap    d0
  1412.     add.l    d1,d0
  1413.     move    d0,bpl5ptl_anm-copper_anm(a1)
  1414.     swap    d0
  1415.     move    d0,bpl5pth_anm-copper_anm(a1)
  1416.     endc
  1417.     movem.l    (a7)+,a1/d1
  1418.     rts
  1419.  
  1420. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1421.  
  1422. standardbg:    movem.l    a0-a2,-(a7)
  1423.     bsr.b    decode_ilbm
  1424.     cmp    #dep_txt-1,iff_depth(BR)
  1425.     bne.w    error_ilbm
  1426.     cmp    #wid_txt,iff_imagew(BR)
  1427.     bne.w    error_ilbm
  1428.     cmp    #hei_txt,iff_imagey(BR)
  1429.     bne.w    error_ilbm
  1430.     move.l    adr_bpla(BR),a1
  1431.     bsr.w    extract_raw
  1432.     bsr.w    unloadfile
  1433.     movem.l    (a7)+,a0-a2
  1434.     rts
  1435.  
  1436. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1437.  
  1438. ; input:    a0 as the pointer to the ILBM file
  1439. ; result:    a0 pointing at the BODY chunk
  1440. ;    all parameters set
  1441.  
  1442. decode_ilbm:    movem.l    a1-a2/d0-d2,-(a7)
  1443.     clr    iff_depth(BR)
  1444.     clr    iff_grabx(BR)
  1445.     clr    iff_graby(BR)
  1446.     clr    iff_frames(BR)
  1447.     move    #30,iff_rate(BR)
  1448.  
  1449.     cmp.l    #"FORM",(a0)+
  1450.     bne.w    .x
  1451.     addq    #4,a0
  1452.     cmp.l    #"ILBM",(a0)+
  1453.     bne.w    .x
  1454.     bra.s    .srch
  1455.  
  1456. .next:    add.l    (a0)+,a0
  1457.     move.l    a0,d0
  1458.     addq.l    #1,d0
  1459.     and    #$fffe,d0
  1460.     move.l    d0,a0
  1461.  
  1462. .srch:    moveq    #0,d0
  1463.  
  1464.     cmp.l    #"BMHD",(a0)
  1465.     bne.s    .nobmhd
  1466.     addq    #4,a0
  1467.     move    4(a0),iff_imagex(BR)    ;horizontal image size
  1468.     move    6(a0),iff_imagey(BR)    ;vertical image size
  1469.     move.b    12(a0),d0
  1470.     move    d0,iff_depth(BR)    ;depth
  1471.     move.b    14(a0),d0
  1472.     move    d0,iff_compr(BR)    ;compression mode
  1473.     move.b    16(a0),d0
  1474.     move    d0,iff_aspectx(BR)    ;horizontal pixel aspect
  1475.     move.b    17(a0),d0
  1476.     move    d0,iff_aspecty(BR)    ;vertical pixel aspect
  1477.     move    20(a0),iff_screenx(BR)
  1478.     move    22(a0),iff_screeny(BR)
  1479.  
  1480.     move    iff_imagex(BR),d0
  1481.     add    #15,d0
  1482.     lsr    #4,d0
  1483.     add    d0,d0
  1484.     move    d0,iff_imagew(BR)    ;image width (in bytes)
  1485.     bra.s    .next
  1486.  
  1487. .nobmhd:    cmp.l    #"GRAB",(a0)
  1488.     bne.s    .nograb
  1489.     addq    #4,a0
  1490.     move    4(a0),iff_grabx(BR)    ;horizontal grab position
  1491.     move    6(a0),iff_graby(BR)    ;vertical grab position
  1492.     bra.s    .next
  1493.  
  1494. .nograb:    cmp.l    #"CMAP",(a0)
  1495.     bne.s    .nocmap
  1496.     addq    #4,a0
  1497.     lea    4(a0),a1
  1498.     lea    iff_palette(BR),a2
  1499.     move.l    (a0),d0
  1500.     divu    #3,d0
  1501.     moveq    #31,d1
  1502. .sc:    moveq    #0,d2
  1503.     move.b    (a1),d2
  1504.     lsl    #4,d2
  1505.     move.b    2(a1),d2
  1506.     lsr.b    #4,d2
  1507.     or.b    1(a1),d2
  1508.     move    d2,(a2)+
  1509.     addq    #3,a1
  1510.     subq    #1,d0
  1511.     dbeq    d1,.sc
  1512.     st    (a2)
  1513.     bra.w    .next
  1514.  
  1515. .nocmap:    cmp.l    #"DPAN",(a0)
  1516.     bne.s    .nodpan
  1517.     addq    #4,a0
  1518.     move    6(a0),iff_frames(BR)    ;number of anim frames
  1519.     move.b    8(a0),d0
  1520.     move    d0,iff_rate(BR)    ;framerate
  1521.     bra.w    .next
  1522.  
  1523. .nodpan:    cmp.l    #"BODY",(a0)+
  1524.     bne.w    .next
  1525.  
  1526. .x:    movem.l    (a7)+,a1-a2/d0-d2
  1527.     tst    iff_depth(BR)
  1528.     beq.w    error_ilbm
  1529.     rts
  1530.  
  1531.  
  1532. iff_compr:    dc.w    0
  1533. iff_depth:    dc.w    0
  1534. iff_imagey:    dc.w    0
  1535. iff_imagex:    dc.w    0
  1536. iff_screeny:    dc.w    0
  1537. iff_screenx:    dc.w    0
  1538. iff_aspectx:    dc.w    0
  1539. iff_aspecty:    dc.w    0
  1540. iff_grabx:    dc.w    0
  1541. iff_graby:    dc.w    0
  1542. iff_imagew:    dc.w    0
  1543. iff_frames:    dc.w    0
  1544. iff_rate:    dc.w    0
  1545. iff_palette:    blk.w    32,0
  1546.     dc.w    -1
  1547.  
  1548. getifflen:    move    iff_imagey(BR),d0
  1549.     mulu    iff_imagew(BR),d0
  1550.     mulu    iff_depth(BR),d0
  1551.     rts
  1552.  
  1553. extract_ilbm:    movem.l    a0-a2/d0-d5,-(a7)
  1554.     addq    #4,a0
  1555.     move.l    d0,d5
  1556.  
  1557.     tst    iff_compr(BR)
  1558.     bne.s    .frozen
  1559.  
  1560.     move    iff_imagew(BR),d0
  1561.     lsr    d0
  1562.     mulu    iff_depth(BR),d0
  1563.     subq    #1,d0
  1564.     move    iff_imagey(BR),d1
  1565.     subq    #1,d1
  1566. .nextlin:    move.l    a1,a2
  1567.     move    d0,d2
  1568. .copyline:    move    (a0)+,(a2)+
  1569.     dbf    d2,.copyline
  1570.     add    d5,a1
  1571.     dbf    d1,.nextlin
  1572.     bra.s    .x
  1573.  
  1574. .frozen:    cmp    #1,iff_compr(BR)
  1575.     bne.w    error_ilbm
  1576.  
  1577.     move    iff_imagey(BR),d1 ;height
  1578.     subq    #1,d1
  1579. .nextline:    move.l    a1,a2
  1580.     move    iff_depth(BR),d2
  1581.     subq    #1,d2
  1582. .nextplane:    move    iff_imagew(BR),d3 ;width
  1583. .nextcode:    moveq    #0,d0
  1584.     move.b    (a0)+,d0
  1585.     bmi.s    .packed
  1586. .copy:    move.b    (a0)+,(a2)+
  1587.     subq    #1,d3
  1588.     beq.s    .eol
  1589.     dbf    d0,.copy
  1590.     bra.s    .nextcode
  1591. .packed:    neg.b    d0
  1592.     move.b    (a0)+,d4
  1593. .fill:    move.b    d4,(a2)+
  1594.     subq    #1,d3
  1595.     beq.s    .eol
  1596.     dbf    d0,.fill
  1597.     bra.s    .nextcode
  1598. .eol:    dbf    d2,.nextplane
  1599.     add    d5,a1
  1600.     dbf    d1,.nextline
  1601.  
  1602. .x:    movem.l    (a7)+,a0-a2/d0-d5
  1603.     rts
  1604.  
  1605. extract_raw:    movem.l    a0-a2/d0-d5,-(a7)
  1606.     addq    #4,a0
  1607.  
  1608.     move    iff_imagey(BR),d5
  1609.     subq    #1,d5
  1610.     mulu    iff_imagew(BR),d5
  1611.  
  1612.     tst    iff_compr(BR)
  1613.     bne.s    .frozen
  1614.  
  1615.     move    iff_imagey(BR),d0
  1616.     subq    #1,d0
  1617. .nxtlin:    move    iff_depth(BR),d1
  1618.     subq    #1,d1
  1619.     move.l    a1,a2
  1620. .nxtpln:    move    iff_imagew(BR),d2
  1621.     lsr    d2
  1622.     subq    #1,d2
  1623. .copyline:    move    (a0)+,(a2)+
  1624.     dbf    d2,.copyline
  1625.     add.l    d5,a2
  1626.     dbf    d1,.nxtpln
  1627.     add    iff_imagew(BR),a1
  1628.     dbf    d0,.nxtlin
  1629.     bra.s    .x
  1630.  
  1631. .frozen:    cmp    #1,iff_compr(BR)
  1632.     bne.w    error_ilbm
  1633.  
  1634.     move    iff_imagey(BR),d1 ;height
  1635.     subq    #1,d1
  1636. .nextline:    move.l    a1,a2
  1637.     move    iff_depth(BR),d2
  1638.     subq    #1,d2
  1639. .nextplane:    move    iff_imagew(BR),d3 ;width
  1640.  
  1641. .nextcode:    moveq    #0,d0
  1642.     move.b    (a0)+,d0
  1643.     bmi.s    .packed
  1644. .copy:    move.b    (a0)+,(a2)+
  1645.     subq    #1,d3
  1646.     beq.s    .eol
  1647.     dbf    d0,.copy
  1648.     bra.s    .nextcode
  1649. .packed:    neg.b    d0
  1650.     move.b    (a0)+,d4
  1651. .fill:    move.b    d4,(a2)+
  1652.     subq    #1,d3
  1653.     beq.s    .eol
  1654.     dbf    d0,.fill
  1655.     bra.s    .nextcode
  1656.  
  1657. .eol:    add.l    d5,a2
  1658.     dbf    d2,.nextplane
  1659.     add    iff_imagew(BR),a1
  1660.     dbf    d1,.nextline
  1661.  
  1662. .x:    movem.l    (a7)+,a0-a2/d0-d5
  1663.     rts
  1664.  
  1665. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1666.  
  1667. wait:    bsr.b    wras
  1668.     subq    #1,d0
  1669.     bne.s    wait
  1670.     rts
  1671.  
  1672. wras:    move.l    d0,-(a7)
  1673. .wr:    move.l    4(CB),d0
  1674.     lsr.l    #8,d0
  1675.     and    #$1ff,d0
  1676.     cmp    #$130,d0
  1677.     bne.s    .wr
  1678. .wra:    move.l    4(CB),d0
  1679.     lsr.l    #8,d0
  1680.     and    #$1ff,d0
  1681.     cmp    #$130,d0
  1682.     beq.s    .wra
  1683.     move.l    (a7)+,d0
  1684.     rts
  1685.  
  1686.     rem
  1687. wras:    movem.l    a0-a1/d0-d1,-(a7)
  1688.     move.l    adr_gralib(BR),a6
  1689.     jsr    -270(a6)    ;waittof
  1690.     movem.l    (a7)+,a0-a1/d0-d1
  1691.     rts
  1692.     endrem
  1693.  
  1694. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1695.  
  1696. blankscreen:    move.l    #copper_blk,$80(CB)
  1697.     clr    $88(CB)
  1698.     rts
  1699.  
  1700. clearscreena:    movem.l    a0-a1/d0-d7,-(a7)
  1701.     move.l    adr_bpla(BR),a0
  1702.     move.l    adr_epla(BR),a1
  1703.     bsr.b    clearscreen
  1704.     movem.l    (a7)+,a0-a1/d0-d7
  1705.     rts
  1706.  
  1707. clearscreenb:    movem.l    a0-a1/d0-d7,-(a7)
  1708.     move.l    adr_bplb(BR),a0
  1709.     move.l    adr_eplb(BR),a1
  1710.     bsr.b    clearscreen
  1711.     movem.l    (a7)+,a0-a1/d0-d7
  1712.     rts
  1713.  
  1714. clearscreen:    movem.l    .empty(BR),d0-d7
  1715. .clr:    movem.l    d0-d7,-(a1)
  1716.     cmp.l    a0,a1
  1717.     bhs.s    .clr
  1718.     rts
  1719.  
  1720. .empty:    blk.l    8,0
  1721.  
  1722. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1723.  
  1724. lighten:    move    #$fff,d0
  1725. .lighten:    bsr.w    wras
  1726.     sub    #$101,d0
  1727.     bsr.b    setc
  1728.     bsr.w    wras
  1729.     sub    #$010,d0
  1730.     bsr.b    setc
  1731.     tst    d0
  1732.     bne.s    .lighten
  1733.     rts
  1734.  
  1735. darken:    moveq    #0,d0
  1736. .darken:    bsr.w    wras
  1737.     add    #$101,d0
  1738.     bsr.b    setc
  1739.     bsr.w    wras
  1740.     add    #$010,d0
  1741.     bsr.b    setc
  1742.     cmp    #$fff,d0
  1743.     bne.s    .darken
  1744.     rts
  1745.  
  1746. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1747.  
  1748. setc:    movem.l    a0-a1/d0-d3,-(a7)
  1749. .do:    move    (a0)+,d1
  1750.     bpl.s    .0
  1751.     movem.l    (a7)+,a0-a1/d0-d3
  1752.     rts
  1753. .0:    move    d0,d2
  1754.     ;bpl.s    .s0
  1755.     ;not    d1
  1756. .s0:    move    d1,d3
  1757.     and    #$0ff,d1
  1758.     and    #$f00,d2
  1759.     and    #$f00,d3
  1760.     sub    d2,d3
  1761.     blo.s    .1
  1762.     or    d3,d1
  1763. .1:    move    d0,d2
  1764.     move    d1,d3
  1765.     and    #$f0f,d1
  1766.     and    #$0f0,d2
  1767.     and    #$0f0,d3
  1768.     sub    d2,d3
  1769.     blo.s    .2
  1770.     or    d3,d1
  1771. .2:    move    d0,d2
  1772.     move    d1,d3
  1773.     and    #$ff0,d1
  1774.     and    #$00f,d2
  1775.     and    #$00f,d3
  1776.     sub    d2,d3
  1777.     blo.s    .3
  1778.     or    d3,d1
  1779. .3:    ;tst    d0
  1780.     ;bpl.s    .s1
  1781.     ;not    d1
  1782. .s1:    move    d1,(a1)
  1783.     addq    #4,a1
  1784.     bra.s    .do
  1785.  
  1786. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1787.  
  1788. startplayer:    sf    s_speed(BR)
  1789.     move    #$f,$96(CB)
  1790.     clr    $a8(CB)
  1791.     clr    $b8(CB)
  1792.     clr    $c8(CB)
  1793.     clr    $d8(CB)
  1794.     tst    d0
  1795.     bmi.s    .x
  1796.     move.b    d0,s_posit(BR)
  1797.     sf    s_ptpos(BR)
  1798.     sf    s_count(BR)
  1799.     sf    s_ptdel(BR)
  1800.     sf    s_newpt(BR)
  1801.     sf    s_soffs(BR)
  1802.     move    #64,s_volum(BR)
  1803.     move    #64,s_destv(BR)
  1804.     move.b    #5,s_timer(BR)
  1805.     move.b    #6,s_speed(BR)
  1806. .x:    rts
  1807.  
  1808. initreplay:    move.l    adr_music(BR),a0
  1809.     move.l    a0,a1
  1810.     move    (a0)+,d0
  1811.     move.l    a0,s_slist(BR)
  1812.     lsl    #3,d0
  1813.     add    d0,a0
  1814.     move.l    a0,s_plist(BR)
  1815.     moveq    #0,d0
  1816. .0:    move.b    (a0),d1
  1817.     and    #$7f,d1
  1818.     cmp    d0,d1
  1819.     ble.s    .1
  1820.     move.b    d1,d0
  1821. .1:    tst.b    (a0)+
  1822.     bpl.s    .0
  1823.     addq    #1,a0
  1824.     move.l    a0,d1
  1825.     and    #$fffe,d1
  1826.     move.l    d1,a0
  1827.     move.l    a0,s_poffs(BR)
  1828.     addq    #1,d0
  1829.     lsl    #3,d0
  1830.     add    d0,a0
  1831.     move    (a0),d0
  1832.     add.l    d0,a0
  1833.     lea    s_smpls(BR),a2
  1834.     move    (a1)+,d0
  1835.     subq    #1,d0
  1836. .2:    move.l    a0,(a2)+
  1837.     moveq    #0,d1
  1838.     move    (a1),d1
  1839.     add.l    d1,d1
  1840.     add.l    d1,a0
  1841.     addq    #8,a1
  1842.     dbf    d0,.2
  1843.  
  1844.     sf    s_speed(BR)
  1845.     move.b    #%1111,s_cstat(BR)    ;all channels on
  1846.  
  1847.     or.b    #2,$bfe001    ;reset filter
  1848.     bra.w    installvblank
  1849.  
  1850. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1851.  
  1852. sethighpri:    move.l    4.w,a6
  1853.     move.l    adr_thistask(BR),a1
  1854.     moveq    #127,d0
  1855.     jsr    -300(a6)    ;settaskpri
  1856.     rts
  1857.  
  1858. setnormpri:    move.l    4.w,a6
  1859.     move.l    adr_thistask(BR),a1
  1860.     moveq    #0,d0
  1861.     jsr    -300(a6)    ;settaskpri
  1862.     rts
  1863.  
  1864. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1865.  
  1866. openlibraries:    move.l    4.w,a6
  1867.     lea    name_doslib(BR),a1
  1868.     moveq    #34,d0
  1869.     jsr    -552(a6)    ;openlib
  1870.     move.l    d0,adr_doslib(BR)
  1871.     beq.w    quit
  1872.     lea    name_intlib(BR),a1
  1873.     moveq    #34,d0
  1874.     jsr    -552(a6)    ;openlib
  1875.     move.l    d0,adr_intlib(BR)
  1876.     beq.w    quit
  1877.     lea    name_gralib(BR),a1
  1878.     moveq    #34,d0
  1879.     jsr    -552(a6)    ;openlib
  1880.     move.l    d0,adr_gralib(BR)
  1881.     beq.w    quit
  1882.     rts
  1883.  
  1884. closelibraries:    move.l    4.w,a6
  1885.     move.l    adr_doslib(BR),d0
  1886.     beq.s    .ndos
  1887.     move.l    d0,a1
  1888.     jsr    -414(a6)    ;closelib
  1889. .ndos:    move.l    adr_intlib(BR),d0
  1890.     beq.s    .nint
  1891.     move.l    d0,a1
  1892.     jsr    -414(a6)    ;closelib
  1893. .nint:    move.l    adr_gralib(BR),d0
  1894.     beq.s    .nreq
  1895.     move.l    d0,a1
  1896.     jsr    -414(a6)    ;closelib
  1897. .nreq:    rts
  1898.  
  1899. name_doslib:    dc.b    "dos.library",0
  1900. name_intlib:    dc.b    "intuition.library",0
  1901. name_gralib:    dc.b    "graphics.library",0
  1902.     even
  1903.  
  1904. adr_doslib:    dc.l    0
  1905. adr_intlib:    dc.l    0
  1906. adr_gralib:    dc.l    0
  1907.  
  1908. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1909.  
  1910.     rem
  1911. opendevice:    move.l    4.w,a6
  1912.     lea    name_condev(BR),a0
  1913.     lea    io_request(BR),a1
  1914.     moveq    #-1,d0
  1915.     moveq    #0,d1
  1916.     jsr    -444(a6)    ;opendevice
  1917.     tst.l    d0
  1918.     bne.w    quit
  1919.     rts
  1920.  
  1921. closedevice:    move.l    4.w,a6
  1922.     tst.l    adr_condev(BR)
  1923.     beq.s    .x
  1924.     lea    io_request(BR),a1
  1925.     jsr    -450(a6)    ;closedevice
  1926.     clr.l    adr_condev(BR)
  1927. .x:    rts
  1928.  
  1929. io_request:    ds.l    5
  1930. adr_condev:    dc.l    0
  1931.     ds.l    2
  1932.  
  1933. name_condev:    dc.b    "console.device",0
  1934.     even
  1935.     endrem
  1936.  
  1937. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1938.  
  1939. openwindow:    movem.l    a0-a1/d0-a1,-(a7)
  1940.     tst.l    adr_window(BR)
  1941.     bne.s    .x
  1942.     move.l    adr_intlib(BR),a6
  1943.     move.l    56(a6),30(a0) ;wbscreen
  1944.     jsr    -204(a6)    ;openwindow
  1945.     move.l    d0,adr_window(BR)
  1946.     beq.w    quit
  1947.     move.l    d0,a0
  1948.     move.l    86(a0),adr_windowport(BR) ;keyport
  1949.     move.l    50(a0),adr_rastport(BR)
  1950. .x:    movem.l    (a7)+,a0-a1/d0-a1
  1951.     rts
  1952.  
  1953. closewindow:    movem.l    a0-a1/d0-a1,-(a7)
  1954.     move.l    adr_intlib(BR),a6
  1955.     move.l    adr_window(BR),d0
  1956.     beq.s    .x
  1957.     move.l    d0,a0
  1958.     jsr    -72(a6)    ;closewindow
  1959.     clr.l    adr_window(BR)
  1960.     clr.l    adr_windowport(BR)
  1961.     clr.l    adr_rastport(BR)
  1962. .x:    movem.l    (a7)+,a0-a1/d0-a1
  1963.     rts
  1964.  
  1965. adr_window:    dc.l    0
  1966. adr_windowport:    dc.l    0
  1967. adr_rastport:    dc.l    0
  1968.  
  1969. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1970.  
  1971. getkey:    movem.l    a0-a2/d1,-(a7)
  1972.  
  1973.     clr    key_rawcode(BR)
  1974.     move.l    4.w,a6
  1975.     move.l    adr_windowport(BR),a0
  1976.     jsr    -384(a6)    ;waitport
  1977.     move.l    adr_windowport(BR),a0
  1978.     jsr    -372(a6)    ;getmsg
  1979.     tst.l    d0
  1980.     beq.s    .x
  1981.     move.l    d0,a1
  1982.     btst    #2,22(a1)    ;message type
  1983.     beq.b    .norawkey
  1984.     btst    #7,25(a1)    ;release
  1985.     bne.b    .norawkey
  1986.     move    24(a1),key_rawcode(BR)
  1987.     move    26(a1),key_qualifier(BR)
  1988.     move.l    28(a1),key_iaddress(BR)
  1989. .norawkey:    jsr    -378(a6)    ;replymsg
  1990.  
  1991. .x:    movem.l    (a7)+,a0-a2/d1
  1992.     move    key_rawcode(BR),d0
  1993.     rts
  1994.  
  1995. key_rawcode:    dc.w    0
  1996. key_qualifier:    dc.w    0
  1997. key_iaddress:    dc.l    0
  1998.  
  1999. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2000.  
  2001. getgadget:    movem.l    a0-a1/d1,-(a7)
  2002.  
  2003.     clr    gadget_id(BR)
  2004.     move.l    4.w,a6
  2005.     move.l    adr_windowport(BR),a0
  2006.     jsr    -384(a6)    ;waitport
  2007.     move.l    adr_windowport(BR),a0
  2008.     jsr    -372(a6)    ;getmsg
  2009.     tst.l    d0
  2010.     beq.s    .x
  2011.     move.l    d0,a1
  2012.     btst    #6,23(a1)
  2013.     beq.s    .nogadget
  2014.     move.l    28(a1),a0
  2015.     move.l    a0,gadget_address(BR)
  2016.     move    38(a0),gadget_id(BR)
  2017. .nogadget:    jsr    -378(a6)    ;replymsg
  2018.  
  2019. .x:    movem.l    (a7)+,a0-a1/d1
  2020.     move    gadget_id(BR),d0
  2021.     rts
  2022.  
  2023. gadget_id:    dc.w    0
  2024. gadget_address:    dc.l    0
  2025.  
  2026. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2027.  
  2028. installvblank:    movem.l    a0-a1/d0-d1,-(a7)
  2029.     tst    sign_vblank(BR)
  2030.     bne.s    .x
  2031.     move.l    4.w,a6
  2032.     lea    server_vblank(BR),a1
  2033.     moveq    #5,d0
  2034.     jsr    -168(a6)    ;addintserver
  2035.     st    sign_vblank(BR)
  2036. .x:    movem.l    (a7)+,a0-a1/d0-d1
  2037.     rts
  2038.  
  2039. removevblank:    movem.l    a0-a1/d0-d1,-(a7)
  2040.     tst    sign_vblank(BR)
  2041.     beq.s    .x
  2042.     move.l    4.w,a6
  2043.     lea    server_vblank(BR),a1
  2044.     moveq    #5,d0
  2045.     jsr    -174(a6)    ;remintserver
  2046.     sf    sign_vblank(BR)
  2047.     move    #$f,$96(CB)
  2048.     clr    $a8(CB)
  2049.     clr    $b8(CB)
  2050.     clr    $c8(CB)
  2051.     clr    $d8(CB)
  2052. .x:    movem.l    (a7)+,a0-a1/d0-d1
  2053.     rts
  2054.  
  2055. sign_vblank:    dc.w    0
  2056. timer_vblank:    dc.w    0
  2057.  
  2058. server_vblank:    dc.l    0,0
  2059.     dc.b    2,5
  2060.     dc.l    .name,0
  2061.     dc.l    code_vblank
  2062. .name:    dc.b    "Global.server",0
  2063.     even
  2064.  
  2065.  
  2066. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2067.  
  2068. alloc:    movem.l    d1/a1,-(a7)
  2069.     move.l    4.w,a6
  2070.     move.l    d0,-(a7)
  2071.     move.l    #$10001,d1
  2072.     jsr    -198(a6)    ;allocmem
  2073.     tst.l    d0
  2074.     beq.w    error_memory
  2075.     move.l    d0,a0
  2076.     move.l    (a7)+,d0
  2077. .x:    movem.l    (a7)+,d1/a1
  2078.     rts
  2079.  
  2080. unloadfile:    lea    adr_file(BR),a2
  2081. unload:    movem.l    a0-a1/d0-d1,-(a7)
  2082.     move.l    4.w,a6
  2083.     move.l    (a2),a1
  2084.     move.l    4(a2),d0
  2085.     beq.s    .x
  2086.     jsr    -210(a6)    ;freemem
  2087.     clr.l    (a2)
  2088.     clr.l    4(a2)
  2089. .x:    movem.l    (a7)+,a0-a1/d0-d1
  2090.     rts
  2091.  
  2092. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2093.  
  2094. load:    moveq    #1,d0
  2095.     bsr.b    readfile
  2096.     beq.w    error_read
  2097.     bmi.w    error_memory
  2098.     rts
  2099.  
  2100. loadchip:    moveq    #2,d0
  2101.     bsr.b    readfile
  2102.     beq.w    error_read
  2103.     bmi.w    error_memory
  2104.     rts
  2105.  
  2106. loadfile:    tst.l    adr_file(BR)
  2107.     bne.w    error_alloc
  2108.     moveq    #1,d0
  2109.     bsr.b    readfile
  2110.     beq.w    error_read
  2111.     bmi.w    error_memory
  2112.     move.l    a0,adr_file(BR)
  2113.     move.l    d0,len_file(BR)
  2114.     rts
  2115.  
  2116. readfile:    movem.l    a1/d1-d7,-(a7)
  2117.     move.l    d0,.memtype(BR)
  2118.  
  2119.     moveq    #64,d4    ;safety
  2120.     moveq    #0,d5    ;fileaccess
  2121.     moveq    #0,d6    ;addr
  2122.     moveq    #0,d7    ;length
  2123.  
  2124.     move.l    adr_doslib(BR),a6
  2125.     move.l    a0,d1
  2126.     move.l    #1005,d2
  2127.     jsr    -30(a6)    ;open
  2128.     move.l    d0,d5
  2129.     beq.b    .xnotread
  2130.  
  2131.     lea    .long(BR),a0
  2132.     moveq    #4,d0
  2133.     bsr.b    .read
  2134.  
  2135.     cmp.l    #"PP20",(a0)
  2136.     beq.w    .pp20
  2137.  
  2138.     moveq    #0,d2 ; offs
  2139.     moveq    #1,d3 ; end
  2140.     bsr.b    .seek
  2141.     moveq    #-1,d3 ; beg
  2142.     bsr.b    .seek
  2143. ;    addq.l    #1,d0
  2144. ;    and    #$fffe,d0 ;even
  2145.     move.l    d0,d7
  2146.  
  2147.     bsr.s    .alloc
  2148.     move.l    d6,a0
  2149.     move.l    d7,d0
  2150.     bsr.b    .read
  2151.     bsr.b    .close
  2152.  
  2153. .x:    move.l    d6,a0 ;adr
  2154.     move.l    d7,d0 ;len
  2155.     movem.l    (a7)+,a1/d1-d7
  2156.     tst.l    d0
  2157.     rts
  2158.  
  2159. .read:    movem.l    a0-a1/d1-d3,-(a7)
  2160.     move.l    adr_doslib(BR),a6
  2161.     move.l    d5,d1
  2162.     move.l    a0,d2
  2163.     move.l    d0,d3
  2164.     jsr    -42(a6)    ;read
  2165.     cmp.l    d3,d0
  2166.     bne.s    .readerror
  2167.     movem.l    (a7)+,a0-a1/d1-d3
  2168.     rts
  2169. .readerror:    movem.l    (a7)+,a0-a1/d1-d3
  2170.     addq    #4,a7
  2171.     bsr.b    .free
  2172.     bsr.b    .close
  2173. .xnotread:    movem.l    (a7)+,a1/d1-d7
  2174.     sub.l    a0,a0
  2175.     moveq    #0,d0
  2176.     rts
  2177.  
  2178. .seek:    movem.l    a0-a1/d1,-(a7)
  2179.     move.l    adr_doslib(BR),a6
  2180.     move.l    d5,d1
  2181.     jsr    -66(a6)    ;seek
  2182.     movem.l    (a7)+,a0-a1/d1
  2183.     rts
  2184.  
  2185. .alloc:    movem.l    a0-a1/d0-d1,-(a7)
  2186.     move.l    4.w,a6
  2187.     move.l    .memtype(BR),d1
  2188.     jsr    -198(a6)    ;allocmem
  2189.     move.l    d0,d6
  2190.     beq.b    .nomem
  2191.     movem.l    (a7)+,a0-a1/d0-d1
  2192.     rts
  2193. .nomem:    movem.l    (a7)+,a0-a1/d0-d1
  2194.     addq    #4,a7
  2195.     bsr.b    .close
  2196.     movem.l    (a7)+,a1/d1-d7
  2197.     sub.l    a0,a0
  2198.     moveq    #-1,d0
  2199.     rts
  2200.  
  2201. .close:    movem.l    a0-a1/d0-d1,-(a7)
  2202.     move.l    adr_doslib(BR),a6
  2203.     move.l    d5,d1
  2204.     beq.s    .nclose
  2205.     jsr    -36(a6)    ;close
  2206.     moveq    #0,d5
  2207. .nclose:    movem.l    (a7)+,a0-a1/d0-d1
  2208.     rts
  2209.  
  2210. .free:    tst.l    d6
  2211.     beq.s    .nfree
  2212.     move.l    4.w,a6
  2213.     move.l    d6,a1
  2214.     move.l    d7,d0
  2215.     jsr    -210(a6)    ;freemem
  2216.     moveq    #0,d6
  2217.     moveq    #0,d7
  2218. .nfree:    rts
  2219.  
  2220. .pp20:    moveq    #-4,d2 ; offs
  2221.     moveq    #1,d3 ; end
  2222.     bsr.b    .seek
  2223.  
  2224.     lea    .long(BR),a0
  2225.     moveq    #4,d0
  2226.     bsr.w    .read
  2227.  
  2228.     move.l    (a0),d7
  2229.     lsr.l    #8,d7
  2230.     add.l    d4,d7
  2231.     and    #$fffe,d7
  2232.  
  2233.     move.l    d7,d0
  2234.     moveq    #2,d1
  2235.     bsr.b    .alloc
  2236.  
  2237.     moveq    #4,d2 ;offs
  2238.     moveq    #-1,d3 ; beg
  2239.     bsr.w    .seek
  2240.     move.l    d0,d3
  2241.  
  2242.     lea    .long(BR),a0
  2243.     moveq    #4,d0
  2244.     bsr.w    .read
  2245.  
  2246.     move.l    d6,a0
  2247.     move.l    d3,d0
  2248.     subq.l    #8,d0
  2249.     bsr.w    .read
  2250.     bsr.b    .close
  2251.  
  2252.     add.l    d0,a0    ;source addr (end)
  2253.     move.l    d6,a1    ;target addr (beg)
  2254.     add.l    d4,a1
  2255.     move.l    .long(BR),d0    ;bitsequence lengths
  2256.     bsr.b    decrunch
  2257.  
  2258.     move.l    4.w,a6
  2259.     jsr    -132(a6)    ;forbid
  2260.     move.l    d6,a1
  2261.     move.l    d7,d0
  2262.     jsr    -210(a6)    ;freemem
  2263.     add.l    d4,d6
  2264.     sub.l    d4,d7
  2265.     move.l    d6,a1
  2266.     move.l    d7,d0
  2267.     jsr    -204(a6)    ;allocabs
  2268.     jsr    -138(a6)    ;permit
  2269.  
  2270.     bra.w    .x
  2271.  
  2272. .memtype:    dc.l    0
  2273. .long:    dc.l    0
  2274.  
  2275.  
  2276. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2277.  
  2278. ; decrunches powerpacked file
  2279. ; uses    a0 as the end address of sourcefile
  2280. ;    a1 as the start address of destination
  2281. ;    d0 as the bitsequence lengths
  2282.  
  2283. decrunch:    movem.l    d0-d4/a0-a2,-(a7)
  2284.     move.l    d0,.bits(BR)
  2285.     move.l    a1,a2
  2286.     moveq    #1,d4
  2287.     move.l    -(a0),d1
  2288.     tst.b    d1
  2289.     beq.s    .zero
  2290.     d_one
  2291.     subq    #1,d1
  2292.     lsr.l    d1,d4
  2293. .zero:    lsr.l    #8,d1
  2294.     add.l    d1,a2
  2295.  
  2296. .nextsign:    d_one
  2297.     bcs.s    .packed
  2298.  
  2299.     moveq    #0,d2
  2300. .getunplen:    moveq    #0,d1
  2301.     d_one
  2302.     roxl.l    d1
  2303.     d_one
  2304.     roxl.l    d1
  2305.     add    d1,d2
  2306.     subq    #3,d1
  2307.     beq.s    .getunplen
  2308. .movebytes:    moveq    #7,d0
  2309.     d_more    d1
  2310.     move.b    d1,-(a2)
  2311.     dbf     d2,.movebytes
  2312.     cmp.l    a2,a1
  2313.     bcs.s    .packed
  2314.     bra.w    .x
  2315.  
  2316. .bits:    dc.l    0
  2317.  
  2318. .packed:    moveq    #0,d1
  2319.     d_one
  2320.     roxl.l    d1
  2321.     d_one
  2322.     roxl.l    d1
  2323.     moveq    #0,d0
  2324.     move.b    .bits(pc,d1.w),d0
  2325.     move    d1,d2
  2326.     subq    #3,d1
  2327.     bne.s    .getdist
  2328.     d_one
  2329.     bcs.s    .usebitseq
  2330.     moveq    #7,d0
  2331. .usebitseq:    subq    #1,d0
  2332.     d_more    d3
  2333. .getpcklen:    moveq    #0,d1
  2334.     d_one
  2335.     roxl.l    d1
  2336.     d_one
  2337.     roxl.l    d1
  2338.     d_one
  2339.     roxl.l    d1
  2340.     add    d1,d2
  2341.     subq    #7,d1
  2342.     beq.s    .getpcklen
  2343.     bra.s    .dodepack
  2344. .getdist:    subq    #1,d0
  2345.     d_more    d3
  2346. .dodepack:    addq    #1,d2
  2347. .copyblock:    move.b    (a2,d3.w),-(a2)
  2348.     dbf     d2,.copyblock
  2349.     cmp.l    a2,a1
  2350.     bcs.w    .nextsign
  2351.  
  2352. .x:    movem.l    (a7)+,d0-d4/a0-a2
  2353.     rts
  2354.  
  2355. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2356.  
  2357. writeout:    movem.l    a0-a1/d0-d3,-(a7)
  2358.     move.l    a0,a1
  2359. .searchend:    tst.b    (a1)+
  2360.     bne.s    .searchend
  2361.     move.l    a0,d2
  2362.     move.l    a1,d3
  2363.     sub.l    a0,d3
  2364.     subq.l    #1,d3
  2365.     move.l    adr_doslib(BR),a6
  2366.     ifeq    test
  2367.     jsr    -60(a6)    ;output
  2368.     jsr    -48(a6)    ;write
  2369.     endc
  2370.     movem.l    (a7)+,a0-a1/d0-d3
  2371.     rts
  2372.  
  2373. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2374.  
  2375. error_ilbm:    lea    errt_ilbm(BR),a0
  2376.     bsr.b    writeout
  2377.     bra.b    quit
  2378.  
  2379. error_read:    lea    errt_read(BR),a0
  2380.     bsr.b    writeout
  2381.     bra.b    quit
  2382.  
  2383. error_notread:    lea    errt_notread(BR),a0
  2384.     bsr.b    writeout
  2385.     bra.b    quit
  2386.  
  2387. error_memory:    lea    errt_memory(BR),a0
  2388.     bsr.b    writeout
  2389.     bra.b    quit
  2390.  
  2391. error_alloc:    lea    errt_alloc(BR),a0
  2392.     bsr.b    writeout
  2393. ;    bra.b    quit
  2394.  
  2395. quit:    bsr.w    removevblank
  2396.  
  2397.     lea    allocations(BR),a2
  2398. .freeall:    bsr.w    unload
  2399.     addq    #8,a2
  2400.     tst.l    (a2)
  2401.     bpl.s    .freeall
  2402.  
  2403.     ifeq    test
  2404.     tst.l    msg_workbench(BR)
  2405.     beq.s    .fromcli
  2406.  
  2407.     jsr    -132(a6)    ;forbid
  2408.     move.l    msg_workbench(BR),a1
  2409.     jsr    -378(a6)    ;replymsg
  2410.  
  2411. .fromcli:    endc
  2412.  
  2413.     move.l    adr_gralib(BR),d0
  2414.     beq.s    .ngra
  2415.     bsr.w    wras
  2416.     move.l    d0,a0
  2417.     move.l    38(a0),$80(CB)
  2418.     clr    $88(CB)
  2419.  
  2420. .ngra:    bsr.w    setnormpri
  2421.     bsr.w    closewindow
  2422.     bsr.w    closelibraries
  2423.  
  2424.     move.l    adr_stack(BR),a7
  2425.     moveq    #0,d0
  2426.     rts
  2427.  
  2428. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2429.  
  2430. s_saveregs:    reg    a0-a2/BR/CB/d0-d7
  2431. code_vblank:    movem.l    s_saveregs,-(a7)
  2432.     lea    s(pc),BR
  2433.     lea    $dff000,CB
  2434.  
  2435.     tst    timer_vblank(BR)
  2436.     beq.s    .notiming
  2437.     subq    #1,timer_vblank(BR)
  2438.  
  2439. .notiming:    move.b    s_speed(BR),d0
  2440.     beq.w    .off
  2441.     addq.b    #1,s_timer(BR)
  2442.     cmp.b    s_timer(BR),d0
  2443.     bne.w    .notime
  2444.     sf    s_timer(BR)
  2445.     tst.b    s_ptdel(BR)
  2446.     beq.s    .ndel
  2447.     subq.b    #1,s_ptdel(BR)
  2448.     bra.w    .notime
  2449. .ndel:    subq.b    #1,s_count(BR)
  2450.     bpl.w    .nonewpattern
  2451.     move.b    s_ptpos(BR),s_count(BR)
  2452.     eor.b    #63,s_count(BR)
  2453.     moveq    #0,d0
  2454.     move.b    s_posit(BR),d0
  2455.     move.l    s_plist(BR),a0
  2456.     tst.b    s_newpt(BR)
  2457.     beq.s    .nonew
  2458.     tst.b    (a0,d0.w)
  2459.     bpl.s    .setpt
  2460.     moveq    #-1,d0
  2461.     tst.b    s_shots(BR)
  2462.     beq.s    .setpt
  2463.     subq.b    #1,s_shots(BR)
  2464.     beq.w    .off
  2465. .setpt:    addq    #1,d0
  2466.     move.b    d0,s_posit(BR)
  2467. .nonew:    st    s_newpt(BR)
  2468.     move.b    (a0,d0.w),d1
  2469.     and    #$7f,d1
  2470.     lsl    #3,d1
  2471.     move.l    s_poffs(BR),a0
  2472.     add    d1,a0
  2473.     lea    .chan(BR),a1
  2474.     moveq    #3,d2
  2475. .findchan:    move.l    a0,a2
  2476.     moveq    #0,d1
  2477.     move    (a0)+,d1
  2478.     add.l    d1,a2
  2479.     move.b    s_ptpos(BR),d0
  2480.     addq.b    #1,d0
  2481. .findnext:    subq.b    #1,d0
  2482.     beq.s    .posfound
  2483.     move    (a2)+,d1
  2484.     and    #$f800,d1
  2485.     cmp    #$4000,d1
  2486.     bne.s    .nosound
  2487.     move    (a2),d1
  2488.     and    #$7800,d1
  2489.     cmp    #$4000,d1
  2490.     beq.s    .findnext
  2491.     btst    #0,(a2)
  2492.     beq.s    .findnext
  2493.     addq    #2,a2
  2494.     bra.s    .findnext
  2495. .nosound:    cmp    #$c000,d1
  2496.     bne.s    .findnext
  2497.     move.b    -1(a2),d1
  2498.     sub.b    d1,d0
  2499.     bgt.s    .findnext
  2500.     neg.b    d0
  2501. .posfound:    move.l    a2,(a1)
  2502.     move.b    d0,._pse(a1)
  2503.     lea    .clen(a1),a1
  2504.     dbf    d2,.findchan
  2505.     sf    s_ptpos(BR)
  2506.  
  2507. .nonewpattern:    lea    .chan(BR),a0
  2508.     moveq    #0,d6
  2509.     moveq    #3,d7
  2510. .channels:    clr    ._efx(a0)
  2511.     tst.b    ._pse(a0)
  2512.     beq.s    .nodel
  2513.     subq.b    #1,._pse(a0)
  2514.     bra.s    .nextc
  2515.  
  2516. .nodel:    move.l    ._act(a0),a1
  2517.     move    (a1)+,d0
  2518. .pcmd:    move    d0,d1
  2519.     move.l    a1,(a0)
  2520.     and    #$f800,d0
  2521.     and    #$07ff,d1
  2522.     rol    #6,d0
  2523.     lea    .table(pc,d0.w),a1
  2524.     add    (a1),a1
  2525.     jsr    (a1)
  2526.     move.l    ._act(a0),a1
  2527.     move    (a1)+,d0
  2528.     move    d0,d1
  2529.     and    #$7800,d1
  2530.     cmp    #$4000,d1 ;sound
  2531.     beq.s    .nextc
  2532.     btst    #8,d0
  2533.     beq.s    .nextc
  2534.     and    #$feff,d0
  2535.     bra.s    .pcmd
  2536.  
  2537. .nextc:    lea    .clen(a0),a0
  2538.     lsr    #1,d6
  2539.     dbf    d7,.channels
  2540.     bra.w    .playsound
  2541.  
  2542. .table:    dr.w    .arp    ;arpeggio    +  0
  2543.     dr.w    .pup    ;portamento up    +  1
  2544.     dr.w    .pdw    ;portamento down    +  2
  2545.     dr.w    .tpt    ;tone-portamento    +  3
  2546.     dr.w    .vib    ;vibrato    +  4
  2547.     dr.w    .tvs    ;tonep+volslide    +  5
  2548.     dr.w    .vvs    ;vibra+volslide    +  6
  2549.     dr.w    .trm    ;tremolo    +  7
  2550.     dr.w    .snd    ;sound    + (8)
  2551.     dr.w    .sof    ;sampleoffset    +  9
  2552.     dr.w    .vsl    ;volumeslide    +  A
  2553.     dr.w    .jmp    ;position jump    +  B
  2554.     dr.w    .vol    ;set volume    +  C
  2555.     dr.w    .brk    ;patternbreak    +  D
  2556.     dr.w    .ssn    ;stop sound    + (E)
  2557.     dr.w    .spd    ;set speed    +  F
  2558.     dr.w    .flt    ;set filter status    +  E0
  2559.     dr.w    .fsu    ;fineslide up    +  E1
  2560.     dr.w    .fsd    ;fineslide down    +  E2
  2561.     dr.w    .ret    ;glissando control    -  E3
  2562.     dr.w    .vbc    ;vibrato control    +  E4
  2563.     dr.w    .sft    ;set finetune    +  E5
  2564.     dr.w    .lop    ;pattern loop    +  E6
  2565.     dr.w    .trc    ;tremolo control    +  E7
  2566.     dr.w    .pse    ;pause    + (E8)
  2567.     dr.w    .rtg    ;retrig note    +  E9
  2568.     dr.w    .fvu    ;finevol up    +  EA
  2569.     dr.w    .fvd    ;finevol down    +  EB
  2570.     dr.w    .cut    ;notecut    +  EC
  2571.     dr.w    .ndl    ;notedelay    +  ED
  2572.     dr.w    .del    ;patterndelay    +  EE
  2573.     dr.w    .ret    ;invert loop    -  EF
  2574.  
  2575. .ret:    rts
  2576.  
  2577. .pse:    move.b    d1,._pse(a0)    ;pause
  2578.     rts
  2579.  
  2580. .spd:    cmp    #31,d1
  2581.     bhi.s    .tmp
  2582.     move.b    d1,s_speed(BR)    ;set speed
  2583. .tmp:    rts
  2584.  
  2585. .flt:    ;move    d1,sign_player(BR)    ;set sign
  2586.     rts
  2587.  
  2588. .jmp:    move.b    d1,s_posit(BR)    ;position jump
  2589.     sf    s_count(BR)
  2590.     sf    s_newpt(BR)
  2591.     rts
  2592.  
  2593. .brk:    move    d1,d0    ;break pattern
  2594.     lsr    #4,d1
  2595.     mulu    #10,d1
  2596.     and    #$f,d0
  2597.     add    d0,d1
  2598.     move.b    d1,s_ptpos(BR)
  2599.     sf    s_count(BR)
  2600.     rts
  2601.  
  2602. .del:    move.b    d1,s_ptdel(BR)    ;pattern delay
  2603.     rts
  2604.  
  2605. .lop:    and    #$f,d1    ;pattern loop
  2606.     bne.s    .lops
  2607.     move.b    s_count(BR),._plp(a0)
  2608.     eor.b    #63,._plp(a0)
  2609.     rts
  2610. .lops:    tst.b    ._plc(a0)
  2611.     bne.s    .lopc
  2612.     move.b    d1,._plc(a0)
  2613.     bra.s    .lopj
  2614. .lopc:    subq.b    #1,._plc(a0)
  2615.     bne.s    .lopj
  2616.     sf    ._plp(a0)
  2617.     rts
  2618. .lopj:    move.b    ._plp(a0),s_ptpos(BR)
  2619.     sf    s_count(BR)
  2620.     sf    s_newpt(BR)
  2621.     rts
  2622.  
  2623. .sof:    ext.l    d1    ;set sampleoffset
  2624.     beq.s    .sof1
  2625.     move.b    d1,s_soffs(BR)
  2626. .sof1:    move.b    s_soffs(BR),d1
  2627.     lsl    #7,d1
  2628.     sub    d1,._len(a0)
  2629.     bhi.s    .sof2
  2630.     move    #1,._len(a0)
  2631.     rts
  2632. .sof2:    add    d1,d1
  2633.     add.l    d1,._adr(a0)
  2634.     rts    
  2635.  
  2636. .vol:    move    d1,._vol(a0)    ;set volume
  2637.     rts
  2638.  
  2639. .vvs:    move    #.evvs-.noefx,._efx(a0)
  2640.     bra.s    .asl
  2641.  
  2642. .tvs:    move    #.etvs-.noefx,._efx(a0)
  2643.     bra.s    .asl
  2644.  
  2645. .vsl:    move    #.evsl-.noefx,._efx(a0)
  2646.  
  2647. .asl:    move    d1,d0    ;set volume slide
  2648.     and    #$f,d0
  2649.     lsr    #4,d1
  2650.     bne.s    .vsl0
  2651.     neg    d0
  2652.     move    d0,d1
  2653. .vsl0:    move    d1,._pr1(a0)
  2654.     rts
  2655.  
  2656. .fvd:    neg    d1    ;finevol down
  2657. .fvu:    move    d1,._pr1(a0)    ;finevol up
  2658.     add    ._vol(a0),d1
  2659.     bpl.s    .fvl0
  2660.     moveq    #0,d1
  2661. .fvl0:    cmp    #64,d1
  2662.     ble.s    .fvl1
  2663.     moveq    #64,d1
  2664. .fvl1:    move    d1,._vol(a0)
  2665.     move    #.efvl-.noefx,._efx(a0)
  2666.     rts
  2667.  
  2668. .pup:    neg    d1    ;set portamento up
  2669. .pdw:    move    d1,._pr1(a0)    ;set portamento down
  2670.     move    #.epsl-.noefx,._efx(a0)
  2671.     rts
  2672.  
  2673. .fsu:    neg    d1    ;fine slide up
  2674. .fsd:    move    d1,._pr1(a0)    ;fine slide down
  2675.     add    ._per(a0),d1
  2676.     cmp    #113,d1
  2677.     bge.s    .fsl0
  2678.     moveq    #113,d1
  2679. .fsl0:    cmp    #856,d1
  2680.     ble.s    .fsl1
  2681.     move    #856,d1
  2682. .fsl1:    move    d1,._per(a0)
  2683.     move    #.efsl-.noefx,._efx(a0)
  2684.     rts
  2685.  
  2686. .tpt:    cmp    #$10,d6    ;toneportamento
  2687.     blo.s    .tpt0
  2688.     and    #$f,d6
  2689.     move    ._opr(a0),d0
  2690.     move    ._per(a0),._opr(a0)
  2691.     move    d0,._per(a0)
  2692. .tpt0:    tst    d1
  2693.     beq.s    .tptx
  2694.     move    d1,._tps(a0)
  2695. .tptx:    move    #.etpt-.noefx,._efx(a0)
  2696.     rts
  2697.  
  2698. .vib:    move    d1,d0    ;vibrato
  2699.     beq.s    .vibx
  2700.     and    #$f,d0
  2701.     beq.s    .vib0
  2702.     move    d0,._vba(a0)
  2703. .vib0:    lsr    #2,d1
  2704.     and    #$3c,d1
  2705.     beq.s    .vib1
  2706.     move.b    d1,._vbs(a0)
  2707. .vib1:    btst    #2,._vbc(a0)
  2708.     bne.s    .vibx
  2709.     sf    ._vbp(a0)
  2710. .vibx:    move    #.evib-.noefx,._efx(a0)
  2711.     rts
  2712.  
  2713. .vbc:    move.b    d1,._vbc(a0)    ;vibrato control
  2714.     rts
  2715.  
  2716. .trm:    move    d1,d0    ;tremolo
  2717.     beq.s    .trmx
  2718.     and    #$f,d0
  2719.     beq.s    .trm0
  2720.     move    d0,._tra(a0)
  2721. .trm0:    lsr    #2,d1
  2722.     and    #$3c,d1
  2723.     beq.s    .trm1
  2724.     move.b    d1,._trs(a0)
  2725. .trm1:    btst    #2,._trc(a0)
  2726.     bne.s    .trmx
  2727.     sf    ._trp(a0)
  2728. .trmx:    move    #.etrm-.noefx,._efx(a0)
  2729.     rts
  2730.  
  2731. .trc:    move.b    d1,._trc(a0)    ;tremolo control
  2732.     rts
  2733.  
  2734. .arp:    lea    .period(BR),a2    ;arpeggio
  2735.     move    d1,d0
  2736.     lsr    #4,d0
  2737.     and    #$f,d1
  2738.     add    d0,d0
  2739.     add    d1,d1
  2740.     moveq    #0,d2
  2741.     move.b    ._lnt(a0),d2
  2742.     add    d2,d2
  2743.     add    d2,d0
  2744.     add    d2,d1
  2745.     move    (a2,d0.w),d0
  2746.     move    (a2,d1.w),d1
  2747.     move    (a2,d2.w),d2
  2748.     sub    d2,d0
  2749.     sub    d2,d1
  2750.     move    d0,._pr0(a0)
  2751.     move    d1,._pr1(a0)
  2752.     clr    ._pr2(a0)
  2753.     move    #.earp-.noefx,._efx(a0)
  2754.     rts
  2755.  
  2756. .ndl:    btst    #4,d6    ;notedelay
  2757.     beq.s    .ndlx
  2758.     and    #$f,d6
  2759.     move    d1,._pr1(a0)
  2760.     move    #.endl-.noefx,._efx(a0)
  2761. .ndlx:    rts
  2762.  
  2763. .rtg:    subq    #1,d1    ;retrig note
  2764.     bmi.s    .rtgx
  2765.     move    d1,._pr1(a0)
  2766.     move    d1,._pr2(a0)
  2767.     move    #.ertg-.noefx,._efx(a0)
  2768. .rtgx:    rts
  2769.  
  2770. .cut:    move    d1,._pr1(a0)    ;notecut
  2771.     move    #.ecut-.noefx,._efx(a0)
  2772.     rts
  2773.  
  2774. .ssn:    move    #1,._len(a0)    ;stop sound
  2775.     clr    ._vol(a0)
  2776.     or    #$10,d6
  2777.     rts
  2778.  
  2779. .snd:    move    d1,d0    ;generate sound
  2780.     and    #$1f,d1
  2781.     bne.s    .snd2
  2782.     move.b    ._lsm(a0),d1
  2783.     lsl    #2,d1
  2784.     lea    s_smpls(BR),a1
  2785.     move.l    (a1,d1.w),._adr(a0)
  2786.     add    d1,d1
  2787.     move.l    s_slist(BR),a1
  2788.     add    d1,a1
  2789.     bra.s    .snd3
  2790. .snd2:    subq    #1,d1
  2791.     move.b    d1,._lsm(a0)
  2792.     lsl    #2,d1
  2793.     lea    s_smpls(BR),a1
  2794.     move.l    (a1,d1.w),._adr(a0)
  2795.     add    d1,d1
  2796.     move.l    s_slist(BR),a1
  2797.     add    d1,a1
  2798.     move    (a1),._len(a0)
  2799.     move.b    3(a1),._vol+1(a0)
  2800.     moveq    #0,d1
  2801.     move    4(a1),d1
  2802.     add.l    d1,d1
  2803.     add.l    ._adr(a0),d1
  2804.     move.l    d1,._rad(a0)
  2805.     move    6(a1),._rln(a0)
  2806. .snd3:    moveq    #0,d1
  2807.     move.b    2(a1),d1
  2808.     lsr    #5,d0    ;pitch
  2809.     cmp    #36,d0
  2810.     bhs.s    .snd1
  2811.     move.b    d0,._lnt(a0)
  2812.     move    d1,d2
  2813.     and    #7,d1
  2814.     and    #8,d2
  2815.     beq.s    .snd0
  2816.     or    #$fff8,d1
  2817. .snd0:    move.b    .fineoffset(pc,d0.w),d2
  2818.     muls    d2,d1
  2819.     add    d0,d0
  2820.     move    .period(pc,d0.w),d0
  2821.     sub    d1,d0
  2822.     move    d0,._per(a0)
  2823.     or    #$10,d6
  2824. .snd1:    rts
  2825.  
  2826. .fineoffset:    dc.b    6,6,5,5,4,3,3,3,3,3,3,3,3,3,2,2,2,2
  2827.     dc.b    2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  2828.  
  2829. .period:    dc.w    $358,$328,$2fa,$2d0,$2a6,$280
  2830.     dc.w    $25c,$23a,$21a,$1fc,$1e0,$1c5
  2831.     dc.w    $1ac,$194,$17d,$168,$153,$140
  2832.     dc.w    $12e,$11d,$10d,$0fe,$0f0,$0e2
  2833.     dc.w    $0d6,$0ca,$0be,$0b4,$0aa,$0a0
  2834.     dc.w    $097,$08f,$087,$07f,$078,$071
  2835.  
  2836. .sft:    moveq    #0,d0
  2837.     move.b    ._lnt(a0),d0
  2838.     cmp    #36,d0
  2839.     beq.s    .sft1
  2840.     move    d1,d2
  2841.     and    #7,d1
  2842.     and    #8,d2
  2843.     beq.s    .sft0
  2844.     or    #$fff8,d1
  2845. .sft0:    lea    .fineoffset(BR),a1
  2846.     move.b    (a1,d0.w),d2
  2847.     muls    d2,d1
  2848.     add    d0,d0
  2849.     move    .period(pc,d0.w),d0
  2850.     sub    d1,d0
  2851.     move    d0,._per(a0)
  2852. .sft1:    rts
  2853.  
  2854. .playsound:    move    s_volum(BR),d2
  2855.     and.b    s_cstat(BR),d6
  2856.     move    d6,$96(CB)
  2857.     beq.w    .exit
  2858.     lea    .chan(BR),a0
  2859.     move    d6,d0
  2860.     lsr    d0
  2861.     bcc.s    .noc1
  2862.     move.l    ._adr(a0),$a0(CB)
  2863.     move    ._len(a0),$a4(CB)
  2864.     move    ._per(a0),._opr(a0)
  2865. .noc1:    lsr    d0
  2866.     bcc.s    .noc2
  2867.     move.l    .clen+._adr(a0),$b0(CB)
  2868.     move    .clen+._len(a0),$b4(CB)
  2869.     move    .clen+._per(a0),.clen+._opr(a0)
  2870. .noc2:    lsr    d0
  2871.     bcc.s    .noc3
  2872.     move.l    2*.clen+._adr(a0),$c0(CB)
  2873.     move    2*.clen+._len(a0),$c4(CB)
  2874.     move    2*.clen+._per(a0),2*.clen+._opr(a0)
  2875. .noc3:    lsr    d0
  2876.     bcc.s    .noc4
  2877.     move.l    3*.clen+._adr(a0),$d0(CB)
  2878.     move    3*.clen+._len(a0),$d4(CB)
  2879.     move    3*.clen+._per(a0),3*.clen+._opr(a0)
  2880. .noc4:    wraslin    8
  2881.     or    #$8000,d6
  2882.     move    d6,$96(CB)
  2883.     wraslin    3
  2884.     lsr    d6
  2885.     bcc.s    .nob1
  2886.     move.l    ._rad(a0),$a0(CB)
  2887.     move.l    ._rln(a0),$a4(CB)
  2888.     move    ._vol(a0),d1
  2889.     mulu    d2,d1
  2890.     lsr    #6,d1
  2891.     move    d1,$a8(CB)
  2892. .nob1:    lsr    d6
  2893.     bcc.s    .nob2
  2894.     move.l    .clen+._rad(a0),$b0(CB)
  2895.     move.l    .clen+._rln(a0),$b4(CB)
  2896.     move    .clen+._vol(a0),d1
  2897.     mulu    d2,d1
  2898.     lsr    #6,d1
  2899.     move    d1,$b8(CB)
  2900. .nob2:    lsr    d6
  2901.     bcc.s    .nob3
  2902.     move.l    2*.clen+._rad(a0),$c0(CB)
  2903.     move.l    2*.clen+._rln(a0),$c4(CB)
  2904.     move    2*.clen+._vol(a0),d1
  2905.     mulu    d2,d1
  2906.     lsr    #6,d1
  2907.     move    d1,$c8(CB)
  2908. .nob3:    lsr    d6
  2909.     bcc.w    .exit
  2910.     move.l    3*.clen+._rad(a0),$d0(CB)
  2911.     move.l    3*.clen+._rln(a0),$d4(CB)
  2912.     move    3*.clen+._vol(a0),d1
  2913.     mulu    d2,d1
  2914.     lsr    #6,d1
  2915.     move    d1,$d8(CB)
  2916.     bra.w    .exit
  2917.  
  2918. .earp:    move    ._pr0(a0),d0
  2919.     move.l    ._pr1(a0),._pr0(a0)
  2920.     move    d0,._pr2(a0)
  2921.     bra.w    .nefx0
  2922.  
  2923. .evsl:    move    ._pr1(a0),d0
  2924.     add    ._vol(a0),d0
  2925.     bpl.s    .evsl0
  2926.     moveq    #0,d0
  2927. .evsl0:    cmp    #64,d0
  2928.     ble.s    .evsl1
  2929.     moveq    #64,d0
  2930. .evsl1:    move    d0,._vol(a0)
  2931.     bra.w    .noefx
  2932.  
  2933. .etvs:    move    ._pr1(a0),d0
  2934.     add    ._vol(a0),d0
  2935.     bpl.s    .etvs0
  2936.     moveq    #0,d0
  2937. .etvs0:    cmp    #64,d0
  2938.     ble.s    .etvs1
  2939.     moveq    #64,d0
  2940. .etvs1:    move    d0,._vol(a0)
  2941.  
  2942. .etpt:    move    ._per(a0),d0
  2943.     cmp    ._opr(a0),d0
  2944.     beq.w    .noefx
  2945.     bgt.s    .etpt0
  2946.     add    ._tps(a0),d0
  2947.     cmp    ._opr(a0),d0
  2948.     ble.s    .etpt2
  2949.     bra.s    .etpt1
  2950. .etpt0:    sub    ._tps(a0),d0
  2951.     cmp    ._opr(a0),d0
  2952.     bge.s    .etpt2
  2953. .etpt1:    move    ._opr(a0),d0
  2954. .etpt2:    move    d0,._per(a0)
  2955.     bra.w    .noefx
  2956.  
  2957. .epsl:    move    ._pr1(a0),d0
  2958.     add    ._per(a0),d0
  2959.     cmp    #113,d0
  2960.     bge.s    .epsl0
  2961.     moveq    #113,d0
  2962. .epsl0:    cmp    #856,d0
  2963.     ble.s    .epsl1
  2964.     move    #856,d0
  2965. .epsl1:    move    d0,._per(a0)
  2966.     bra.w    .noefx
  2967.  
  2968. .evvs:    move    ._pr1(a0),d0
  2969.     add    ._vol(a0),d0
  2970.     bpl.s    .evvs0
  2971.     moveq    #0,d0
  2972. .evvs0:    cmp    #64,d0
  2973.     ble.s    .evvs1
  2974.     moveq    #64,d0
  2975. .evvs1:    move    d0,._vol(a0)
  2976.  
  2977. .evib:    move.b    ._vbs(a0),d0
  2978.     add.b    ._vbp(a0),d0
  2979.     move.b    d0,._vbp(a0)
  2980.     smi    d3
  2981.     lsr    #2,d0
  2982.     and    #$1f,d0
  2983.     move.b    ._vbc(a0),d4
  2984.     and    #3,d4
  2985.     bne.s    .evib0
  2986.     move.b    .sinewave(pc,d0.w),d0    ;sine
  2987.     bra.s    .evibd
  2988. .evib0:    subq    #1,d4
  2989.     bne.s    .evib1
  2990.     lsl.b    #3,d0    ;rampdown
  2991.     eor.b    d3,d0
  2992.     bra.s    .evibd
  2993. .evib1:    st    d0    ;square
  2994. .evibd:    mulu    ._vba(a0),d0
  2995.     lsr    #7,d0
  2996.     tst.b    d3
  2997.     bpl.w    .nefx0
  2998.     neg    d0
  2999.     bra.w    .nefx0
  3000.  
  3001. .sinewave:    dc.b    000,024,049,074,097,120,141,161
  3002.     dc.b    180,197,212,224,235,244,250,253
  3003.     dc.b    255,253,250,244,235,224,212,197
  3004.     dc.b    180,161,141,120,097,074,049,024
  3005.  
  3006. .etrm:    move.b    ._trs(a0),d0
  3007.     add.b    ._trp(a0),d0
  3008.     move.b    d0,._trp(a0)
  3009.     smi    d3
  3010.     lsr    #2,d0
  3011.     and    #$1f,d0
  3012.     move.b    ._trc(a0),d4
  3013.     and    #3,d4
  3014.     bne.s    .etrm0
  3015.     move.b    .sinewave(pc,d0.w),d0    ;sine
  3016.     bra.s    .etrmd
  3017. .etrm0:    subq    #1,d4
  3018.     bne.s    .etrm1
  3019.     lsl.b    #3,d0    ;rampdown
  3020.     eor.b    d3,d0
  3021.     bra.s    .etrmd
  3022. .etrm1:    st    d0    ;square
  3023. .etrmd:    mulu    ._tra(a0),d0
  3024.     lsr    #7,d0
  3025.     tst.b    d3
  3026.     bpl.s    .etrm3
  3027.     neg    d0
  3028. .etrm3:    move    ._per(a0),(a1)
  3029.     add    ._vol(a0),d0
  3030.     bpl.s    .etrm4
  3031.     moveq    #0,d0
  3032. .etrm4:    cmp    #64,d0
  3033.     bls.w    .nefx1
  3034.     moveq    #64,d0
  3035.     bra.w    .nefx1
  3036.  
  3037. .efsl:    tst.b    s_timer(BR)
  3038.     bne.w    .noefx
  3039.     move    ._pr1(a0),d0
  3040.     add    ._per(a0),d0
  3041.     cmp    #113,d0
  3042.     bge.s    .efsl0
  3043.     moveq    #113,d0
  3044. .efsl0:    cmp    #856,d0
  3045.     ble.s    .efsl1
  3046.     move    #856,d0
  3047. .efsl1:    move    d0,._per(a0)
  3048.     bra.w    .noefx
  3049.  
  3050. .efvl:    tst.b    s_timer(BR)
  3051.     bne.w    .noefx
  3052.     move    ._pr1(a0),d0
  3053.     add    ._vol(a0),d0
  3054.     bpl.s    .efvl0
  3055.     moveq    #0,d0
  3056. .efvl0:    cmp    #64,d0
  3057.     ble.s    .efvl1
  3058.     moveq    #64,d0
  3059. .efvl1:    move    d0,._vol(a0)
  3060.     bra.w    .noefx
  3061.  
  3062. .ecut:    move    ._pr1(a0),d0
  3063.     cmp.b    s_timer(BR),d0
  3064.     bne.w    .noefx
  3065.     clr    ._vol(a0)
  3066.     clr    ._efx(a0)
  3067.     bra.w    .noefx
  3068.  
  3069. .ertg:    subq    #1,._pr2(a0)
  3070.     bpl.w    .noefx
  3071.     move    ._pr1(a0),._pr2(a0)
  3072.     bra.s    .erg
  3073.  
  3074. .endl:    move    ._pr1(a0),d0
  3075.     cmp.b    s_timer(BR),d0
  3076.     bne.w    .nefx2
  3077.     clr    ._efx(a0)
  3078. .erg:    move    d6,$96(CB)
  3079.     move.l    ._adr(a0),-6(a1)
  3080.     move    ._len(a0),-2(a1)
  3081.     move    ._per(a0),._opr(a0)
  3082.     wraslin    8
  3083.     or    #$8000,d6
  3084.     move    d6,$96(CB)
  3085.     wraslin    3
  3086.     move.l    ._rad(a0),-6(a1)
  3087.     move    ._rln(a0),-2(a1)
  3088.     bra.s    .noefx
  3089.  
  3090. .notime:    lea    .chan(BR),a0
  3091.     lea    $a6(CB),a1
  3092.     moveq    #3,d1
  3093.     move    s_volum(BR),d2
  3094.     moveq    #1,d6
  3095. .doefx:    move.b    s_cstat(BR),d0
  3096.     and    d6,d0
  3097.     beq.s    .nefx2
  3098.     move    ._efx(a0),d0
  3099.     jmp    .noefx(pc,d0.w)
  3100. .noefx:    moveq    #0,d0
  3101. .nefx0:    add    ._per(a0),d0
  3102.     move    d0,(a1)
  3103.     move    ._vol(a0),d0
  3104. .nefx1:    mulu    d2,d0
  3105.     lsr    #6,d0
  3106.     move    d0,2(a1)
  3107. .nefx2:    lea    .clen(a0),a0
  3108.     lea    16(a1),a1
  3109.     add    d6,d6
  3110.     dbf    d1,.doefx
  3111.  
  3112. .exit:    cmp    s_destv(BR),d2
  3113.     beq.s    .ncv
  3114.     blo.s    .inc
  3115.     subq    #2,d2
  3116. .inc:    addq    #1,d2
  3117. .cv:    move    d2,s_volum(BR)
  3118. .ncv:    movem.l    (a7)+,s_saveregs
  3119.     rts
  3120.  
  3121. .off:    move    #$f,$96(CB)
  3122.     clr    $a8(CB)
  3123.     clr    $b8(CB)
  3124.     clr    $c8(CB)
  3125.     clr    $d8(CB)
  3126.     movem.l    (a7)+,s_saveregs
  3127.     rts
  3128.  
  3129.     rsreset
  3130. ._act:    rs.l    1    ;actual address
  3131. ._pse:    rs.w    1    ;pause
  3132. ._adr:    rs.l    1    ;sample address
  3133. ._len:    rs.w    1    ;sample length
  3134. ._rad:    rs.l    1    ;repeat address
  3135. ._rln:    rs.w    1    ;repeat length
  3136. ._per:    rs.w    1    ;period
  3137. ._vol:    rs.w    1    ;volume
  3138. ._opr:    rs.w    1    ;old period
  3139. ._vba:    rs.w    1    ;vibrato amplitude
  3140. ._tra:    rs.w    1    ;tremolo amplitude
  3141. ._vbp:    rs.b    1    ;vibrato position
  3142. ._trp:    rs.b    1    ;tremolo position
  3143. ._vbs:    rs.b    1    ;vibrato speed
  3144. ._trs:    rs.b    1    ;tremolo speed
  3145. ._vbc:    rs.b    1    ;vibrato control
  3146. ._trc:    rs.b    1    ;tremolo control
  3147. ._lsm:    rs.b    1    ;last sample
  3148. ._lnt:    rs.b    1    ;last note
  3149. ._pr0:    rs.w    1    ;arpeggio offset 0
  3150. ._pr1:    rs.w    1    ;arpeggio offset 1,volume slide,portamento slide,notedelay,retrigation
  3151. ._pr2:    rs.w    1    ;arpeggio offset 2,retrigation counter
  3152. ._tps:    rs.w    1    ;tone portamento speed
  3153. ._plp:    rs.b    1    ;pattern loop position
  3154. ._plc:    rs.b    1    ;pattern loop counter
  3155. ._efx:    rs.w    1    ;effect offset
  3156. .clen:    rs.w    0
  3157.  
  3158. .chan:    blk.l    .clen,0
  3159.  
  3160. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3161.  
  3162. s_smpls:    blk.l    31,0    ;sample addresses
  3163. s_slist:    dc.l    0    ;sample-list address
  3164. s_plist:    dc.l    0    ;pattern-list address
  3165. s_poffs:    dc.l    0    ;pattern-offset-table address
  3166. s_volum:    dc.w    0    ;master volume control (0-64)
  3167. s_destv:    dc.w    0    ;destination volume (0-64)
  3168. s_speed:    dc.b    0    ;value of speed (0-31)
  3169. s_cstat:    dc.b    0    ;chanell status (3210)
  3170. s_shots:    dc.b    0    ;number of shots to play
  3171. s_timer:    dc.b    0    ;time counter
  3172. s_posit:    dc.b    0    ;song position
  3173. s_ptpos:    dc.b    0    ;pattern position
  3174. s_count:    dc.b    0    ;pattern counter
  3175. s_ptdel:    dc.b    0    ;pattern delay
  3176. s_newpt:    dc.b    0    ;new pattern at next restart
  3177. s_soffs:    dc.b    0    ;sample offset
  3178.  
  3179. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3180.  
  3181. allocations:
  3182. adr_file:    dc.l    0
  3183. len_file:    dc.l    0
  3184. adr_music:    dc.l    0
  3185. len_music:    dc.l    0
  3186. adr_mfont:    dc.l    0
  3187. len_mfont:    dc.l    0
  3188. adr_sfont:    dc.l    0
  3189. len_sfont:    dc.l    0
  3190. adr_sibanim:    dc.l    0
  3191. len_sibanim:    dc.l    0
  3192. adr_glbanim:    dc.l    0
  3193. len_glbanim:    dc.l    0
  3194. adr_january:    dc.l    0
  3195. len_january:    dc.l    0
  3196. adr_text:    dc.l    0
  3197. len_text:    dc.l    0
  3198. adr_cred1:    dc.l    0
  3199. len_cred1:    dc.l    0
  3200. adr_cred2:    dc.l    0
  3201. len_cred2:    dc.l    0
  3202. adr_cred3:    dc.l    0
  3203. len_cred3:    dc.l    0
  3204.     dc.l    -1
  3205.  
  3206. adr_bpla:    dc.l    bpla
  3207. adr_epla:    dc.l    bplea
  3208.  
  3209. adr_bplb:    dc.l    bplb
  3210. adr_eplb:    dc.l    bpleb
  3211.  
  3212. adr_copper_anm:    dc.l    copper_anm
  3213. adr_copper_msc:    dc.l    copper_msc
  3214. adr_copper_txt:    dc.l    copper_txt
  3215.  
  3216. msc_palette:    blk.w    2^dep_msc,0
  3217.     dc.w    -1
  3218.  
  3219. wid_mfont:    dc.w    0
  3220. hei_mfont:    dc.w    0
  3221. wid_sfont:    dc.w    0
  3222. hei_sfont:    dc.w    0
  3223.  
  3224. errt_ilbm:    dc.b    "Incorrect ILBM file.",10,0
  3225. errt_read:    dc.b    "Error while reading file.",10,0
  3226. errt_notread:    dc.b    "File has not been loaded before.",10,0
  3227. errt_memory:    dc.b    "Insufficient free store.",10,0
  3228. errt_alloc:    dc.b    "Block has already been allocated.",10,0
  3229.  
  3230. name_music:    dc.b    "Things/Global Tracks",0
  3231. name_mfont:    dc.b    "Things/Font Multi",0
  3232. name_sfont:    dc.b    "Things/Font Single",0
  3233. name_sibanim:    dc.b    "Things/Anim Silence",0
  3234. name_glbanim:    dc.b    "Things/Anim Global",0
  3235. name_january:    dc.b    "Things/Logo January",0
  3236. name_chat:    dc.b    "Things/Chat",0
  3237. name_duma:    dc.b    "Things/Duma",0
  3238. name_howto:    dc.b    "Things/BG How to Get There",0
  3239. name_whyto:    dc.b    "Things/BG Why to Come",0
  3240. name_facis:    dc.b    "Things/BG Facilities",0
  3241. name_rules:    dc.b    "Things/BG Global Rules",0
  3242. name_event:    dc.b    "Things/BG Events",0
  3243. name_craze:    dc.b    "Things/BG Full Craze",0
  3244. name_conts:    dc.b    "Things/BG Contest",0
  3245. name_movie:    dc.b    "Things/BG Movies",0
  3246. name_cred1:    dc.b    "Things/End Genie",0
  3247. name_cred2:    dc.b    "Things/End Cabo",0
  3248. name_cred3:    dc.b    "Things/End Active",0
  3249.  
  3250. head_meeting:    dc.b    "THE MEETING",0
  3251. head_area:    dc.b    "THE AREA",0
  3252. head_earth:    dc.b    "EARTH",0
  3253. head_eur:    dc.b    "EUROPE",0
  3254. head_hun:    dc.b    "HUNGARY",0
  3255. head_bp:    dc.b    "BUDAPEST",0
  3256. head_howto:    dc.b    "HOW TO GET THERE",0
  3257. head_whyto:    dc.b    "WHY TO COME",0
  3258. head_facis:    dc.b    "FACILITIES",0
  3259. head_rules:    dc.b    "GLOBAL RULES",0
  3260. head_event:    dc.b    "EVENTS",0
  3261. head_craze:    dc.b    "FULL CRAZE",0
  3262. head_conts:    dc.b    "CONTEST",0
  3263. head_movie:    dc.b    "MOVIES",0
  3264. head_finally:    dc.b    "AND FINALLY",0
  3265. head_access:    dc.b    "ACCESS",0
  3266.  
  3267.  
  3268. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3269.  
  3270.     section    Bpl1,bss_c
  3271.     ds.l    7
  3272. bpla:    ds.b    bpllen*5
  3273.     ds.b    bpllen
  3274. bplea:
  3275.     section    Bpl6,bss_c
  3276.     ds.l    7
  3277. bplb:    ds.b    bpllen*6
  3278.     ds.b    bpllen
  3279. bpleb:
  3280.  
  3281. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3282.  
  3283.     copper    anm,wid_anm,hei_anm,dep_anm,(dep_anm-1)*wid_anm
  3284.     copper    msc,wid_msc,hei_msc,dep_msc,(dep_msc-1)*wid_msc
  3285.     copper    txt,wid_txt,hei_txt,dep_txt,0
  3286.  
  3287.     section    Blk,data_c
  3288. copper_blk:    dc.w    $100,$200
  3289.     dc.w    $180,$000
  3290.     dc.l    -2,-2
  3291.  
  3292. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3293.  
  3294.     section    Holmi,data
  3295.  
  3296. window_choice:    dc.w    155,100    ;leftedge,topedge
  3297.     dc.w    330,26    ;width,height
  3298.     dc.b    0,1    ;detailpen,blockpen
  3299.     dc.l    $00000468    ;IDCMP
  3300.     dc.l    $00033006    ;flags
  3301.     dc.l    .gadget1    ;firstgadget
  3302.     dc.l    0    ;checkmark
  3303.     dc.l    .title    ;title
  3304.     dc.l    0    ;screen
  3305.     dc.l    0    ;bitmap
  3306.     dc.w    330,26    ;minwidth,minheigth
  3307.     dc.w    330,26    ;maxwidth,maxheigth
  3308.     dc.w    $000f    ;type (normal)
  3309.     dc.w    0    ;size
  3310.  
  3311. .title:    dc.b    "Global Gathering invitation",0
  3312.     even
  3313.  
  3314. .gadget1:    dc.l    .gadget2    ;nextgadget
  3315.     dc.w    10,12    ;leftedge,topedge
  3316.     dc.w    150,11    ;width,height
  3317.     dc.w    0,3,1    ;flags,activation,gadgettype
  3318.     dc.l    render    ;gadgetrender
  3319.     dc.l    0    ;selectrender
  3320.     dc.l    .itext1    ;gadgettext
  3321.     dc.l    0,0    ;mutualexclude,specialinfo
  3322.     dc.w    1    ;gadgetid
  3323.     dc.l    0    ;userdata
  3324.  
  3325. .gadget2:    dc.l    0    ;nextgadget
  3326.     dc.w    170,12    ;leftedge,topedge
  3327.     dc.w    150,11    ;width,height
  3328.     dc.w    0,3,1    ;flags,activation,gadgettype
  3329.     dc.l    render    ;gadgetrender
  3330.     dc.l    0    ;selectrender
  3331.     dc.l    .itext2    ;gadgettext
  3332.     dc.l    0,0    ;mutualexclude,specialinfo
  3333.     dc.w    2    ;gadgetid
  3334.     dc.l    0    ;userdata
  3335.  
  3336. .itext1:    dc.b    1,0    ;frontpen,backpen
  3337.     dc.b    1,0    ;drawmode,kludgefill
  3338.     dc.w    (150-4*8)/2,2    ;leftedge,topedge
  3339.     dc.l    attr_font    ;itextfont
  3340.     dc.l    .text1    ;itext
  3341.     dc.l    0    ;nexttext
  3342.  
  3343. .itext2:    dc.b    1,0    ;frontpen,backpen
  3344.     dc.b    1,0    ;drawmode,kludgefill
  3345.     dc.w    (150-5*8)/2,2    ;leftedge,topedge
  3346.     dc.l    attr_font    ;itextfont
  3347.     dc.l    .text2    ;itext
  3348.     dc.l    0    ;nexttext
  3349.  
  3350. .text1:    dc.b    "Full",0
  3351. .text2:    dc.b    "Brief",0
  3352.     even
  3353.  
  3354. window_lang:    dc.w    155,100    ;leftedge,topedge
  3355.     dc.w    330,26    ;width,height
  3356.     dc.b    0,1    ;detailpen,blockpen
  3357.     dc.l    $00000468    ;IDCMP
  3358.     dc.l    $00053006    ;flags
  3359.     dc.l    .gadget1    ;firstgadget
  3360.     dc.l    0    ;checkmark
  3361.     dc.l    .title    ;title
  3362.     dc.l    0    ;screen
  3363.     dc.l    0    ;bitmap
  3364.     dc.w    330,26    ;minwidth,minheigth
  3365.     dc.w    330,26    ;maxwidth,maxheigth
  3366.     dc.w    $000f    ;type (normal)
  3367.     dc.w    0    ;size
  3368.  
  3369. .title:    dc.b    "Select your language",0
  3370.     even
  3371.  
  3372. .gadget1:    dc.l    .gadget2    ;nextgadget
  3373.     dc.w    10,12    ;leftedge,topedge
  3374.     dc.w    150,11    ;width,height
  3375.     dc.w    0,3,1    ;flags,activation,gadgettype
  3376.     dc.l    render    ;gadgetrender
  3377.     dc.l    0    ;selectrender
  3378.     dc.l    .itext1    ;gadgettext
  3379.     dc.l    0,0    ;mutualexclude,specialinfo
  3380.     dc.w    1    ;gadgetid
  3381.     dc.l    0    ;userdata
  3382.  
  3383. .gadget2:    dc.l    0    ;nextgadget
  3384.     dc.w    170,12    ;leftedge,topedge
  3385.     dc.w    150,11    ;width,height
  3386.     dc.w    0,3,1    ;flags,activation,gadgettype
  3387.     dc.l    render    ;gadgetrender
  3388.     dc.l    0    ;selectrender
  3389.     dc.l    .itext2    ;gadgettext
  3390.     dc.l    0,0    ;mutualexclude,specialinfo
  3391.     dc.w    2    ;gadgetid
  3392.     dc.l    0    ;userdata
  3393.  
  3394. .itext1:    dc.b    1,0    ;frontpen,backpen
  3395.     dc.b    1,0    ;drawmode,kludgefill
  3396.     dc.w    (150-6*8)/2,2    ;leftedge,topedge
  3397.     dc.l    attr_font    ;itextfont
  3398.     dc.l    .text1    ;itext
  3399.     dc.l    0    ;nexttext
  3400.  
  3401. .itext2:    dc.b    1,0    ;frontpen,backpen
  3402.     dc.b    1,0    ;drawmode,kludgefill
  3403.     dc.w    (150-7*8)/2,2    ;leftedge,topedge
  3404.     dc.l    attr_font    ;itextfont
  3405.     dc.l    .text2    ;itext
  3406.     dc.l    0    ;nexttext
  3407.  
  3408. .text1:    dc.b    "Magyar",0
  3409. .text2:    dc.b    "English",0
  3410.     even
  3411.  
  3412. window_load:    dc.w    155,100    ;leftedge,topedge
  3413.     dc.w    330,10    ;width,height
  3414.     dc.b    0,1    ;detailpen,blockpen
  3415.     dc.l    $00000400    ;IDCMP
  3416.     dc.l    $00053006    ;flags
  3417.     dc.l    0    ;firstgadget
  3418.     dc.l    0    ;checkmark
  3419.     dc.l    .title    ;title
  3420.     dc.l    0    ;screen
  3421.     dc.l    0    ;bitmap
  3422.     dc.w    330,10    ;minwidth,minheigth
  3423.     dc.w    330,10    ;maxwidth,maxheigth
  3424.     dc.w    $000f    ;type (normal)
  3425.     dc.w    0    ;size
  3426.  
  3427. .title:    dc.b    "Loading demo",0
  3428.     even
  3429.  
  3430. window_brief:    dc.w    0,0    ;leftedge,topedge
  3431.     dc.w    640,256    ;width,height
  3432.     dc.b    0,1    ;detailpen,blockpen
  3433.     dc.l    $00000668    ;IDCMP
  3434.     dc.l    $00033000    ;flags
  3435.     dc.l    .gadget1    ;firstgadget
  3436.     dc.l    0    ;checkmark
  3437.     dc.l    .title    ;title
  3438.     dc.l    0    ;screen
  3439.     dc.l    0    ;bitmap
  3440.     dc.w    640,256    ;minwidth,minheigth
  3441.     dc.w    640,256    ;maxwidth,maxheigth
  3442.     dc.w    $000f    ;type (normal)
  3443.     dc.w    0    ;size
  3444.  
  3445. .title:    dc.b    "Global Gathering information",0
  3446.     even
  3447.  
  3448. .gadget1:    dc.l    .gadget2    ;nextgadget
  3449.     dc.w    8,12    ;leftedge,topedge
  3450.     dc.w    16,16    ;width,height
  3451.     dc.w    0,3,1    ;flags,activation,gadgettype
  3452.     dc.l    .render    ;gadgetrender
  3453.     dc.l    0    ;selectrender
  3454.     dc.l    0    ;gadgettext
  3455.     dc.l    0,0    ;mutualexclude,specialinfo
  3456.     dc.w    $1000    ;gadgetid
  3457.     dc.l    0    ;userdata
  3458.  
  3459. .gadget2:    dc.l    .gadget3    ;nextgadget
  3460.     dc.w    8,236    ;leftedge,topedge
  3461.     dc.w    16,16    ;width,height
  3462.     dc.w    0,3,1    ;flags,activation,gadgettype
  3463.     dc.l    .render    ;gadgetrender
  3464.     dc.l    0    ;selectrender
  3465.     dc.l    0    ;gadgettext
  3466.     dc.l    0,0    ;mutualexclude,specialinfo
  3467.     dc.w    $2000    ;gadgetid
  3468.     dc.l    0    ;userdata
  3469.  
  3470. .gadget3:    dc.l    bpla    ;nextgadget
  3471.     dc.w    12,78    ;leftedge,topedge
  3472.     dc.w    8,108    ;width,height
  3473.     dc.w    0,3,1    ;flags,activation,gadgettype
  3474.     dc.l    .renderq    ;gadgetrender
  3475.     dc.l    0    ;selectrender
  3476.     dc.l    0    ;gadgettext
  3477.     dc.l    0,0    ;mutualexclude,specialinfo
  3478.     dc.w    $3000    ;gadgetid
  3479.     dc.l    0    ;userdata
  3480.  
  3481. .render:    dc.w    0,0    ;leftedge,topedge
  3482.     dc.b    2,1    ;frontpen,backpen
  3483.     dc.b    0,5    ;drawmode,count
  3484.     dc.l    .xy    ;xy
  3485.     dc.l    0    ;nextborder
  3486.  
  3487. .renderq:    dc.w    0,0    ;leftedge,topedge
  3488.     dc.b    3,2    ;frontpen,backpen
  3489.     dc.b    1,5    ;drawmode,count
  3490.     dc.l    .xyq    ;xy
  3491.     dc.l    0    ;nextborder
  3492.  
  3493. .xy:    dc.w    -1,-1
  3494.     dc.w    16,-1
  3495.     dc.w    16,16
  3496.     dc.w    -1,16
  3497.     dc.w    -1,-1
  3498.  
  3499. .xyq:    dc.w    -1,-1
  3500.     dc.w    8,-1
  3501.     dc.w    8,108
  3502.     dc.w    -1,108
  3503.     dc.w    -1,-1
  3504.  
  3505. render:    dc.w    0,0    ;leftedge,topedge
  3506.     dc.b    1,0    ;frontpen,backpen
  3507.     dc.b    0,5    ;drawmode,count
  3508.     dc.l    .xy    ;xy
  3509.     dc.l    0    ;nextborder
  3510.  
  3511. .xy:    dc.w    -1,-1
  3512.     dc.w    150,-1
  3513.     dc.w    150,11
  3514.     dc.w    -1,11
  3515.     dc.w    -1,-1
  3516.  
  3517. attr_font:    dc.l    .name
  3518.     dc.w    8    ;size
  3519.     dc.b    0,0
  3520.     dc.w    8    ;size
  3521.  
  3522. .name:    dc.b    "topaz.font",0
  3523.     even
  3524.  
  3525. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3526.  
  3527.     if    test
  3528.     printt    "WARNING: Workbench messages inactive!"
  3529.     endc
  3530.  
  3531.     end
  3532.  
  3533.