382 lines
5.1 KiB
Text
382 lines
5.1 KiB
Text
! .MACRO SUM FROM=0, TO=9
|
|
! ; \FROM \TO
|
|
! MOV R\FROM,R10
|
|
!COUNT .ASSIGNA \FROM+1
|
|
! .AWHILE \&COUNT LE \TO
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! .ENDM
|
|
!
|
|
|
|
! SUM 0,5
|
|
! ; 0 5
|
|
; 0 5
|
|
! MOV R0,R10
|
|
MOV R0,R10
|
|
!COUNT .ASSIGNA 0+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R1,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R2,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R3,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R4,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R5,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! SUM TO=5
|
|
! ; 0 5
|
|
; 0 5
|
|
! MOV R0,R10
|
|
MOV R0,R10
|
|
!COUNT .ASSIGNA 0+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R1,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R2,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R3,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R4,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R5,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! SUM FROM=2, TO=5
|
|
! ; 2 5
|
|
; 2 5
|
|
! MOV R2,R10
|
|
MOV R2,R10
|
|
!COUNT .ASSIGNA 2+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R3,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R4,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
! MOV R\&COUNT,R10
|
|
MOV R5,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AWHILE \&COUNT LE 5
|
|
! MOV R\&COUNT,R10
|
|
!COUNT .ASSIGNA \&COUNT+1
|
|
! .AENDW
|
|
!
|
|
|
|
!
|
|
|
|
!; hi this is a comment
|
|
; hi this is a comment
|
|
! .MACRO BACK_SLASH_SET
|
|
! \(MOV #"\",R0)
|
|
! .ENDM
|
|
! BACK_SLASH_SET
|
|
! MOV #"\",R0
|
|
MOV #"\",R0
|
|
! .MACRO COMM
|
|
! bar ; this comment will get copied out
|
|
! foo \; this one will get dropped
|
|
! .ENDM
|
|
! COMM
|
|
! bar ; this comment will get copied out
|
|
bar ; this comment will get copied out
|
|
! foo \; this one will get dropped
|
|
foo \; this one will get dropped
|
|
! BACK_SLASH_SET
|
|
! MOV #"\",R0
|
|
MOV #"\",R0
|
|
! .MACRO PLUS2
|
|
! ADD #1,R\&V1
|
|
! .SDATA "\&V'1"
|
|
! .ENDM
|
|
!V .ASSIGNC "R"
|
|
!V1 .ASSIGNA 1
|
|
! PLUS2
|
|
! ADD #1,R\&V1
|
|
ADD #1,R1
|
|
! .SDATA "\&V'1"
|
|
.byte 82,49
|
|
! .MACRO PLUS1 P,P1
|
|
! ADD #1,\P1
|
|
! .SDATA "\P'1"
|
|
! .ENDM
|
|
! PLUS1 R,R1
|
|
! ADD #1,R1
|
|
ADD #1,R1
|
|
! .SDATA "R1"
|
|
.byte 82,49
|
|
!
|
|
|
|
! .MACRO SUM P1
|
|
! MOV R0,R10
|
|
! ADD R1,R10
|
|
! ADD R2,R10
|
|
! \P1
|
|
! ADD R3,R10
|
|
! .ENDM
|
|
!
|
|
|
|
! SUM .EXITM
|
|
! MOV R0,R10
|
|
MOV R0,R10
|
|
! ADD R1,R10
|
|
ADD R1,R10
|
|
! ADD R2,R10
|
|
ADD R2,R10
|
|
! .EXITM
|
|
!
|
|
|
|
! .MACRO foo bar=a default=b
|
|
! \bar
|
|
! \default
|
|
! bar
|
|
! default
|
|
! .ENDM
|
|
! foo default=dog bar=cat
|
|
! cat
|
|
cat
|
|
! dog
|
|
dog
|
|
! bar
|
|
bar
|
|
! default
|
|
default
|
|
! foo X Y
|
|
! X
|
|
X
|
|
! Y
|
|
Y
|
|
! bar
|
|
bar
|
|
! default
|
|
default
|
|
! foo
|
|
! a
|
|
a
|
|
! b
|
|
b
|
|
! bar
|
|
bar
|
|
! default
|
|
default
|
|
! foo bar=cat default=dog
|
|
! cat
|
|
cat
|
|
! dog
|
|
dog
|
|
! bar
|
|
bar
|
|
! default
|
|
default
|
|
!
|
|
|
|
!
|
|
|
|
! .MACRO foo bar
|
|
! HI
|
|
! HI \bar
|
|
! HI
|
|
! .ENDM
|
|
!
|
|
|
|
! foo 1
|
|
! HI
|
|
HI
|
|
! HI 1
|
|
HI 1
|
|
! HI
|
|
HI
|
|
! foo 123
|
|
! HI
|
|
HI
|
|
! HI 123
|
|
HI 123
|
|
! HI
|
|
HI
|
|
! foo 1 2 3 4
|
|
! foo
|
|
! HI
|
|
HI
|
|
! HI
|
|
HI
|
|
! HI
|
|
HI
|
|
!
|
|
|
|
!
|
|
! .MACRO PUSH Rn
|
|
! MOV.L \Rn,@-r15
|
|
! .ENDM
|
|
! PUSH R0
|
|
! MOV.L R0,@-r15
|
|
MOV.L R0,@-r15
|
|
! PUSH R1
|
|
! MOV.L R1,@-r15
|
|
MOV.L R1,@-r15
|
|
!
|
|
|
|
!
|
|
|
|
! .MACRO RES_STR STR, Rn
|
|
! MOV.L #str\@,\Rn
|
|
! BRA end_str\@
|
|
! NOP
|
|
!str\@ .SDATA "\STR"
|
|
! .ALIGN 2
|
|
!end_str\@
|
|
! .ENDM
|
|
!
|
|
! RES_STR "ONE",R0
|
|
! MOV.L #str18,R0
|
|
MOV.L #str18,R0
|
|
! BRA end_str18
|
|
BRA end_str18
|
|
! NOP
|
|
NOP
|
|
!str18 .SDATA "ONE"
|
|
str18: .byte 79,78,69
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str18
|
|
end_str18:
|
|
! RES_STR "TWO",R1
|
|
! MOV.L #str19,R1
|
|
MOV.L #str19,R1
|
|
! BRA end_str19
|
|
BRA end_str19
|
|
! NOP
|
|
NOP
|
|
!str19 .SDATA "TWO"
|
|
str19: .byte 84,87,79
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str19
|
|
end_str19:
|
|
! RES_STR "THREE",R2
|
|
! MOV.L #str20,R2
|
|
MOV.L #str20,R2
|
|
! BRA end_str20
|
|
BRA end_str20
|
|
! NOP
|
|
NOP
|
|
!str20 .SDATA "THREE"
|
|
str20: .byte 84,72,82,69,69
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str20
|
|
end_str20:
|
|
!
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! RES_STR STR=donkey Rn=R1
|
|
! MOV.L #str21,R1
|
|
MOV.L #str21,R1
|
|
! BRA end_str21
|
|
BRA end_str21
|
|
! NOP
|
|
NOP
|
|
!str21 .SDATA "donkey"
|
|
str21: .byte 100,111,110,107,101,121
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str21
|
|
end_str21:
|
|
! RES_STR donkey,R1
|
|
! MOV.L #str22,R1
|
|
MOV.L #str22,R1
|
|
! BRA end_str22
|
|
BRA end_str22
|
|
! NOP
|
|
NOP
|
|
!str22 .SDATA "donkey"
|
|
str22: .byte 100,111,110,107,101,121
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str22
|
|
end_str22:
|
|
! RES_STR donkey Rn=R1
|
|
! MOV.L #str23,R1
|
|
MOV.L #str23,R1
|
|
! BRA end_str23
|
|
BRA end_str23
|
|
! NOP
|
|
NOP
|
|
!str23 .SDATA "donkey"
|
|
str23: .byte 100,111,110,107,101,121
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str23
|
|
end_str23:
|
|
! .END
|