Code: Select all
A$ ="ABCDEFGH"
*p.string
v.i =4
! lea rcx,[v_A$]
! add rcx, [v_v] ;???
! mov [p_p], rcx
Debug *p\s ;should be "EFGH"
Code: Select all
A$ ="ABCDEFGH"
*p.string
v.i =4
! lea rcx,[v_A$]
! add rcx, [v_v] ;???
! mov [p_p], rcx
Debug *p\s ;should be "EFGH"
Code: Select all
A$ ="ABCDEFGH"
*p.string
v.i = 8;Unicode!
!lea rcx,[v_A$]
!mov rax,[v_v]
!add [rcx],rax
!mov [p_p],rcx
Debug *p\s
Code: Select all
Procedure.i WreckStr(Input.i,Value.i)
!lea rax,[p.v_Input]
!mov rcx,[p.v_Value]
!add [rax],rcx
ProcedureReturn
EndProcedure
TestString.s = "Hello! :)"
*Str.String = WreckStr(@TestString,14)
Debug *Str\s
I don't want to use Peeks() and also I want to learn.wilbert wrote:Variables inside a procedure are proceded by p.
Like [p.v_A]
Any reason you are using assembly for this and not simple PB code ?
Code: Select all
Procedure test()
A.s ="ABCDEFGH"
*p.string
; v.i = 8;Unicode!
v.i = 4;Asci!
!lea rcx,[p.v_A]
!mov rax,[p.v_v]
!add [rcx],rax ;crashes not if I remove this
!mov [p.p_p],rcx
Debug *p\s
EndProcedure
test()
This is not a pointer to string data, it is a pointer to structure called "string". You can see its definition in Tools>Structure Viewer.Wolfram wrote:*p.string
Code: Select all
Procedure test()
A.s ="ABCDEFGH"
*p.string=AllocateMemory(SizeOf(string))
PokeI(*p,@A+SizeOf(Character)*4)
Debug *p\s
PokeI(*p,@A+SizeOf(Character)*5)
Debug *p\s
PokeI(*p,@A+SizeOf(Character)*6)
Debug *p\s
FreeMemory(*p)
EndProcedure
test()
Code: Select all
Procedure test()
A.s ="ABCDEFGH"
*p.string=AllocateMemory(SizeOf(string))
*p_i.Integer=*p
*p_i\i=@A+SizeOf(Character)*4
Debug *p\s
*p_i\i=@A+SizeOf(Character)*5
Debug *p\s
*p_i\i=@A+SizeOf(Character)*6
Debug *p\s
FreeMemory(*p)
EndProcedure
test()