                      This file was downloaded from:
              _______ __  __ _______   ___________   ______ ______
             /__  __// /_/ // _____/  / _____/\__ \ / ____// ____/
               / /  / __  // ___/    / ___/  / \/ // /\  // ___/
              /_/  /_/ /_/ \__/      \__/   /____/ \_\/_/ \__/
 
                  -*- The Silents World Head-Quarters -*-
                     0 Day Amiga & 0 Day Console Warez!   
                        3 Nodes! all 16.8 Dual HST's
                          Running GVP 33Mhz! '040
                              Multi-Node Chat
                              1-716-655-4940
                             OnLine Since 1985
 
    No Freeloaders here, you want to read this file, then download it!!


; $VER: 68516Magazine1.01(24.2.93)

                           !!PLEASE DON'T SPREAD!!
                           ~~~~~~~~~~~~~~~~~~~~~~~
                             The 65816 Magazine
                             ~~~~~~~~~~~~~~~~~~
                 Original Idea, Concept By The Rasta Catcha

        Thanks MUST go to the following for the addition help given :
                                     JC
                                   Shaggy
                                     Dax

                   TAB SIZE FOR THIS TEXT FILE IS SET AT 3

                       Editor      : The Rasta Catcha
                       Dep. Editor : JC

              ****  PLEASE REMEMBER TO DATE YOUR ADDITIONS ****
                    THEN SEND THIS TEXT TO : Rasta Catcha
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
1.1

This text wasn't meant to be spread but if it does, It is provided "as is"
without warranty of any kind, either expressed or implied, including, but
not limited to, correctness, reliability, and the fitness for any particular
purpose.  The entire risk as to its quality and accuracy is assumed solely
by the user. Phew!

   And there's my disclaimer! signed RC.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
1.2

   Index
   =====
   1.1   Disclaimer
   1.2   Index
   1.3   About this text file
   1.4   Question Corner
   1.5   Instruction Set
   1.6   Coding Titbits, Algorythms, and General Methods
   1.7   People Letters
   1.8   Possible Future Improvements
   1.9   Thanks

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
1.3
              What's this file about that I've just downloaded?
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This text file is for all those taking part in the coders section to add
their own SNES questions, which will get censored, looked over, then
redistributed back to The Fun House. Obviously, for this text to work it is
better just kept between people in this special SNES coders section, that way
the word will get around about it (probably) and more people will want to join 
this section, we will then be able to only except certain well trusted, mature
people and so learn more about the SNES which is the reason why we are here
anyway isn't it? (If you don't think so then tell Shaggy!!!). What we can also
do is say to new people if they don't contribute to this text then they will
have a length of time to do so before being kicked out of the section as they
are obviously just leechers.
By doing this the section gains a major quality, Respect! From here other
people will also realise how good this is and so start to contribute, we could
periodically hand out snippits from the growing article as to attract a larger
group. Something like this sort of co-operation between fellow coders can only
serve not only to ourselves but also to greaten the potential of the scene, and
to improve the atmosphere of it again! So come on, add whatever you like (but
please keep programming examples as small as possible!)

Note : if you add something you can leave your name at the end of the list
at the top of this file if you so wish, if not, then please place a date after
each individual new section you add, thanks.

Ideas for improvements :
Small examples of code next to each command ie.

bra                     b               branch always
Example :

before 
PC = yy
   beq xx  ;will branch to xx 
after
   PC = xx
all other register including stack and status bits un-altered.

This is probably by no means the best code example so someone improve on it.

Note2 : That was probably the best example as you can see what this text is all
about , filling in other peoples queries and at the same time having yours
filled too (if you have any queries that is!)

So to sum this text file up , its like a ftp list that everyone adds to!
Get it? GOOD!

Again , I'd like to Thank all who is able to be mature enough to take part!

BTW
   ??? signifies that that particular section is PROBABLY correct but needs
   verifying! If you see one and believe it to be correct, add an example
   to show others why it is true, and to explain it!

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
1.4
                               Question Corner
                               ~~~~~~~~~~~~~~~

What does the expression  -> ,s  <- mean?                               Anon

The ,s is for stack relative (I think?) haven't used it yet             (Dax)

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

What does the command STZ mean?                                         Anon
and also what are the differences between [] and ()

1. STZ is surprise surprise  STORE ZERO, just stores a 0 in that address.
                                                                        (Dax)
2. ADC [$00] takes a 24 bit address (3bytes) from $00
   so if $00= $10  , $01= $80 , $02 = $01   then the address would be $018010

