Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Arrays/6502-Assembly/arrays-1.6502
Normal file
2
Task/Arrays/6502-Assembly/arrays-1.6502
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Array:
|
||||
db 5,10,15,20,25,30,35,40,45,50
|
||||
2
Task/Arrays/6502-Assembly/arrays-10.6502
Normal file
2
Task/Arrays/6502-Assembly/arrays-10.6502
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Array:
|
||||
db 5,10,15,20,25,30,35,40,45,50
|
||||
11
Task/Arrays/6502-Assembly/arrays-11.6502
Normal file
11
Task/Arrays/6502-Assembly/arrays-11.6502
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Array:
|
||||
db 5
|
||||
db 10
|
||||
db 15
|
||||
db 20
|
||||
db 25
|
||||
db 30
|
||||
db 35
|
||||
db 40
|
||||
db 45
|
||||
db 50
|
||||
6
Task/Arrays/6502-Assembly/arrays-12.6502
Normal file
6
Task/Arrays/6502-Assembly/arrays-12.6502
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Array:
|
||||
db 5,10
|
||||
db 15,20
|
||||
db 25,30
|
||||
db 35,40
|
||||
db 45,50
|
||||
6
Task/Arrays/6502-Assembly/arrays-13.6502
Normal file
6
Task/Arrays/6502-Assembly/arrays-13.6502
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Array:
|
||||
db 5,10
|
||||
db 15,20
|
||||
db 25,30
|
||||
db 35,40
|
||||
db 45,50
|
||||
8
Task/Arrays/6502-Assembly/arrays-14.6502
Normal file
8
Task/Arrays/6502-Assembly/arrays-14.6502
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
LDA #3 ;desired row
|
||||
ASL A ;Times 2 bytes per row (if the array's row size wasn't a multiple of 2 we'd need to actually do multiplication)
|
||||
;which the 6502 doesn't have in hardware but can be simulated by repeated adding.
|
||||
CLC
|
||||
ADC #1 ;desired column (since it's 1 byte per column, we can skip the part where we multiply desired column by bytes per column)
|
||||
TAX ;move A to X so we can use it as the index
|
||||
|
||||
LDA Array,x ;evaluates to LDA #40
|
||||
5
Task/Arrays/6502-Assembly/arrays-2.6502
Normal file
5
Task/Arrays/6502-Assembly/arrays-2.6502
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
char foo()
|
||||
{
|
||||
char array[5] = {3,6,9,12,15};
|
||||
return array[2];
|
||||
}
|
||||
7
Task/Arrays/6502-Assembly/arrays-3.6502
Normal file
7
Task/Arrays/6502-Assembly/arrays-3.6502
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
foo:
|
||||
LDX #2 ;load the desired index
|
||||
LDA array,x ;load the second (zero-indexed) entry in array, i.e. 9
|
||||
RTS ;return. The return value is stored in A.
|
||||
|
||||
array: ;this is the array we're reading from.
|
||||
db 3,6,9,12,15
|
||||
3
Task/Arrays/6502-Assembly/arrays-4.6502
Normal file
3
Task/Arrays/6502-Assembly/arrays-4.6502
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
LDX #$80
|
||||
LDA $80,x ;evaluates to LDA $00
|
||||
LDA $0480,x ;evaluates to LDA $0500
|
||||
2
Task/Arrays/6502-Assembly/arrays-5.6502
Normal file
2
Task/Arrays/6502-Assembly/arrays-5.6502
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
wordArray:
|
||||
dw $ABCD,$BEEF,$CAFE,$DADA
|
||||
2
Task/Arrays/6502-Assembly/arrays-6.6502
Normal file
2
Task/Arrays/6502-Assembly/arrays-6.6502
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
wordArray:
|
||||
db $CD,$AB,$EF,$BE,$FE,$CA,$DA,$DA
|
||||
7
Task/Arrays/6502-Assembly/arrays-7.6502
Normal file
7
Task/Arrays/6502-Assembly/arrays-7.6502
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
LDX #2 ;load the 1st (zero-indexed) WORD from the array (which is why this is 2 not 1)
|
||||
LDA wordArray,X ;evaluates to LDA #$EF
|
||||
STA $00 ;store in a zero page temporary variable
|
||||
INX ;point X to the high byte
|
||||
LDA wordArray,X ;evaluates to LDA #$BE
|
||||
STA $01 ;store in a different zero page temporary variable. If your word data is a pointer you want to dereference,
|
||||
;you'll need to store the low byte in $nn and the high byte in $nn+1 like I did here.
|
||||
5
Task/Arrays/6502-Assembly/arrays-8.6502
Normal file
5
Task/Arrays/6502-Assembly/arrays-8.6502
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
wordArray_Lo:
|
||||
db $CD,$EF,$FE,$DA
|
||||
|
||||
wordArray_Hi:
|
||||
db $AB,$BE,$CA,$DA ;both this version and the above versions are 8 bytes of memory.
|
||||
5
Task/Arrays/6502-Assembly/arrays-9.6502
Normal file
5
Task/Arrays/6502-Assembly/arrays-9.6502
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
LDX #1 ;with split arrays we DON'T need to double our index.
|
||||
LDA wordArray_Lo,x ;evaluates to LDA #$EF
|
||||
STA $00
|
||||
LDA wordArray_Hi,x ;evaluates to LDA #$BE
|
||||
STA $01
|
||||
Loading…
Add table
Add a link
Reference in a new issue