Index | Fejlesztés Development | CPU | Számítógép Computer | Assembler | Monitor | Függvények Library
Direktívák: Drectives: CPU | ORG | EQU | DS | DB,DW,DD | DP | SEG | ENDS | GLOBAL | .INCLUDE
Melléklet: Appendix: Feltételek#1Conditions#1 | Feltételek#2Conditions#2 | Utasítások#1Instructions#1 | Utasítások#2Instructions#2 |
A p2223 CPU-hoz kifejlesztett p2as assembler program alkalmas a processzoron futtatható assembly nyelvű programok lefordítására és a futtatható gépi kódú program létrehozására. Az assembler két menetben fordít és közvetlenül a futtatható kódot készíti el. Mivel nem generál átmeneti áthelyezhető (object) kódot, így nincs szükség szerkesztő (linker) programra. The p2as assembler program developed for the p2223 CPU is suitable for compiling assembly language programs that can be run on the processor and for creating executable machine code programs. The assembler compiles in two passes and directly creates the executable code. Since it does not generate temporary relocatable (object) code, no editor (linker) program is required.
Az assembler egyaránt képes a CPU 1-es verziójára (p1516), vagy a 2-es verziójára (p2223) készült programot lefordítani, a forrásban használható feltételek, utasítások a választott processzortól (assembly nyelv) függenek. A processzor kiválasztására szolgáló direktívát a forrás fájl elején kell elhelyezni. Ha nem alkalmazzuk, akkor a fordító alapértelmezés szerint a p1516 nyelvet használja. The assembler can compile a program for either CPU version 1 (p1516) or CPU version 2 (p2223), the conditions and instructions that can be used in the source depend on the chosen processor (assembly language). The directive for selecting the processor must be placed at the beginning of the source file. If not used, the compiler will use the p1516 language by default.
A program parancssorban futtatható, a következő módon: The program can be run from the command line, as follows:
php p2as.php [-o kimenet] [-l] [-c] [-k] forrás_file... php p2as.php [-o output] [-l] [-c] [-k] source_file...
Az -o kapcsolóval megadható a kimeneti fájl neve. A generált kimeneti fájl neve alapértelmezés szerint az elsőként megadott assembly forrás fájl nevével egyezik (a kiterjesztés .p2h-ra cserélésével), vagy megadható a -o kapcsoló paramétereként. The -o switch can be used to specify the name of the output file. The name of the generated output file by default matches the name of the first assembly source file specified (with the extension replaced with .p2h), or can be specified as a parameter to the -o switch.
A -l kapcsolóval (list file creation) kérhetjük, hogy a program készítsen lista fájlt, amely a lefordított kódról tartalmaz részletes információkat. A fájl neve az első assembly forrás fájl nevével egyező lesz, .lst kiterjesztéssel. With the -l switch (list file creation), we can ask the program to create a list file that contains detailed information about the compiled code. The file name will be the same as the name of the first assembly source file with the .lst extension.
A -c kapcsoló (compile only) használata esetén a fordító nem ad hibajelzést ha olyan szimbólumot használunk, amely nincs definiálva. Az ilyen módon lefordított kimeneti fájl nem alkalmas a program futtatására, mert az még félkész. Ez megfelel az egyéb fejlesztő rendszerekben használatos un. object fájl típusnak. Ezek a fájlok további fordításokban forrás fájlként adhatók meg, a tartalmuk bekerül a lefordított programba. A kimeneti fájlt ebben az esetben ajánlott .p2o kiterjesztéssel ellátni. Több forrás, vagy object fájl -c kapcsolóval való lefordításával könyvtár fájlt készíthetünk, ezeket a fájlokat javasolt .p2l kiterjesztéssel elnevezni. A -c kapcsoló használata bekapcsolja a -k kapcsoló hatását, így nem szükséges használni. When using the -c switch (compile only), the compiler will not give an error if a symbol is used that is not defined. The output file compiled in this way is not suitable for running the program, because it is still half-finished. This corresponds to the so-called object file type used in other development systems. These files can be specified as source files in further compilations, and their contents will be included in the compiled program. In this case, it is recommended to give the output file the .p2o extension. By compiling several source or object files with the -c switch we can create a library file, and it is recommended to name these files with the .p2l extension. Using the -c switch activates the effect of the -k switch, so it is not necessary to use it.
A -k kapcsoló (keep segments) használata esetén a fordító nem távolítja el azoknak a szegmenseknek a tartalmát, amelyekre nincsenek hivatkozások, így minden szegmens tartalma bekerül a kimeneti fájlba. Ennek a kapcsolónak csak akkor van hatása, ha a -c kapcsolót nem használtuk. When using the -k switch (keep segments), the compiler does not remove the contents of segments that are not referenced, so the contents of all segments are included in the output file. This switch only has an effect if the -c switch was not used.
A program további paraméterei az assembly forrás fájlok, illetve object, vagy könyvtár fájlok nevei lehetnek, ezekből legalább egyet kötelező megadni. A megadott fájlok tartalmát a program összefűzi, és egy programként fordítja le. Ezért, ha a forrás több fájlban szétbontva található, azonos globális címkék nem fordulhatnak elő többször a fájlokban. Additional program parameters can be the names of assembly source files, object or library files, of which at least one must be specified. The contents of the specified files are concatenated by the program and compiled as a single program. Therefore, if the source is split into multiple files, the same global symbols cannot occur more than once in the files.
A forrás fájlok más assembler-eknél megszokott szintaxisúak lehetnek. Az utasításokat egy sorba írva kell a fájban elhelyezni, a sorok a következő mezőket tartalmazhatják: Source files can have the syntax common to other assemblers. The instructions should be written on a single line in the file, and the lines may contain the following fields:
[címke:[:]] [feltétel] utasítás paraméterek [;megjegyzés] [label:[:]] [condition] instruction parameters [;comment]
A címke: (a szó végén lévő kettőspont jelöli), egy névvel (label) látja el azt a memória helyet, amelyre az utasítás kódszava kerül. Ugrásoknál és szubrutin hívásoknál használható a cím megadására. A címke a sorban egyedül is állhat, ekkor a forrásban ezután következő első utasítás helyét fogja jelölni. The label: (denoted by a colon at the end of the word) gives a name (label) to the memory location where the instruction's codeword is located. It can be used to specify the address for jumps and subroutine calls. The label can also stand alone in the line, in which case it will indicate the location of the next instruction in the source.
Ha a címke neve után egynél több kettőspontot teszünk, akkor a címke globális lesz, akkor is, ha egy szegmensen belül hoztuk létre. Az így létrehozott szimbólumokat nem kell a .global direktívával exportálni. If you put more than one colon after the label name, the symbol will be global, even if it was created within a segment. Symbols created in this way do not need to be exported with the .global directive.
Az utasítások feltétellel is elláthatók, ha valódi, CPU utasításokról van szó. Ha a feltételt nem adjuk meg, akkor AL (always) feltételt használja a program, amely a feltétel nélküli végrehajtást jelenti. Ugyanazt a feltételt több névvel is használhatjuk, amivel a program olvashatósága növelhető. A használható elnevezések a fordításhoz választott processzor típustól függnek, részletes felsorolásukat a melléklet tartalmazza. Instructions can also be provided with conditions, if they are real, CPU instructions. If the condition is not specified, then the program uses the AL (always) condition, which means unconditional execution. The same condition can be used with several names, which can increase the readability of the program. The names that can be used depend on the processor type chosen for compilation, a detailed list of them is included in the appendix.
Az utasítás lehet konkrét CPU utasítás (a választott processzor típustól függően), illetve a fordítónak szóló ún. pszeudó utasítás, direktíva. The instruction can be a specific CPU instruction (depending on the chosen processor type), or a so-called pseudo instruction, directive for the compiler.
A paraméterek az utasítástól függenek, ha több paramétert adunk meg, akkor azokat vesszővel kell elválasztani egymástól. Regiszterek megadásánál az R betűt és a regiszter sorszámát használjuk, pl. R10. Adatok esetében használhatunk címkeként létrehozott szimbólumokat, vagy konstansokat. A konstansoknak számjeggyel kell kezdődniük. A 0-val kezdődő konstansokat a fordító 8-as számrendszerűnek tekinti, a 0b-vel kezdődőeket kettes számrendszerűnek (bináris), míg a 0x-el kezdődőeket 16-osnak (hexadecimális). ASCII kódok megadására használhatjuk a ’b’ formát (az ASCII kód betűje egyszeres idézőjelek között). Ilyen esetben azonban ún. escape szekvenciát, illetve szóközt nem használhatunk! A szimbólumok nevében a kis- és nagybetűk különbözőnek számítanak. The parameters depend on the instruction, if we specify more parameters, they must be separated from each other by a comma. When specifying registers, we use the letter R and the register number, e.g. R10. In the case of data, we can use symbols or constants created as labels. Constants must start with a digit. The compiler considers constants starting with 0 as being in the 8th number system, those starting with 0b as being in the binary number system (binary), while those starting with 0x as being in the 16th (hexadecimal). To specify ASCII codes, we can use the ’b’ form (the letter of the ASCII code between single quotes). However, in such a case, we cannot use so-called escape sequences or space! In the names of symbols lowercase and uppercase letters are considered different.
Bizonyos utasítások nem a processzor utasításainak a leírására szolgálnak, nem a fordító működését szabályozzák, vagy egyéb eredményük van. A direktívák nevében a kis- és nagybetűk azonosnak számítanak. Azok a direktívák amelyeknek a neve nem ponttal kezdődik, ponttal kezdődően is megadhatók, tehát pl a CPU direktíva .CPU formában is használható. Some statements are not used to describe the instructions of the processor, but control the operation of the compiler, or have other results, they are called directives. In the names of directives, the upper and lowercase letters are considered the same. Directives whose names do not start with a dot can also be specified starting with a dot, so for example the directive CPU can also be used in the form .CPU.
A használt processzor, és ezáltal az assembly nyelv kiválasztására szolgáló direktíva. P1 paraméter esetén a fordító a forrás fájlt p1516 processzor assembly nyelveként értelmezi, P2 esetén pedig a p2223 nyelvet használja. Ez a beállítás csak a CPU utasításokra vonatkozik, a fordító által felismert direktívák azonosak. A direktíva paramétere kis- és nagybetűvel is írható. A directive for selecting the processor used, and thus the assembly language. In the case of the P1 parameter, the compiler interprets the source file as the assembly language of the p1516 processor, and in the case of P2 the compiler uses the p2223 language. This setting only applies to CPU instructions, the directives recognized by the compiler are the same. The directive parameter can be written in both upper and lower case.
Az ORG utasítás paramétere egy számérték, ez lesz a memória cím számláló értéke. Arra használható, hogy valamilyen tartalmat egy adott memória területen helyezzünk el. The ORG instruction parameter is a numeric value, this will be the counter value of the memory address. It can be used to place some content in a specific memory area.
org 0 ; 0-s címen elhelyezve call rutin vege: jmp vege org 50 ; a rutint az 50-es címre tesszük rutin: ldl0 r1,0 ; .... org 0 ; placed at address 0 call routine end: jmp end org 50 ; routine placed at 50 routine: ldl0 r1,0 ; ....Ezzel az utasítással (amelyet EQU, vagy =, illetve == formában is írhatunk) egy szimbólumnak értéket adhatunk. This instruction (which can also be written as EQU, or =, or ==) can be used to assign a value to a symbol.
porta = 0xff00 ; a kimeneti port címe ldl r0,porta ; a cím betöltése ldh r0,porta ; az R0 regiszterbe porta = 0xff00 ; address of output port ldl r0,porta ; load the address ldh r0,porta ; into R0 registerHa a == jelet használjuk, akkor a szimbólum globálisként jön létre, vagyis egyúttal exportálódik a szegmensen kívülre, így a .global direktívát már nem kell használni. If we use the == sign, the symbol is created as global, meaning it is also exported outside the segment, so the .global directive no longer needs to be used.
Ez a direktíva hely lefoglalására használható, a tartalom megadása nélkül. Paraméterként a hely méretét kell megadni. Ha a memóriában le akarunk foglalni valahány rekeszt adat tárolására, ezzel a direktívával megadhatjuk, hány szó helyre van szükségünk. A direktíva paraméterének 0-nál nagyobb pozitív számnak kell lennie. This directive can be used to allocate space, without specifying the contents. The size of the space must be specified as a parameter. If we want to allocate some space in memory to store data, we can use this directive to specify how many words of space we need. The parameter of the directive must be a positive number greater than 0.
org 20 ; ettől a címtő kezdve adatok: ds 5 ; 5 szó helyet foglalunk le org 20 ; from this address data: ds 5 ; we allocate 5 wordsEzekkel a direktívákkal a paraméterként megadott értékeket tudjuk elhelyezni a memóriában. A DB az érték alsó 8 bitjét használja fel, a DW 16 bitet, míg a DD 32 bites adatokat használ. Egy direktívánál több paraméter is megadható vesszővel elválasztva, ezek a felsorolás sorrendjében kerülnek a memóriába. A paramétereknek konstansnak, vagy szimbólumnak kell lenniük. A szimbólumok az EQU, = direktívákkal, vagy címkeként hozhatók létre. With these directives, we can place the values specified as parameters in memory. DB uses the lower 8 bits of the value, DW uses 16 bits, while DD uses 32-bit data. More parameters can be specified in a directive, separated by commas, and they are placed in memory in the order they are listed. The parameters must be constants or symbols. Symbols can be created with the directives EQU, = or as labels.
Ezeknél a direktíváknál használhatunk sztring konstanst is, amely ”kettős idézőjelek” között megadott szöveg. A szövegen belül használhatók a C nyelvben megszokott escape szekvenciák is. A fordító a sztring konstansokat mindig kiegészíti egy 0 értékű szóval. Ebben az esetben a direktívának nem lehet más paramétere. With these directives, we can also use a string constant, which is a text enclosed in ”double quotes”. The escape sequences common in the C language can also be used within the text. The compiler always completes the string constants with a word with the value 0. In this case, the directive cannot have any other parameters.
start: ldl0 r1,0 ... org 10 adat1: db 123 ; 8 bites adat db 65,’z’,13 ; ASCII konstans dw 0x213 ; 16 bites adat dd -4321 ; negatív számok is megadhatók dd start ; vagy címkék is db ”Hello World!\n” ; sztring konstans start: ldl0 r1,0 ... org 10 data1: db 123 ; 8 bit data db 65,’z’,13 ; ASCII constant dw 0x213 ; 16 bit data dd -4321 ; data can be negative dd start ; or a label db ”Hello World!\n” ; string constantSztring elhelyezése a memóriában, “pakolt” formátumban. Négy karakter kódja kerül egy memóriahelyre, little-endian sorrendben, tehát az első karakter az alsó helyen lévő 8 bites helyre kerül. Az utolsó szó fel nem használt bájtjai 0 értékűek lesznek, majd egy 0 értékű szó zárja le a sztringet. Place a string in memory, in “packed” format. Four character codes are placed in a memory location, in little-endian order, so the first character is placed in the 8-bit location in the lower position. The unused bytes of the last word are set to 0, and then a word with value 0 terminates the string.
s3: .dp "Hello World!\n" ... 6c6c6548 //C 00087 dd 0x6c6c6548 ; "lleH" 6f57206f //C 00088 dd 0x6f57206f ; "oW o" 21646c72 //C 00089 dd 0x21646c72 ; "!dlr" 0000000a //C 0008a dd 0x0000000a ; "\012" 00000000 //C 0008b dd 0Szegmens kezdetét definiáló direktíva. A szegmensek a szimbólumok láthatóságát a szegmensen belülre korlátozzák, így az egyes szegmensek ugyanazt a szimbólum nevet saját célra használhatják. A directive defining the start of a segment. Segments restrict the visibility of symbols to within the segment, so that each segment can use the same symbol name for its own purpose.
Az első paraméter a szegmens neve, ami után opcionális paraméterek következhetnek. A szegmensen belül létrehozott szimbólumok és címkék csak a szegmensen belül láthatóak. Ha a szegmensen kívül is használni szeretnénk egy szimbólumot, akkor azt a .global direktívával exportálni kell. The first parameter is the name of the segment, followed by optional parameters. Symbols and labels created within a segment are only visible within the segment. If we want to use a symbol outside the segment, it must be exported with the .global directive.
A szegmensben újra definiálhatunk globális szimbólumokat. Ezekből egy új példány jön létre, így az értékük a szegmensen belül más lesz, mint a globális területen. Global symbols can be redefined in the segment. A new instance of these will be created, so their value within the segment will be different from that in the global area.
A szegmens végét jelző direktíva. Ez után a program globális területe folytatódik, így a globális szimbólumok válnak láthatóvá. A directive that marks the end of a segment. After this, the global area of the program continues, so that global symbols become visible.
A szegmensen belül definiált szimbólum globális szimbólummá való konvertálását végző direktíva. Paramétere a szimbólum neve. Csak egy paraméter adható meg. Ha a szimbólum a globális területen már létezik, akkor hibaüzenetet kapunk. Directive that converts a symbol defined within a segment into a global symbol. Its parameter is the name of the symbol. Only one parameter can be specified. If the symbol already exists in the global area, an error message will be returned.
A paraméterként megadott fájl betöltése és
fordítása. A fájl nevét nem kell idézőjelbe tenni. A betöltött
fájl után az aktuális fájl fordítása folytatódik. A fájlt a
program először abban a könyvtárban keresi, ahol az eredeti
forrásfájl található. Ha ott nem található, akkor a rendszer
fájljai között fogja keresni, ez lehet a felhasználó saját
könyvtárának p12tool/include
alkönyvtára, vagy a
fejlesztőrendszer lib
alkönyvtára.
Load and compile the file specified as a
parameter. The file name does not need to be enclosed in
quotes. After the loaded file, the compilation of the current
file continues. The program first searches for the file in the
directory where the original source file is located. If it is
not found there, it will search among the system files, which
can be the p12tool/include
subdirectory of the
user's home directory, or the lib
subdirectory of
the development system.
Regiszter alternatív elnevezésének létrehozása. Az alternatív név a fordítás hátralévő részében használható. Create an alternative name for a register. The alternative name can be used in the rest of the compilation.
A CPU utasításokban használható feltételek a kiválasztott processzor típusától függnek (lásd CPU direktíva). Egyes feltételek több különféle névvel is használhatók. The conditions that can be used in CPU instructions depend on the type of processor selected (see CPU directive). Some conditions can be used with several different names.
FeltételCondition | Használható nevekUsable names |
---|---|
S==0 | S0 |
S==1 | S1 |
C==0 | C0 |
C==1 | C1 |
Z==0 | Z0, NZ |
Z==1 | Z1, Z |
O==0 | O0 |
O==1 | O1 |
FeltételCondition | Használható nevekUsable names |
---|---|
Z==0 | NE, ZC, Z0, NZ, T |
Z==1 | EQ, ZS, Z1, Z, F |
C==0 (u1<u2) | CC, LO, C0, NC, ULT |
C==1 (u1>=u2) | CS, HS, C1, C, UGE |
S==0 | PL, SC, S0, NS |
S==1 | MI, SS, S1, S |
O==0 | VC, OC, V0, O0, NV, NO |
O==1 | VS, OS, V1, O1, V, O |
C==1 && Z==0 (u1>u2) | HI, UGT |
C==0 || Z==1 (u1<=u2) | LS, ULE |
S==O (s1>=s2) | GE, SGE |
S!=O (s1<s2) | LT, SLT |
Z==0 && S==O (s1>s2) | GT, SGT |
Z==1 || S!=O (s1<=s2) | LE, SLE |
Az utasításokat ismertető táblázatban a következő rövidítéseket használjuk: In the table describing the instructions, the following abbreviations are used:
A konstansokban a # jelet nem kell használni, elég a számértéket, vagy a szimbólum nevét megadni. A regiszterek közül az R13 helyett használhatjuk az SP, az R14 helyett az LR, míg az R15 helyett a PC elnevezéseket is. You don't need to use the # sign in constants, just specify the numerical value or the name of the symbol. Among the registers, you can use SP instead of R13, LR instead of R14, and PC instead of R15.
Mnemonic | Paraméterezési módok Parameterization methods | Utasítás Instruction |
---|---|---|
NOP | Rd,Ra,Rb Rda,Rb Rd - |
No operation |
LD | Rd,Ra | Load from memory |
ST | Rd,Ra | Store to memory |
MOV | Rd,Ra | Move register to register |
LDL0 | Rd,#16 | Load zex(immediate) to low |
LDL | Rd,#16 | Load low of immediate to low |
LDH | Rd,#H16 | Load high of immediate to high |
CALL | #27 | Call subroutine |
ADD | Rd,Ra,Rb Rda,Rb |
Add without carry |
ADC | Rd,Ra,Rb Rda,Rb |
Add with carry |
SUB | Rd,Ra,Rb Rda,Rb |
Subtract without borrow |
SBB | Rd,Ra,Rb Rda,Rb |
Subtract with borrow |
INC | Rd,Ra Rda |
Increment |
DEC | Rd,Ra Rda |
Decrement |
AND | Rd,Ra,Rb Rda,Rb |
Bitwise AND |
OR | Rd,Ra,Rb Rda,Rb |
Bitwise OR |
XOR | Ra,Ra,Rb Rda,Rb |
Bitwise XOR |
SHL | Rd,Ra Rda |
Shift left |
SHR | Rd,Ra Rda |
Shift right |
ROL | Rd,Ra Rda |
Rotate left |
ROR | Rd,Ra Rda |
Rotate right |
MUL | Rd,Ra,Rb Rda,Rb |
Multiply |
CMP | Rd,Ra,Rb Rda,Rb |
Compare |
SHA | Rd,Ra Rda |
Shift arithmetic right |
SETC | - | Set carry |
CLRC | - | Clear carry |
A következő makrók egyes utasítások alternatív elnevezéseiként használhatók. The following macros can be used as alternative names for some instructions.
Makró név Macro | Paraméterezési módok Parameterization methods | Jelentése Meaning |
---|---|---|
JMP | #16 | LDL0 R15,#16 |
JZ | #16 | Z LDL0 R15,#16 |
JNZ | #16 | NZ LDL0 R15,#16 |
RET | - | MOV R15,R14 |
PUSH | Rd | ST Rd,R13 |
POP | Rd | LD Rd,R13 |
Az utasításokat ismertető táblázatban a következő rövidítéseket használjuk: In the table describing the instructions, the following abbreviations are used:
A konstansokban a # jelet nem kell használni, elég a számértéket, vagy a szimbólum nevét megadni. A regiszterek közül az R13 helyett használhatjuk az SP, az R14 helyett az LR, míg az R15 helyett a PC elnevezéseket is. A speciális regiszterek azonosítására a következő elnevezések használhatók: The # sign does not need to be used in constants, it is enough to specify the numerical value or the name of the symbol. Among the registers, we can use SP instead of R13, LR instead of R14, and PC instead of R15. The following names can be used to identify special registers:
Mnemonic | Paraméterezési módok Parameterization methods | Utasítás Instruction |
---|---|---|
MOV | Rd,Rb | Move register to register |
SED | Rd,Rb | Sex to double |
MVL | Rd,#16 | Load low of immediate to low |
MVH | Rd,#H16 | Load high of immediate to high |
MVZL | Rd,#16 | Load zex(immediate) |
MVS | Rd,#16 | Load sex(immediate) |
GETB | Rd,Rb,#2 Rd,Rb,Ri |
Get byte |
GETBS | Rd,Rb,#2 Rd,Rb,Ri |
Get sign extended byte |
GETBZ | Rd,Rb,#2 Rd,Rb,Ri |
Get zero extended byte |
PUTB | Rd,Rb,#2 Rd,Rb,Ri |
Put byte |
RDS | Rd,Rs | Read special register |
WRS | Rd,Rs | Write special register |
ADD | Rd,Rn,Rb Rd,Rb Rd,#16 |
Add without carry |
ADC | Rd,Rn,Rb Rd,Rb Rd,#16 |
Add with carry |
SUB | Rd,Rn,Rb Rd,Rb Rd,#16 |
Subtract without borrow |
SBB | Rd,Rn,Rb Rd,Rb Rd,#16 |
Subtract with borrow |
CMP | Rd,Rn,Rb Rd,Rb Rd,#16 |
Compare |
MUL | Rd,Rn,Rb Rd,Rb Rd,#16 |
Multiply |
PLUS | Rd,Rb Rd,#16 |
Add without carry (do not alter flags) |
BTST | Rd,Rb Rd,#16 |
Bit test (AND) with write-back |
TEST | Rd,Rb Rd,#16 |
Bit test (AND) without write-back |
OR | Rd,Rn,Rb Rd,Rb Rd,#16 |
Bitwise OR |
XOR | Rd,Rn,Rb Rd,Rb Rd,#16 |
Bitwise XOR |
AND | Rd,Rn,Rb Rd,Rb Rd,#16 |
Bitwise AND |
ZEB | Rd | Zero extend byte |
ZEW | Rd | Zero extend word |
SEB | Rd | Sign extend byte |
SEW | Rd | Sign extend word |
NOT | Rd | Bitwise NOT |
NEG | Rd | Sign change |
ROR | Rd,Rn Rd |
Rotate right |
ROL | Rd,Rn Rd |
Rotate left |
SHL | Rd,Rn Rd |
Shift left |
SHR | Rd,Rn Rd |
Shift right |
SHA | Rd,Rn Rd |
Shift arithmetic right |
SZ | Rd | Sign, zero check |
SEC | - | Set carry |
CLC | - | Clear carry |
GETF | Rd | Get flags |
SETF | Rd | Set flags |
CALL | Rd,#20 #24 |
Call subroutine |
CES | Rd,#20 #24 |
Call subroutine with embedded string |
ST | Rd,Ra,Ri Rd,Ra+,Ri Rd,Ra-,Ri Rd,+Ra,Ri Rd,-Ra,Ri Rd,Ra,#16 Rd,*Ra,#16 Rd,Ra Rd,#16 #16,Rd |
Store to memory |
LD | Rd,Ra,Ri Rd,Ra+,Ri Rd,Ra-,Ri Rd,+Ra,Ri Rd,-Ra,Ri Rd,Ra,#16 Rd,*Ra,#16 Rd,Ra Rd,#16 #16,Rd |
Load from memory |
A következő makrók egyes utasítások alternatív elnevezéseiként használhatók. The following macros can be used as alternative names for some instructions.
Makró név Macro | Paraméterezési módok Parameterization methods | Jelentése Meaning |
---|---|---|
NOP | - | MOV R0,R0 |
JMP | #16 | MVZL R15,#16 |
JZ | #16 | Z MVZL R15,#16 |
FALSE | #16 | Z MVZL R15,#16 |
JNZ | #16 | NZ MVZL R15,#16 |
TRUE | #16 | NZ MVZL R15,#16 |
JC | #16 | C MVZL R15,#16 |
JNC | #16 | NC MVZL R15,#16 |
JP | Rb | MOV R15,Rb |
RET | - | MOV R15,R14 |
PUSH | Rd | ST Rd,*R13,0 |
POP | Rd | LD Rd,*R13,0 |
INC | Rd | ADD Rd,1 |
DEC | Rd | ADD Rd,-1 |
LDL0 | Rd,#16 | MVZL Rd,#16 |
LDL | Rd,#16 | MVL Rd,#16 |
LDH | Rd,#16 | MVH Rd,#16 |