scene.org File Archive

File download

<root>­/­mirrors­/­amigascne­/­Scrollers­/­C-Groupstext­/­Culprits/Culprits-CodersSceneMag04.txt

File size:
75 304 bytes (73.54K)
File date:
2014-06-13 23:01:44
Download count:
all-time: 56

Preview

CSM Issue #4 @ Oct 1st 1990   * MENU *   (Use Mouse To Change Page >         )
                                                                              
                                                                    @ Culprits
                                                                    Production
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
 Welcome, Once Again, to this, the only disk magazine dedicated to Amiga 68000
 Coders & Hackers & Phreakers & Crackers & Swappers & Dudes....(C+H+P+C+S+D !)
                                                                              
   Article                    Page     |     Article                    Page  
  --------------------------------     |    --------------------------------  
   About Issue Number IV.........0     |     Secrets Of The Sine Scroll!..22  
   Editorial Comment Page........1     |     CES Show Review..............27  
   Co-Ed's Comment Page..........2     |     Setting Up A Picture.........28  
   Optimize Your 68000 Code......3     |     How To Steal Lamposts!.......38  
   Letter Pages.................15     |     Phuck A Friend...............42  
   WordSearch II................18     |     Hall of FAME!................45  
   Classified Ads...............20     |     Credits Page.................46  
                                                                              
                     Exit Magazine................47                          
                                                                              
------------------------------------------------------------------------------
                                                                              
Instructions: Select Desired Article, Then Move Mouse To Alter The Page Number
 (Top Right) To The Correct Page.  Now Press LEFT Mouse Button.  Now, Either  
 Press RIGHT Mouse To Progress A Page, Or LEFT Mouse To Go Back A Page.       
 (Both MOUSE Buttons = Return Here (MENU) ).                                  
 To EXIT Select Last Page.  Joy=Col Change: Up=B+, Left=G+, Right=R+, Fire=Def
                                                                              

The Coder's Scene Magazine Issue #4.                           1/1 |           
Yes, by God!  We've had responses!  Letters have been flooding (well,dripping)
in from all over the globe (Australia, W.Germany to name but two!), and most
of them want subscriptions, and none of them want to contribute!  (well, one
or two have...)
  This issue we have a good article on optimizing your 68000 code by Laurance 
Vanhelsuwe.  Also we have the usual splattering of varied interesting articles
including our regular features (Classified, Reader's Letters etc..) 
  I'm sorry all you die-hard hackers/phreakers, but there's no stuff for you
this issue... sorry, but I've found it hard to come by lately, but I'll have
some text for you next issue.  (Does that make sense???!)
  We also have an article by Centreline/Acme, but he made me promise not to
tell you which one he wrote (squeak!)...... 
 
  Yes, yet more control methods and changes!  This time you can select a page 
by pressing Left mouse as usual, then either progress (Right Mouse) or Go Back
a page (LEFT Mouse), or Go Back To The Menu (BOTH MOUSE Buttons!). 
(Make sure it IS BOTH MOUSE BUTTONS, AT ONCE, as in simultaniously, as both 
together... If you have a problem, write to us and tell us!) 
 
  Must dash now, we've got to get this issue out before I leave for Lancaster!
Byeeeeee! 
 
** STOP PRESS ** Our sources tell us that a new mag is in town, we're not 
worried because it has such a crappy name it can't be of any real quality !    
------------------------------------------------------------------------------
NOTE: All information in this mag CANNOT be verified, and all hacking info is 
 for Informational/Interest purposes ONLY (as is ALL the text in the mag....) 
 laws CAN be broken if various instructions in texts were carried out, and I  
 can accept NO responsability for ANY STUPID actions taken !


The Editor's Comment Page.                                     1/1 |           
Fourth Issue!  Wow!  And it's now popular!  We've had letters and phone-calls!
Great!  --  Keep it up!  Keep Sending! 
  Now, if you're going to contact me to grumble about the new control method, 
then don't bother -- I'm not changing it for a while, I'll re-write it to use 
keys or something some-time, but until then I'll have to ignore the whinges 
of ~Aww, but I can't press both mouse buttons down togtherm it's too haaard!~ 
Aw, stop yer' moaning, one sharp tap on both mouse buttons together brings you
back to the menu! 
  And no, I'm not going back to the Menu-Bar selector, as there's too much 
crap to change each issue -- now all I have to do is bung in the new text and 
arrange the graphics!!!
  As you may know, I'm off to university in Lancaster in a few days from when 
I write this, so for now send your stuff only to Count Z, not me(although I'll
still get em' eventually if you do), I'll publish the address of myself at Uni
in the NEXT issue (5!) -- I'll still be compiling the mag, but Count Z will 
be collecting the contributions for now..
  Oh yeah, I too am a member of the Culprits now, so this mag is a ~Culprits~ 
production...  Look out for my part in our mega-demo soon! 
  Anybody live in Lancaster that reads this?  Drop Count Z a line, and he'll
pass it to me, and we can get in touch when I'm settled in in Lancaster Uni..  
 
  Urm, that's it this issue, I'm off to go and watch NightBreed....  Cya!
 
Later Note: Nightbreed is crap -- it's official!   There's no storyline, and
 not so many good special effects..... 

The Co-Ed's Comments                                           1/1 |           
 Yea!,Coder's Scene Magazine is now a CULPRITS production,as both The Snowman
and myself have joined this long established group,look out for Demo's and 
Intro's coming your way soon,Including a Megademo to be released at the 
Commodore Show in November (If we get it finished in time!). 
 Since last Issue we have started to recieve some feedback,both classified 
adverts and articles,also some good comments about the Mag,but we still need
lots of cool contributers from the scene.Articles can be on anything at all,
provided they are interesting!,we especially would like peoople from abroad to
send us reports,news and gossip from the scene in their country. 
  Okay,Now for a few hello's to people......Hello to Beyonder of System 5,I
hope you don't mind if I swap with you instead of The Snowman,as he is rather
busy with University,etc. Also Hi to Frap of M/F,nice speaking to you on the 
phone the other day,I should have mentioned that I was the Co-Ed of CSM,as 
The Snowman tells me that when you were talking to ~Dan~ from The Culprits,
(Yes,he has joined us),you mentioned that you had seen Recoil Pd's Advert in 
CSM,so therefore you must have seen the Mag!!! (Does that make sense to you?)
 Hi to Skaga of Triplex (Germany),thanks for the Advert,and the German Stamp,
(not much use!),I'll write soon. 
 
------------------------------------------------------------------------------
 Order CSM Issue 5,From me,Count Zero ( as The Snowman is off to University )
 All I want is a blank disk,and Return Postage,if you are writing from abroad
 then send a paper note of the nearest equivalent to 1 pound Sterling to cover
 postage!!
                          Count Zero,   
                          40 Vine Road,  
                          Backford Cross, 
                          South Wirral,    
                          L66 2XX,
                          ENGLAND.  


Super-Charge Your 68000 Code.                                 1/12 |          
Super-Charging 68000 code             by Laurence Vanhelsuwe (C) Jan 1990
-------------------------             -----------------------------------

Let's assume you're past the stage where your code runs slowly because
of inefficient algorithms, but your code still doesn't burn tyres...
What do you do ?
Well, frankly, you shouldn't use the following tips but redesign your
algorithms AGAIN and spend some more time designing them!
....

O.K. so you think the algorithm is the sexiest around or you hit a dead end
in that area; then it's time to look at your code in small sections at
a time.
Most C compilers do it (according to the dealers), it's called peephole
optimization.
Basically it consists of taking small sections of code (say half a dozen
instructions max) and modifying them into identical functional sequences but
with this rare and valuable attribute added: efficiency.

In the remainder of the article I'll assume that you have programmed the 
68000 before, in other words you know most available instructions and
addressing modes.

When hunting down cycle-guzzling sections of your program, there are
a couple of rules that you should always keep in mind:

1) Loops are the killers.
-------------------------
When reading your source file, loops easily blend in with the crowd.
                                                                      (Cont'd)
Super-Charge Your 68000 Code.                                 2/12 |          
They look like normal code but it's only at run time that loops surface
to absorb all your precious processing time.
Anybody who has used a debugger to trace through a program will know
how time consuming loops can be.
Therefore, if you can optimize your loops you will multiply your
savings by the number of times your loop gets executed.
If your program consists mainly of simple processing inside a couple
of loops, then your entire program will speed up visibly.

2) The 68000 is a 32 bit machine : use it like one.
---------------------------------------------------
All to often newcomers on the 68K continue to use their old 8-bit
habits that are totally inadequate and highly inefficient on the 68K.
Prime examples are using the 68K as an accumulator-based machine (fetch-
process-store fashion) and continuing to use bytes as a basic storage
element (instead of words). On the standard 68000 chip byte memory
accesses take as long as word accesses. In other words you can double
throughput in some cases by using words instead of bytes.

3) Think in terms of memory cycles.
-----------------------------------
The 68K needs 4 machine cycles (.125 microseconds for an 8Mhz 68K) to 
fetch/store one word from/to main memory.
Keeping as much as possible on the CPU (addresses, compare constants,
intermediate results..) reduces the amount of memory accesses that the
CPU has to perform.
Cultivating a ~feel~ for how many fetches/stores an instruction needs
to execute will give you an accurate basis to tune your code for speed
and tightness.
                                                                      (Cont'd)

Super-Charge Your 68000 Code.                                 3/12 |          
Sticking to these rules will already give you considerable performance
increases.
If you still come short, then the following techniques might make the
difference.
Note that the substitutions are very rarely totally transparent.
Like always in assembler a lot of care should be taken when changing
things to make sure that you don't introduce bugs.
Only your routine calling conventions (or lack of) will determine how
painlessly you'll be able to enhance your programs with these tips.

a) The Q instructions (fast immediate)
--------------------------------------
The 68K has 3 instructions (MOVEQ,ADDQ,SUBQ) that are much faster than their
normal equivalent because of rule (3): they need less memory cycles to
achieve their goal.