then gets the data from there... a bit like ($00) but uses a 24 bit address
instead....VERY useful for accessing data..

and with the ,y works the same way. just adding y onto the 24 bit addr
BTW. NOTE the value in the [] can only be $00-$fe

NB...LDA($00) would get the values of $00 and $01 and use them to make a
     16 bit address within the bank pointed to by the Data bank register.
     Then would load the accumulator with the value at that address.
     
     LDA[$00] would get the values of $00,$01 and $02 and use them to make
     a 24 bit address within the SNES memory map.
     Then would load the accumulator with the value at that address.

     The order for the address would be $02 $01 $00.
     so for the 16 bit addr $8010..       $00=$10 $01=$80
     and the    24 bit addr $018020       $00=$20 $01=$80 $02=$01

     Limits : the value in the ($00) brackets can be $0000 - $fffe
     the value in the [$00] brackets can be $00   - $fe
                                                                        (Dax)
-------------------------------------------------------------------------------
What is the difference between ;

A Aummulator,B Accumulator, C Accumulator

Accumulator is 16 bit...  A accumulator is Bits 0->7  (Byte)
                          B accumulator is Bits 8->15 (Byte)
                          C accumulator is Bits 0->15 (Word)

Now I can see from this that each of A,B & C are different in the sizes
but how do I access for example the B Accumulator & C Accumulator? Is it
something to do with the sep/rep instruction, if so when I do change
modes which register corresponds to which mode, and are the previous values
which was in the old accumulator stored?                                Anon

    If you use REP #$20 - then you have access to the C(16 bit) Accumulator.
    If you use SEP #$20 - then you have access to the A(8  bit) Accumulator.
    But then XBA will swap the contents of the B and A accumulators, so that
    you can in effect hold two 8 bit values in the acc at the same time.
                                                                        (Dax)
-------------------------------------------------------------------------------
23.2.93
What are the flag bits called, and which is each bit?                   Anon
ie bit 0 = Carry ?
       1 = Zero ?
   etc. etc.

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

23.2.93
What does HDMA mean or stand for?                                       Anon

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
1.5
                               Instruction Set
                               ~~~~~~~~~~~~~~~
Table
~~~~~
[a] = accumulator
[x] = x can be a data or indirect address register
[y] = y can be a data or indirect address register
n   = explicit number
add = address


example of indirection :
      cmp $12,x = use address $12 + x for compare
      therefore if x = #$5 address to be compared is $17

when talking about words remember they are stored as low-high order bytes

Mnemonics    operator
            vague size           Description
adc n          b/w            Add memory to accumulator with carry
and n          w              And memory with the accumulator
and add        b/w            and a to address 
bcc            b              branch carry clear
bcs            b              branch carry set
beq            b              branch equal
bmi            b              branch minus
bne            b              branch not equal
bpl            b              branch plus
bra            b              branch always
brk n          b              break - Jsr's to break vector
brl add        w              branch always long (within the bank)
bvc            b              branch if no overflow (overflow=clear)
bvs            b              branch if overflow (overflow=set)
bit            b/w            tests bit and sets z flag in flag register
clc                           clear carry flag
cld                           clear decimal flag
cli                           clear interupt (NOT NMI) 
                              (use after using sei) this restore ints
