raw character rune is now raw string rune
This commit is contained in:
parent
772fdcbe01
commit
7ed0dbafbd
|
@ -430,7 +430,7 @@ si solo queremos tener un número específico en la memoria principal, sin empuj
|
|||
|
||||
## runa de carácter crudo o "raw"
|
||||
|
||||
esta es la runa de carácter crudo: '
|
||||
esta es la runa de caracteres crudos: "
|
||||
|
||||
nos permite que uxnasm decodifique el valor numérico de un carácter ascii.
|
||||
|
||||
|
@ -438,10 +438,10 @@ nuestro programa "hola" luciría de la siguiente manera, usando las nuevas runas
|
|||
|
||||
```
|
||||
( hola.tal )
|
||||
|0100 LIT 'h #18 DEO
|
||||
LIT 'o #18 DEO
|
||||
LIT 'l #18 DEO
|
||||
LIT 'a #18 DEO
|
||||
|0100 LIT "h #18 DEO
|
||||
LIT "o #18 DEO
|
||||
LIT "l #18 DEO
|
||||
LIT "a #18 DEO
|
||||
#0a #18 DEO ( nuevalínea )
|
||||
```
|
||||
|
||||
|
@ -494,10 +494,10 @@ podemos reescribir nuestro "programa hola mundo" como sigue:
|
|||
|10 @Consola [ &vector $2 &lee $1 &pad $5 &escribe $1 &error $1 ]
|
||||
|
||||
( programa principal )
|
||||
|0100 LIT 'h .Consola/escribe DEO
|
||||
LIT 'o .Consola/escribe DEO
|
||||
LIT 'l .Consola/escribe DEO
|
||||
LIT 'a .Consola/escribe DEO
|
||||
|0100 LIT "h .Consola/escribe DEO
|
||||
LIT "o .Consola/escribe DEO
|
||||
LIT "l .Consola/escribe DEO
|
||||
LIT "a .Consola/escribe DEO
|
||||
#0a .Consola/escribe DEO ( nuevalínea )
|
||||
```
|
||||
|
||||
|
@ -528,7 +528,7 @@ para llamar a un macro, solo escribimos su nombre:
|
|||
|
||||
```
|
||||
( imprime carácter h )
|
||||
LIT 'h EMIT
|
||||
LIT "h EMIT
|
||||
```
|
||||
|
||||
podemos llamar a macros dentro de macros, por ejemplo:
|
||||
|
@ -554,10 +554,10 @@ usando todos estos macros y runas, nuestro programa puede terminar luciendo como
|
|||
%NL { #0a EMIT } ( -- )
|
||||
|
||||
( programa principal )
|
||||
|0100 LIT 'h EMIT
|
||||
LIT 'o EMIT
|
||||
LIT 'l EMIT
|
||||
LIT 'a EMIT
|
||||
|0100 LIT "h EMIT
|
||||
LIT "o EMIT
|
||||
LIT "l EMIT
|
||||
LIT "a EMIT
|
||||
NL
|
||||
```
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ el siguiente código leerá el valor de la tecla del controlador y empujará a l
|
|||
|
||||
```
|
||||
.Controlador/tecla DEI ( lee la tecla y la empuja hacia abajo en la pila )
|
||||
LIT 'a ( empuja el código ascii del carácter 'a' )
|
||||
LIT "a ( empuja el código ascii del carácter 'a' )
|
||||
EQU ( compara ambos bytes y empuja 01 si son iguales, 00 si no )
|
||||
```
|
||||
|
||||
|
@ -208,9 +208,9 @@ el siguiente código empujará una bandera hacia abajo en la pila si el byte tec
|
|||
|
||||
```
|
||||
.Controlador/tecla DEI ( lee la tecla y la empuja a la pila )
|
||||
LIT '1 EQU ( ¿es '1'? empuja la bandera a la pila )
|
||||
LIT "1 EQU ( ¿es '1'? empuja la bandera a la pila )
|
||||
.Controlador/tecla DEI ( lee la tecla y empujar a la pila )
|
||||
LIT 'a EQU ( ¿es 'a'? empuja la bandera a la pila )
|
||||
LIT "a EQU ( ¿es 'a'? empuja la bandera a la pila )
|
||||
ORA ( aplica un OR a las banderas en la pila y empuja el resultado en la pila )
|
||||
```
|
||||
|
||||
|
@ -311,7 +311,7 @@ la siguiente subrutina en-controlador ilustra el uso de los saltos, dibujando nu
|
|||
```
|
||||
@en-controlador
|
||||
.Controlador/tecla DEI ( lee la tecla )
|
||||
LIT '1 EQU ( ¿es '1'? )
|
||||
LIT "1 EQU ( ¿es '1'? )
|
||||
|
||||
( salta a dibuja-sprite si es el caso )
|
||||
,&dibuja-sprite JCN
|
||||
|
@ -353,13 +353,13 @@ el siguiente código ilustra el uso de muchas condiciones: el color del sprite c
|
|||
( establecer direccion del sprite )
|
||||
;cuadrado .Pantalla/direc DEO2
|
||||
|
||||
.Controlador/tecla DEI LIT '1 EQU ( ¿es la tecla '1'? )
|
||||
.Controlador/tecla DEI LIT "1 EQU ( ¿es la tecla '1'? )
|
||||
,&color-1 JCN ( salta al color-1 si es el caso )
|
||||
|
||||
.Controlador/tecla DEI LIT '2 EQU ( ¿es la tecla '2'? )
|
||||
.Controlador/tecla DEI LIT "2 EQU ( ¿es la tecla '2'? )
|
||||
,&color-2 JCN ( salta al color-2 si es el caso )
|
||||
|
||||
.Controlador/tecla DEI LIT '3 EQU ( ¿es la tecla '3'? )
|
||||
.Controlador/tecla DEI LIT "3 EQU ( ¿es la tecla '3'? )
|
||||
,&color-3 JCN ( salta al color-3 si es el caso )
|
||||
|
||||
( en cualquier otro caso, terminar )
|
||||
|
@ -525,13 +525,13 @@ podríamos reescribirlo usando varios DUPs y POPs:
|
|||
;cuadrado .Pantalla/direc DEO2
|
||||
|
||||
.Controlador/tecla DEI ( leer tecla )
|
||||
DUP LIT '1 EQU ( ¿es la tecla '1'? )
|
||||
DUP LIT "1 EQU ( ¿es la tecla '1'? )
|
||||
,&color-1 JCN ( salta al color-1 si es el caso )
|
||||
|
||||
DUP LIT '2 EQU ( ¿es la tecla '2'? )
|
||||
DUP LIT "2 EQU ( ¿es la tecla '2'? )
|
||||
,&color-2 JCN ( salta al color-2 si es el caso )
|
||||
|
||||
DUP LIT '3 EQU ( ¿es la tecla '3'? )
|
||||
DUP LIT "3 EQU ( ¿es la tecla '3'? )
|
||||
,&color-3 JCN ( salta al color-3 si es el caso )
|
||||
|
||||
( en cualquier otro caso, termina )
|
||||
|
|
|
@ -61,11 +61,11 @@ podemos usar una estructura como la siguiente, donde el nombre del archivo y la
|
|||
Archivo0/éxito DEI2 #0000 EQU2 ,&fallo JCN
|
||||
|
||||
&éxito
|
||||
LIT 'Y .Consola/escribe DEO
|
||||
LIT "Y .Consola/escribe DEO
|
||||
RTN
|
||||
|
||||
&fallo
|
||||
LIT 'N .Consola/escribe DEO
|
||||
LIT "N .Consola/escribe DEO
|
||||
RTN
|
||||
|
||||
@archivo
|
||||
|
@ -107,11 +107,11 @@ el siguiente programa escribirá "hola" y una nueva línea (0a) en un archivo ll
|
|||
.Archivo0/éxito DEI2 #0006 NEQ2 ,&fallo JCN
|
||||
|
||||
&éxito
|
||||
LIT 'Y .Consola/escribe DEO
|
||||
LIT "Y .Consola/escribe DEO
|
||||
RTN
|
||||
|
||||
&fallo
|
||||
LIT 'N .Consola/escribe DEO
|
||||
LIT "N .Consola/escribe DEO
|
||||
RTN
|
||||
|
||||
@archivo
|
||||
|
|
|
@ -407,7 +407,7 @@ if we just want to have a specific number in the main memory, without pushing it
|
|||
|
||||
## raw character rune
|
||||
|
||||
this is the raw character rune: '
|
||||
this is the raw character or string rune: "
|
||||
|
||||
uxnasm reads the ascii character after the rune, and decodes its numerical value.
|
||||
|
||||
|
@ -415,11 +415,11 @@ using this rune, our "hello program" would look like the following:
|
|||
|
||||
```
|
||||
( hello.tal )
|
||||
|0100 LIT 'h #18 DEO
|
||||
LIT 'e #18 DEO
|
||||
LIT 'l #18 DEO
|
||||
LIT 'l #18 DEO
|
||||
LIT 'o #18 DEO
|
||||
|0100 LIT "h #18 DEO
|
||||
LIT "e #18 DEO
|
||||
LIT "l #18 DEO
|
||||
LIT "l #18 DEO
|
||||
LIT "o #18 DEO
|
||||
#0a #18 DEO ( newline )
|
||||
```
|
||||
|
||||
|
@ -472,11 +472,11 @@ we could re-write our "hello program" as follows:
|
|||
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|
||||
|
||||
( main program )
|
||||
|0100 LIT 'h .Console/write DEO
|
||||
LIT 'e .Console/write DEO
|
||||
LIT 'l .Console/write DEO
|
||||
LIT 'l .Console/write DEO
|
||||
LIT 'o .Console/write DEO
|
||||
|0100 LIT "h .Console/write DEO
|
||||
LIT "e .Console/write DEO
|
||||
LIT "l .Console/write DEO
|
||||
LIT "l .Console/write DEO
|
||||
LIT "o .Console/write DEO
|
||||
#0a .Console/write DEO ( newline )
|
||||
```
|
||||
|
||||
|
@ -509,7 +509,7 @@ in order to call a macro, we just write its name:
|
|||
|
||||
```
|
||||
( print character h )
|
||||
LIT 'h EMIT
|
||||
LIT "h EMIT
|
||||
```
|
||||
|
||||
we can call macros inside macros, for example:
|
||||
|
@ -535,11 +535,11 @@ using all these macros and runes, our program could end up looking like the foll
|
|||
%NL { #0a EMIT } ( -- )
|
||||
|
||||
( main program )
|
||||
|0100 LIT 'h EMIT
|
||||
LIT 'e EMIT
|
||||
LIT 'l EMIT
|
||||
LIT 'l EMIT
|
||||
LIT 'o EMIT
|
||||
|0100 LIT "h EMIT
|
||||
LIT "e EMIT
|
||||
LIT "l EMIT
|
||||
LIT "l EMIT
|
||||
LIT "o EMIT
|
||||
NL
|
||||
```
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ here's a small example. the following code will read the value of the controller
|
|||
|
||||
```
|
||||
.Controller/key DEI ( read key and push it down into the stack )
|
||||
LIT 'a ( push ascii code of character 'a' )
|
||||
LIT "a ( push ascii code of character 'a' )
|
||||
EQU ( compare both bytes and push 01 if they are the same, 00 if not )
|
||||
```
|
||||
|
||||
|
@ -208,9 +208,9 @@ the following code will push a flag down into the stack if the key byte is eithe
|
|||
|
||||
```
|
||||
.Controller/key DEI ( read key and push into the stack )
|
||||
LIT '1 EQU ( is it '1'? push flag into the stack )
|
||||
LIT "1 EQU ( is it '1'? push flag into the stack )
|
||||
.Controller/key DEI ( read key and push into the stack )
|
||||
LIT 'a EQU ( is it 'a'? push flag into the stack )
|
||||
LIT "a EQU ( is it 'a'? push flag into the stack )
|
||||
ORA ( apply an OR to the flags in the stack, and push the result in the stack )
|
||||
```
|
||||
|
||||
|
@ -311,7 +311,7 @@ the following on-controller subroutine illustrates the use of jumps, drawing our
|
|||
```
|
||||
@on-controller
|
||||
.Controller/key DEI ( read key )
|
||||
LIT '1 EQU ( is it '1'? )
|
||||
LIT "1 EQU ( is it '1'? )
|
||||
|
||||
( jump to draw-sprite if that's the case )
|
||||
,&draw-sprite JCN
|
||||
|
@ -353,13 +353,13 @@ the following code illustrates the use of many conditions: the color of the spri
|
|||
( set sprite address )
|
||||
;square .Screen/addr DEO2
|
||||
|
||||
.Controller/key DEI LIT '1 EQU ( is the key '1'? )
|
||||
.Controller/key DEI LIT "1 EQU ( is the key '1'? )
|
||||
,&color-1 JCN ( jump to color-1 if that's the case )
|
||||
|
||||
.Controller/key DEI LIT '2 EQU ( is the key '2'? )
|
||||
.Controller/key DEI LIT "2 EQU ( is the key '2'? )
|
||||
,&color-2 JCN ( jump to color-2 if that's the case )
|
||||
|
||||
.Controller/key DEI LIT '3 EQU ( is the key '3'? )
|
||||
.Controller/key DEI LIT "3 EQU ( is the key '3'? )
|
||||
,&color-3 JCN ( jump to color-3 if that's the case )
|
||||
|
||||
( in any other case, finish )
|
||||
|
@ -525,13 +525,13 @@ we could rewrite it using several DUPs and POPs:
|
|||
;square .Screen/addr DEO2
|
||||
|
||||
.Controller/key DEI ( read key )
|
||||
DUP LIT '1 EQU ( is the key '1'? )
|
||||
DUP LIT "1 EQU ( is the key '1'? )
|
||||
,&color-1 JCN ( jump to color-1 if that's the case )
|
||||
|
||||
DUP LIT '2 EQU ( is the key '2'? )
|
||||
DUP LIT "2 EQU ( is the key '2'? )
|
||||
,&color-2 JCN ( jump to color-2 if that's the case )
|
||||
|
||||
DUP LIT '3 EQU ( is the key '3'? )
|
||||
DUP LIT "3 EQU ( is the key '3'? )
|
||||
,&color-3 JCN ( jump to color-3 if that's the case )
|
||||
|
||||
( in any other case, finish )
|
||||
|
|
|
@ -61,11 +61,11 @@ we can use a structure like the following, where the filename and reserved memor
|
|||
.File0/success DEI2 #0000 EQU2 ,&failed JCN
|
||||
|
||||
&success
|
||||
LIT 'Y .Console/write DEO
|
||||
LIT "Y .Console/write DEO
|
||||
RTN
|
||||
|
||||
&failed
|
||||
LIT 'N .Console/write DEO
|
||||
LIT "N .Console/write DEO
|
||||
RTN
|
||||
|
||||
@file
|
||||
|
@ -107,11 +107,11 @@ the following program will write "hello" and a newline (0a) into a file called "
|
|||
.File/success DEI2 #0006 NEQ2 ,&failed JCN
|
||||
|
||||
&success
|
||||
LIT 'Y .Console/write DEO
|
||||
LIT "Y .Console/write DEO
|
||||
RTN
|
||||
|
||||
&failed
|
||||
LIT 'N .Console/write DEO
|
||||
LIT "N .Console/write DEO
|
||||
RTN
|
||||
|
||||
@file
|
||||
|
|
Loading…
Reference in New Issue