Language…
16 users online:  AmperSam, Cardioid, DanMario24YT, Dark Prince, Green, GRIMMKIN, Kwat1, Rykon-V73, Serena,  Shoujo, Skewer, SMW Magic, Tulip Time Scholarship Games, vktr, W3aper,  yoshi3706 - Guests: 311 - Bots: 473
Users: 64,795 (2,373 active)
Latest user: mathew

ASM LABEL XKAS

I start the ASM, I manage to put routines in the game using the hexadecimal editor by helping me from the matrix of opcodes

On the other hand I can not make a label, and XKAS I do not understand what to write in the .ASM file: should A header before my routine ?? nowhere is the correct syntax explained ...
How is a LABEL created?

Thank You
people around here usually use asar, xkas isn't really used here anymore but anyway,

Quote
nowhere is the correct syntax explained

have you looked at the documentation? It states everything right there:

Originally posted by xkas documentation
Labels / Sublabels / +/- Labels:
A label is used to represent a position in code, and allows one to code without having to constantly update branches and jumps/calls. A label should be able to be used in any opcode, but was specifically added to be used with branches, jumps, and calls. Labels can contain A-Za-z0-9_. They must end with : or ()
A sublabel is used to declare labels within labels that will share its address space only, and can contain the same characters as a label, but must start with a period. A sublabel must not end with a : or (). Here's an example:


proc1:
nop
.l1
bra .l1
proc2:
nop
.l1
bra .l1
;The two opcodes below will branch back and forth forever.
- bra +
+ bra -


Sublabels allow you to reuse redundantly named labels such as loop, end, etc. without causing duplicate label conflicts. A new sublabel group is started immediately after a label is declared automatically. A +/- label can be up to 3 levels deep, e.g. +, ++, +++, -, --, ---. They overwrite their pc offsets immediately after being redefined. Useful for very short loops, when even something like .loop would become redundant in a long routine.
Lastly, there are labels specifically for macros. They are identical to real labels, and begin with a ?
Example: ?label:
Do not use these outside of macros!!



You also don't need to write the same thing in two different places at the same time.
Originally posted by TheBiob
people around here usually use asar, xkas isn't really used here anymore but anyway,

Quote
nowhere is the correct syntax explained

have you looked at the documentation? It states everything right there:

Originally posted by xkas documentation
Labels / Sublabels / +/- Labels:
A label is used to represent a position in code, and allows one to code without having to constantly update branches and jumps/calls. A label should be able to be used in any opcode, but was specifically added to be used with branches, jumps, and calls. Labels can contain A-Za-z0-9_. They must end with : or ()
A sublabel is used to declare labels within labels that will share its address space only, and can contain the same characters as a label, but must start with a period. A sublabel must not end with a : or (). Here's an example:


proc1:
nop
.l1
bra .l1
proc2:
nop
.l1
bra .l1
;The two opcodes below will branch back and forth forever.
- bra +
+ bra -


Sublabels allow you to reuse redundantly named labels such as loop, end, etc. without causing duplicate label conflicts. A new sublabel group is started immediately after a label is declared automatically. A +/- label can be up to 3 levels deep, e.g. +, ++, +++, -, --, ---. They overwrite their pc offsets immediately after being redefined. Useful for very short loops, when even something like .loop would become redundant in a long routine.
Lastly, there are labels specifically for macros. They are identical to real labels, and begin with a ?
Example: ?label:
Do not use these outside of macros!!


.




THANK YOU, but to created & give an address to the label how do we do it ?? (nowhere is it explained! he just explains to go to a label)
Ah, well I can't really find anything in xkas's documentation but it's in asar's documentation so I'm not sure if that works in xkas

Originally posted by asar's manual
An alternate form of defining main labels is by directly assigning a value to them. A common use-case for this is to make a label point to an existing address inside a ROM. Syntax:
Code
{identifier} = {snes_address}

where snes_address can be a number or any math statement evaluating to an SNES address. Note that defining a main label this way does not start a new sub label group.
Code
Main:
; ...

SomewhereInRom = $04CA40

.Sub:
; ...

Table:
    dl Main_Sub                 ; Okay!
    dl SomewhereInRom_Sub       ; Error, label not found



Alternatively, you could probably do
Code
org $abcdef : label:
to assign a number to a label, not sure if that supports math though
thanks TheBiob , so I'm going to use Asar if it's better