Normal         Optimized      Timings & Comments
------         ---------      ------------------
CLR.L   D3      MOVEQ   #0,D3      ;6 > 4

Use MOVEQ #0 to clear data registers of any size (be consistent). CLR
should only be used if you need to preserve most significant bytes or
words.

ORI.B   #$04,CCR       MOVEQ   #0,D0      ;20 > 4   Set Zero Flag
ANDI.B  #$FF-$04,CCR   MOVEQ   #1,D0      ;20 > 4 Clear Zero Flag
ORI.B   #$08,CCR       MOVEQ   #-1,D0     ;20 > 4 Set Negative Flag

Instead of going straight to the status flags to set or clear the Z or N
                                                                      (Cont'd)
Super-Charge Your 68000 Code.                                 4/12 |          
flags, use a scratch data register and MOVEQ to achieve the same result.
It pays to adopt a convention of using the Zero flag to return the status
of completion of a subroutine instead of the Carry flag (from Z80 times).

MOVE.W   D0,D1      MOVEQ   #64,D1
AND.W    #64,D1     AND.W   D0,D1     ;(4+8) > (4+4) Quick ANDing

MOVE.W   D6,D7      MOVEQ   #$04,D7
OR.W     #$04,D7    OR.W   D6,D7      ;12 > 8 Quick ORing

Here we simply eliminate one memory fetch from the ANDI or ORI instructions
that store their immediate operands as a full extra word after the opcode.

ADD.L   #1,D0      ADDQ.L   #1,D0      ;16 > 8
SUB.L   #4,A2      SUBQ.L   #4,A2      ;16 > 8

For small increments/decrements (+- 1..8) ALWAYS use the Q variant.

b) Use of short addressing modes
--------------------------------
On the 68K the price to pay for a large contiguous address space is long
absolute addresses. And with assemblers that allow you to work with 
absolute addressing modes as if they're relocatable, a lot of time and
space is wasted on long absolute addresses.
The use of base relative (or its variant: PC relative) addressing mode
reduces each definition of an effective address by one word and also
eliminates an entry in the relocation information table at the end of
executable Amiga files.
In addition you can also virtually eliminate your BSS sections (un-
                                                                      (Cont'd)
Super-Charge Your 68000 Code.                                 5/12 |          
initialized variables/ptrs/buffers etc..) by allocating memory at
run time (via AllocMem() or via LINK/UNLK if your requirements are small).
This really shrinks the size of your final executable dramatically.

MOVE.W   world_x,D0   MOVE.W   world_x(PC),D0   ;16 > 12   
MOVE.W   sprites,D0   MOVE.W   sprites(A4),D0   ;16 > 12   

Here we save 4 cycles (alias one fetch) per effective address each time.

c) Use of DBcc instructions
---------------------------
The DBcc family is used mainly for looping. The cc can be replaced by all
the normal branch conditions like EQ,PL,MI but also by RA (for False).
Most people though only use half of its capability by using only the DBRA
variant...that's probably because of the inverted logic compared to
the normal conditional branch instructions: the cc condition determines
when the loop terminates, NOT when the instruction should loop back!

      MOVE.W  #39,D7           MOVEQ  #40-1,D7   ;use N-1 notation
loop: TST.W   (A0)+      loop: TST.W  (A0)+
      BEQ     found            DBEQ   D7,loop    ;combine tests
      DBRA    D7,loop          BEQ    found
      :                        :
found:                   found:

The optimized loop will execute in 8+10= 18 clock cycles whereas the
first form will crawl along at 8+12+10= 30 cycles per iteration (because of
the superfluous long branch obstructing us).

                                                                      (Cont'd)
Super-Charge Your 68000 Code.                                 6/12 |          
One way to optimize very tight loops that really goes against the entire
loop philosophy is to ~unroll~ them. By reducing the loop control overhead
and thus increasing the net amount of processing done, you can again
dramatically improve execution speed.

        MOVE.W  #1023,D0           MOVE.W  #(1024/4)-1,D0
wipe_l: CLR.W   (A0)+      wipe_l: CLR.W   (A0)+
        DBRA    D0,wipe_l          CLR.W   (A0)+
        CLR.W   (A0)+
        CLR.W   (A0)+
        DBRA    D0,wipe_l

In the textbook-style loop the overhead is 10/(12+10) *100 = 45.5%
In the slightly optimized version the overhead is reduced to
10 /(12+12+12+12+10) *100 = 17.2%
This particular example can be optimized much further.
A first step is to ~cache~ the implicit zero constant of the CLR instruction
in a register and to use a MOVE Dn,(A0)+.
Next we can use long words instead of words. In a sense this reduces the
overhead of opcode decoding per net processing done.
The ultimate though for clearing/filling memory is to use MOVEM.L regs,(An).
With MOVEM.L you can store (16-2)*4 = 56 bytes in one go if you use a
register list like D1-D7/A1-A7 (You need one data register for the counter
and one address register to point to your area to be filled).
With a bit of loop unrolling and saving/restoring the stack pointer, this
is the fastest way to clear memory using a 68000.

                                                                      (Cont'd)
Super-Charge Your 68000 Code.                                 7/12 |          
d) Working efficiently with flags
---------------------------------
When you allocate bits in a status word, start from the most significant bit.
Throughout the code a fetch of that word will also reflect the status of your
most important flag. This practice should ALWAYS be combined with clearly
marking the bitmap for your status byte/word with comments warning yourself
and others that that bit can't be swapped with another!

SPR_ALIVE   EQU   0
SPR_ENEMY   EQU   1
      :

   BTST   #SPR_ALIVE,spr_stat(A0)
   BEQ    dead_one
   BTST   #SPR_ENEMY,spr_stat(A0)

;------- Can be replaced by:

SPR_ALIVE   EQU   7   ;**!! DO NOT MOVE (position dependent)
SPR_ENEMY   EQU   6
      :

   MOVE.B  spr_stat(A0),D0         ;cache entire status byte
   BPL     dead_one
   BTST    #SPR_ENEMY,D0

Here the BTST executes in 24 clock cycles whereas the simple MOVE.B
takes only 12 cycles plus has the advantage of leaving the entire
status byte on-chip, thus reducing future memory accesses.
                                                                      (Cont'd)
Super-Charge Your 68000 Code.                                 8/12 |          
      BTST   #ACTION,D0          BCLR   #ACTION,D0
      BNE    do_x                BNE    do_x
      :                          :

do_x: BCLR   #ACTION,D0          do_x:   

This example illustrates again the underuse of an instruction (like DBcc).
The programmer of the first sequence doesn't know that the BCLR/BSET/BCHG
instructions all do a BTST before changing bits. The second sequence
uses this fact and clearly reduces complexity, execution time and storage
space.

When working with flags that use a full byte instead of bits, use the
Scc family of instructions instead of CLR.B dest or MOVE.B #-1,dest.
It makes for much clearer reading and in the case of setting the flag,
it's quicker too.

You can also use Scc to eliminate conditional branches, e.g. :

   MOVEQ   #-1,D1   ;assume LF   CMP.B   #LF,D0
   CMP.B   #LF,D0                SEQ     D1
   BEQ     flag_LF
   MOVEQ   #0,D1    ;it isn't LF
flag_LF:

Still on the subject of flags, for those hackers planning to attach a
Transputer to the Amiga bus, the TAS memory instruction DOES NOT WORK on
an Amiga (it does on data registers, but it is only useful on shared memory).
                                                                      (Cont'd)

Super-Charge Your 68000 Code.                                 9/12 |          
e) Quick multiplying
--------------------
When multiplying by a power of two (2,4,8..) you should use the ASL or
LSL instructions. When the number of shifts is less than 3 you can use
additions to further decrease execution times.

MULU   #4,D0      LSL.L   #2,D0        ADD.L   D0,D0
        =          =                   ADD.L   D0,D0

Also watch the way you multiply by simple sums of powers of two (10,40,80,..).
MOVE.W  D0,D1   ;copy of index   LSL.W   #3,D0   ;*8
LSL.W   #5,D0   ;*32             MOVE.W   D0,D1   ;copy of *8
LSL.W   #3,D1   ;*8              ADD.W   D1,D1   ;*16
ADD.W   D1,D0   ;*(32+8)=*40     ADD.W   D1,D1   ;*32
                ADD.W   D1,D0   ;*40

The second sequence achieves exactly the same as the first but does
it in 8 cycles less.

f) Testing for valid pointers
-----------------------------
When programming the Amiga you often have to test the validity of a returned
pointer. Because of the consistent policy of setting flags as much as
possible, with the 68000 we don't need to test explicitly for zero pointers.

JSR    AllocMem(A6)   JSR    AllocMem(A6)
TST.L  D0             MOVE.L D0,mybuffer   ;sets the flags
BEQ    bail_out       BEQ    bail_out
                                                                      (Cont'd)

Super-Charge Your 68000 Code.                                10/12 |          
MOVE.L D0,mybuffer

g) Clearing a high word of a data register
------------------------------------------

               AND.L   #$0000FFFF,D0         SWAP   D0
               CLR.W   D0
               SWAP   D0

This alternative is 12 cycles against 16 and really becomes useful
if you define a MACRO for it like ... CLRH.

h) Using address registers
--------------------------
Address registers are special in the 68K because they are supposed to
hold addresses; that doesn't stop us from using this limitation to our
advantage.
Normally LEA is used to point to a location somewhere, e.g. LEA samples,A0.
LEA's purpose in life is to calculate an effective address from the
addressing mode given. You can use LEA to do simple sums in one go instead
of doing them in multiple instructions.

