;ENTRY POINTS - jumping forward to procedures
o2
(
!4
)
jmp long initialise ; o2_exec sets up ebx and ecx registers
o2
(
!4
)
jmp long service ;
o2
(
!4
)
jmp long push eax :call [ebx+1224]
:call [ebx+1072]
:push esi


call [ebx+8]
:pop eax :;
'inline patchable table to hold essential
'pointers between calls
o2
(
!64  
)
dd 0 0 0 0 ; some dwords
; PROCEDURES
;----------
.initialise
;----------
dataspace 256
mov esi,eax
; space for static variables
mov eax,ecx
mov [16164760],eax
add eax,8
mov [16164880],eax
add eax,8
mov [16165000],eax
mov [ecx+100],esi     ; pointer for var space
mov [ecx+104],ebx     ; pointer for runtime system calls
dataspace 1000
mov [esi+0] ,eax
; another dataspace for static  strings
`hello`
push eax


push [esi+0]


call [ebx+28]
data
(
  `Hello Little Sky!` 3f 3f  00   
)
mov [esi+4] ,eax
`user32.dll`
push eax


call [ebx+12]
mov [esi+8] ,eax
lea eax,[esi+12]
push eax
`MessageBoxW
MessageBoxA
`
push eax
push [esi+8]
call [ebx+24]
`Hello Big World!`
push eax


push [esi+0]


call [ebx+28]
;copy00 dap,`Hello Big Sky!`
;copyn dap,daq,32
;mbox 0,`Hello World!`,`Greeting`,0
push 0


`Greeting`
push eax


push [esi+0]


push 0


call [esi+16]
push [esi+8]


call [ebx+16]
ret
;----------
.service
;----------
push ebx
push esi
push edi
mov ecx,[16164760]
mov esi,[ecx+100] ; restore pointer for varspace
mov ebx,[ecx+104] ; restore pointer for runtime system functions
push 0


`Conversation`
push eax


`I come here often!`
push eax


push 0


call [esi+16]
pop edi
pop esi
pop ebx
ret
;----------
push eax :call [ebx+1224]
:call [ebx+1072]
:push esi


call [ebx+8]
:pop eax ::;----------
push ebx
push esi
push edi
mov ecx,[16164760]
mov esi,[ecx+100] ; restore pointer for varspace
mov ebx,[ecx+104] ; restore pointer for runtime system functions
push 0


`Departure`
push eax


`Goodbye World!`
push eax


push 0


call [esi+16]
pop edi
pop esi
pop ebx
ret
