Alive
News Team Current issue History Online Support Download Forum @Pouet

01 - 02 - SE - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 - 14

Alive 13

Da Bootshitctor


Commented source


        Written at/for Outline 2006 bootsector compo


        Outline 2006, my first computer party!!! After all these years, 
        it finally became a reality! Yes, I'm sure you're all laughing 
        at me by now, but it was a wonderful experience for me! Seeing 
        all the people I saw on pictures on the internet in real life 
        was a joy and a privilege.

        I knew it would be a great experience: so many people I wanted
        to meet showed up at the party, all the nice conversations I
        had. I only wished I had prepared more for the party, it would
        have been cool to chat with people instead of bashing the
        keyboard in desperation :)

        Anyway, on with the main story I wanted to write here: Some
        months before the party Cyclone was constantly bugging me into
        entering the bootsector competition. I always answered with
        stuff like: "Well, I've got no idea what to code", "If we take
        into account that last year I submitted my entry right at the
        deadline, then you see I had LOTS of time!".

        Of course I knew from back then that he intended to win the
        compo and just wanted to humiliate the rest of us with our
        crappy bootsectors, but he wanted to secure his position: you
        see, if there were few entries in the compo, it might have
        merged with other compos, and he didn't want to take that chance
        :)

        Haha, stop bitching around George :) If I had wanted to avoid 
        merging the compo I could have easily created more bootsectors, 
        it usually takes only a few hours for each :)             (cxt)

        So the days came and went, and I still didn't have any solid
        idea what to code. Then the party came, and I went there with
        virtually NOTHING! However, fate had other plans for me as
        you'll read below! (That is, of course, if you're still awake :)

        The minute I arrived at the party place (thanks for the lift
        Havoc, btw!) I met up with Grazey, Calsoft and MUG UK. Grazey
        announced me that we were going to release a menu that night, so
        we went to work! I was doing some code for menu #194 (the crappy
        Falcon menu most of you have already seen) and Grazey was
        happily hacking at the menu code for both #192C and #192D.
        Calsoft with MUG were working on Cal's 2 games he was going to
        release at the party (GLobotwars and BackGLash).

        While talking to Cal about BackGLash he mentioned that he was a
        big fan of Paul Woakes, who wrote it (who isn't anyway? :).
        Immediately I grabbed the opportunity to show him Encounter on
        the Atari800 emulator, which BackGLash is based on. Naturally he
        was amazed by it. Anyway, because my girlfriend was getting a
        bit bored, I started playing some more games on the emulator to
        entertain her (hey, I try my best ;). After some games I booted
        the classic H.E.R.O. and started playing. Now here's the fate
        bit coming: I was still unsure about what to code at the party,
        and Cyclone strolled by while playing H.E.R.O. and saw the
        chunky waves that simulated the sea movement and told me
        something like: "That would be a nice effect for a bootsector!"

        That was it! My brain immediately went into gear! A wavy
        something! Immediately I gathered some ideas and started playing
        around with Turbo Assembler until next day in the afternoon!
        After that lots of time was spent on debugging SH3's game,
        designing some levels for BackGLash, preparing some stuff for
        the D-BUG menu, chatting with people, playing both of Cal's game
        on the big screen for the compo (as he couldn't do it himself
        because he left early) and lots of other stuff!

        So, without further ado, here's the source in all its glory. I
        must also pay respect to Ziggy Stardust/Overlanders and Mcoder
        for the sinus rout I used in this intro (forgot to write that in
        the credits, sorry!)


;
; Da bootshitctor
; By GGN of KUA software productions/Paradize/D-BUG
; Coded at Outline 06 (03/06/06) from 11:00 to 19:59 ;)
;
; PARTY VERSION!!!!! Expect full version in about 20 years featuring overscan,
; raster scrollers and lots of other crap!
;
; Thanks: Cyclone for urging me to code it in the first place and encouragement
;         Rana for tolerating with me all this time and some design input
;         Defjam for faking that he liked it (although he burned me with the
;         question: "is that 128 bytes?" ;)
;         Grazey and Paranoid for being the first victims of this code (they
;         saw previews ;)
;      
                OPT     P+

; This little piece of code pre-shifts the graphic. Due to a slight bug, 
; it does vertical movement as well, but unfortunately I was coding/testing this 
; in a PC laptop and I didn't see that a glitch is produced every 16 frames :( 
; Try to find the bug though!

                lea     pattern(PC),A0
                lea     34(A0),A1
                move.w  #15*16-1,D7
rotloop:        move.w  (A0)+,D0
                ror.w   #1,D0
                move.w  D0,(A1)+
                dbra    D7,rotloop

; This uses XBIOS to set ST-LOW resolution and clear the screen.

                clr.w   -(SP)
                move.l  #-1,-(SP)
                move.l  (SP),-(SP)
                move.w  #5,-(SP)
                trap    #14

; This prints my small message on-screen.

                pea     message(PC)
                move.w  #9,-(SP)
                trap    #1

; And here we get the screen's pointer and store it for later use.

                move.w  #2,-(SP)
                trap    #14
                lea     20(SP),SP
                movea.l D0,A6

; Here's the sinus generator I use in lots of programs of mine 
; (by Ziggy and Mcoder)

nbsinus         EQU 512
cos1            EQU 32766       ;cos(2*pi/512)
sin1            EQU 402         ;sin(2*pi/512)

genere_sinus:
                lea     tabsinus(PC),A0
                moveq   #nbsinus/4-1,D7
                move.w  #$7FFF,D0       ;cos(0)=1
                clr.w   D1              ;sin(0)=0