MOVE.L   A0,A1         LEA   40(A0,D0),A1   ;(4+8+12) > 12
ADD.W    D0,A1
ADD.W    #40,A1

The PEA instruction is similarly useful when you want a sign-extendable
constant on the stack as a long word.
                                                                      (Cont'd)

Super-Charge Your 68000 Code.                                11/12 |          
MOVE.L   #640,-(SP)    PEA   640      ;20 > 16

Also when working with addresses it's a good idea to work with words
when adding/subtracting offsets. This technique is only possible if
your data structures are smaller than 32K. The 68K will always
sign extend your word operands, thus reducing expensive LONG processing
(casting,checks,loads,adds,..).

CLR.L   D0           ADD.W   offset,A0   ;(6+16+8) > 16
MOVE.W  offset,D0
ADD.L   D0,A0

i) The cost of calling a subroutine
-----------------------------------
Sometimes it's possible to eliminate the time consuming pushing and popping
of return addresses when calling a subroutine.
You should only use this technique when the call overhead becomes a
significant proportion of the actual processing time of the subroutine. 
The obvious way consists of bypassing the stack and keeping the return
address in an address register (ARM fashion).
A section using state tables might be optimized like this:

   MULU    #4,D0          ADD.W   D0,D0
   LEA     jump_tab,A0    ADD.W   D0,D0
   MOVE.L  (A0,D0),A0     MOVE.L  jump_tab(PC,D0),A0
   JSR     (A0)           LEA     return(PC),A6
   :                      JMP     (A0)
