Index | Fejlesztés Development | CPU | Számítógép Computer | Assembler | Monitor | Függvények Library


Kimenet Output | Input Bemenet | Karakter Character | Sztring String | Matematika Math | Kártya Board | Rendszer System | Egyéb Standard | Terminál Terminal
Lang: Nyelv: HU EN

Output functions Kimeneti függvények

putchar

A bemenetként megadott karakterkód kiírása az UART periférián keresztül a terminálra. A függvény először megvárja az előzőleg kiírt karakter kiküldését. Writes the character code given as input to the terminal via the UART peripheral. The function first waits for the previously written character to be sent.

prints

Szöveg (0 végződésű karaktersorozat) kiírása a terminálra. Write text (string of characters ending in 0) to the terminal.

printsnl

Szöveg (0 végződésű karaktersorozat) kiírása a terminálra, ezután a függvény kiír egy soremelés karaktert. Write text (a string of characters ending in 0) to the terminal, then the function prints a newline character.

printh

Kiírja a bemeneti 32 bites bináris egész szám értékét a terminálra hexadecimális számrendszerben, 8 karakteren, bevezető nullákkal. Az R1-ben megadott számú karakterenként egy _ elválasztó jelet is kiír. Prints the value of the input 32-bit binary integer to the terminal in hexadecimal, 8 characters, with leading zeros. It also prints a _ separator after every number of characters specified in R1.

printd

A bemenetként megadott 32 bites (pozitív) bináris számot kiírja a terminálra tízes számrendszerben. The 32-bit (positive) binary number given as input is printed to the terminal in decimal.

eprints

Beágyazott, 0 végződésű karaktertömb kiírása a terminálra. A sztringnek a program kódjában közvetlenül a szubrutint meghívó CALL/CES utasítás után kell lennie. A szubrutin a sztring záró nullája utáni címre fog visszatérni. Escape szekvenciák (formázó karakterek) nem használhatók. A funkciónak sem bemeneti, sem kimeneti paraméterei nincsenek. Helyes használatára egy példa: Writes a nested, 0-terminated character array to the terminal. The string must be in the program code immediately after the CALL/CES statement that calls the subroutine. The subroutine will return to the address after the trailing zero of the string. Escape sequences (formatting characters) cannot be used. The function has neither input nor output parameters. Here is an example of its correct usage:

nop ces eprints db ”Hello World!\n” mvzl r0,12 ...

A CALL utasítás helyett ebben az esetben használható a CES utasítás is. Instead of the CALL instruction, the CES instruction can also be used in this case.

printf

Formázott szöveg kiírása a terminálra. A szövegben elhelyezhetők formázó utasítások (% jellel kezdve), amelyek egy adat megfelelő formátumban való kiírását eredményezik. Az adatokat az R1..R12 regiszterekben adhatjuk át, amelyekből sorban annyit használ fel a szubrutin, amennyi formázó utasítás van a szövegben. Print formatted string to the terminal. Formatting instructions (starting with the % sign) can be placed in the string, which result in the printing of a data in the appropriate format. The data can be transferred in the registers R1..R12, of which the subroutine uses as many of the formatting instructions in the text.

A szubrutin által kezelt formázó utasítások a következők: The formatting instructions handled by the subroutine are:

Utasítás Instruction Formátum Format Példa, megjegyzés Example, note
%% Százalékjel Percent sign %
%u Előjel nélküli decimális Unsigned decimal 12345
%d Előjeles decimális Signed decimal -12345
%x 32 bites hexadecimális 32 bit hexadecimal 1a2b3c5d
%b 32 bites bináris 32 bit binary 00010010001101000101011001111000
%p 32 bites pointer 32 bit pointer 02AB_CD78
%s Szöveg String az adat regiszternek a beillesztendő (normál, vagy pakolt) szöveg címét kell tartalmaznia the data register must contain the address of the string to be inserted (normal or packed)
%c Karakter Character az adat regiszterben lévő ASCII kódot írja ki prints the ASCII code in the data register