.loop:
                move.w  D0,(A0)+
                move.w  D1,(A0)+

                move.w  D0,D3
                muls    #cos1,D3
                move.w  D1,D4
                muls    #sin1,D4

                muls    #cos1,D1
                muls    #sin1,D0

                sub.l   D4,D3
                add.l   D0,D1

                move.l  D3,D0

                add.l   D0,D0
                swap    D0
                add.l   D1,D1
                swap    D1
                dbra    D7,.loop

                lea     tabsinus(PC),A0
                moveq   #nbsinus/4-1,D2
.loop2:
                move.w  (A0)+,D0
                move.w  (A0)+,D1
                move.w  D0,nbsinus*1/4*4-4+2(A0)
                neg.w   D0
                move.w  D0,nbsinus*2/4*4-4+0(A0)
                move.w  D0,nbsinus*3/4*4-4+2(A0)
                move.w  D1,nbsinus*3/4*4-4+0(A0)
                neg.w   D1
                move.w  D1,nbsinus*1/4*4-4+0(A0)
                move.w  D1,nbsinus*2/4*4-4+2(A0)

                dbra    D2,.loop2

; Here we set the palette. It's actually TOS' palette with some colours swapped
; around.

                movem.l palette(pc),d0-d7
                movem.l d0-7,$ffff8240.w

; Here's the main loop... What it actually does is copying plane 2 into 3, 1
; into 2 and 0 into 1 and uses plane 0 for drawing the current wave. After that
; it draws the pattern on the top of the screen. Actually the reason it's 
; written like that is that because I don't swap screens at all I have to make
; sure that there are no tearing, so first I draw the sinus wave (which is at
; the bottom of the screen), and then the pattern (which is at the top of the
; screen). Dunno what happens at Falcons/TTs/Accelerated machines though :)

go:             move.w  phase(PC),D6    ;phase
                lea     199*160(A6),A5

                move.w  #39,D7          ;no of blocks
                lea     tabsinus(PC),A1
                moveq   #1,D4           ;next byte's position
                moveq   #0,D5           ;current screen offset

wave:           move.w  D6,D0
                lea     0(A5,D5.w),A2   ;screen address
                move.w  0(A1,D0.w),D1
                muls    #16,D1
                add.l   D1,D1
                swap    D1
                add.w   #16,D1

                moveq   #31,D0

drawloop:       subq.w  #1,D1
                sge     (A2)
                lea     -160(A2),A2
                dbra    D0,drawloop

                add.w   #64,D6          ;increase phase
                and.w   #2047,D6
                add.w   D4,D5
                adda.w  D4,A6           ;hehe
                eori.w  #6,D4           ;bitplane shit

                dbra    D7,wave

                move.w  #37,-(SP)
                trap    #14
                addq.l  #2,sp

                lea     -160(A6),A6
                lea     phase(pc),a3
                addi.w  #64,(a3)
                andi.w  #2047,(a3)

                move.w  #32*20-1,D7
                lea     (-31*160)(A5),A4
                lea     2(A4),A3
copystuff:
                move.w  4(A4),4(A3)
                move.w  2(A4),2(A3)
                move.w  (A4),(A3)

                addq.l  #8,A4
                addq.l  #8,A3
                dbra    D7,copystuff

                lea     0(A6),A0
                move.w  counter(PC),D0
                lea     pattern(PC),A1
                lea     0(A1,D0.w),A1

                moveq   #15,D0
drawpatloop0:   moveq   #19,D1
                move.w  (A1)+,D2
drawpatloop1:   move.w  D2,(A0)
                addq.l  #8,A0
                dbra    D1,drawpatloop1
                dbra    D0,drawpatloop0
                lea     counter(pc),a0
                addi.w  #32,(a0)
                andi.w  #511,(a0)

                cmpi.b  #57,$FFFFFC02.w
                bne     go

                rts

                DATA

; And here's the message that's printed on-screen.

;                                    1234567890123456789012345678901234567890
message:        DC.B 13,10,10,10,10,"  Outline 2k6 - GGN/KUA/Paradize/D-BUG",0
                EVEN

Our palette....

palette:        dc.w $0,$f00,$f0,$700,$fff,$f00,$f0,$ff0
                dc.w $f,$f0f,$ff,$555,$333,$f33,$3f3,$ff3

; Finally, the pattern sprite (designed by Rana and me :) 
; Commented out is the original design.

pattern:
                DC.W %100000000
                DC.W %100000000
                DC.W %1010000000
                DC.W %1010000000
                DC.W %10001000000
                DC.W %10001000000
                DC.W %100000100000
                DC.W %100100100000
                DC.W %1001000010000
                DC.W %1001000010000
                DC.W %10010000001000
                DC.W %10010000001000
                DC.W %100100000000100
                DC.W %100100000000100
                DC.W %1001000000000010
                DC.W %1001111111111110
;                DC.W %0000000100000000
;                DC.W %0000000100000000
;                DC.W %0000001010000000
;                DC.W %0000001010000000
;                DC.W %0000010001000000
;                DC.W %0000010001000000
;                DC.W %0000100000100000
;                DC.W %0000100100100000
;                DC.W %0001001010010000
;                DC.W %0001001010010000
;                DC.W %0010010001001000
;                DC.W %0010010001001000
;                DC.W %0100100000100100
;                DC.W %0100100000100100
;                DC.W %1001000000000010
;                DC.W %1001111111111110

                BSS

; This space is reserved for the pre-shifting of the sprite

                DS.W 16*15

counter:        DS.W 1
tabsinus:       DS.B 2048
phase:          DS.W 1

                END

                                            GGN for Alive, re-written 2006-07-31

Alive 13