aboutsummaryrefslogtreecommitdiff
path: root/assembler/register.s
blob: dd0e1ae0221e4343ea68a82099ba9f11d1eebe34 (plain)
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
61
62
register4:
  PUSH {LR}
10:
  BL get_char
  MOVS R1, 'R
  CMPS R0, R1
  BNE 10b
20:
  BL get_char
  MOVS R1, '0
  CMPS R0, R1
  BLO 20b
  MOVS R1, '9
  CMPS R0, R1
  BHI 20b
  MOVS R1, '1
  CMPS R0, R1
  BNE 30f
50:
  BL get_char
  BEQ 60f
  MOVS R1, '0
  CMPS R0, R1
  BLO 50b
  MOVS R1, '5
  CMPS R0, R1
  BHI 50b
  ADDS R0, 10
30:
  SUBS R0, '0
  MOVS R4, 0
  ORRS R4, R0
40:
  BL get_char
  BNE 40b
  POP {PC}
60:
  MOVS R4, 1
  POP {PC}

register3:
  PUSH {LR}
10:
  BL get_char
  MOVS R1, 'R
  CMPS R0, R1
  BNE 10b
20:
  BL get_char
  MOVS R1, '0
  CMPS R0, R1
  BLO 20b
  MOVS R1, '7
  CMPS R0, R1
  BHI 20b
30:
  SUBS R0, '0
  MOVS R4, 0
  ORRS R4, R0
  BL get_char
  BNE 40b
  POP {PC}