Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Copy-a-string/Z80-Assembly/copy-a-string-1.z80
Normal file
8
Task/Copy-a-string/Z80-Assembly/copy-a-string-1.z80
Normal 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.
|
||||
4
Task/Copy-a-string/Z80-Assembly/copy-a-string-2.z80
Normal file
4
Task/Copy-a-string/Z80-Assembly/copy-a-string-2.z80
Normal 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
|
||||
12
Task/Copy-a-string/Z80-Assembly/copy-a-string-3.z80
Normal file
12
Task/Copy-a-string/Z80-Assembly/copy-a-string-3.z80
Normal 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
|
||||
15
Task/Copy-a-string/Z80-Assembly/copy-a-string-4.z80
Normal file
15
Task/Copy-a-string/Z80-Assembly/copy-a-string-4.z80
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue