; No Lower Border on Monochrome
; developed on the SWISS-ALP-CONVENTION 92'93
;
; code by: CHARON  / NATO
;          MR.BOND / New Trend
;          MR.PEE  / TCM
;
; Finished: 10.02.93!!!!!!!!!!
;

                PATH 'E:\LOWER_BO.RDE\'

do_intro        EQU 1
do_distort      EQU 1           ; logo distorter
do_sound        EQU 1           ; musax
do_scroller     EQU 1           ; scroller in border
do_signum       EQU 1           ; signum-textdisplay
do_lb           EQU 1           ; lower border
do_animation    EQU 1           ; comic

instant_help    EQU 0

                pea     demo(PC)        ; Aufruf des Demos im Supi-Mode
                move.w  #38,-(SP)
                trap    #14
                addq.l  #6,SP

                pea     0.w
                trap    #1

demo:           bra.s   start

                >PART 'Ripper message'
                DC.B 'Fuck you ripper !!! Wanna steal our code, or what ? '
                DC.B 'Laaaaaaaaaame.........'
                EVEN
                ENDPART

                OPT X+,F+,O+,W+

                >PART 'in & out'
start:          move.l  SP,old_sp
                pea     new_sp

                bsr     check_machine
                bsr     clear_bss

                move.w  #-1,magic_border ; switch lower border off for intro

                DC.W $A00A
                move.b  #$12,$FFFFFC02.w

                move.b  $FFFFFA07,storage ; Save all shit
                move.b  $FFFFFA09,storage+2
                move.b  $FFFFFA17,storage+4
                move.b  $FFFFFA13,storage+6
                move.l  $70,storage+8
                move.l  $0120,storage+12
                move.l  $FFFF8200.w,storage+16
                move.l  $FFFF8240.w,storage+20

                IFNE do_sound
                moveq   #1,D0
                jsr     muzak
                ENDC

                bsr     clear_screen
                bsr     create_help_text

                IFNE do_signum
                bsr     center_text
                ENDC

                IFNE do_distort
                bsr     preshift_logos
                ENDC

                move    #$2700,SR       ; All off
                clr.b   $FFFFFA07.w     ; Clear MFP
                clr.b   $FFFFFA09.w
                clr.b   $FFFFFA13.w
                bclr    #3,$FFFFFA17.w  ; No more bit-clearing...
                ori.b   #1,$FFFFFA07.w  ; Activate Timer B
                ori.b   #1,$FFFFFA13.w
                move.l  #vbl,$70.w      ; Install Raster-Routines
                move.l  #border,$0120.w
                move.b  #0,$FFFFFA1B.w
                move    #$2300,SR

                move.l  SP,res_sp

                IFNE do_intro
                bsr     intro
                ENDC

                IFNE do_animation
                bsr     animation_part
                ENDC

                clr.w   magic_border    ; switch lower border on

                bsr     main_part       ; Hauptteil mit scroller,dister....

finish:         movea.l res_sp(PC),SP

                move    #$2300,SR

                move.b  storage(PC),$FFFFFA07.w ; Save all shit
                move.b  storage+2(PC),$FFFFFA09.w
                move.b  storage+4(PC),$FFFFFA17.w
                move.b  storage+6(PC),$FFFFFA13.w
                move.l  storage+8(PC),$70.w
                move.l  storage+12(PC),$0120.w
                move.l  storage+16(PC),$FFFF8200.w
                move.l  storage+20(PC),$FFFF8240.w

                move.l  #$08080000,$FFFF8800.w
                move.l  #$09090000,$FFFF8800.w
                move.l  #$0A0A0000,$FFFF8800.w

                move    #$2700,SR

                move.b  #$08,$FFFFFC02.w

                movea.l old_sp(PC),SP

                rts

res_sp:         DC.L 0
old_sp:         DC.L 0
                ENDPART
                >PART 'bss l”schen'
clear_bss:      lea     user_bss,A0
                lea     user_end,A1
                moveq   #0,D0
cbss_loop:      move.l  D0,(A0)+
                cmpa.l  A0,A1
                ble.s   cbss_loop
                rts
                ENDPART
                >PART 'check st'
st_type:        DC.W 0          ; 0=ST,1=STE,2=Mega STE
oldbus:         DC.L 0

check_machine:  clr.w   st_type         ; clear first

                move.l  $08.w,oldbus    ; Bus error
                move.l  #bus_error,$08.w

                move.b  $FFFF820D.w,D0  ; Lowbyte only on STE
                addq.b  #8,$FFFF820D.w  ; change it
                cmp.b   $FFFF820D.w,D0  ; test if it's changed
                beq.s   machine_found   ; if not it must be an ST

                addq.w  #1,st_type      ;

                move.b  D0,$FFFF820D.w  ; put old value back

                move.b  #0,$FFFF8E21.w  ;8 mhz, if it's no mega ste: bus error

                addq.w  #1,st_type

machine_found:  move.l  oldbus(PC),$08.w
                rts

bus_error:      lea     14(SP),SP
                bra.s   machine_found
                ENDPART

wait_a_while:   bsr     syncro
                bsr     switch_screen
                subq.w  #1,D0
                bpl.s   wait_a_while

                rts

                >PART 'Helptext zeichnen'
create_help_text:move.l #screen_3+256,D0
                clr.b   D0
                move.l  D0,help_screen

                movea.l D0,A0
                lea     10*80(A0),A0
                lea     very_first_text,A1

ft_l1:          moveq   #39,D6

ft_l2:          moveq   #0,D0
                move.b  (A1)+,D0
                bsr.s   convert_char

                mulu    #18,D0
                lea     font2,A2
                adda.w  D0,A2

                move.w  (A2)+,(A0)
c               SET 80
                REPT 8
                move.w  (A2)+,c(A0)
c               SET c+80
                ENDR

                addq.l  #2,A0

                dbra    D6,ft_l2

                lea     12*80(A0),A0

                tst.b   (A1)
                bpl.s   ft_l1

                rts
                ENDPART

convert_char:   lea     convert,A2

                moveq   #-1,D2          ; Z„hler fr Zeichenposition

cc_next:        addq.w  #1,D2
                move.b  (A2)+,D1        ; Zeichen aus convert-tabelle

                cmp.b   D1,D0
                beq.s   got_char

                tst.b   (A2)
                bpl.s   cc_next

                moveq   #29,D2          ; 29=space

got_char:       move.l  D2,D0

                rts

                >PART 'intro text' ; Bergrsungstexte usw.
intro:          bsr     syncro
                bsr     switch_screen

                tst.w   text_wait
                bne.s   no_sig_disp2

                tst.w   do_clear
                bne.s   after_text2

                IFNE do_signum
                bsr     disp_signum
                ENDC

after_text2:    tst.w   do_clear
                beq.s   no_clear2

                movea.l signum_pos,A0
                cmpa.l  #st2,A0
                beq.s   stop_intro_text

                IFNE do_signum
                bsr     clear_text
                ENDC

no_clear2:      bra.s   intro           ;    move.w  #1,$FFFF8240.w

stop_intro_text:rts

no_sig_disp2:   subq.w  #1,text_wait
                bne.s   wait_more2

                tst.w   sig_fine
                beq.s   wait_more2

                move.w  #1,do_clear

wait_more2:     bra.s   after_text2
                ENDPART

                IFNE do_animation
                >PART 'animations control'
animation_part: bsr     draw_floor      ; boden "reinfahren"

                moveq   #127,D0         ; D0=Sekunden
                bsr     wait_a_while

anim_loop:      bsr     syncro          ; BOND l„uft bis zur mitte
                bsr     switch_screen   ; des screens

                bsr     animation

                cmpi.l  #640+320-31,x
                bge.s   next_anim

                bra.s   anim_loop

next_anim:      moveq   #36,D0          ; offset fr sideshoot
                bsr     side_shoot      ; von der seite

                moveq   #40,D0
                bsr     wait_a_while

                moveq   #36,D0          ; direkt von vorne
                bsr     front_shoot

                moveq   #100,D0
                bsr     wait_a_while

                bsr     bond_talk       ; er kann sprechen

                moveq   #100,D0
                bsr     wait_a_while

                bsr     jump_around     ; hpft wie verrckt herum
                bsr     jump_around
                bsr     jump_around

                moveq   #40,D0
                bsr     wait_a_while

                bsr     bond_talk       ; er spricht nochmal

                moveq   #40,D0
                bsr     wait_a_while

                moveq   #36,D0          ; offset fr sideshoot
                bsr     side_shoot      ; dreht sich wieder zur seite

                moveq   #40,D0
                bsr     wait_a_while

                movea.l pscreen(PC),A0  ; noch rest des sideshoots l”schen,
                movea.l lscreen(PC),A1  ; da gr”žer
                lea     (264*80)+36(A0),A0
                lea     (264*80)+36(A1),A1
                moveq   #0,D0
                move.l  D0,(A0)
                move.l  D0,(A1)
                move.l  D0,4(A0)
                move.l  D0,4(A1)

                clr.w   anim_phase      ; animationsphase = 0

