383 lines
5.3 KiB
Plaintext
383 lines
5.3 KiB
Plaintext
! .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 #str00018,R0
|
|
MOV.L #str00018,R0
|
|
! BRA end_str00018
|
|
BRA end_str00018
|
|
! NOP
|
|
NOP
|
|
!str00018 .SDATA "ONE"
|
|
str00018: .byte 79,78,69
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str00018
|
|
end_str00018:
|
|
! RES_STR "TWO",R1
|
|
! MOV.L #str00019,R1
|
|
MOV.L #str00019,R1
|
|
! BRA end_str00019
|
|
BRA end_str00019
|
|
! NOP
|
|
NOP
|
|
!str00019 .SDATA "TWO"
|
|
str00019: .byte 84,87,79
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str00019
|
|
end_str00019:
|
|
! RES_STR "THREE",R2
|
|
! MOV.L #str00020,R2
|
|
MOV.L #str00020,R2
|
|
! BRA end_str00020
|
|
BRA end_str00020
|
|
! NOP
|
|
NOP
|
|
!str00020 .SDATA "THREE"
|
|
str00020: .byte 84,72,82,69,69
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str00020
|
|
end_str00020:
|
|
!
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! RES_STR STR=donkey Rn=R1
|
|
! MOV.L #str00021,R1
|
|
MOV.L #str00021,R1
|
|
! BRA end_str00021
|
|
BRA end_str00021
|
|
! NOP
|
|
NOP
|
|
!str00021 .SDATA "donkey"
|
|
str00021: .byte 100,111,110,107,101,121
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str00021
|
|
end_str00021:
|
|
! RES_STR donkey,R1
|
|
! MOV.L #str00022,R1
|
|
MOV.L #str00022,R1
|
|
! BRA end_str00022
|
|
BRA end_str00022
|
|
! NOP
|
|
NOP
|
|
!str00022 .SDATA "donkey"
|
|
str00022: .byte 100,111,110,107,101,121
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str00022
|
|
end_str00022:
|
|
! RES_STR donkey Rn=R1
|
|
! MOV.L #str00023,R1
|
|
MOV.L #str00023,R1
|
|
! BRA end_str00023
|
|
BRA end_str00023
|
|
! NOP
|
|
NOP
|
|
!str00023 .SDATA "donkey"
|
|
str00023: .byte 100,111,110,107,101,121
|
|
! .ALIGN 2
|
|
.align 2
|
|
!end_str00023
|
|
end_str00023:
|
|
! .END
|