A % jel és a formázó utasítás között lehetnek paraméterek, amelyek befolyásolhatják a kiírás jellemzőit. There may be parameters between the % sign and the formatting statement that can affect the characteristics of the output.

szám number

Mező szélesség Field width

A paraméternek 0-tól eltérő számjeggyel kezdődő decimális számnak kell lennie. A formázó utasítás által kiírt szöveg által elfoglalt karakterhelyek számát adja meg. A %d, %u esetén a szám akkor is kiíródik, ha ennél hosszabb. %x, %b esetén a hosszabb szövegek balról csonkolódnak, tehát csak a megadott számú alsó helyiértékek karakterei íródnak ki. The parameter must be a decimal number starting with a digit other than 0. It specifies the number of character positions occupied by the text printed by the formatting instruction. In the case of %d, %u, the number is printed even if it is longer. In the case of %x, %b, longer texts are truncated from the left, so only the characters of the specified number of lower part ​​are printed.

%d "10000" %15d " 10000" %u "4294967196" %5u "4294967196" %15u " 4294967196" %x "3e8" %5x "003e8" %15x " 3e8" %2x "e8" %b "00010010001101000101011001111000" %34b " 00010010001101000101011001111000" %9b "001111000"

-

Balra igazítás Left align

Akkor van hatása, ha megadjuk a kiíráshoz a mező szélességet, és a szélesség nagyobb, mint a behelyettesített szöveg hossza. Ebben az esetben a kiírás a mező bal széléhez lesz igazítva, a jobb szél helyett. It has an effect if we specify the field width for the output, and the width is greater than the length of the resulting text. In this case, the output will be aligned to the left side of the field, instead of the right side.

%20s " HelloWorld!" %-20s "HelloWorld! " %5u "4294967196" %15u " 4294967196" %-15u "4294967196 " %5d "10000" %15d " 10000" %-15d "10000 " %5x "003e8" %15x " 3e8" %-15x "3e8 " %5bb "11000" %34b " 00010010001101000101011001111000" %-34b "00010010001101000101011001111000 "

+

Előjel Show sign

Csak a %d formátum esetében van hatása. Ha megadjuk, akkor a pozitív számok előjele is kiíródik. Only has an effect for the %d format. If it is specified, the sign of positive numbers is also printed.

%d "10000" %+d "+10000" %-+15d "+10000 "

0

Balról kitöltés 0-val Fill left side with 0

Szám típusú formátumok (%u, %d, %x, %b) esetén van hatása akkor, ha a szám előjele nem jelenik meg, meg van adva a mező szélesség és ez nagyobb mint a szöveg hossza. Ekkor a megadott mezőhossz balról 0 karakterekkel lesz feltöltve. For number type formats (%u, %d, %x, %b), it has an effect if the number sign is not displayed, the field width is specified and it is greater than the length of the text. In this case, the specified field length will be filled with 0 characters from the left.

%015u "000004294967196" %015d "000000000010000" %0+15d " +10000" %015d " -1000" %015x "0000000000003e8" %034b "0000010010001101000101011001111000"

eprintf

Beágyazott, 0 végződésű formázó szöveg kiírása a terminálra. A formázó szövegnek közvetlenül a CALL (vagy CES) utasítás után kell lennie, a további paraméterek a printf szubrutinéval egyeznek, azonban ez a funkció az R0 regiszterben nem vár bemenő adatot. Prints embedded, 0-terminated formatting text to the terminal. The formatting text must be placed immediately after the CALL (or CES) instruction, the additional parameters are the same as those of the printf subroutine, but this function does not require input data in the R0 register.

UART_CPB = 0xff44 ld r1,UART_CPB mov r2,r1 ces eprintf db ”Uart cpb= %d (0x%x)\n” nop ...