anim_loop2:     bsr     syncro          ; bond l„uft ein wenig nach rechts
                bsr     switch_screen

                bsr     animation

                cmpi.l  #640+320+15,x
                bge.s   next_anim2

                bra.s   anim_loop2

next_anim2:     moveq   #42,D0
                bsr     side_shoot      ; dreht sich zur seite

                moveq   #40,D0
                bsr     wait_a_while

                moveq   #42,D0
                bsr     front_shoot     ; ...und nach vorne

                moveq   #40,D0
                bsr     wait_a_while

                moveq   #42,D0
                bsr     side_shoot_left ; ... und nach links

                bsr     do_clock        ; die uhr tickt!!!
test:           bsr     do_boom         ; jetzt micht mehr
                bsr     bond_abgang     ; er verschwindet

                moveq   #40,D0
                bsr     wait_a_while

                bsr     syncro
                bsr     switch_screen

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (400-68)*80+32(A0),A0
                lea     (400-68)*80+32(A1),A1

                moveq   #0,D0
                moveq   #66,D1

clear_boom:     move.l  D0,(A0)
                move.l  D0,(A1)
                move.l  D0,4(A0)
                move.l  D0,4(A1)
                move.l  D0,8(A0)
                move.l  D0,8(A1)
                move.l  D0,12(A0)
                move.l  D0,12(A1)
                lea     80(A0),A0
                lea     80(A1),A1
                dbra    D1,clear_boom

                bsr     fade_floor

                rts

ypos:           DC.W 0
                ENDPART
                >PART 'animation part floor1'
draw_floor:     bsr     syncro
                bsr     switch_screen

                movea.l pscreen(PC),A0
                lea     -16*80(A0),A0
                move.w  ypos(PC),D0
                mulu    #80,D0
                adda.w  D0,A0
                move.w  D0,D5

                bsr.s   put_floor

                addi.w  #2,ypos
                cmpi.w  #400,ypos
                blt.s   draw_floor

                bsr     syncro
                bsr     switch_screen

                movea.l pscreen(PC),A0
                lea     -16*80(A0),A0
                adda.w  D5,A0

                bsr.s   put_floor

                rts

put_floor:      lea     -320(A0),A0
                moveq   #0,D0
                moveq   #79,D1
floor_clear:    move.l  D0,(A0)+
                dbra    D1,floor_clear

                lea     floor,A1
                moveq   #15,D4

df_loop_1:      movem.l (A1)+,D0-D3

c               SET 0
                REPT 5
                movem.l D0-D3,c(A0)
c               SET c+16
                ENDR

                lea     80(A0),A0

                dbra    D4,df_loop_1

                rts
                ENDPART
                >PART 'animation walk'
await:          DC.W 8
await2:         DC.W 1
x:              DC.L 640-64
interl_flag:    DC.W 0
anim_phase:     DC.W 0

second_anim:    lea     bond_anim+7424,A0
                bra.s   anim_goon

animation:      not.w   interl_flag
                bmi.s   second_anim

                lea     bond_anim(PC),A0

anim_goon:      move.l  x(PC),D0        ; xpos
                move.l  #400-19-116,D1  ; ypos
                adda.w  anim_phase(PC),A0 ; sprite daten
                bsr.s   draw_sprite

                subq.w  #1,await
                bpl.s   a_fine

                move.w  #9,await

                addi.w  #928,anim_phase
                cmpi.w  #8*928,anim_phase
                blt.s   a_fine

                clr.w   anim_phase

a_fine:         addq.l  #1,x

                rts

; Sprite-Zeichnen auf P-Screen
; D0 = X Position
; D1 = Y Position
; A0 = Adresse der Spritedaten

; Die Routine ist wirklich nicht die beste, aber sie funktioniert!!!!

draw_sprite:    movea.l pscreen(PC),A1
                lea     -80(A1),A1

                mulu    #80,D1
                adda.w  D1,A1           ; ypos in A1

                move.l  D0,D1
                lsr.w   #4,D0
                add.w   D0,D0
                adda.w  D0,A1           ; xpos in A1
                lsl.w   #3,D0
                sub.w   D0,D1

                move.w  #15,D4
                sub.w   D1,D4           ; D4=Anzahl fr shift n. links

                moveq   #116-1,D5

sd_loop:        moveq   #0,D0
                moveq   #0,D1
                moveq   #0,D2
                moveq   #0,D3

                move.l  D0,-4(A1)

                move.w  (A0)+,D0
                lsl.l   D4,D0
                move.w  (A0)+,D1
                lsl.l   D4,D1
                move.w  (A0)+,D2
                lsl.l   D4,D2
                move.w  (A0)+,D3
                lsl.l   D4,D3

                swap    D1
                or.w    D1,D0
                move.l  D0,(A1)+

                swap    D1
                swap    D2
                or.w    D1,D2
                swap    D2
                swap    D3
                or.w    D3,D2

                move.l  D2,(A1)+

                swap    D3

                move.w  D3,(A1)

                lea     80-8(A1),A1

                dbra    D5,sd_loop

                cmpi.l  #640,x
                bgt.s   no_clipping     ; it's a fake clipping!!!!

                movea.l pscreen(PC),A0
                adda.l  #(400-19-116)*80,A0
                subq.w  #8,A0

                moveq   #0,D0
                moveq   #116-1,D1

fake_clip:      move.l  D0,(A0)
                move.l  D0,4(A0)
                lea     80(A0),A0
                dbra    D1,fake_clip

no_clipping:    rts
                ENDPART
                >PART 'bond von seite'
side_shoot:     bsr     syncro

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (264*80)(A0),A0
                lea     (264*80)(A1),A1
                adda.w  D0,A0           ; seite offset
                adda.w  D0,A1
                lea     bond_side,A2
                lea     bond_side+944,A3

                bsr     draw_bond

                rts
                ENDPART
                >PART 'bond von seite ->links'
side_shoot_left:bsr     syncro

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (264*80)(A0),A0
                lea     (264*80)(A1),A1
                adda.w  D0,A0           ; seite offset
                adda.w  D0,A1
                lea     bond_left,A2
                lea     bond_left+944,A3

                bsr     draw_bond

                rts
                ENDPART
                >PART 'bond von vorne'
front_shoot:    bsr     syncro

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (263*80)(A0),A0
                lea     (263*80)(A1),A1
                adda.w  D0,A0
                adda.w  D0,A1
                lea     bond_front,A2
                lea     bond_front+968,A3

                bsr     draw_bond

                rts
                ENDPART
                >PART 'bond sprechend'
bond_talk:      bsr     syncro          ; immer zuerst synchronisieren

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (235*80)+44(A0),A0
                lea     (235*80)+44(A1),A1
                lea     open,A2

                moveq   #61,D0

bt_loop:        move.l  (A2),(A0)
                move.l  (A2)+,(A1)
                move.l  (A2),4(A0)
                move.l  (A2)+,4(A1)
                move.l  (A2),8(A0)
                move.l  (A2)+,8(A1)
                move.l  (A2),12(A0)
                move.l  (A2)+,12(A1)

                lea     80(A0),A0
                lea     80(A1),A1

                dbra    D0,bt_loop

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (263*80)+36(A0),A0
                lea     (263*80)+36(A1),A1
                lea     bond_front+2*968,A2
                lea     bond_front+3*968,A3
                bsr     draw_bond

                bsr     talk_delay

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (263*80)+36(A0),A0
                lea     (263*80)+36(A1),A1
                lea     bond_front,A2
                lea     bond_front+1*968,A3
                bsr     draw_bond

                bsr     talk_delay

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (263*80)+36(A0),A0
                lea     (263*80)+36(A1),A1
                lea     bond_front+2*968,A2
                lea     bond_front+3*968,A3
                bsr.s   draw_bond

                bsr.s   talk_delay

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (263*80)+36(A0),A0
                lea     (263*80)+36(A1),A1
                lea     bond_front,A2
                lea     bond_front+1*968,A3
                bsr.s   draw_bond

                bsr.s   talk_delay
                bsr.s   talk_delay

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (235*80)+44(A0),A0
                lea     (235*80)+44(A1),A1

                moveq   #0,D0
                moveq   #61,D1

talk_clear:     move.l  D0,(A0)
                move.l  D0,(A1)
                move.l  D0,4(A0)
                move.l  D0,4(A1)
                move.l  D0,8(A0)
                move.l  D0,8(A1)
                move.l  D0,12(A0)
                move.l  D0,12(A1)

                lea     80(A0),A0
                lea     80(A1),A1

                dbra    D1,talk_clear

                rts

