I want have a string and copy its address to the start of the character struct. i.e. right on the playerCharacter label.
The string will be the characters name, but there are going to be loads of characters called 'goblin' so im just copying a pointer to the string goblin to the character's address....well, trying to.
Im using numbers here to make the example super short. So usually number: would hold a string.
the result im looking for is two black lines on the screen ie 255,255
that would mean it works for strings.
i copy the address of playerCharacter to the RAM address thisCharacter because I want a function that works on any character. So i copy the character I want to work on to 'thisCharacter'.
Code: Select all
ORG #8000
LD HL,playerCharacter
LD (thisCharacter),HL
LD HL,(thisCharacter)
LD DE,number
LD A,D
LD (HL),A
INC HL
LD A,E
LD (HL),A
DEC HL
LD D,(HL)
INC HL
LD E,(HL)
LD (16384),DE
keeplooping:
jp keeplooping
thisCharacter:
defw #0
playerCharacter:
defw #1
defb 3;strength
defb 3;skill
defb 3; charisma
number:
defb 255,255