Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
1
Task/Arrays/68000-Assembly/arrays-1.68000
Normal file
1
Task/Arrays/68000-Assembly/arrays-1.68000
Normal file
|
|
@ -0,0 +1 @@
|
|||
MOVE.L #$00100000,A0 ;define an array at memory address $100000
|
||||
18
Task/Arrays/68000-Assembly/arrays-2.68000
Normal file
18
Task/Arrays/68000-Assembly/arrays-2.68000
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
;8-bit data
|
||||
MyArray:
|
||||
DC.B 1,2,3,4,5
|
||||
DC.B 6,7,8,9,10
|
||||
DC.B 11,12,13,14,15
|
||||
EVEN ;needed to ensure proper alignment after a byte array with an odd number of entries.
|
||||
|
||||
;16-bit data
|
||||
MyArrayW:
|
||||
DC.W 1,2,3,4,5
|
||||
DC.W 6,7,8,9,10
|
||||
DC.W 11,12,13,14,15
|
||||
|
||||
;32-bit data
|
||||
MyArrayL:
|
||||
DC.L 1,2,3,4,5
|
||||
DC.L 6,7,8,9,10
|
||||
DC.L 11,12,13,14,15
|
||||
7
Task/Arrays/68000-Assembly/arrays-3.68000
Normal file
7
Task/Arrays/68000-Assembly/arrays-3.68000
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
MyString:
|
||||
DC.B "Hello World",0
|
||||
even
|
||||
|
||||
MyString2:
|
||||
DC.B 'H','e','l','l','o',' ','W','o','r','l','d',0
|
||||
even
|
||||
7
Task/Arrays/68000-Assembly/arrays-4.68000
Normal file
7
Task/Arrays/68000-Assembly/arrays-4.68000
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
myArray equ $240000
|
||||
|
||||
LEA myArray,A0 ;load the base address of the array into A0
|
||||
MOVE.W #3,D0 ;load the desired offset into D0
|
||||
LSL.W #2,D0 ;this array is intended for 32-bit values.
|
||||
MOVE.L #23,D1 ;load decimal 23 into D1
|
||||
MOVE.L D1,(A0,D0) ;store #23 into the 3rd slot of the array (arrays are zero-indexed in assembly)
|
||||
2
Task/Arrays/68000-Assembly/arrays-5.68000
Normal file
2
Task/Arrays/68000-Assembly/arrays-5.68000
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
int myArray[];
|
||||
myArray[3] = 23;
|
||||
7
Task/Arrays/68000-Assembly/arrays-6.68000
Normal file
7
Task/Arrays/68000-Assembly/arrays-6.68000
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
myArray equ $240000
|
||||
|
||||
;load element 4
|
||||
LEA myArray,A0 ;load the base address of the array into A0
|
||||
MOVE.W #4,D0 ;load the desired offset into D0
|
||||
LSL.W #2,D0 ;this array is intended for 32-bit values.
|
||||
MOVE.L (A0,D0),D1 ;load the 4th element into D1.
|
||||
29
Task/Arrays/68000-Assembly/arrays-7.68000
Normal file
29
Task/Arrays/68000-Assembly/arrays-7.68000
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
myArray equ $240000
|
||||
|
||||
;insert a new element into the 2nd slot and push everything behind it back.
|
||||
|
||||
LEA myArray,A0 ;load the base address of the array into A0
|
||||
MOVE.W #2,D0 ;offset into 2nd slot
|
||||
LSL.W #2,D0 ;this array is intended for 32-bit values.
|
||||
MOVE.L #46,D1 ;this is our new element.
|
||||
|
||||
|
||||
|
||||
MOVE.L (A0,D0),(4,A0,D0) ;store the 2nd element into the 3rd slot
|
||||
ADDA.L #4,A0 ;increment to next slot.
|
||||
MOVE.L (A0,D0),(4,A0,D0) ;store the 3nd element into the 4th slot
|
||||
ADDA.L #4,A0 ;increment to next slot.
|
||||
MOVE.L (A0,D0),(4,A0,D0) ;store the 4th element into the 5th slot
|
||||
ADDA.L #4,A0 ;increment to next slot.
|
||||
MOVE.L (A0,D0),(4,A0,D0) ;store the 5th element into the 6th slot
|
||||
|
||||
LEA myArray,A0 ;restore the base address
|
||||
MOVE.L D1,(A0,D0) ;store the new 2nd element over the 2nd slot.
|
||||
|
||||
;for a larger array we can use the following loop:
|
||||
MOVE.W #3,D2 ;array length minus starting offset minus 1
|
||||
|
||||
LOOP:
|
||||
MOVE.L (A0,D0),(4,A0,D0)
|
||||
ADDA.L #4,A0
|
||||
DBRA D2,LOOP
|
||||
Loading…
Add table
Add a link
Reference in a new issue