Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,5 @@
Array: ;an array located in RAM. Its values can be updated freely.
byte 0,0,0,0,0
byte 0,0,0,0,0
byte 0,0,0,0,0
byte 0,0,0,0,0

View file

@ -0,0 +1,5 @@
Array:
byte 0,0,0,0,0
byte 0,0,20,0,0
byte 0,0,0,0,0
byte 0,0,0,0,0

View file

@ -0,0 +1,11 @@
;for this example the array's size, the data we want to write, and where we want to write the data, are all known in advance.
ld hl,Array ;hl points to the 0th element of row 0.
ld c,5 ;one-indexed row length
ld b,0 ;set bc = row length
add hl,bc ;now hl points to the 0th element of row 1.
inc hl ;now hl points to the 1st element of row 1.
inc hl ;now hl points to the 2nd element of row 1. This is where we planned on storing our new value.
ld a,20 ;get the value 20 which we want to store here
ld (hl),a ;store 20 into the desired slot. (Retrieving a value is the same process except we skip the step above and
; execute "ld a,(hl)" at this point instead.)

View file

@ -0,0 +1,13 @@
LD H,>MyTable ;works out to be LD h,4 thanks to our alignment below.
;>LABEL means "the high byte of the address represented by LABEL
LD L,13 ;this was a lot faster than doing LD HL,&0400 and adding the desired index later.
LD a,(HL) ;loads 12 into the accumulator.
RET
org &0400
MyTable: ;thanks to the ORG statement above, this label's address is guaranteed to be &0400
byte 1,2,3,4,5
byte 2,4,6,8,10
byte 3,6,9,12,15
byte 4,8,12,16,20
byte 5,10,15,20,25

View file

@ -0,0 +1,5 @@
org &0400
word &8000,&8327,&864e,&8973,&8c98,&8fba,&92da,&95f7
word &9911,&9c27,&9f38,&a244,&a54c,&a84d,&ab48,&ae3c
word &b12a,&b40f,&b6ed,&b9c2,&bc8e,&bf50,&c209,&c4b7
word &c75b,&c9f4,&cc81,&cf02,&d177,&d3e0,&d63b,&d889

View file

@ -0,0 +1,10 @@
org &0400
byte <&8000,<&8327,<&864e,<&8973,<&8c98,<&8fba,<&92da,<&95f7
byte <&9911,<&9c27,<&9f38,<&a244,<&a54c,<&a84d,<&ab48,<&ae3c
byte <&b12a,<&b40f,<&b6ed,<&b9c2,<&bc8e,<&bf50,<&c209,<&c4b7
byte <&c75b,<&c9f4,<&cc81,<&cf02,<&d177,<&d3e0,<&d63b,<&d889
org &0500
byte >&8000,>&8327,>&864e,>&8973,>&8c98,>&8fba,>&92da,>&95f7
byte >&9911,>&9c27,>&9f38,>&a244,>&a54c,>&a84d,>&ab48,>&ae3c
byte >&b12a,>&b40f,>&b6ed,>&b9c2,>&bc8e,>&bf50,>&c209,>&c4b7
byte >&c75b,>&c9f4,>&cc81,>&cf02,>&d177,>&d3e0,>&d63b,>&d889

View file

@ -0,0 +1,7 @@
LD h,&04 ;load high byte of address &0400
LD L,&1F ;desired index
ld a,(hl)
ld c,a
inc h ;LD h,&05. We can keep L the same since the index is the same.
;Effectively we did all the necessary pointer arithmetic for indexing the second table, just with this one instruction!
ld a,(hl) ;now we have the low byte in C and the high byte in A.