http://www.terraspace.co.uk/HJWasm Object Oriented Language Extension.pdf (http://www.terraspace.co.uk/HJWasm%20Object%20Oriented%20Language%20Extension.pdf)
Included in the packages now too.
Interesting, although too C++ for my taste ;)
METHOD Person, Init, age:BYTE
LOCAL isAlive:DWORD
; Internally the METHOD forms a traditional procedure, so anything that you can
; do in a PROC you can do in a method.
; On entry into any method RCX is a pointer to the instance
; and the correct reference type is assumed.
mov [rcx].human, 1 ; Hence this is possible.
mov (Person PTR [rcx]).human, 1 ; Alternative forms of reference.
mov [rcx].Person.human, 1 ; " "
mov isAlive,0
mov al,age
mov [rcx].age,al
.if( age < 100 )
mov isAlive,1
.endif
; Constructor MUST return thisPtr in rax (the implicit self reference
; passed in RCX).
mov rax,thisPtr
ret
ENDMETHOD
Are this just examples how to do it, or does the library provide some of them? Could you use more assembly-style code like this?
and isAlive,0
mov al,age
mov [rcx].age,al
.if age < 100
inc isAlive
.endif
Hey,
That was just an example.
Inside a method you can code it however you like :) It's really just a PROC behind the scenes with this sort of structure :
MyClass_MyMethod PROC FRAME thisPtr:QWORD, <args>
asssume rcx:PTR MyClass
.
.
So you can do whatever you want :) follow the rules, break the rules.. make up new rules lol
How I can use it?
... Error A2260: Missing .ENDPROLOG: _Person_Release ENDCLASS(11)[....
There was a small bug in the $DELETE implementation which I've fixed. The new packages are up on the site and Git, dated 7th April.
The packages now include a new sample oo1.asm which demonstrates a few of the new features and using the OO layer.
Thank you johnsa