Forth-STC-Macros.inc
CCurl_Forth-GCC/Forth-STC-Macros.inc
; ------------------------------------------------------------------------------
; macros for forth 
; ------------------------------------------------------------------------------
macro m_getTOS val
{
       mov val, ebx
}

macro m_setTOS val
{
       mov ebx, val
}

; ------------------------------------------------------------------------------
macro m_push val
{
       add ebp, 4
       m_set2ND ebx
       m_setTOS val
}

macro m_pop val
{
       m_getTOS val
       m_get2ND ebx
       sub ebp, 4
}

; ------------------------------------------------------------------------------
macro m_get2ND val
{
       mov val, [ebp]
}

macro m_set2ND val
{
       mov [ebp], val
}

; ------------------------------------------------------------------------------
macro m_rpop tgt
{
       pop tgt
}

; ------------------------------------------------------------------------------
macro m_rpush val
{
       push val
}

; ------------------------------------------------------------------------------
macro m_DTOR
{
       m_pop eax
       m_rpush eax
}

; ------------------------------------------------------------------------------
macro m_RTOD
{
       m_rpop eax
       m_push eax
}

; ------------------------------------------------------------------------------
macro m_onePlus 
{ 
       inc ebx 
}

; ------------------------------------------------------------------------------
macro m_oneMinus 
{ 
       dec ebx 
}

; ------------------------------------------------------------------------------
macro m_drop
{ 
       m_pop eax
}

; ---------------------------------------------------------------------------------------------------------
macro m_execO	opCode
{
       mov  edx, opCode
       call executeOpCode
}

; ---------------------------------------------------------------------------------------------------------
macro m_execXT codeAddr
{
       mov  edx, codeAddr
       call executeWord_SAFE
}

; ---------------------------------------------------------------------------------------------------------
macro m_pushExecO theVal, opCode
{
       m_push	theVal
       m_execO opCode
}

; ---------------------------------------------------------------------------------------------------------
macro val2mem addrTo, theVal
{
       push theVal
       pop addrTo
}