talk_delay:     moveq   #20,D0
tl_loop:        bsr     syncro
                bsr     switch_screen
                subq.w  #1,D0
                bpl.s   tl_loop
                rts
                ENDPART
                >PART 'routine fr bond draw simple'
draw_bond:      moveq   #116,D0         ; a0=pscreen a1=lscreen
db_loop:        move.l  (A2)+,(A0)      ; a2=pic1 a3=pic2
                move.l  (A2)+,4(A0)

                move.l  (A3)+,(A1)
                move.l  (A3)+,4(A1)

                lea     80(A0),A0
                lea     80(A1),A1

                dbra    D0,db_loop

                rts
                ENDPART
                >PART 'bond jumps'
jump_around:    bsr.s   jump_up
                bsr     jump_down

                rts

ju_tab:         DC.W 0,2,4,6,8,9,11,12,13,13,14,15,15,16,16,16,16
                DC.W -1

jump_up:                                ;illegal
                lea     ju_tab(PC),A4
ju_loop:        move.w  (A4)+,D0

                mulu    #80,D0

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (263*80)+36(A0),A0
                lea     (263*80)+36(A1),A1

                suba.w  D0,A0
                suba.w  D0,A1

                tst.w   D0
                beq.s   no_clear_last

                moveq   #0,D1

                move.l  D1,(117*80)(A0)
                move.l  D1,(117*80)(A1)
                move.l  D1,(117*80)+4(A0)
                move.l  D1,(117*80)+4(A1)

                move.l  D1,(118*80)(A0)
                move.l  D1,(118*80)(A1)
                move.l  D1,(118*80)+4(A0)
                move.l  D1,(118*80)+4(A1)

                move.l  D1,(119*80)(A0)
                move.l  D1,(119*80)(A1)
                move.l  D1,(119*80)+4(A0)
                move.l  D1,(119*80)+4(A1)

no_clear_last:
                lea     bond_front,A2
                lea     bond_front+968,A3

                bsr     syncro
                bsr     switch_screen

                bsr     draw_bond

                bsr     syncro
                bsr     switch_screen

                tst.w   (A4)
                bpl.s   ju_loop

                rts

jd_tab:         DC.W 16,16,16,16,15,15,14,13,13,12,11,9,8,6,4,2,0
                DC.W -1

jump_down:                              ; illegal
                lea     jd_tab(PC),A4
jd_loop:        move.w  (A4)+,D0

                mulu    #80,D0

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (263*80)+36(A0),A0
                lea     (263*80)+36(A1),A1
                suba.w  D0,A0
                suba.w  D0,A1
                lea     bond_front,A2
                lea     bond_front+968,A3

                bsr     syncro
                bsr     switch_screen

                bsr     draw_bond

                bsr     syncro
                bsr     switch_screen

                tst.w   (A4)
                bpl.s   jd_loop

                rts
                ENDPART
                >PART 'clock'
do_clock:       moveq   #0,D2           ; d0=phase

dc_loop1:       bsr     syncro
                bsr     switch_screen

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     (400-16-26)*80+38(A0),A0
                lea     (400-16-26)*80+38(A1),A1
                lea     clock,A2

                move.w  D2,D1
                mulu    #104,D1

                adda.w  D1,A2           ; daten fr uhr

                moveq   #25,D1

dc_loop2:       move.l  (A2),(A0)
                move.l  (A2)+,(A1)

                lea     80(A0),A0
                lea     80(A1),A1

                dbra    D1,dc_loop2

                moveq   #71,D0
                bsr     wait_a_while

                addq.w  #1,D2
                cmp.w   #4,D2

                bne.s   dc_loop1

                rts
                ENDPART
                >PART 'explosion'
do_boom:        bsr     syncro
                bsr     switch_screen

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                adda.l  #(400-68)*80+32,A0
                adda.l  #(400-68)*80+32,A1
                lea     boom,A2

                moveq   #65,D0

boom_loop:      move.l  (A2),(A0)
                move.l  (A2)+,(A1)
                move.l  (A2),4(A0)
                move.l  (A2)+,4(A1)
                move.l  (A2),8(A0)
                move.l  (A2)+,8(A1)
;                move.l  (A2),12(A0)
;                move.l  (A2)+,12(A1)
                addq.l  #4,A2
                lea     80(A0),A0
                lea     80(A1),A1

                dbra    D0,boom_loop

                rts
                ENDPART
                >PART 'bond abgang'
ba_pos:         DC.W 264
ba_clearpos:    DC.L ba_clear
ba_clear:       DC.L screen,screen,-1

bond_abgang:
                bsr     syncro
                bsr     switch_screen
;                illegal

                moveq   #0,D1
                moveq   #0,D2

                movea.l ba_clearpos(PC),A0
                movea.l (A0),A0
                moveq   #116,D0

ba_clear_loop:  move.l  D1,(A0)
                move.l  D1,4(A0)
                lea     80(A0),A0
                dbra    D0,ba_clear_loop

                move.w  ba_pos(PC),D0
                bpl.s   ba_ok

                neg.w   D0
                move.w  D0,D2
                mulu    #8,D0
                move.w  D0,D1
                moveq   #0,D0

ba_ok:          movea.l pscreen(PC),A0
                mulu    #80,D0
                adda.w  D0,A0
                lea     42(A0),A0

                movea.l ba_clearpos(PC),A1
                move.l  A0,(A1)

                lea     bond_left,A1
                adda.w  D1,A1

                moveq   #116,D0
                sub.w   D2,D0

ba_loop:        move.l  (A1)+,(A0)
                move.l  (A1)+,4(A0)

                lea     80(A0),A0

                dbra    D0,ba_loop

                movea.l pscreen(PC),A0
                adda.l  #(400-68)*80+32,A0
                lea     boom,A1

                moveq   #30,D0

ba_boom_loop:   move.l  (A1)+,(A0)
                move.l  (A1)+,4(A0)
                move.l  (A1)+,8(A0)
                addq.l  #4,A1
                lea     80(A0),A0

                dbra    D0,ba_boom_loop

                movea.l pscreen(PC),A0
                lea     (400-16-11)*80+42(A0),A0
                moveq   #0,D0
                moveq   #7,D1

rest_clear:     move.l  D0,(A0)
                move.l  D0,4(A0)
                lea     80(A0),A0
                dbra    D1,rest_clear
                movea.l ba_clearpos(PC),A0
                addq.l  #4,A0
                tst.l   (A0)
                bpl.s   no_new_ba_clear

                lea     ba_clear(PC),A0

no_new_ba_clear:move.l  A0,ba_clearpos

                subi.w  #8,ba_pos
                cmpi.w  #-116,ba_pos
                bge     bond_abgang

                bsr     syncro
                bsr     switch_screen

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     42(A0),A0
                lea     42(A1),A1
                moveq   #0,D0
                moveq   #31,D1

rest_clear2:    move.l  D0,(A0)
                move.l  D0,(A1)
                move.l  D0,4(A0)
                move.l  D0,4(A1)
                lea     80(A0),A0
                lea     80(A1),A1
                dbra    D1,rest_clear2

                rts
                ENDPART
                >PART 'boden weg'
fade_floor:     move.l  #260,D1

fl_loop1:       movea.l pscreen(PC),A0
                lea     (400-18)*80(A0),A0
                lea     (A0),A1

                bsr     syncro

                moveq   #15,D0
fl_loop2:
c               SET 30
                lsl.w   c(A0)
c               SET c-2
                REPT 15
                roxl.w  c(A0)
c               SET c-2
                ENDR

c               SET 48
                lsr.w   c(A0)
c               SET c+2
                REPT 15
                roxr.w  c(A0)
c               SET c+2
                ENDR

                lea     80(A0),A0

                dbra    D0,fl_loop2

                dbra    D1,fl_loop1

                bsr     syncro

                movea.l lscreen(PC),A0
                lea     (400-18)*80(A0),A0
                moveq   #0,D0
                moveq   #15,D1

clear_floor:
                REPT 20
                move.l  D0,(A0)+
                ENDR
                dbra    D1,clear_floor

                rts
                ENDPART
                ENDC

                >PART 'hauptteil'
main_part:      bsr     syncro

                cmpi.w  #2,muzcount
                beq.s   no_muz
                addq.w  #1,muzcount

                IFNE do_sound
                jsr     muzak+4
                ENDC

                bra.s   weiter
no_muz:
                clr.w   muzcount

