Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,8 @@
ld hl,MyString
ld (PointerVariable),hl
MyString: ;assembler equates this label to a memory location at compile time
byte "Hello",0
PointerVariable:
word 0 ;placeholder for the address of the above string, gets written to by the code above.

View file

@ -0,0 +1,4 @@
ld a,<MyString ; < represents the low byte of the address. Some assemblers use LOW() with the label in the parentheses.
ld (PointerVariable),a
ld a,>MyString ; > represents the high byte of the address. Some assemblers use HIGH() with the label in the parentheses.
ld (PointerVariable+1),a

View file

@ -0,0 +1,12 @@
StrCpy:
;input: HL = base address of string you wish to copy
; DE = where you want to copy it to.
; This program assumes that the string is null-terminated, and that there is enough RAM to hold the entire string.
ld a,(hl)
or a ;compare A to 0.
ret z
ld (de),a
inc hl
inc de
jr StrCpy

View file

@ -0,0 +1,15 @@
ld hl,myString
ld c,(hl)
ld b,0
inc c
ld de,buffer
ldir ;copies from (HL) to (DE), BC times.
ret
myString:
byte 5 ;len("Hello")
byte "Hello"
buffer:
byte 0
byte 0,0,0,0,0