; -------- GABasic Program ending Code ---------
; EndProgram Include file
; Please don't edit this file

EndProgram:
  PUSH eax
  mov ax, 0
  cmp [screenmode], ax
  JE skiprettextmode
    mov eax, 0
    call Screen
skiprettextmode:
  POP eax
  CMP ax, 1
  je DontFreeBlock
  mov ebx, StringHandle
  mov si, [ebx]
  mov di, [ebx+2]
  PUSH AX
  Call FreeBlock
  POP AX
DontFreeBlock:
  CMP AX, 2
  JE Skiprmodeblock
    PUSH AX
    mov dx, [rmodesel]
    mov eax, 101h
    INT 31h
    POP AX
Skiprmodeblock:
  CMP AX, 0
  JE FreeArrays
    mov ah, 9
    mov edx, EndErr
    int 21h
FreeArrays:
