-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInput.hla
60 lines (52 loc) · 1.28 KB
/
Input.hla
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
program intInput;
#include( "stdlib.hhf" )
static
i8: int8;
i16: int16;
i32: int32;
begin intInput;
repeat
try
stdout.put( "Insira um inteiro entre -128 e +127: " );
stdin.readLn();
stdin.geti8();
mov( al, i8 );
exception( ex.ValueOutOfRange );
stdout.put( "Valor fora de escopo, insira novamente", nl );
exception( ex.ConversionError );
stdout.put( "Valor nao valido, insira novamente", nl );
endtry;
until(al == i8 );
repeat
try
stdout.put( "Insira um inteiro entre -32768 e +32767: " );
stdin.readLn();
stdin.geti16();
mov( ax, i16 );
exception( ex.ValueOutOfRange );
stdout.put( "Valor fora de escopo, insira novamente", nl );
exception( ex.ConversionError );
stdout.put( "Valor nao valido, insira novamente", nl );
endtry;
until( ax == i16 );
repeat
try
stdout.put( "Insira um inteiro entre +/- 2 bihoes: " );
stdin.readLn();
stdin.geti32();
mov( eax, i32 );
exception( ex.ValueOutOfRange );
stdout.put( "Valor fora de escopo, insira novamente", nl );
exception( ex.ConversionError );
stdout.put( "Valor nao valido, insira novamente", nl );
endtry;
until( eax == i32 );
stdout.put
(
nl,
"Numeros inseridos:", nl, nl,
"Inteiro de 8 bits: ", i8:12, nl,
"Inteiro de 16 bits: ", i16:12, nl,
"Inteiro de 32 bits: ", i32:12, nl
);
end intInput;