PDA

View Full Version : Zasm: Blown Away



Revfan9
01-04-2007, 04:26 AM
Well, here is a script for a potential boss attack: Blown Away. If Link touches the FFC, Link will be sent at to a random spot on the edge of the room. 3 things that you need to know about this script before you use it...

1. It assumes that the room is a rectangle where the walls are 2 tiles in on every side. I tried to allow for the user to set registers for the walls... But we don't have enough FFC registers to do so (it uses all of them in the script as is).

2. All of the registers set themselves within the script except d7, which the user must set themselves as the "wind strength". The higher this is set, the weaker the "wind" (this is because it is much easier to set the strength from the edges of the screen rather than from the FFC's position), although anything set lower than 1 will get the player stuck in the walls around the edge of the screen, so be warned.

3. The scripts doesn't give the FFC any movement of it's own, although it does record the FFC's position. So you can use traditional FFC speed+Changers to make it move around. Do some experimenting with this.

Sorry if it seems unprofessional being a Zasm script, and that it was written and tested within a half-hour. I don't understand Zscript all too well yet... So I wrote it in Zasm. I'm also pretty sure that this is the largest Zasm script ever written... (released, anyway).

Have fun. ;P


SETR d0,x
SETR d1,y
SETR d2,linkx
SETR d3,linky
WAIT WAITFRAME
POS1 COMPARER d0,d2
GOTOTRUE POS2
GOTOFALSE POS3
POS2 COMPARER d1,d3
GOTOTRUE POS4
GOTOFALSE POS3
POS3 SETR d0,x
SETR d1,y
SETR d2,linkx
SETR d3,linky
GOTO WAIT
POS4 RNDV d4,1
MULTV d4,10
COMPAREV d4,5
GOTOLESS POS5
GOTOMORE POS6
POS5 SETV d4,1
GOTO POS7
POS6 SETV d4,0
GOTO POS7
POS7 RNDR d5,d7
MULTV d5,32
ADDV d5,48
COMPAREV d4,1
GOTOTRUE POS8
GOTOFALSE POS9
POS8 SETR linkx,d5
GOTO POS10
POS9 SETV d0,256
SUBR d0,d5
SETR linkx,d0
GOTO POS10
POS10 RNDV d4,1
MULTV d4,10
COMPAREV d4,5
GOTOLESS POS11
GOTOMORE POS12
POS11 SETV d4,1
GOTO POS13
POS12 SETV d4,0
GOTO POS13
POS13 RNDR d5,d7
MULTV d5,32
ADDV d5,48
COMPAREV d4,1
GOTOTRUE POS14
GOTOFALSE POS15
POS14 SETR linky,d5
GOTO POS16
POS15 SETV d0,174
SUBR d0,d5
SETR linky,d0
GOTO POS16
POS16 GOTO POS3
QUIT

jman2050
01-04-2007, 11:06 AM
You know, you can use the stack even in ZAsm to store variables beyond the 8 registers provided. use POPR and PUSHR.

Also, don't worry about it being in ZAsm. It's usually more efficient than DD's ZScript implementation anyway :P

C-Dawg
01-04-2007, 11:57 AM
Harder to read, though.

Revfan9
01-04-2007, 01:27 PM
You know, you can use the stack even in ZAsm to store variables beyond the 8 registers provided. use POPR and PUSHR.

Really? Could I get some more explanation on how these functions work exactly? Does PUSHR d0 push d0 "aside" in the stack, and POPR d0 returns it to it's previous value in the stack? Or does it work in some other way?


Harder to read,though.

Perhaps it's just me and my weird thought patterns, but I've always found Assembly easier to read than High-Level languages such as C/++. :shrug:

C-Dawg
01-04-2007, 01:31 PM
I understand the basics of how ASM works (command, parameter, parameter; working with registers more or less directly) but I find it hard to follow because it's doing such simple little things each step. I think the BIG thing is that object-oriented programming languages are just naturally WAY easier to follow than procedural languages.

So this code pushes Link towards the edges, or just "warps" him there?

Revfan9
01-05-2007, 01:06 AM
It just warps him there. Unfortunately, I don't understand enough about Zasm to push Link to the edge of the wall...