; Listing1-5.asm
;
; A program that demonstrates the _push and _pop
; macros (version 1 macros).

            option     casemap:none

use1var      =         1
            include    ctPushPop.inc

            
            .const

; Program title:

            align   word
ttlStr      byte    "Listing 1-5", 0


            .code

        
; Here is the main assembly language function.

            
            public  asmMain
asmMain     proc

; Create a fake display here:
            
            push    rbp
            mov     rbp, rsp
            sub     rsp, 56
            push    rbx

ifStk       textequ <>
%           echo    Before push #1, the stack is <<ifStk>>
            echo

            _push(ifStk, <Hello >)
%           echo    After push #1, the stack is <<ifStk>>
            echo

            _push(ifStk, <Hello >)
%           echo    After push #2, the stack is <<&ifStk>>
            echo

tos         _pop(ifStk)     
%           echo After 1st pop, item popped is <<&tos>>
%           echo and stack contains <<&ifStk>>
            echo

nos         _pop(ifStk)     
%           echo After 2nd pop, item popped is <<&nos>>
%           echo and stack contains <<&ifStk>>
            
            

allDone:    pop     rbx
            leave
            ret     ;Returns to caller
        
asmMain     endp
            end