weiter:         tst.w   help_flag
                bmi     show_help_screen

                bsr     switch_screen

                clr.w   col0

                moveq   #0,D0
                moveq   #0,D1
                moveq   #0,D2
                moveq   #0,D3
                moveq   #0,D4
                moveq   #0,D5
                moveq   #0,D6
                moveq   #0,D7

                IFNE do_scroller
                bsr     scroller
                ENDC

                IFNE do_distort
                bsr     distort
                ENDC

                bsr     sprites

                bsr     volume_bars

                tst.w   text_wait
                bne.s   no_sig_disp

                tst.w   do_clear
                bne.s   after_text

                IFNE do_signum
                bsr     disp_signum
                ENDC

after_text:     tst.w   do_clear
                beq.s   no_clear

                IFNE do_signum
                bsr     clear_text
                ENDC

no_clear:                               ;     move.w  #1,$FFFF8240.w
                bra.s   main_part

no_sig_disp:
                subq.w  #1,text_wait
                bne.s   wait_more

                tst.w   sig_fine
                beq.s   wait_more

                move.w  #1,do_clear

wait_more:      bra.s   after_text

do_clear:       DC.W 0          ; flag fr text-l”schroutine
text_wait:      DC.W 0          ; flag fr l„nge das textdisplays
pscreen:        DC.L 0
lscreen:        DC.L 0
help_screen:    DC.L 0
sig_fine:       DC.W 0          ; flag fr ende des texts
                ENDPART
                >PART 'bildschirm l”schen'
clear_screen:   move.l  #screen+256,D0
                clr.b   D0
                movea.l D0,A0

                moveq   #0,D0

                move.l  A0,pscreen
                move.l  A0,D1
                add.l   #32000+(110*80)+(8*160),D1
                clr.b   D1
                move.l  D1,lscreen

                move.l  #18400-1,D1

cs_loop:        move.l  D0,(A0)+
                dbra    D0,cs_loop

                rts
                ENDPART
                >PART 'log->phys screen'
switch_screen:  move.l  D0,-(SP)
                move.l  lscreen(PC),D0
                move.l  pscreen(PC),lscreen
                move.l  D0,pscreen
                lsr.w   #8,D0
                move.l  D0,$FFFF8200.w
                move.l  (SP)+,D0
                rts
                ENDPART
                >PART 'syncro'
syncro:         move.l  D0,-(SP)
                move.w  sync_bit(PC),D0
sync_wait:      cmp.w   sync_bit(PC),D0
                beq.s   sync_wait
                move.l  (SP)+,D0
                rts
                ENDPART

muzcount:       DC.W 0
storage:        DS.L 24

sync_bit:       DC.W 0
col0:           DC.W 0

vbl:            addq.w  #1,sync_bit
                move.w  col0(PC),$FFFF8240.w

                tst.w   magic_border
                bmi.s   no_border

                clr.b   $FFFFFA1B.w     ; 16     Stop Timer B
                move    #$2700,SR

                move.l  #timerb,$0120.w ; Re-install rasters
                move.b  #198,$FFFFFA21.w ; 16    1st Line is #199

                move.b  #8,$FFFFFA1B.w  ; 16     Start Timer B
                move    #$2300,SR

goon_vbl:       clr.w   key_changed

                move.l  D0,-(SP)

                move.b  $FFFFFC02.w,D0
                cmp.b   old_key(PC),D0
                beq.s   no_help

                move.w  #1,key_changed

                move.b  D0,key
                move.b  D0,old_key

                cmpi.b  #$39,key
                bne.s   no_end

                bra     finish

no_end:         cmpi.b  #$62,key
                bne.s   no_help

                not.w   help_flag

no_help:        move.l  (SP)+,D0
                rte

no_border:      clr.b   $FFFFFA1B.w     ; 16     Stop Timer B
                move    #$2700,SR

                move.l  #dummy,$0120.w  ; Re-install rasters
                move.b  #199,$FFFFFA21.w ; 16    1st Line is #199

                move.b  #8,$FFFFFA1B.w  ; 16     Start Timer B
                move    #$2300,SR

                bra.s   goon_vbl

dummy:          rte


key:            DC.W 0
old_key:        DC.W 0

                IFNE do_signum
                >PART 'Textzentrierung' ; by MR.PEE / TCM
center_text:    lea     st+1,A0         ; Adresse des Textanfangs
c_next_line:    lea     2(A0),A1        ; nach der x,y pos

                moveq   #0,D1           ; reg fr gesamtbreite des textes

next_char:      moveq   #0,D0
                move.b  (A1)+,D0        ; zeichen aus Text holen
                ext.w   D0

                cmp.b   #" ",D0         ; wenn space
                bne.s   c_nicht_space   ; festen Abstand adieren

                addq.w  #6,D1
                bra.s   ct_1

c_nicht_space:  lea     signum_font+144,A2

                subq.w  #1,D0

                add.w   D0,D0
                add.w   D0,D0
                adda.w  D0,A2
                move.l  (A2),D0         ; Adresse des Zeichens errechnen

                lea     signum_font+652,A2
                adda.l  D0,A2

                addq.l  #2,A2           ; breite des zeichens in (a2)

                move.b  (A2),D0         ; breite nach d0 als byte
                ext.w   D0              ; erweitern auf wort
                add.w   D0,D1           ; und zur Gesamtbreite addieren

ct_1:           tst.b   (A1)            ; Zeilenende
                bpl.s   next_char

                lsr.l   #1,D1           ; L„nge/2
;                move.w  #320,D0         ; mitte des screen-(l„nge/2)
;                sub.w   D1,D0

                move.b  D1,(A0)         ; = Anfangspos des Textes

                addq.w  #1,A1
                tst.b   (A1)
                bmi.s   text_ende

                lea     (A1),A0

                bra.s   c_next_line

text_ende:      movea.l signum_pos,A0
                movea.l (A0)+,A1
                move.l  A0,signum_pos
                cmpa.l  #-1,A1
                beq.s   text_end_real

                lea     2(A1),A0
                bra.s   c_next_line

text_end_real:  move.l  #signum_texts+12,signum_pos

                tst.w   st_type
                bne.s   check_ste

                move.l  #st-1,textpos
                bra.s   ter_2

check_ste:      cmpi.w  #1,st_type
                bne.s   its_mega_ste

                move.l  #ste,textpos
                bra.s   ter_2

its_mega_ste:   move.l  #mega_ste,textpos

ter_2:          rts
                ENDPART
                ENDC
                >PART 'lower border' ; Code BY MR.BOND of New Trend

; NO-LOWER-BORDER Routine on Monochrome
; developed by Mr.BOND of NEW-TREND on 31.12.92 / 15.46

timerb:
                clr.b   $FFFFFA1B.w
                movem.l D0/A0,-(SP)
                move    #$2700,SR

                move.b  $FFFF8209.w,D0
tb_sync:        cmp.b   $FFFF8209.w,D0
                beq.s   tb_sync
                not.w   D0
                lsr.w   D0,D0

                lea     $FFFFFA21.w,A0
                move.b  #200-3,(A0)
                move.l  #border,$0120.w
                move    #$2300,SR
                move.b  #8,$FFFFFA1B.w
                movem.l (SP)+,D0/A0
                rte

border:         move    #$2700,SR
                movem.l D0/A0,-(SP)
                lea     $FFFF8209.w,A0

                move.w  #$0F+1,D0       ;8  ; Einige Zeit warten
dss:            DS.W 1,$4E71    ; 16*4
                dbra    D0,dss          ; 12*16

                addq.w  #2,D0
                lsl.w   D0,D0

                move.b  (A0),D0         ; Synchronisieren
sync:           cmp.b   (A0),D0
                beq.s   sync
                not.w   D0
                lsl.l   D0,D0

delay1:         bra     nops1-(65*2)
                DS.W 100,$4E71
nops1:

                IFNE do_lb
                move.b  #0,$FFFF8260.w
delay2:         bra     nops2-(11*2)
                DS.W 40,$4E71
nops2:
                move.b  #2,$FFFF8260.w  ;70hz
                ENDC

                movem.l (SP)+,D0/A0
                rte
                ENDPART
                IFNE do_scroller
                >PART 'scroller' ;code by CHARON

scroll_off:     DC.W 25*80+54

scroller:       moveq   #0,D1
                movea.l pscreen(PC),A0
                adda.l  #400*80,A0      ; FIX=425*80+54
                adda.w  scroll_off(PC),A0

                moveq   #29,D0          ; Font is 20 px high
lineloop:
count           SET 0           ; Scroll it
                REPT 39
                move.w  count+2(A0),count(A0)
count           SET count+2
                ENDR
                adda.l  #80,A0
                dbra    D0,lineloop
again:
;        illegal
                lea     scrolltext,A0
                lea     fontadr,A1
                move.w  scrollpoint,D0
                move.b  0(A0,D0.w),D1   ; D1 = Letter
                addq.w  #1,D0
                move.b  0(A0,D0.w),D2   ; D2 = Next Letter

                tst.b   D2
                bge.s   no_wraz
                clr.w   scrollpoint
                clr.w   byte
                bra.s   again
