-
Notifications
You must be signed in to change notification settings - Fork 0
/
marco.asm
110 lines (101 loc) · 1.41 KB
/
marco.asm
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
.module marco
pantalla .equ 0xFF00
m .equ 0xE000
.globl marco
.globl imprime_cadena
.globl imprimir_num
sumaExt: .word 0
sumaInt: .word 0
filas: .byte 0
columnas: .byte 0
tam: .word 0
filimp: .byte 0
colimp: .byte 0
f: .byte 0
c: .byte 0
contador: .byte 0
sext: .asciz "\n SUMA EXTERIOR-> "
sint: .asciz "\n SUMA INTERIOR-> "
simarco: .asciz "\n Es matriz marco"
nomarco: .asciz "\n No es matriz marco"
marco:
ldy #m
sta filas
stb columnas
mul
std tam
ldd #0
std contador
;mientras contador != tam
buclecarga:
ldd #0
ldd ,y++
addd sumaExt
std sumaExt
ldd contador
addd #1
std contador
cmpd tam
bne buclecarga
;;;;;;;;;;;;
ldy #m
ldb columnas
lslb
incb
incb
clra
leay d,y; en y tenemos ya la mat[1][1]
ldb filas
subb #2
stb filimp
clrb
ldb columnas
subb #2
stb colimp
clra clrb
ldb #1
buclefil:
ldb f
cmpb filimp
beq fin_filas
addb #1
stb f
buclecol:
ldb c
cmpb colimp
beq fin_col
addb #1
stb c
ldd #0
ldd ,y++
addd sumaInt
std sumaInt
bra buclecol
fin_col:
leay 4,y
ldb #0
stb c
bra buclefil
fin_filas:
clra clrb
ldd sumaExt
subd sumaInt
ldx #sext
jsr imprime_cadena
std sumaExt
jsr imprimir_num
ldx #sint
jsr imprime_cadena
ldd sumaInt
jsr imprimir_num
ldd sumaExt
cmpd sumaInt
bgt esmarco
ldx #nomarco
jsr imprime_cadena
bra salir
esmarco:
ldx #simarco
jsr imprime_cadena
salir:
rts