Assembly ideas / Syntax


An assembly program

Label Mnemonic Remark / Comment
ORG $1010
;Program begins at $1010, so you can run with "SYS4112"
LDX #$01
;Load $01 into the X register
loop_x
;A label called "loop_x"
TXA
;Transfer the value of X ($01,$02,...,$1A) to the Accumulator
STA $0C00,X
;Put the value ("A","B",...,"Z") of Accumulator to $0C00,X (the first row of the screen)
INX
;Increment the value of X register by 1
CMP #$1A
;Compare the value of Accumulator to $1A
BNE loop_x
;if Accumulator doesn't equal to $1A then go to "loop_x" label
RTS
;End of the program (return)

Well, as you can see an assembly program consists of three main parts:
  1. A label: an identifier of a row
  2. A mnemonic: an assembly instruction
  3. A remark: a comment after a ";" (semicolon), it "just" helps to understand the current line, so it's optional.