no_wraz:
                lsl.w   #2,D1
                lsl.w   #2,D2
                movea.l 0(A1,D1.w),A2   ; A2 = Letteradr
                movea.l 0(A1,D2.w),A3   ; A3 = Next Letteradr

                move.w  byte,D0
                lea     stufen,A0
                movea.l 0(A0,D0.w),A1

                movea.l pscreen(PC),A0
                adda.l  #400*80+78,A0
                adda.w  scroll_off(PC),A0

                jsr     (A1)
                rts
stufe1:
                addq.w  #4,byte

count           SET 0
c2              SET 0
                REPT 30
                move.b  c2+3(A2),count(A0)
count           SET count+80
c2              SET c2+4
                ENDR
count           SET 0
c2              SET 0
                REPT 30
                move.b  c2(A3),count+1(A0)
count           SET count+80
c2              SET c2+4
                ENDR
                rts
stufe2:
                addq.w  #4,byte

count           SET 0
c2              SET 0
                REPT 30
                move.w  c2(A3),count(A0)
count           SET count+80
c2              SET c2+4
                ENDR

                rts
stufe3:
                addq.w  #4,byte

count           SET 0
c2              SET 0
                REPT 30
                move.b  c2+1(A3),count(A0)
count           SET count+80
c2              SET c2+4
                ENDR
count           SET 0
c2              SET 0
                REPT 30
                move.b  c2+2(A3),count+1(A0)
count           SET count+80
c2              SET c2+4
                ENDR

                rts
stufe4:
                clr.w   byte

count           SET 0
c2              SET 0
                REPT 30
                move.w  c2+2(A3),count(A0)
count           SET count+80
c2              SET c2+4
                ENDR

                addq.w  #1,scrollpoint
                rts
                ENDPART
                ENDC
                IFNE do_signum
                >PART 'signum'  ; Lamester Code by SPIFF of ORION
*
*
*       Modul zum Signum-Bildschirmfonts darstellen (Mono)
*
*

textpos:        DC.L st-1
sxpos:          DC.W 0
sypos:          DC.W 5*(21*80)
swait:          DC.W 0
xpos:           DC.W 1

disp_signum:    subq.w  #1,swait
                bpl.s   no_next_char

                move.w  #1,swait

                movea.l textpos(PC),A0

                addq.l  #1,A0
                tst.b   (A0)
                bmi.s   next_line

normal_text:    move.l  A0,textpos
                move.w  sxpos(PC),xpos
                move.b  (A0),D0
                ext.w   D0
                bra.s   nicht_fertig

no_next_char:   movea.l textpos(PC),A0
                bra.s   normal_text

next_line:
                addq.l  #1,A0
                cmpi.b  #$FF,(A0)
                beq.s   text_finished

                moveq   #0,D1
                move.b  (A0)+,D1
                move.w  #320,D0
                sub.w   D1,D0
                move.w  D0,sxpos

                move.b  (A0)+,D0
                ext.w   D0
                mulu    #21*80,D0
                move.w  D0,sypos

                bra.s   normal_text

text_finished:  move.w  #1,sig_fine
                move.w  #7*70,text_wait
                rts

nicht_fertig:
                cmp.b   #" ",D0
                bne.s   nicht_space
                cmpi.w  #1,swait
                beq.s   no_space
                addq.w  #6,xpos
no_space:       bra.s   signum_end

nicht_space:
                lea     signum_font+144,A1

                subq.w  #1,D0

                add.w   D0,D0
                add.w   D0,D0
                adda.w  D0,A1
                move.l  (A1),D0

                lea     signum_font+652,A1
                adda.l  D0,A1

                movea.l pscreen(PC),A2
                adda.w  sypos(PC),A2

                move.b  (A1)+,D1        ;   topoffset
                ext.w   D1
                mulu    #80,D1
                adda.w  D1,A2
                move.w  xpos(PC),D1
                lsr.w   #3,D1
                adda.w  D1,A2

                move.b  (A1)+,D2        ;   hoehe der Daten
                ext.w   D2              ;   nach d2
                subq.w  #1,D2

                move.w  xpos(PC),D4     * xpos mod 8
                move.w  D4,D6
                and.w   #%1111111111111000,D4
                sub.w   D4,D6

                move.b  (A1)+,D3        ;   Breite in pixel
                addq.l  #1,A1           ;   reserviertes Byte berspringen

                ext.w   D3              ;   nach d3

                cmpi.w  #1,swait
                beq.s   draw_char_loop
                add.w   D3,xpos
draw_char_loop:
                moveq   #0,D5
                move.w  (A1)+,D5
                ror.l   D6,D5
                or.b    D5,1(A2)
                ror.l   #8,D5
                or.b    D5,0(A2)
                swap    D5
                or.b    D5,2(A2)
                lea     80(A2),A2
                dbra    D2,draw_char_loop

signum_end:     move.w  xpos(PC),sxpos

                rts
                ENDPART
                ENDC
                IFNE do_signum
                >PART 'text l”schen' ; Code by MR.PEE of TCM
clear_p1:       DC.W 5*(21*80)
clear_p2:       DC.W 13*(21*80)+80+160
ct_flag:        DC.W 0

clear_text:     not.w   ct_flag
                tst.w   ct_flag
                beq.s   no_new_line

                addi.w  #160,clear_p1
                subi.w  #160,clear_p2

                cmpi.w  #13*(21*80)+160,clear_p1
                ble.s   no_new_line

                clr.w   do_clear
                clr.w   sig_fine
                clr.w   text_wait

                move.w  #5*(21*80),clear_p1
                move.w  #13*(21*80)+80+160,clear_p2

                movea.l signum_pos,A0
                movea.l (A0)+,A1
                tst.l   (A0)
                bpl.s   no_cycle_text

                lea     st3,A0

no_cycle_text:  move.l  A0,signum_pos

                move.l  A1,textpos
                clr.w   swait

no_new_line:    movea.l pscreen(PC),A0
                lea     12(A0),A0
                lea     (A0),A1
                adda.w  clear_p1(PC),A0
                adda.w  clear_p2(PC),A1

                moveq   #0,D0

                REPT 14
                move.l  D0,(A0)+
                move.l  D0,(A1)+
                ENDR

                rts
                ENDPART
                ENDC
                IFNE do_distort
                >PART ' logos vorshiften' ;code by charon / NATO
preshift_logos: moveq   #5,D6
shift_all:
                lea     logo1(PC),A0    ; Move it into the special shiftpuffer
                adda.l  logoadd,A0
                addi.l  #32*51+62,logoadd
                lea     expuf,A1
                moveq   #0,D0
                moveq   #49,D1
shiftloop:      move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  (A0)+,(A1)+
                move.w  D0,(A1)+
                dbra    D1,shiftloop

                moveq   #0,D0
                roxl.w  #2,D0           ; Clear Carry

                lea     shiftpuf,A1
                adda.l  logoadd2,A1
                moveq   #15,D0          ; 16 Shiftstufen
shiftloop2:
                lea     expuf,A0
                REPT 50*17      ; Move it into the shiftpuffer
                move.w  (A0)+,(A1)+
                ENDR

                lea     expuf,A0
                REPT 50*17
                roxr.w  (A0)+
                ENDR

                dbra    D0,shiftloop2
                addi.l  #34*50*16,logoadd2
                dbra    D6,shift_all

                clr.l   logoadd

                rts
                ENDPART
                >PART 'logos distorten' ; code by charon / NATO
distort:
                movea.l cladr1(PC),A0   ; Clear the lines
                moveq   #0,D3
                REPT 49
                movea.l (A0)+,A1
                move.w  D3,-2(A1)
                move.w  D3,(A1)
                move.w  D3,34(A1)
                ENDR
                movea.l (A0)+,A1
count           SET -2
                REPT 18
                move.w  D3,count(A1)
count           SET count+2
                ENDR

                movea.l cladr1(PC),A4
                lea     shiftadr(PC),A2
                move.l  pscreen(PC),D0
                sub.l   #4000,D0
                movea.l sinadr(PC),A0
                movea.w (A0)+,A1        ; A1 = X-Wort
                move.w  (A0)+,D1
                move.l  A0,sinadr

                movea.l yadr(PC),A5
                move.w  (A5)+,D4        ; D4 = Y-Offset*80
                move.l  A5,yadr

                tst.w   (A5)
                bge.s   no_wrapy
                move.l  #ytab,yadr
                addi.l  #34*50*16,logoadd
                cmpi.l  #34*50*16*5,logoadd
                ble.s   no_wrapy
                clr.l   logoadd
no_wrapy:
                move.l  logoadd(PC),D5
                movea.l 0(A2,D1.w),A3   ; A3 = Adr of logo
                adda.l  D5,A3           ; Welches Logo ?

                adda.w  D4,A1
                adda.l  D0,A1           ; A1 = Adr of aim

                moveq   #0,D6
                moveq   #0,D7

                moveq   #49,D2
