Von wissen erschlagen sein
Ok, danke für das mit den Blöcken, das ist glaube ich das einzige was ich relativ gut verstehe XD
Beispiel aus dem Tut:
Say we wanted a block that when hit, would make a sound effect depending on Mario's powerup. Just for example, i'm going to use the shell sound effects that get higher as the shell hits more enemies.
CodeSOUNDTABLE dcb $13,$14,$15,$16
LDX $19
LDA SOUNDTABLE,x
STA $1DF9
RTS
Geht das nicht auch in dem wir das Powerup laden, schauen ob MArio einen Pilz hat, wenn ja zu Code Pilz springen und den Soundeffekt abspielen, wenn nein schauen ob Mario eine Blume hat, wenn ja....
Dann bräuchte ich doch garkeine Tabelle.
Wenn LDY auch geht, gibt es dann einen Unterschied zwischen LDX und LDY?
Zu dem mit den Binarys hier der Tut Teil:
Today, we are going to learn Binary commands. Now, say we wanted to check if a certain button is pressed. Now, with your current knowledge, you would probably do something like:
CodeLDA $15
CMP #$01
BEQ MYCODE
RTS
MYCODE
(blah)
RTS
Now, this would not work, as this checks if ONLY down is pressed, so if they were holding any other buttons, our code would not work. Instead, we do it a different way. In binary, there are 8 figures, which can be either 1 or 0. SMW uses these as bits, which are either set or not (1 or 0 respectively). The binary > SMW Bits goes like this:
CodeBit number: 7 6 5 4 3 2 1 0
Binarycode: 1 0 0 0 1 0 1 0
So from this random piece of binary, bits 7, 3 and 1 are set. The rest are not.
Now, instead of using CMP to check if that is set, we use AND. AND works like this.
CodeLDA $15
AND #$01
BNE MYCODE
RTS
MYCODE
(blah)
RTS
Now, say the controller was pressing Y and Down. This would make A amount to 41 (I believe, but the Ram map is unavailable, making this rather difficult). This would set bits 6 and 0. Then, we AND #$01, which is a value that has bit 0 set. AND then works like this:
Code01000001
00000001
So we get:
00000001
Was bringt mir das nun? Wo pack ich das hin?
ZitatIn der Beschreibung steht's:
CODE: ALLES AUSWÄHLEN
$7E:0015 1 byte I/O Controller data 1. Format: byetUDLR.
b = A or B; y = X or Y; e = select; t = Start; U = up; D = down; L = left, R = right.
Die Buchstabenfolge byetUDLR stellt ein Byte dar (acht Bits). Jeder Buchstabe entspricht einem Button und damit einem Bit. Würde START gedrückt und sonst nichts, wäre der Wert in $15 00010000. Der Buchstabe t steht in der Beschreibung für den START-Knopf, und der steht in dem Byte an der vierten Stelle von Links, also ist das Bit an der viersten Stelle von links gesetzt.
Die Buchstabenvergabe ist übrigens völlig egal, das dient nur der Verdeutlichung.
Sorry, kein Wort verstanden, nur das man es irgendwie aus diesem Code rauslesen kann
Ok, warum man TAX, etc. brauchen könnte leuchtet mir ein, aber wieso brauche ich PHA, etc. gibt es da irgendeine praktische Anwendung?