jump_tab
   DC.L   rout_1,rout_2   return:   :
                                                                      (Cont'd)
Super-Charge Your 68000 Code.                                12/12 |          
   DC.L   rout_3,rout_4
   :
rout_1:   RTS             rout_1:   JMP   (A6)

Replacing the JSR/RTS pair by two JMP (An) instructions saves you
(20+16)-(2*8)= 20 cycles.

How do all these tricks fit in with general software quality considerations?

Optimizations affect readability and therefore maintainability of your
program source.
They can affect readability of your source both ways: changes can enhance
or degrade readability.
In general though, if a sequence shrinks, it will be easier to read.
Some optimizations will make reading easier for seasoned programmers because
of the standard nature of the optimization.
As stated earlier, optimizations can introduce bugs if you haven't written
your program with bug prevention in mind.
When changing any programs always remember the law of diminishing returns!
How much do you gain by making that last modification ?

                           Enjoy your Amigas !!

CSM Letters.                                                   1/3 |          
                                               Laurence Vanhelsuwe
                                               39, Loughborough Road
                                               Leicester
                                               LE4 5LJ
                                               Leicester, 26 September 1990
   Dear Snowman,

   I've received a copy of your interesting disk magazine from a certain
   old colleague of mine.

   Anyway, I thought that I should contribute to your mag.

   On the disk there's one article that should easily fit in with the
   magazine: it's one on optimizing your 68000 code.
   I've also copied the articles that I wrote for a local ICPUG branch
   when I lived in Watford.
   There's also an ~educational slideshow~ that comes with those articles.
   I don't know if the articles or the slideshow are interesting enough
   to be put in the next mag, but I give you permission to use all that
   stuff anyway.

   I think your magazine idea is brilliant and I'd like to give you some
   opinions on how I would compile the mag.

      - since it's a mag for coders (= slightly intelligent people ???),
      I wouldn't put stupid things in it like your ~TEN THINGS TO DO...~
      If you keep it a bit more serious, you could be the start of a disk-
      based magazine that would become VERY famous after just a couple of
      issues.
                                                                      (Cont'd)
CSM Letters.                                                   2/3 |          
      - for every release, add the date of the release somewhere.

      - why not have super-dooper super-HAM pictures as ~front covers~ ?

      - the tune-in-the-background idea is GREAT.

      - don't encourage illegal stuff (hacking, blowing your brain with LSD!)

      - can't you make the magazine properly multi-task ??
        (it's much nicer for power-users like us)

      IMPORTANT: Why not allow programs to execute as items ?! (as in
        Megademos).
        That way, people could give you little animated tutorials or
        demonstrate a programming technique by actually showing the program
        run.

   In the future I might write articles on interesting chemical experiments
   that are much less dangerous than trying to synthesize LSD.
   For example, making rocket fuel.

   Hope I can be a regular contributor.
                                                         Yours sincerely,

                                                         L. Vanhelsuwe

                                                              (Reply Overpage)

CSM Letters.                                                   3/3 |          
The Editor Replies.

Nice of you to write and praise our unworthy worm of a magazine. Your articles
have been, and will continue be published with our unworthy thanks.

Now to your suggestions.

As you may or may not realise, the aim of this magazine is to reach a wide
range of people, not just coders, and offer a wide source of material --
something for everyone.  There are many dedicated coder's mags about (and
many other mags for that matter), but CSM tries to be different and publish
unusual material, not found in other mags.  If that covers illegal topics,
then so-be-it.  Our other aim is to make the mag as small as possible when
crunched, so it can be put onto demo-compacts etc.. and achieve a much bigger 
circulation than it would were it a full-disk / 300k file.  So, executable
tutorials are out for the time being.  (HAM-Piccies for that matter too!)

Multi-task?  Shmask!  Ha!  We'd have to open Intu-windows etc.. in order to
do that!   --  Too much of a re-write for me-busy-student-type.


Thanks anyway Laurence Vanhelsuwe.... Is that an English name???!?


CSM WordSearch Number 2.                                       1/2 |          
å-------------------------°
|KERSREDNOWFODLROWIEVRSEEK|   Here it is.  The official CSM word-search 2.
|EAEATTSOCXXETROVDENIAUTVE|   Hidden in the word-table are 20 words,
|NOBWLRICOWFAIRLHUBOENIRUN|   all listed below.  These words run either
|TNOITAICOSSAGNIKCARCSSIWS|   in a horizontal, diagnol, or vertical line.
|TQORXNPOTORAOABCAROMRISSU|   But are ALWAYS in a straight line.
|EEUXSDIHOTPXOLDFAITROITAR|   Prize: 1 Page of whatever you want to say.
|ALEASOIOAAXESPUBSRCEAFAEA|   (Un-edited) in next issue.
|MSUBUMWTUFCUTXDQSODEUSCRT|   Prize is awarded to first entry out of
|SEQEAAAREDLSODETRUSKCULKS|   the hat (blank 25x16 grid with only words on)
|AOUASCCULPRITSCFEEAAUIEEH|   (In the event that only one person enters,
|DFAIRCHAIFOCGEUOJNGQLOATT|   he will win by default, right or wrong..)
|EQRTHETAXXEESHASUAIURODER|   - You may as well send in your text (about
|FUTRBSRQUBADDETBXIMLQAIOO|   29 lines by 80 chars across) anyway, coz
|JIEEESOSASEIONXCAOAUTACKN|   we'll probaly publish it never-the-less!
|EDXNQONRORUUNITAEMBOXOXEE|   
|OFAIRLIGHTODWROBAMIGEXHIK|   TIP: Use a non-permanent marker to circle
æ-------------------------ß   the words/cross-em-out (Permanent is fun!)
These Are The Words (I've made it easier this time!) :-

ALPHAFLIGHT      AXXESS           BAMIGASECTORONE   CULPRITS
DEFJAM           FAIRLIGHT        HOTLINE           INERTIA
KENTTEAM         NORTHSTAR        ORACLE            QUARTEX
RANDOMACCESS     REDSECTOR        SCOOPEX           TRISTAR
UNITA            VORTEX           WORLDOFWONDERS 
SWISSCRACKINGASSOCIATION (Easy One!)

(Last Issue's Solution Is On The Next Page)
Send Your Entries To Either The Editor, Or Co-Ed.  Good Luck!

CSM WordSearch Number 1 Solution                               2/2 |          
                            Last Issue's Solution.

   A    VERTICAL     R      Unfortunately, nobody entered the Competion, so 
    G    M          E       there is no prize winner.  If nobody enters the 
     I  U  C       T        wordsearch this time, it'll be dropped, and I'll
      ML  O       T    A    do some crosswords instead.  Let me know what you 
      TA M    SURIV    LG   think.
Y    I  M  D KCOLSPAC  U  
R   T  O Z E   B T  O BA    Personally, I think it must have been too hard
A  A  D  O N    R   LE P    for all you people that can't even write (or so
RES COPPERLIST A    D       it still seems by the insignificant dribble of
BKX R  W R S  C     C       letters we get...)
I  E  O  O E K      A  T  
L   CD      D       P  A    If you have any competitions that you have des-
    NB    DISKVALIDATORM    igned that you think are better than my word-
   I  A   S         U  R    searches, then send them to us and we'll publish
  W    S K          R  O    them (and offer a really good prize to the winner!
        ERAWTFOS    E  F    -- Like a free page in CSM Issue #5?????)


 ---------------------------------------------------------------------------- 
Right before I leave the ~Puzzle Pages~, I'd like to set a teaser for you...
The puzzle is, how do I get hold of lots of Pascal source listings for PC
machines, that I'm likely to be set on my degree course ; for free????
Answers on the back of a sealed down envelope to the addresses that the whole 
world must surely know by now!

CSM Classified Ads (Free!)                                     1/2 |          
            OOOOOOO  OOOOOO  OOOOO  OOOOOO  O       OOOOOO  O    O 
               O     O    O    O    O    O  O       O        O  O  
               O     OOOOOO    O    OOOOOO  O       OOOOOO    OO   
               O     O   O     O    O       O       O        O  O  
               O     O    O  OOOOO  O       OOOOOO  OOOOOO  O    O  

            TRIPLEX  -  THE MAJOR BREAKTHROUGH IN AMIGA PERFORMANCE 
  -------------------------------------------------------------------------
    We Are searching for some really cool members from all over the world
      WANTED: Coders,Musicians (Good Ones!),Graficians (Very Good Ones!)
           ------>   W E  N E E D  N O  S W A P P E R S !!   <------    

                        IF YOU ARE INTERESTED WRITE TO:

                                                   1 THE CRESCENT
                    PLK 107                        BERKSHIRE
                    2103 HAMBURG 95      OR        SLOUGH
                    WEST GERMANY                   2L1 2LH
                                                   ENGLAND

                   CONTACT ALSO FOR ELITE (!) MAIL SWAPPING
  -------------------------------------------------------------------------


      *--------------------------------------------------------------*


(More Adverts Next Page -- Right Mouse Button)...

CSM Classified Ads (Free!)                                     2/2 |          
            Contact  ### ## #  ### ####  ### #   #    ####   
                    ##   ## # ##    ##  ##   ## ##    ##     
                     ##   ###  ##   ##  ###  #####    ####   
                      ##   ##   ##  ##  ##   # # #       ##  
                    ###  ###  ###   ##   ### #   #    ####   

                       ~ Trading The Latest Releases ~  

                               (Beyonder)
                               PLK 027673 D 
                               7500 KARLSRUHE
                               WEST-GERMANY

                    ---> Elite Guyz Will Be Prefered <---

      *--------------------------------------------------------------*




Help!  SOS!  We need your adverts!  They're free and they travel the entire
world!  Send ads in ASCII 80 Col format (If they're on paper, try to print em'
clearly -- All disks will be returned if postage is included!)
We also need 1bpl Med-Res GFX, and Soundmonitor Modules -- Full credit given! 
(If you want an advert with GFX in, send your logo in IFF, Med-Res format, 1
bitplane ONLY! -- No bigger than 600 x 40 in dimensions!)


Secrets Of The Sine! -- The Snowman                            1/5 |          
How is it that the quality of a coder is measured?  Is it the technical
way that he tackles the derision of a real-time cosine vector routine?
Well, yes, but that's not the point.... Why does everyone ask, ~Yeah,
but can you do a sine-scroller?~ As if it's an earth shattering effort
to code one? Okay, I admit, it took me a while, but I've done one!  Wow!
Okay, now I'll share the secrets....
  If you want a sine-scroller in your demo, then you'll have to double
buffer it... but if you want it in an intro, you can probably squeeze
a nice single-frame one in.  That's what I'll describe, I'll presume that
if you manage to code this, then you'll manage to double buffer it!
  Okay, the theory...  You scroll a normal scroller accross the screen.
Easy?  Of course, now, scroll the scroller thru' a memory buffer, but not
actually on the screen.  Now, each frame, we delete the last sine-frame,
and copy the buffer-scroll, vertical line by line to the screen, varying
each Y position thru' a sine-table.  After you copy the whole scroller, you
repeat the process as needed. (Okay, this is MY way of doin' a sine-scroller
all you guys that have a better method, send it in!)
  I'm sure you can all do a standard scroller... Yeah?, Good, now, each VB
we can do a:
        BSR     Scroller                Scroll Buffer
        BSR     Sine                    Copy To Screen
Oh yeah, set BLITTER-NASTY on or you'll run out of raster quickly, you can
do this when you enable Blitter/Screen DMA etc..
Okay, here's the sine-copy routine:
Sine    MOVE.L  TABLEP,A5               Last Position In Sine-Table
        MOVE.L  #0,D0
        SUB.L   #1,A5                   Move Back Thru' One.
        MOVE.B  (A5),D0
                                                                      (Cont'd)

Secrets Of The Sine! -- The Snowman                            2/5 |          
        CMP.B   #$FF,D0                 Is It The Beginning?
        BNE.S   NOWAY
        LEA.L   TABEND,A5               Yeah, Point To End.
NOWAY   MOVE.L  A5,TABLEP               Save Position To Var.
This moves us thru' the sine table backwards, rather than forwards, so
the sine curve moves Left to Right as the scroll goes Right to Left.
Next:   LEA.L   $DFF000,A6              Custom Base
        MOVE.W  #$0900,$40(A6)          Select Miniterm To Clear
        MOVE.W  #0000,$66(A6)           Set    BLTDMOD
        MOVE.W  #0000,$64(A6)           Clr    BLTAMOD
        MOVE.W  #0000,$62(A6)           Clr    BLTBMOD
        LEA     SineP,A1                SineP = Bitmap Address
        MOVE.L  (A1),D3
        MOVE.L  D3,$54(A6)              Select  BLTDPTH
        MOVE.L  D3,$50(A6)              Select  BLTAPTH
        MOVE.W  #23+64*68,$58(A6)       Write   BLTSIZE (Delete)
Okay, I'm sure you can optimize this, but it deletes the last frame of
sine-scroller on the screen.  Note, there is no need to wait for blitter
in blitter-nasty mode.
Okay, one disadvantage of blitter-nasty is that it steals cycles from
the screen, so you might get a nice black diagnol line cutting in half
you sine-scroll - two solutions, 1. Don't do a sine-bigger than 60 high,
or 2. re-load the bit-plane pointers to somewhere else to get rid of it.
Okay, now the sine-copy routine. 
        MOVE.l  #$0dfc0000,$40(A6)   Select D = A+B Miniterm
        MOVE.W  #46,$66(A6)          Set    BLTDMOD
        MOVE.W  #46,$64(A6)          Clr    BLTAMOD
        MOVE.W  #46,$62(A6)          Clr    BLTBMOD
                                                                      (Cont'd)
Secrets Of The Sine! -- The Snowman                            3/5 |          
        Move.l  #22,d0               Overall Words Width Screen = 22
        Move.w  #$8000,d1            Mask To Rotate
        Move.l  #16,d2               Pixels per word
        Move.l  SineP,D7             Point To Screen Bitmap
        Move.l  SineP,d3             Point To Screen Bitmap
        Move.l  Offset,D6            Point TO Buffer-Scroller
        Move.l  #$dff054,a0          Load All Blitter Regs.
        Move.l  #$dff04c,a1
        Move.l  #$dff050,a2
        Move.l  #$dff044,a3
        Move.l  #$dff058,a4
Now we have the blitter set up, we come to the LOOP, the most important part
of the routine, as one command can cost you 25 raster lines!  You should be
able to optimize this routine to hell.
Loop    Move.L  d3,D7                Screen Pointer
        MOVE.w  #0,D4                Clear d4
        MOVE.B  (A5)+,D4             Move Next Y Sine-Pos to d4
        CMPI.B  #$FF,D4
        BNE.S   NOWAY2               Check 4 end etc..
        Move.l  #TABLE,A5     
        MOVE.B  (A5)+,D4
NOWAY2  MULU    #48,D4               Mulu By 48 for Screen (Slow!)
        ADD.L   D4,D7                Add to screen pos.
        MOVE.L  D7,(A0)              Select  BLTDPTH
        MOVE.L  D7,(A1)              Select  BLTBPTH
        MOVE.L  D6,(A2)              Select  BLTAPTH
        Move.w  D1,(A3)              New Mask
        MOVE.W  #1+64*16,(A4)        Write   BLTSIZE Blit Vert Line
                                                                      (Cont'd)

Secrets Of The Sine! -- The Snowman                            4/5 |          
        Ror.w   #1,d1                Rotate Mask
        Subq.b  #1,d2                Dec Pixels, then
        Bne.s   Loop
        Add.l   #2,d3                Inc 1 Word to screen.
        Add.l   #2,D6                / 1 word in buffer-scroll.
        Move.b  #16,d2               Re-load pixels.
        Move.w  #$8000,d1            Re-load mask.
        Subq.b  #1,d0                Decrement words until end.
        Bne.S   Loop
        Rts                          E-O-R
Okay, slow, but it does it in one frame with about 70 raster lines-free.
I have myself a much better routine (dervived from this one) that gives
me half a free screen of raster, but couldn't include it here!!!!!
If you read the article on speeding up your code, you might do well!
Okay, here's the variables you might need.
Offset    DC.L     0             Pointer To Scroller In Memory
SineP     DC.L     0             Pointer To Screen Bitmap
TABLEP    DC.L     TABLE         Sine-table Position Pointer
          DC.B     $FF
TABLE     dc.b     50,50,50,50,50,50,49,49,49,49,48,48,48,47,47,47
          dc.b     46,46,45,45,44,44,43,42,42,41,40,40,39,38,37,37
          dc.b     36,35,34,34,33,32,31,30,29,28,28,27,26,25,24,23
          dc.b     22,22,21,20,19,18,17,16,16,15,14,13,12,12,11,10
          dc.b     10,9,8,8,7,6,6,5,5,4,4,3,3,3,2,2,2,1,1,1,1,0,0,0
          dc.b     0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,3
          dc.b     3,3,4,4,5,5,6,6,7,8,8,9,10,10,11,12
          dc.b     13,13,14,15,16,16,17,18,19,20,21,22,22,23,24,25
          dc.b     26,27,28,28,29,30,31,32,33,34,34,35,36,37,37,38
                                                                      (Cont'd)
Secrets Of The Sine! -- The Snowman                            5/5 |          
          dc.b     39,40,40,41,42,42,43,44,44,45,45,46,46,47,47,47
          dc.b     48,48,48,49,49,49,49,50,50,50,50,50
TABEND     
          EVEN

Also, bear in mind my sizes, and that I've used a huge overscan screen,
so your blitter modulos will probably be different.   Well that's it,
You can also get more raster by making it a 2 pixel sine-scroller, and
halving your blits.
Well, I've managed to get a 1-frame scroller, overscan, a bouncing 320x115,
four bitplane logo, a starfield, and a soundmonitor tune going without
running out of raster... how about you?          




More articles like this in the mag would be nice, maybe some other people
could send in some similar stuff, like bob-routines, wire-vectors, multi-
scrappers etc... etc.., or maybe even some game-coding principles?

                                                              The Snowman.


CES Show Review.                                               1/1 |           
  I've seen them all before.  Every show around, I've been too about once. 
Unfortunately, the CES show was THE worst show for many moons.   Other than
morons walking round in ~teenage-asshole-turtle~ suits, and a real ~robocop~, 
there was nothing worth going for.  The show was small, most of Earls Court 
was unused, this resulted in walking round deserted landings looking for more 
stalls... 
  One thing that WAS good was the cheap hardware (and hot-dogs) -- You could
pick up a 2nd drive, AND a half meg for under 80 quid if you shopped around.
  There was a nice JAM session on Sunday, with a ~Northern~ band that wasn't
very good, and was VERY, VERY loud... we were sitting in the bar area being 
deafened by the LOUD music... 
  There were a great deal of stalls there and the most impressive was probably
Ocean's and Commodore's (Upon reflection I'll go for ocean because they gave 
away nice Total Recall posters... 
  Other than that, there were no real people there worth mentioning, I saw a
few teams represented (like Scoopex, Oracle (obviously) etc..), but not really
a hum-dinger turn out. 
  We arrived there at about 9 thrity and wandered round a fairly deserted 
place, but it gradually got busier -- not better, but busier until we couldn't
move anymore, so we left then.  Outside there was a queue about a mile long!! 
  So, hints for next year, arrive early -- they'll let you in before it opens 
most time,  take a business card and flash it at the nice man when you go in
and demand a free entry becuase you are ~trade~ -- you'll get it too...  Don't
think you'll be getting drunk, becuase you'll need a fortune to do it (Lager =
1.60, Small bottle of Guinness = 1.00,  Shorts, not worth mentioning..), also
take your own food, becuase what little there is on sale is more expensive
than the beer!, Don't leave buying hardware until too late, because they'll
probably sell out later on (and the prices won't get any cheaper..), and don't
expect free arcade games, becuase you have to pay for them.... 
  In all, a rip-off. 


 Setting Up A Picture The Easy Way (By Count Zero)            1/10 |           
 The first piece of real code I did was to set up a picture,and that took     
me some time,so if you are just starting to code then save yourself a lot
of time and effort and set up your screens like I do,forget about using
the libz,like AllocMem,access the hardware directly and you will get the
best results.I assume you have a basic knowledge of assembler,and binary
and hex numbers,anything I found difficult I've tried to explain in more
detail.If you can't be bothered to copy the code onto paper,then type it
in yourself,then send me (Count Z) a disk,and RETURN Postage and I will 
copy you the source (to be assembled on Devpac (seka is crap) ).

 -----------------------------------------------------------------------

Okay,lets start with the assembler directive,SECTION,this avoids having
to allocate memory using libs,as I'm sure many of you know.

 SECTION LOWMEM,CODE_C            

 The format is SECTION <any name>,<data type>_C
 
I use LOWMEM as this ensures that on 1 meg machines the code goes into 
the lower half of memory,which is Chip ram.Chip ram contains all the data
that is accessed by the custom chips,like music,graphics,sprite data etc.
this is what '_C' does,to place the code into chip ram.Data type can be
CODE,or DATA,(like Graphics),or BSS (unintialised data).

 OPT C-   
 
This means assemble case independant,ie labels PICTURE and Picture are
regarded as the same.
                                                                Continued...

 Setting Up A Picture The Easy Way (By Count Zero)            2/10 |          
 MOVEM.L A0-A6/D0-D7,-(A7)               Push All Registers Onto Stack
 MOVE.L  A7,Stackpoint                   Save Stack Pointer to Label 

It is essential to save all the registers,as in a startup-sequence,the
registers are used by the Operating System,failure to save them will
usually result in an error code of some kind.
 The Opcode,MOVEM is move multiple,and allows more than one register to be
moved in a single command.
 In the 68000,there is a hardware implemented stack,basically an area of
memory,it can be use to store our saved registers,the Stackpointer is A7.
When you save data to the stack you `push' data onto it,but because the stack
grows towards lower address's then we have to subtract the amount of data
from the initial pointer value,so that when the data is added the stack 
pointer is back at its initial value again.
Next I jump to my routines,starting with disabling the operating system.

 JSR     Kill_Os
 JSR     SetUp
 JSR     Main
 JSR     Help_OS

 MOVE.L  Stackpoint,A7                   Restore Pointer
 MOVEM.L (A7)+,A0-A6/D0-D7               Restore Registers
 RTS

This is the opposite of what is done above,note that we use post-increment
addressing,as we pull data of the stack,the top of the stack needs to be
moved up,to a higher address.                                    Continued...

 Setting Up A Picture The Easy Way (By Count Zero)            3/10 |          
Kill_OS  MOVE.L  $4,A6

This moves address,not the quantity,to a6 as this is the Execbase
address,which needs to be passed in a6 as a sort of offset from which
to jump to other address's

 CLR.L    D0

The library version is placed in d0,it is one of the parameters needed when
opening the graphics library.We don't need any particular version,so we clear
it.
 LEA      GFXlib(PC),A1

Load Effective Address (LEA) moves the contents of the label GFXlib,to A1,
which is the library we need to open,note that ~graphics.library~ label must
be in lower case!.(PC),this is called Program counter relative addressing,it 
moves the address as an offset from the program counter,this makes the  
instruction execute faster (The Program Counter pionts to the address at which
the next instruction to be executed is found).

 JSR      -552(A6)                           Open GFX Lib

Now we open the graphics library,by jumping to an offset from Execbase,a
list of offsets and there functions are found in most books.

 MOVE.L   D0,GFXBase    

The base address of the library is returned in d0,and is saved to a label,
which will be used in the restore operating system routine.
                                                                Continued...

 Setting Up A Picture The Easy Way (By Count Zero)            4/10 |          
 JSR      -132(A6)                       LVO_Forbid
Library Vector Offset,is just the place in the library that this routine
exists,LVO forbid switches of multi-tasking,so your program can use the CPU
all of the time.

 MOVE.W   $DFF002,DMAsave                Save DMA

This is a custom register,ie a register that is accessed by the custom chips
all these registers begin from $DFF000 in memory.$DFF002 is DMA Read,it
allows you to find out what DMA (direct memory access - without using the CPU)
is enabled,in this case we just save it as we will be enabling our own
different DMA channels.

 MOVE.W   $DFF01C,INTensave              Save Interupt Enable

Again we save a register,this time Interupt enable,an interupt is a device
used by the 68000,an interupt occurs only when the corresponding bit is set
in this register,for example there is a Vertical blank interupt,which occurs
50 times a second,we need to save this as we will stop all interupts from 
occuring by writing to this register,and restore them later.Interupts allow
a program's execution to be stopped,another program jumped to,and then the
previous program's execution resumed,(similiar to a branch).

 MOVE.W   $DFF01E,INTrqsave              Save Interupt Request

This register tells us what intrupts are being requested,it is a mirror of
the Interupt enble register,only when both bits corresponding to the same
Interupt in both registers are set will it be executed.

                                                                Continued...


 Setting Up A Picture The Easy Way (By Count Zero)            5/10 |          
Wt        BTST    #0,$DFF004                     Test MSB of VPOS
          BNE.S   Wt  
Wtt       CMPI.B   #55,$DFF006                   Wait Line 310
          BNE.S    Wtt                           (stops Spurious Sprite Data)

This wait loop waits for line 310,I use this to stop spurious sprite data,
ie,those vertical lines that appear sometimes in people's code.This is due
to switching off Sprite DMA at a point on the screen where the CLI sprite 
pointer is still being displayed.

 MOVE.W   #$7FFF,$DFF09A                 Disable Interupts
 MOVE.W   #$7FFF,$DFF096                 Disable DMA

This is where I disable the interupts,and switch off all DMA,note that the
Most Significant Bit must be zero,so whenever there is a binary '1' in the
move command that bit is cleared in the register.If you are unsure about what
I'm talking about here,don't worry,just accept it as fact.

 MOVE.L   #Copperlist,$DFF080             Replace Copper 

When displaying your own screen,you must have a Copperlist,this is a list of
instructions that is exected by the Co-processor (Copper) 50 times per second
See Copperlist section for more info.When you MOVE.L #Label,you move the 
addres of that label,we move our copperlist address to a register called 
COP1LCH,which points to the copperlist.

 MOVE.W   $DFF088,D0                      Strobe Copper
This register is called COPJMP1,and accessing this address causes execution 
the Copperlist ot begin.This type of address is called a strobe address.
                                                                Continued...

 Setting Up A Picture The Easy Way (By Count Zero)            6/10 |          
 MOVE.W   #%1000001110000000,$DFF096     Enable Copper/Bitplane DMA
This register is DMACON ,and allows DMA channels to be enabled,the bits set
correspond to copper and bitplane DMA,note that also you have to set a bit
called DMAEN,this does not enable all Dma channels,despite what is said in
the systems guide!

 RTS 

Return to execute sequence to execute next routine.
 

Next I load the bitplanes pointers in the copperlist,these are pointers to
screen,there are two for each plane,a register containing the high word,and
one containing the low word,eg BPL1PTH and BPL1PTL.The Label ~Planes~ points
to the bitplane pointers in the copperlist,first we load load the low word
of the Picture (address of the screen),into BPL1PTL,then we swap the words
so then we load the high word into BPL1PTH.For those unfamiliar with the
addressing mode used,Indirect with discplacement,the I will attempt an easy
explanation.Whenever you put brackets around an address register,you are no
longer dealing with the address in that register,but instead with the 
contents of what that address points to.The discplacement is an easy way of
adding to the address that a register points to,although the address IS NOT
CHANGED,the discplacement merely acts as an temporary offset,for example a
discplacement of 2 is equal to two bytes,or 1 word




                                                                Continued...


 Setting Up A Picture The Easy Way (By Count Zero)            7/10 |           
SetUp     MOVE.L   #Planes,A0                    Bpl Pointer In Copper
          MOVE.L   #Picture,D0                   Picture Block
          MOVE.L   #3,D1                         No. Planes-1
PlLp      MOVE.W   D0,6(A0)                      Load Low Word
          SWAP     D0                            Swap Words
          MOVE.W   D0,2(A0)                      Load High Word
          SWAP     D0                            Swap Words
          ADD.L    #290*44,D0                    Add Size of plane
          ADD.L    #8,A0                         Next Bpl Pointer In copper
          DBF      D1,PlLp
          RTS 

As the picture is more than one plane,we need to add the size of the plane
onto our initial address,in this case it is 290 lines high and 44 bytes wide.
This is an overscan screen,the advantage of using this screen is that 
scrollers,etc cannot be seen emerging from any invisable borders,the disad-
vantage is that it uses up more raster time,and as a result some sprite DMA
channels are lost.I add 8 to A0 as this is the pointer in our Copperlist,if
you look at the Copperlist you will see that adding 8 moves us onto the 2nd
lot of bitplane pointers (remeber 8 bytes is 16 hex digits,a 2 longwords).
Note when using DBF to loop the number of loops required is N loops-1.

 -----------------------------------------------------------------------

Main     CMPI.B  #255,$DFF006            Wait For line 255
         BNE.S   Main

The low byte in VPOS tells us the beam position,do not wait for a position
below 58,at this occurs twice per frame.
                                                                Continued...

 Setting Up A Picture The Easy Way (By Count Zero)            8/10 |                     
         BTST    #6,$BFE001                       Test Mouse
         BNE.S   Main
         RTS

$BFE001 is one of the CIA registers (Complex Interface Adapter),among other
things this register contains a bit that is set if left mouse is pressed.The
BTST opcode means bittest,if the bit is not set (ie = 0) then mouse has not 
been pressed,so continue looping,if the bit is set (ie = 1) then it will not
continue looping,so will return to the main execute sequence,from where it
jump to Help_Os ,which will end the program.  

 -----------------------------------------------------------------------

Help_OS  MOVE.W  INTensave,D7
         BSET    #$F,D7                  Set Write Bit
         MOVE.W  D7,$DFF09A              Restore INTen
         MOVE.W  INTrqsave,D7
         BSET    #$F,D7
         MOVE.W  D7,$DFF09C               Restore INTrq
         MOVE.W  DMAsave,D7
         BSET    #$F,D7
         MOVE.W  D7,$DFF096              Restore DMA


This is where I restore all the things I saved earlier,note that to write
to these registers you have to set bit 16,the most significant bit,this 
allows you to set bits,as opposed to if it were zero then bits would be
cleared,whenever a 1 was present.

                                                                Continued...


 Setting Up A Picture The Easy Way (By Count Zero)            9/10 |                     
         MOVE.L  GFXbase,A0
         MOVE.L  $26(A0),$DFF080         Find/Replace System Copper

This is why I opened the graphics lib,offset $26 finds the address of the
system copper,it is moved to COP1LCH.

 MOVE.L  $4,A6
 JSR     -138(A6)                        LVO_Permit
 RTS 

This restores multitasking,it's the opposite of LVO_Forbid

 -----------------------------------------------------------------------

This is my copperlist,I can just see the people who use labels cringing.
It may look difficult to understand,but you get used to it.Remember that the
the first word of an instruction is always the custom register to be accessed,
and the second word (or last 4 hex characters) contains the data to be loaded.
Copperlist
         DC.L $01080000,$010A0000,$01004200,$01020000    Mod / BplCon 0/1    
         DC.L $00920030,$009400D8,$008E1A64,$009039D1    Display/Data Fetch  
Planes   DC.L $00E00000,$00E20000,$00E40000,$00E60000    Bitplane Ptr's
         DC.L $00E80000,$00EA0000,$00EC0000,$00EE0000
Col      DC.L $01800000,$01820000,$01840000,$01860000    Colours
         DC.L $01880000,$018A0000,$018C0000,$018E0000
         DC.L $01900000,$01920000,$01940000,$01960000
         DC.L $01980000,$019A0000,$019C0000,$019E0000
         DC.L $FFFFFFFE   Wait for impossible position (stop copperlist)
                                                                Continued...

 Setting Up A Picture The Easy Way (By Count Zero)           10/10 |          
I place my labels and include files if I have any,below.


GFXlib                   DC.B ~graphics.library~  
Stackpoint               DC.L 0
GFXbase                  DC.L 0
INTrqsave                DC.W 0
INTensave                DC.W 0
DMAsave                  DC.W 0


             SECTION  LOWMEM,DATA_C          Section Data

Picture      DCB.B (290*44)*4


Declare Block reserves intialised data,because Declare Block clears the
space for you,whilst Declare Space ( DS.B ) does not.
 Note that any Graphics or Music can be Sectioned as BSS,as it does not
require intialised memory.

 Any Probs experienced,drop me a line,and I'll answer them in the next Issue

                                                       SEE YA L'EIGHT'ER !  

 Lamposts-4-Ever-2-Gother By Nonny Mouse                       1/4 |


After reading the Article 'How to steal beacons' i decided it deserved a 
follow up article. So i hereby submit this article.

 How To Collect Lamp Posts
 -------------------------
The common english lamp post is a very usefull and collectable item that you
will not regret collecting as a hobby.
 The first step in lamp post collecting is to decide what style of 
lamp post you wish to collect as this decides what tools you will need.
So i will split this up into three sections.

Collecting Victorian style lamp posts
-------------------------------------
 The first step is to locate a Victorian style lamp post (as i write
there are 4 of the beauties in range) which may be easier than you think.
Just go to an older part of your area and chances are, you will find a 
old style lamp post to covet as your own.
Then you will need some equipment, due to the high costs i suggest that
you hire the equipment unless you are totaly committed to the cause.
You will need:-
1 Stonecutter fitted with metal cutting disc.
1 Class 3 HGV fitted with a HIAB arm or some similar equipment (a fire
engine does quite well - see how to collect fire engines).
1 set of ladders high enough to reach the top of the lamp and made of wood.
1 pair of wellingtons.
1 pair of rubber gloves.
1 pair of insulated wire cutters (heavy duty)

                                                               Continued...

 Lamposts-4-Ever-2-Gother By Nonny Mouse                       2/4 |
 
First take the wellingtons and put them on along with the rubber gloves and
carry the ladder to your selected lamppost. Then remove the bulb (carefull
its liable to be hot) and using the insulated cutters sever the live wire and
connect it to the body of the lamp post. Carefully climb down (without 
touching said lamp post).
Wait 4 days and then by that time a dog will have pissed on the live lamp post
and electrocuted himself on it. The council will have disconnected it from the
supply to prevent any more canine fatalities. Take the hgv and rope the 
lifting hook of the crane to the cross pieces of the lamp in a criss cross
style. Take the stonecutter and start its engine , wearing safety goggles 
(you did remember the safety goggles didnt you?) quicky whizz through the
lamp post at just above floor level and then lift the lamp post onto the HGV
and stop the stone cutter and throw that it the back too. Now stash the post
and bask in the exhilleration of the aquisition. If you decide it is not for
you , sell the lamp posts - theyre worth about 150 pounds each!

Collecting Concrete lamp posts
-------------------------------------
 The first step is to locate this style  of lamp post (as i write
there are 80 of the beauties in range) .
Then you will need some equipment, due to the high costs i again suggest that
you hire the equipment unless you are totaly committed to the cause.
You will need:-
1 Stonecutter fitted with stone cutting disc.
1 Class 3 HGV fitted with a HIAB arm or some similar equipment (a fire
engine does quite well - see how to collect fire engines).
1 rope sling for hiab arm.
1 pair of wellingtons.
1 pair of insulated wire cutters (normal duty)
1 set of box spanners.                                         Continued...

 Lamposts-4-Ever-2-Gother By Nonny Mouse                       3/4 |
 
First take the wellingtons and put them on along with the rubber gloves and
carry the box spanner set to your selected lamppost. Then using the correct
size box spanner remove the metal cover at the base and using the insulated
cutters sever the live wire and connect it to the metal cover. Carefully 
refit the cover wearing the rubber gloves and wellingtons. DO NOT TOUCH ANY
OBJECT IN CONTACT WITH THE GROUND otherwise you wont need a dog.
Wait 4 days and then by that time a dog will have pissed on the live cover
and electrocuted himself on it. The council will have disconnected it from the
supply to prevent any more canine fatalities. Take the hgv and rope sling the 
lifting hook of the crane to the body of the lamp in a criss cross
style. Take the stonecutter and start its engine , wearing safety goggles 
(you did remember the safety goggles didnt you?) quicky whizz through the
lamp post at just above floor level and then lift the lamp post onto the HGV
and stop the stone cutter and throw that it the back too. Now stash the post
and bask in the exhilleration of the aquisition. If you decide it is not for
you , sell the lamp posts - theyre worth about 0 pounds each!

Collecting Steel tubular  lamp posts
------------------------------------
 The first step is to locate a steel tubular lamp post.
Then you will need some equipment, due to the high costs i again suggest that
you hire the equipment unless you are totaly committed to the cause.
You will need:-
1 Stonecutter fitted with metal cutting disc.
1 Class 3 HGV fitted with a HIAB arm or some similar equipment.
1 pair of wellingtons.
1 pair of rubber gloves.
1 pair of insulated wire cutters (heavy duty)
1 set of box spanners.
1 rope sling for hiab arm.                                      Continued...


 Lamposts-4-Ever-2-Gother By Nonny Mouse                       4/4 |
 
First take the wellingtons and put them on along with the rubber gloves and
carry the ladder to your selected lamppost. Then remove the cover with the box
spanners .Snip the live wire and connect it to the body, discard the cover -
its not worth the risk in refitting it.
Again wait 4 days and then by that time a dog will have pissed on the live
lamp post and electrocuted himself on it. Again the council will have 
disconnected it from the supply to prevent any more canine fatalities. 
Take the hgv and rope sling the crane to the body of the lamp in a criss cross
style. Take the stonecutter and start its engine , wearing safety goggles 
(you did remember the safety goggles didnt you?) quicky whizz through the
lamp post at just above floor level and then lift the lamp post onto the HGV
and stop the stone cutter and throw that it the back too. Now stash the post
and bask in the exhilleration of the aquisition. If you decide it is not for
you , sell the lamp posts - theyre worth about 15 pounds each scrap value!
A good tip though is to smash up all your stone lamp posts and put the bits
inside the tubular posts and plug the ends inside (so it is not visable)
with cement. Try weighing them in now   - bingo 100 pounds or more.
Note - dont use the same scrap metal yard twice, and dont use any near me!

Alternative things to do with the posts include:-
Rodgering them.
Buggery.
Necrophylia.
Baseball (needs stong batsmen).
Caber tossing (cover with glue and toss wood chippings on them)
Lamer + st elimination (find a nice tall building.....)

Ok  happy lamping

An Nonny Mouse

How To Phuck A Friend                                          1/3 |           
  Phucking a friend is always great fun, especially when he doesn't know
that you are doing it!  There are loads of ways, but here are just a few.
1. Ring up every girl he knows and tell them that your friend is shy,and
asked you to call to see if they'd like to go out with him sometime?  If
they say no, then this is funny coz the next time he meets them he'll
go on talking as if nothing ever happened. If they say yes, then this is
even funnier, arrange for them to meet at a certain place, the more you
can get you meet at the same place, the better, because your friend is
going to stand them all up!
2. Find papers that carry free classified ads, and place 1 in each.  Ads
like ~E-Reg MRII, Good Condition, 20000miles, Genuine reason for sale,
only 1,000 pounds. Call etc..~, or Young gentleman (describe James Dean
or Tom Cruise here) requires female company for friendship and marrige,
call..), or ~Think you're hard?  Well I'm harder!  Want a fight?  Come
round to (address of friend) with your hardest friends, and we'll see!~
Etc..  Your friend will go crazy with phone-calls etc..
3. Go through the yellow pages and order one of EVERYTHING for him...
Dump trucks, orchestras, removal vans, magicians, caterers, taxis (lots
of taxis), gas leak emergency, tell the RSPCA that you have a fox in
your back garden and it looks ill, ask BT to send an engineer round to
look at your phone (fun if you friend phreaks and has loads of elecy
connected to his phone...)  This will result in A. Tears, B. His name
being put on the blacklist of every company going!
4. Telephone FAST with his address and collect 1000 pounds.
5. Telephone AT&T America and describe what he's been doing with their
cards for the past year... leave his address and phone number!
6. Write an article to a magazine called ~The merits of getting the Pi-
rates~ and describe how morally right it is to give information to FAST
and ask for the address of your friend to be published coz I'm proud
of what I do...                                                Continued...

How To Phuck A Friend                                          2/3 |           
7. Wear some gloves and rip out the page in the phone book with your
friend's name on it, and cricle his and a few above and below it with
a red marker.  Now enclose 2 photocopied pictures of anyone from a
book in the library that you've never heard of before, and send it to
your local police station with the address written with your left hand
(careful not to get fingerprints over the envelope etc..)  Then throw
away the gloves, pen, rest of paper, envelopes, and your phone book.
Next, after a few days, call up your friend and tell him in a whisper
(whispers can't be identified or recoginised) that the next time he
goes out alone, you'll kill him and hang up.  Repeat the threat every
day for three days.  Hopefully the police will pick his name out of
the list you send when he calls and take the threats seriously (try-
ing to connect all this with 2 pictures of winnie churchill!
8. Find some ID that your friend leaves lying around (driver's licence,
nat'ins, etc..) but doesn't use.  When he's out of the room, hide it
so that he'd find it if he looked for a few hours.  In a couple of
days, if it's still there, take it.  Now, go down your local town, and
use the ID to open a bank account at every bank going (except any he
might already be in), you can collect all the free gifts/money (~Can I
withdraw some now, until my first deposit?..~).  Using the ID you
should have no problems.  Now join every Video store around (that's 
free) and hire out your fave' vidoes from each store (keep em' now,
your friend will only get the bill!).  Anything else that you can join
is cool too (the more you join, the more ID you have!)  Now throw all
the new ID you got away (a bin?) and after stashing you free-gifts 
(don't take em' home and put money in the bank), go back round your
friend's and replace the ID to the hiding place.  (He's now in big shit!)
                                                               Continued...

How To Phuck A Friend                                          3/3 |           
- If you like you could write an ANON note to the police sta' saying,
~My friend is under a lot of pressure and keeps talking about opening
lots of bank accounts etc.. just for the free-gifts, I don't know if 
this is illegal...~ (Use the gloves etc.. as described above for this,
coz you don't want it traced back you you do you?) And when your friend 
calls up the police to ask them for help, coz someone has opened loads
of bank accounts and kept the free-gifts, they'll think it was him!
9. Order as many directories from porn shops as you can find for him,
especially when they come with a ~free vibro~ (in this case you might
want to send it to his mother instead!).
10.Do ALL of the above within the space of a few days, your friend will
be lucky if he's not arrested!  Note: If you are going to do any serious
ones in this list, then Don't do number 1.  because that can be traced
back to you!
11.Don't lose your nerve or tell ANYBODY about what you've done coz
they might not find it funny, and might just tell your friend about it.
If you don't lose your nerve and don't talk in your sleep, you can wait
'till it's all over and then carry on being your friend's friend.

The Coder's Scene Hall Of Fame!                                1/1 |           
            | | å-° |   |     å-° å--   å-- å-° å-±-° å--
            ±-± | | |   |     | | |     |   | | | | | ±--
            | | ±-± |   |     | | ±--   ±-- ±-± | | | |
            | | | | æ-ß ±-ß   æ-ß |     |   | | | | | æ--

             The Famous, The Infamous .. The Hall Of Fame


           INNER CITY (EDDIE)..MAGNETIC FIELDS (COSY,FRAP) 
 REBELS (ROCKSTEADY)..REAKTOR (THE EXECUTIONER,OGRE) ORACLE (SCOTT,TEKKY)
 PHOTON  ANARCHY (KREATOR,MOLE)..SAE..TRIPLEX (SKAGA) SILENTS U.K (STEVE)
    ACCOMULATORS (MIKE)..SYSTEM 5 (SPELLCASTER)..D-MOB (XOR) DEFJAM..
   THE POWERLORDS U.K (COGGER)..PUSSY (WIZOID)..CRYPTIC (PROTON,TANGO)
 ABAKUS (TURMOIL)..JAY (EX-ACIDFORCE)..AMAZE (FIRECODE)..ANIMATE..A.O.F.C.F
    AUTOMATION..CYTAX..DESTINY (INDEX)..ENERGY SPREADERS EQUINOX U.K 
  EXCELSORS (APPOLO)..EXTERMINATORS (TOMCAT)..FINGERBOBS (THE COUNT!!)
GAMESMAN..HURRICANE KID..ILLUSIONS U.K (HACKER)..MIND WIPE..MIRACLE..MIKE J
    MOTIVE..MYSTIX (BLITZER)..NEW AGE (DREDD)..ODYSSEY (NICK)..ODA
  PHOENIX (PANTHER) QUARK TEAM..RARE (TAURUS)..SECURITATE U.K..SONNY
STARLIGHT (MIDNIGHT RUNNER)..THE COPY CREW..TRAX (EDITOR)..TROND MICHELSEN
    ZOFO..PLATT-SPLATTERHOUSE..MURKEY CAVERNS..THE LIGHT..THE KRYPT 
      THE MINDER-REAKTOR, ALL AT MELTDOWN BBS AND REIGN IN BLOOD.
               ITV (ROTOR)..ACME (CENTRE)..BEYONDER


 If you'd like your name here, then write to the CSM and let us know.....

The Coder's Scene Magazine Issue #4 -- Credits.                1/1 |           
Credits for this issue: 
 
   Credit                                  Creditor
------------------------------------------------------------------------------
   Coded by............................... The Snowman
   Graphics/Font by.......................  ~     ~
   Editor.................................  ~     ~
   Co-Editor.............................. Count Zero
   Idea/compliation....................... The Snowman / Count Zero
 
   Article                    Page         Contributer
------------------------------------------------------------------------------
   About Issue Number IV.........0 ....... Editor
   Editorial Comment Page........1 ....... Editor
   Co-Ed's Comment Page..........2 ....... Co-Editor
   Optimize Your 68000 Code......3 ....... Laurence Vanhelsuwe
   Letter Pages.................15 ....... Various
   WordSearch II................18 ....... Editor
   Classified Ads...............20 ....... Various
   Secrets Of The Sine Scroll!..22 ....... Editor
   CES Show Review..............27 ....... Editor
   Setting Up A Picture.........28 ....... Co-Editor
   How To Steal Lamposts!.......38 ....... Anon
   Phuck A Friend...............42 ....... Anon