putloop:
                move.l  A1,(A4)+

                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                move.w  (A3)+,(A1)+
                addi.w  #34,D6          ; N„chste logo-Zeile
                addi.w  #80,D7          ; N„chste Screen-Zeile

                movea.w (A0)+,A1        ; A1 = X-Wort
                adda.w  D7,A1
                move.w  (A0)+,D1
                movea.l 0(A2,D1.w),A3   ; A3 = Adr of logo
                adda.w  D6,A3
                adda.l  D5,A3           ; Welches Logo ?

                adda.w  D4,A1
                adda.l  D0,A1           ; A1 = Adr of aim

                dbra    D2,putloop

                tst.w   (A0)            ; Wrap ?
                bge.s   no_wrap
                move.l  #sintab,sinadr
no_wrap:
                rts

cladr1:         DC.L clrpuf1
cladr2:         DC.L clrpuf2
clrpuf1:        DS.L 50,$0F8000
clrpuf2:        DS.L 50,$0F8000
logoadd:        DC.L 62
logoadd2:       DC.L 0

shiftadr:
count           SET 0
                REPT 16
                DC.L shiftpuf+count
count           SET count+1700
                ENDR

sinadr:         DC.L sintab
yadr:           DC.L ytab
ytab:
count           SET 0
                REPT 50
                DC.W count
count           SET count+80
                ENDR
                DS.W 5*70,4000
count           SET 4000
                REPT 50
                DC.W count
count           SET count-80
                ENDR
                DC.W $FFFF
sintab:
                IBYTES 'DISTAB.IMG'
                DC.W $FFFF
screen1:        DC.L $0F8000
screen2:        DC.L $0EF300

logo1:          IBYTES 'LOGOS.BIN'
                ENDPART
                ENDC
                >PART 'help screen'
help_flag:      DC.W instant_help ; 0= no help, -1=help
key_changed:    DC.W 0
old_scroll_off: DC.W 0
magic_border:   DC.W 0

show_help_screen:move.w #1,col0

                move.l  help_screen(PC),D0
                lsr.w   #8,D0
                move.l  D0,$FFFF8200.w

                move.w  scroll_off(PC),old_scroll_off

                tst.w   key_changed
                beq.s   no_change

                tst.w   magic_border
                bmi.s   dont_change_diz

                cmpi.b  #$3B,key        ; F1
                beq     increase_d2
                cmpi.b  #$3C,key        ; F2
                beq     decrease_d2
                cmpi.b  #$3D,key        ; F3
                beq     increase_d1
                cmpi.b  #$3E,key        ; F4
                beq     decrease_d1
                cmpi.b  #$3F,key        ; F5
                beq     decrease_soff
                cmpi.b  #$40,key        ; F6
                beq     increase_soff
                cmpi.b  #$41,key        ; F7
                beq     decrease_soff_2
                cmpi.b  #$42,key        ; F8
                beq     increase_soff_2
dont_change_diz:cmpi.b  #$44,key        ; F10
                beq     switch_border

no_change:                              ; illegal
                moveq   #0,D0
                moveq   #0,D1
                move.w  delay2+2(PC),D0
                movea.l help_screen(PC),A0
                lea     (20*12*80)+52+320(A0),A0
                bsr     print_number

                moveq   #0,D0
                move.w  delay1+2(PC),D0
                movea.l help_screen(PC),A0
                lea     (22*12*80)+52+480(A0),A0
                bsr     print_number

                tst.w   magic_border
                bmi.s   dont_show_diz
                moveq   #0,D0
                move.w  scroll_off(PC),D0
                add.w   D0,D0
                movea.l help_screen(PC),A0
                lea     (24*12*80)+52+640(A0),A0
                bsr     print_number

                bsr     show_scroll_off

dont_show_diz:  move.w  old_scroll_off(PC),D0
                cmp.w   scroll_off(PC),D0
                beq.s   end_this_part

                bsr     copy_scroller

end_this_part:  move.w  scroll_off(PC),old_scroll_off

                bsr     show_status

                bra     main_part
                ENDPART
                >PART 'werte wechseln'
increase_d2:    cmpi.w  #2,delay2+2
                beq.s   no_id2
                subq.w  #2,delay2+2
no_id2:         bra.s   no_change

decrease_d2:    cmpi.w  #39*2,delay2+2
                beq.s   no_dd2
                addq.w  #2,delay2+2
no_dd2:         bra     no_change

increase_d1:    cmpi.w  #2,delay1+2
                beq.s   no_id1
                subq.w  #2,delay1+2
no_id1:         bra     no_change

decrease_d1:    cmpi.w  #99*2,delay1+2
                beq.s   no_dd1
                addq.w  #2,delay1+2
no_dd1:         bra     no_change

decrease_soff:  tst.w   scroll_off
                beq.s   no_d_sof
                subq.w  #2,scroll_off
no_d_sof:       bra     no_change

increase_soff:  cmpi.w  #2612+80,scroll_off
                beq.s   no_i_sof
                addq.w  #2,scroll_off
no_i_sof:       bra     no_change

decrease_soff_2:subi.w  #80,scroll_off
                bpl.s   no_d_sof_2
                addi.w  #80,scroll_off
no_d_sof_2:     bra     no_change

increase_soff_2:addi.w  #80,scroll_off
                cmpi.w  #2612+80,scroll_off
                ble.s   no_i_sof_2
                subi.w  #80,scroll_off
no_i_sof_2:     bra     no_change

switch_border:  not.w   magic_border
                bmi.s   over_border

                move.w  save_offset(PC),scroll_off

                bra     no_change

save_offset:    DC.W 0          ; offset fr scroller

over_border:    move.w  scroll_off(PC),save_offset
                move.w  #-31*80,scroll_off
                bra     no_change

                ENDPART
                >PART 'print number'
print_number:                           ; illegal
                lsr.w   #1,D0           ; Wert/2

                move.w  D0,D1
                divu    #1000,D1
                move.w  #1000,D2
                mulu    D1,D2
                sub.w   D2,D0

                lea     font2,A1
                lea     31*18(A1),A1    ; Position von 0 im font
                mulu    #18,D1
                adda.w  D1,A1

c               SET 0
                REPT 9
                move.w  (A1)+,c(A0)
c               SET c+80
                ENDR

                move.w  D0,D1
                divu    #100,D1
                move.w  #100,D2
                mulu    D1,D2
                sub.w   D2,D0

                lea     font2,A1
                lea     31*18(A1),A1    ; Position von 0 im font
                mulu    #18,D1
                adda.w  D1,A1

c               SET 0
                REPT 9
                move.w  (A1)+,c+2(A0)
c               SET c+80
                ENDR

                move.w  D0,D1
                divu    #10,D1
                move.w  #10,D2
                mulu    D1,D2
                sub.w   D2,D0

                lea     font2,A1
                lea     31*18(A1),A1    ; Position von 0 im font
                mulu    #18,D1
                adda.w  D1,A1

c               SET 0
                REPT 9
                move.w  (A1)+,c+4(A0)
c               SET c+80
                ENDR

                lea     font2,A1
                lea     31*18(A1),A1    ; Position von 0 im font
                mulu    #18,D0
                adda.w  D0,A1

c               SET 0
                REPT 9
                move.w  (A1)+,c+6(A0)
c               SET c+80
                ENDR

                rts
                ENDPART
                >PART 'show scroll offset'
show_scroll_off:movea.l help_screen(PC),A0
                adda.l  #400*80,A0
                adda.w  scroll_off(PC),A0
                moveq   #0,D0
                moveq   #-1,D1
                move.w  D0,-80(A0)
c               SET 0
                REPT 30
                move.w  D0,c-2(A0)
                move.w  D1,c(A0)
                move.w  D0,c+2(A0)
c               SET c+80
                ENDR
                move.w  D0,c(A0)
                rts
                ENDPART
                >PART 'scroller kopieren'
copy_scroller:  movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     scroll_puf,A2

                lea     (400*80)(A0),A0
                lea     (400*80)(A1),A1
                adda.w  old_scroll_off(PC),A0
                adda.w  old_scroll_off(PC),A1

                moveq   #0,D0
                moveq   #29,D1          ; anzahl Zeilen

copy_loop:      REPT 20
                move.l  (A0),(A2)+
                move.l  (A1),(A2)+
                move.l  D0,(A0)+
                move.l  D0,(A1)+
                ENDR

                dbra    D1,copy_loop

                movea.l pscreen(PC),A0
                movea.l lscreen(PC),A1
                lea     scroll_puf,A2

                lea     (400*80)(A0),A0
                lea     (400*80)(A1),A1
                adda.w  scroll_off(PC),A0
                adda.w  scroll_off(PC),A1

                moveq   #29,D1          ; anzahl Zeilen

