; Other functions for Gabasic
; Gabriel Fernandez 2000

; Timer
; EAX - time (in Hundredths of seconds)
; Call with:	AH = 2C hex
;  Returns:	CH = Hours (0 to 23, using 24-hour clock format)
;		CL = Minutes (0 to 59)
;		DH = Seconds (0 to 59)
;		DL = Hundredths of seconds (0 to 99) (see note below)
Timer:
  mov eax, 0
  mov ebx, 0
  mov edx, 0
  MOV AH, 2Ch
  INT 21h

  mov eax, 0
  mov edi, edx
  Mov EDX, 0
  mov al, ch
  mov ebx, 360000
  mul ebx

  PUSH eax       ; Grabo las horas
  mov eax, 0
  mov ax, cx
  mov ah, 0
  mov bx, 6000
  mul bx

  PUSH eax       ; Grabo los minutos
  mov eax, 0
  mov ebx, 0
  mov bx, di

  mov bl, 0
  xchg bl, bh
  mov ax, 100

  mul bx

  mov ecx, edi
  mov ch, 0
  add eax, ecx

  POP ebx
  add eax, ebx
  POP ebx
  add eax, ebx
RET

; EAX - Program Name(string), must terminate in 0
; EBX - Parameters
; I can't get this to work, if someone make it, make me know

Shell:
  mov edi, tmp
  mov ecx, [eax]
  mov esi, eax
  add esi, 4
  rep movsb

  mov edi, tmp
  add edi, 500
  mov ecx, [ebx]
;  dec ecx
;  mov [edi], cl
;  inc ecx
;  inc edi
  mov esi, ebx
  add esi, 4
  rep movsb

  mov edi, tmp
  add edi, 500
  mov [par4], edi
  mov [par3], ds

  mov edx, tmp
  mov ebx, par1

  mov ax, 4B00h
  INT 21h
RET