clv                           clear overflow
cmp n          b              compare n with [a]
cmp add        b/w            compare [a] with contents of address
cop n                         Co-Processor Command
                              (Followed By Signature byte. ($00-7f)
cpx n          b              compare x with num
cpx add        b/w            compare [x] with contents of address
cpy n          b              compare y with num
cpy add        b/w            compare [y] with contents of address
dec a                         subtract 1 from [a]
dec add        b/w            subtract 1 from contents of address
dec add,x      b/w            subtract 1 from contents of address+[x]
dex                           subtract 1 from [x]
dey                           subtract 1 from [y]
eor n          b              exclusive or n with [a]
eor add        b/w            exclusive or [a] with contents of address
                              (dont know where result will go???)
eor add,x      b/w            exclusive or [a] with contents of address+[x]
eor add,s                     exclusive or [a] with contents of addrress+[s]
inc a                         increase [a] by 1
inc add        b/w            increase contents of address by 1
inx                           increase x by 1
iny                           increase y by 1
jml            l              Jump
                              (Anything to do with longwords???)
jmp            w              jump
Jsl            l              Jump to subroutine
                              (Anything to do with longwords???)
jsr            w              jump to subroutine
lda n          b/w            load [a] with n
ldx n          b/w            load [x] with n
ldy n          b/w            load [y] with n
lsr add                       logical shift addressress once
                              (always clc or set carry)
mvn add                       - Forward Block Transfer.
                              {Dest addr > Source addr}
mvp add                       - Block transfer in reverse direction. 
                              {Dest addr < Source addr}
               With MVN and MVP.
                  X - Source start Address.
                  Y - Destination start Address.
                  C - (Number of bytes to transfer) -1. {16 bit accumulator}.
                  X & Y are altered according to the count..

nop                           no operation
ora n          b/w            or n with [a]
pea add        w              - Push effective absolute address to stack.
                              (Push immediate data to stack)
pei add        b              - Push effective indirect address to stack.
                              (Push direct data to stack)
per add        w              - Push effective program counters relative addr to stack.
pha                           push [a] onto stack
phb                           - Push data bank register to stack.
phd                           - Push direct register to stack.
phk                           - Push program bank register to stack.
php                           push Processor status register onto stack
phx                           push [x] onto stack
phy                           push [y] onto stack
pla                           pull [a] off stack
plb                           - Pull from stack to data bank register.
pld                           - Pull from stack to direct register.
plp                           pull Processor status off stack
plx                           pull [x] off stack
ply                           pull [y] off stack
rep n                         a,x,y:16bit (ie; rep #$30 = x,y,a 
                              fixed -> 16 bit mode)
rol a                         rotate [a] left once
rol add                       rotate contents of (add) left once
ror a                         rotate [a] right once
ror add                       rotate contents of (add) right once
rti                           return from interupt
rtl                           - Return from subroutine to long address
                              (from JSL)
rts                           return from subroutine
sbc n          b/w            subtract from [a] n + carry flag
sec                           set carry
sed                           set decimal
sei                           Set Interupt Flag in SR (Disables interupts)
sep n          b              sep #$20 = Accumulator ->  8 bit mode
sta add                       store [a] in address
stp                           - STOP processor..Halts execution.
                              {Only RESET can re-start execution.}
stx add                       store [x] in address
sty add                       store [y] in address
stz add                       store ZERO in address
tax                           transfer [a] to [x]
tay                           transfer [a] to [y]
tcd                           - Transfer C accumulator to direct register.
tdc                           - Transfer direct register to C accumulator.
trb n                         - Test/Reset bit. 
tsb n                         - Test/Set bit. 
tsc                           - Transfer stack pointer to C accumulator.
tsx                           transfer status register to x
txy                           transfer [x] to [y]
tya                           transfer [y] to [a]
wai                           - Interrupt on hold.(Wait for int)
                              (NB.a NMI,IRQ or RESET interrupt will end the
                              wait state. and will call the interrupt, then
                              resume processing.)
xba                           -Exchange A and B accumulators. (SWAP) ???
             Accumulator is 16 bit...  A accumulator is Bits 0->7  (Byte) ???
                                       B accumulator is Bits 8->15 (Byte) ???
                                       C accumulator is Bits 0->15 (Word) ???
xce                           Xfer carry flag to emulation flag  ???
                              ( >16 bit mode   ??? )
                  
- The Following People have contributed towards the Instruction List:-

   Rasta Catcha
   Dax

-----------------------------------------
The List was Setup By the Rasta Catcha.   \
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
1.6
               Coding Titbits, Algorythms, and General Methods
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This section is for people to add small examples of how to use the hardware
registers, or whatever they deem to be useful.

ie:
   Using Mode 7
   Tile Format
   Reading the pad
   Using a sprite
   Adding a vertical blank
   Setting up a screen
   Algorithms
   Sound Usage
   Sprite Usage
   Copper Usage (or it's equivalent)

etc. etc I'm sure you understand what I mean!  Please I have titled some
examples above, why not add an example about any of the above now!!! If you
want to see any example too then add to this list!!!
-------------------------------------------------------------------------------
JoyPad Reading Example - The Rasta Catcha 24.2.93
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
padread
   lda   $4212       ;  Get Contents of Pad Selected bits
   and   #$1         ;  Tests if a button has been pressed
   bne   padread     ;  branches if a button wasn't pressed
   lda   $4219       ;  Get Actual Pad Data Bits into accumulator
                     ;   bit values are :-
                     ;   7 = X
                     ;   6 = Y
                     ;   5 = Left
                     ;   4 = Right
                     ;   3 = not used
                     ;   2 = not used
                     ;   1 = not used
                     ;   0 = not used
   and   #$80        ;  Mask out all bits except for X button bit and set flags
   bne   X_Pressed   ;  if not 0 then there is a 1 in bit 7 so button has been
                     ;  pressed
   bra   padread     ;  loop back to padread
X_Pressed
   ;
   ;   Some Funky Code
   ;
-------------------------------------------------------------------------------
1.7
                               Peoples Letters
                               ~~~~~~~~~~~~~~~
Some Quick Comments ...
1.I think the idea is very good, but i think the alterations should be left
  to a named moderator for inclusion in the list, not just have people
  alter and upload the file.

2.I think it is pointless having seperate entries for the addr and n, in
  the instruction list,either put all the address entries or put them 
  in a seperate section at the end.(for all cases)
  I think also people should be able to add methods, but not specific 
  routines to the end section(Coding titbits). Ie a general HDMA method.
  or algorithms..

3.Having the originator of each instruction data is crazy, just put a list
  at the end of the section saying all the people who have contributed to
  it..
  In the other sections it would be good to put each name, next to the entry
  because it gives people an idea of who has done what, and who to contact
  for more specific help.

4.ABANDON the 3-tab spaces, converting files between amiga and PC etc is
  weird enough as it is, but i have just got all my editors set up right,
  and do not want to have to convert them to 3-tab spaces. As i think a lot
  of other people will agree..POINT 1 gets around this, if you are going
  to be the moderator, but if you are going to let anyone alter the file
  then the default 'space' will have to be a space not a tab.

Thats all....Good luck....Dax

24.2.93
Reply:   Thanks for the input Dax, Firstly there is 1 Editor and Dep Editor of
this file, the reason why everyone adds to this file is to make things easier
for us to do our job, we will always keep backups to make sure everything is
intact but doing things this way ensures that messages dont get lost via email.
We intend on sorting out the _very_ basic instruction list, bear with us. We
just need to think of a good format (Please pass on any suggestions) As for
your views on the HDMA?? methods and algorithms , excellent, thats exactly
what this is all about, Coding Titbits as a title is very , very general, if
you folks want to add extras then do so!! The tabs have (sigh!) been abandoned
for those of you who use the PC. If I haven't commented on a particular section
or point that you have written about then this means I totally agree with you.
Thanks again Dax.

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


-------------------------------------------------------------------------------
1.8
                         Possible Future Improvement
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Incorporating the hardware registers file.
Algorithm Section.
How to code the SNES CDROM, NOT!
How to code the ZX Spectrum 16k , Definately NOT!
Whatever you want!
-------------------------------------------------------------------------------
1.9

   Thanks to all the people concerned in this project and to all those
   who join in.

      The Rasta Catcha
-------------------------------------------------------------------------------

                                                                          
                                                                          
                     .....and don't forget to call.....                   
                                                                          
                                                                          
           ___      .          .           .       *   .            .     
     .    /  /\        *_________    _______        _______ .  ______     
         /  / /        /\        \ . \      \  .   /\      \ ./\     \   .
o  .    /__/ /_  .    /  \        \ . \      \    /  \      \/  \     \   
       /__/\ \/\__   /    \________\ / \______\. /    \______\   \_____\  
      _\__\ \  / /\./     / _______//   \_  __ \/     / ___  /   / ____/  
 .   /__/\/  \ \/ //     / / \  .__/     / /  \ \    / / \/_/   / /__\    
    /  /\  /\ \  //     / /___\. \ \    / /\   \ \  / /\____\  / ____/    
   /  / /\ \ \ \//     / _____/___\ \  / /  \  / / / /\/__  / / /   \   * 
  /__/  \ \ \_\/ \    / /          \ \/ /____\/ / / /___\/ /\/ /_____\    
  \__\/\ \ \ \    \  / /            \__________/\/________/  \_______/    
     \  \ \_\/ .   \/  \_____________________________________________\   .
      \  \ \        \                                                /    
       \__\/         \   -*- The Silents World Head-Quarters -*-    /     
                      \____________________________________________/    . 
  .            .       .                .           .          .         .
       .                  .  SysOp:  PLANET MASTER     .           .      
          3 NODES!          7 1 6 - 6 5 5 - 4 9 4 0      .   3 NODES!     
.  * 0 DAY AMIGA WAREZ  16.8 Dual HST's  24Hrs/7Days   0 DAY CONSOLE WAREZ
    .                 Running GVP's G-Force '040/2000 33Mhz!   .    .     
        .       .       900 Megs On-Line  Multi-Node Chat    .         .  
                                OnLine Since 1985             *           
     .            .             .                .                  .     
   .          .             C A L L     T O D A Y ! !     .      .      . 