copy_loop2:     REPT 20
                move.l  (A2)+,(A0)+
                move.l  (A2)+,(A1)+
                ENDR

                dbra    D1,copy_loop2

                rts
                ENDPART
                >PART 'show status'
on:             DC.B 14,13,29
off:            DC.B 14,5,5

show_status:    tst.w   magic_border
                bmi.s   its_off
                lea     on(PC),A0
                bra.s   goon_ss
its_off:        lea     off(PC),A0
goon_ss:        movea.l help_screen(PC),A1
                lea     (27*12*80)+52+880(A1),A1

                moveq   #2,D1
ss_loop:        moveq   #0,D0
                move.b  (A0)+,D0
                mulu    #18,D0
                lea     font2,A2
                adda.w  D0,A2

c               SET 0
                REPT 9
                move.w  (A2)+,c(A1)
c               SET c+80
                ENDR

                addq.w  #2,A1

                dbra    D1,ss_loop

                rts
                ENDPART
                >PART 'sprites' ; ECHTZEIT!!!!!!!!
sprite_dat:     DC.B 18,22,8,18,18,44,0,11,15,44,2,14,13,21,4,13,19,8,14,13
swave_pos:      DC.L sprite_wave

scpos:          DC.L sclear
sclear:         DC.L sclear1,sclear2,-1
sclear1:        REPT 20
                DC.L screen
                ENDR
sclear2:        REPT 20
                DC.L screen
                ENDR


sprites:                                ;  illegal
                movea.l scpos(PC),A0
                movea.l (A0),A0

                moveq   #0,D1
                moveq   #19,D0
sc_loop:        movea.l (A0)+,A1

                move.l  D1,(A1)

c               SET 80
                REPT 8
                move.l  D1,c(A1)
c               SET c+80
                ENDR

                dbra    D0,sc_loop


                movea.l pscreen(PC),A0
                lea     5*80-2(A0),A0
                movea.l swave_pos(PC),A1
                lea     sprite_dat(PC),A2
                movea.l scpos(PC),A5
                movea.l (A5),A5

                moveq   #19,D0          ; Anzahl Sprites

sprite_loop:    moveq   #0,D1
                move.b  (A2)+,D1
                mulu    #18,D1
                lea     font2,A3
                adda.w  D1,A3

                move.w  (A1)+,D2        ; D2=shift-anzahl
                moveq   #0,D3

                lea     (A0),A4
                adda.w  (A1)+,A4
                move.l  A4,(A5)+

                move.w  (A3)+,D3
                lsl.l   D2,D3
                or.l    D3,(A4)

c               SET 80
                REPT 8
                moveq   #0,D3
                move.w  (A3)+,D3
                lsl.l   D2,D3
                or.l    D3,c(A4)
c               SET c+80
                ENDR

                dbra    D0,sprite_loop

                tst.w   (A1)
                bpl.s   no_new_swave

                lea     sprite_wave,A1

no_new_swave:   move.l  A1,swave_pos

                movea.l scpos(PC),A0
                addq.l  #4,A0
                tst.l   (A0)
                bpl.s   no_new_sc
                lea     sclear(PC),A0
no_new_sc:      move.l  A0,scpos

                rts
                ENDPART
                >PART 'sound bars'
volume:         DC.W 0,0,0      ; fr alle 3 Stimmen
show_volume:    DC.W 0,0,0      ; angezeigtes volume

volume_bars:    bsr.s   get_volume
                bsr.s   calc_show_volume
                bsr.s   clear_bars
                bsr     show_bars

                rts

get_volume:                             ; illegal
                lea     volume(PC),A0

                moveq   #0,D0
                move.b  #8,$FFFF8800.w
                move.b  $FFFF8800.w,D0
                and.b   #15,D0
                move.w  D0,(A0)+

                moveq   #0,D0
                move.b  #9,$FFFF8800.w
                move.b  $FFFF8800.w,D0
                and.b   #15,D0
                move.w  D0,(A0)+

                moveq   #0,D0
                move.b  #10,$FFFF8800.w
                move.b  $FFFF8800.w,D0
                and.b   #15,D0
                move.w  D0,(A0)+

                rts

calc_show_volume:                       ;illegal
                lea     volume(PC),A0
                lea     show_volume(PC),A1

                moveq   #2,D0

csv_loop:       move.w  (A0)+,D1
                move.w  (A1),D2

                cmp.w   D1,D2
                ble.s   hard_move

                subq.w  #1,D2

csv_next:       move.w  D2,(A1)+
                dbra    D0,csv_loop

                rts

hard_move:      move.w  D1,D2
                bra.s   csv_next

clear_bars:     movea.l pscreen(PC),A0
                lea     292*80+4(A0),A0
                moveq   #0,D0

                move.l  #63,D1

cb_loop:        move.l  D0,(A0)
                move.w  D0,4(A0)
                move.l  D0,66(A0)
                move.w  D0,70(A0)

                lea     80(A0),A0

                dbra    D1,cb_loop

                rts

show_bars:      movea.l pscreen(PC),A0
                lea     292*80+4(A0),A0
                lea     64*80(A0),A2

                move.w  #$3FFC,D0       ; Bitmuster Balken

                lea     show_volume(PC),A1

                move.w  (A1)+,D1
                add.w   D1,D1
                move.w  #31,D2
                sub.w   D1,D2
                mulu    #80,D2
                adda.w  D2,A0
                suba.w  D2,A2

;                lsl.w   #1,D1

sb_loop1:       move.w  D0,(A0)
                move.w  D0,70(A0)
                move.w  D0,(A2)
                move.w  D0,70(A2)
                lea     160(A0),A0
                lea     -160(A2),A2

                dbra    D1,sb_loop1

                movea.l pscreen(PC),A0
                lea     292*80+4(A0),A0
                addq.l  #2,A0
                lea     64*80(A0),A2

                move.w  (A1)+,D1
                add.w   D1,D1
                move.w  #31,D2
                sub.w   D1,D2
                mulu    #80,D2
                adda.w  D2,A0
                suba.w  D2,A2

;                lsl.w   #1,D1

sb_loop2:       move.w  D0,(A0)
                move.w  D0,66(A0)
                move.w  D0,(A2)
                move.w  D0,66(A2)
                lea     160(A0),A0
                lea     -160(A2),A2

                dbra    D1,sb_loop2

                movea.l pscreen(PC),A0
                lea     292*80+4(A0),A0
                addq.l  #4,A0
                lea     64*80(A0),A2

                move.w  (A1)+,D1
                add.w   D1,D1
                move.w  #31,D2
                sub.w   D1,D2
                mulu    #80,D2
                adda.w  D2,A0
                suba.w  D2,A2

;                lsl.w   #1,D1

sb_loop3:       move.w  D0,(A0)
                move.w  D0,62(A0)
                move.w  D0,(A2)
                move.w  D0,62(A2)
                lea     160(A0),A0
                lea     -160(A2),A2

                dbra    D1,sb_loop3

                rts
                ENDPART

                DATA

                >PART 'animation graphics'
                IFNE do_animation
bond_anim:      IBYTES 'BONDWALK_1.BIN' ; 8 Bytes, 116 Zeilen, 8 Phasen
;                                         = 7424 Bytes je interlace-phase
floor:          IBYTES 'FLOOR.BIN' ; 16 Bytes, 16 Zeilen
bond_side:      IBYTES 'BONDSIDE.BIN' ; 8 Bytes, 118 Zeilen!!!!!
bond_front:     IBYTES 'BONDFRON.BIN' ; 2 mal von vorne normal
;                                       2 mal von vorne sprechend
;                                       121 Zeilen u. 968 Bytes
bond_left:      IBYTES 'BONDLEFT.BIN' ; das gleiche wie bei bond_side nur nach links
open:           IBYTES 'OPEN.BIN' ; MR.BOND SAYS OPEN!!!!!!!!!!!!!!! (128x62)
clock:          IBYTES 'CLOCK.BIN' ; Zeitbombe: 32x26 pixels , 4 phasen
boom:           IBYTES 'BOOOOOOM.BIN' ; explosion 128x66 pixels
                ENDC
                EVEN
                ENDPART
                >PART 'scroll data'
                IFNE do_scroller
stufen:         DC.L stufe1,stufe2,stufe3,stufe4
byte:           DC.W 0
scrollpoint:    DC.W 0
scrolltext:     DS.B 150,47
                IBYTES 'SCROLLER.BIN'
                DC.B -1
                EVEN
fontadr:
count           SET 0
                REPT 48
                DC.L font+count
count           SET count+120
                ENDR

font:           IBYTES 'FONT.BIN'
                EVEN
                ENDC
                ENDPART
                >PART 'signumtext daten'
                IFNE do_signum
signum_pos:     DC.L signum_texts+4
signum_texts:   DC.L st-1,ste,mega_ste,it1,it2
st2:            DC.L mt1
st3:            DC.L mt2,credit1,credit2,credit3,credit4,greet_intro,greet1,greet2,greet3
                DC.L -1


                DC.B 0
st:             DC.B -1
                DC.B 0,7,'You are the owner of a ST!!!!',-1
                DC.B 0,8,'I have also one, I use it to keep',-1
                DC.B 0,9,'the door of my room open!!!!',-1
mega_ste:       DC.B -1,-1
                DC.B 0,7,'WOW!!! What a powerfull machine you have.',-1
                DC.B 0,8,'You are the proud owner of a Mega-STE.',-1
                DC.B 0,9,'This screen is mostly written on a Mega-STE....',-1
                DC.B 0,10,"So it should also work on yours.",-1
ste:            DC.B -1,-1
                DC.B 0,7,'Lucky one!!!!!',-1
                DC.B 0,8,'You are the owner of a STE.',-1
                DC.B 0,9,"To bad that it's not used in this screen....",-1
it1:            DC.B -1,-1
                DC.B 0,6,"At the start of the year 1993,",-1
                DC.B 0,7,"Mr.Bond of New Trend managed what",-1
                DC.B 0,8,"nobody thought that it's possible!!!!",-1
                DC.B 0,10,"For the first time he opened the",-1
                DC.B 0,11,"lower border on monochrome!!!!!!!!",-1
it2:            DC.B -1,-1
                DC.B 0,6,'Watch now how Mr.Bond discovered',-1
                DC.B 0,7,'this new technique.............',-1
                DC.B 0,10,'(Press Help if the screen is',-1
                DC.B 0,11,"flickering after the animation.)",-1
mt1:            DC.B -1,-1
                DC.B 0,7,"He survived his attack on the ST-hardware.",-1
                DC.B 0,9,'And now live from hospital.....',-1
                DC.B 0,10,'MR.BOND with his famous last words:',-1
mt2:            DC.B -1,-1
                DC.B 0,7,"The work is done, for more information",-1
                DC.B 0,8,"read the lower scroller.",-1
                DC.B 0,10,"It's time now for some credits'n'greets......",-1
credit1:        DC.B -1,-1
                DC.B 0,5,"Code:",-1
                DC.B 0,7,"Mr.Bond of New Trend",-1
                DC.B 0,8,"(Lower Border Routine)",-1
                DC.B 0,10,"Charon of the NATO",-1
                DC.B 0,11,"(Logo distorer and scroller)",-1
credit2:        DC.B -1,-1
                DC.B 0,6,"Spiff of Orion",-1
                DC.B 0,7,'(Signumtext-displayer)',-1
                DC.B 0,9,"Mr.PEE of The Cyclemasters",-1
                DC.B 0,10,"(putting together, animation, sprites",-1
                DC.B 0,11,"and all the rest)",-1
credit3:        DC.B -1,-1
                DC.B 0,5,"Grafix:",-1
                DC.B 0,7,"Mr.Gibe of Black Byte",-1
                DC.B 0,8,"(fantastic animation grafix)",-1
                DC.B 0,10,"Mr.PEE of The Cyclemasters",-1
                DC.B 0,11,"(only the logos, the rest is ripped)",-1
credit4:        DC.B -1,-1
                DC.B 0,7,"Sound:",-1
                DC.B 0,10,"Tao of ACF",-1
greet_intro:    DC.B -1,-1
                DC.B 0,6,"I hope you have noticed that the",-1
                DC.B 0,7,"animation was interlaced with nine",-1
                DC.B 0,8,"real grey-shades?",-1
                DC.B 0,10,"OK, doesn't matter. Get ready for the greetings,",-1
                DC.B 0,11,"In re-alphabetic order......",-1
greet1:         DC.B -1,-1      ; muss dc.b -1,-1 sein, sonst
; bei ungerader Zeichenanzahl Absturz!!!!!!!!!!!!
                DC.B 0,5,'White Status - Werewolf Software',-1
                DC.B 0,6,'Vinvo - TSB - TPN - TOM G - Thomas Crown',-1
                DC.B 0,7,'The Wild Boys - The Untouchables',-1
                DC.B 0,8,'The Respectables - The Overlanders',-1
                DC.B 0,9,'The Final Spacecoders - The Exceptions',-1
                DC.B 0,10,'The Detonators - The Debug Boys',-1
                DC.B 0,11,'The Bushwackers - The Black Cats',-1
                DC.B 0,12,'TDA - Synergy - Strangers - STAX',-1
greet2:         DC.B -1,-1
                DC.B 0,5,'ST Conexxion - Slayer - Risk',-1
                DC.B 0,6,'Pure Energy - Psychonomix - Prophecy PD',-1
                DC.B 0,7,'Prism - Phenix - Passion - Oxygene',-1
                DC.B 0,8,'NPG - Newline - Mad Vision - Lynx',-1
                DC.B 0,9,'Lucky of ST - Legacy - Lazer - Kopa',-1
                DC.B 0,10,'ICS - Hotline - Hemoroids - Gudul',-1
                DC.B 0,11,'Germs - Future Minds - Fournitz',-1
                DC.B 0,12,'Flavour - Euphorea - Electra',-1
greet3:         DC.B -1,-1
                DC.B 0,5,'Dr. Diddle - Digital Underground',-1
                DC.B 0,6,'Diamond Design - Delta Force - Cobra',-1
                DC.B 0,7,'Channel 38 - BMT - Blue Software',-1
                DC.B 0,8,'Aura - Altair - Animal Mine',-1
                DC.B 0,11,'And of course all the others that',-1
                DC.B 0,12,'we have forgotten.............',-1
                DC.B -1,-1

                EVEN
signum_font:    IBYTES 'PIN*.E24'
                ENDC
                ENDPART

convert:        DC.B 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,! ?'
                DC.B "0123456789'()-/",'"=t',-1

font2:          IBYTES 'FONT2.BIN'

                >PART 'help text'
;                    "0123456789012345678901234567890123456789" 40 Zeichen
very_first_text:DC.B '        LOWER-BORDER ADJUSTMENT         '
                DC.B '        -----------------------         '
                DC.B '                                        '
                DC.B 'AS THE LOWER-BORDER-ROUTINE IS  MONITOR-'
                DC.B 'AND  COMPUTER-DEPENDEND, WE  DECIDED  TO'
                DC.B 'GIVE YOU THE OPPORTUNITY TO ADJUST  YOUR'
                DC.B 'OWN ROUTINE.                            '
                DC.B '                                        '
                DC.B "AND  ALWAYS  REMEMBER: WE DON'T TAKE ANY"
                DC.B "RESPONSIBILITY  FOR  DAMAGES  WHICH  ARE"
                DC.B 'CAUSED ON YOUR MONITOR OR COMPUTER!!!!!!'
                DC.B '                                        '
                DC.B 'IF YOU  CAN DO A BETTER ROUTINE OR  OPEN'
                DC.B 'ANOTHER  BORDER  ON  MONOCHROME   PLEASE'
                DC.B 'WRITE US!!!!!!!!!!!                     '
                DC.B '                                        '
                DC.B '----------------------------------------'
                DC.B '                                        '
                DC.B 'H-RAY-DIFFERENCE        =        (F1/F2)'
                DC.B '                                        '
                DC.B 'V-CLOCK-SPEED-VARIATION =        (F3/F4)'
                DC.B '                                        '
                DC.B 'SCROLLER OFFSET X       =        (F5/F6)'
                DC.B 'FOR Y-CHANGE PRESS               (F7/F8)'
                DC.B '                                        '
                DC.B 'LOWER BORDER ON/OFF     =         (F10) '
                DC.B '                                        '
                DC.B '                                        '
                DC.B ' PRESS HELP TO LEAVE ADJUSTMENT-SCREEN. '
                DC.B -1
                ENDPART

                EVEN

sprite_wave:    IBYTES 'S_WAVE.BIN'
                DC.W -1

                IFNE do_sound
muzak:          PATH 'E:\SOUNDS\TAO\'
                IBYTES 'TAO_04.MUS'
                ENDC

                BSS

user_bss:
                DS.B 50*80      ; Sicherheitspuffer fr logos
screen:         DS.W 38928+(8*160)
screen_3:       DS.B 32000+(70*80)+256

scroll_puf:     DS.B 80*30*2    ; Zwischenpuffer fr den Scroller (beim umkopieren)

                IFNE do_distort
expuf:          DS.W 17*50
shiftpuf:       DS.W 16*50*16*6
                ENDC

user_end:       DS.L 2

                DS.B 1000
new_sp:         DS.L 1

                END
