Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement WaitForChar #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions amitools/vamos/lib/DosLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import ctypes
import re
import os
import select

from amitools.vamos.machine.regs import *
from amitools.vamos.libcore import LibImpl
Expand Down Expand Up @@ -594,6 +595,16 @@ def Close(self, ctx):
self.setioerr(ctx, 0)
return self.DOSTRUE

def WaitForChar(self, ctx):
# file,timeout)(d1/d2)
fh_b_addr = ctx.cpu.r_reg(REG_D1)
fh = self.file_mgr.get_by_b_addr(fh_b_addr, False)
ms = ctx.cpu.r_reg(REG_D2)
if select.select([fh.obj], [], [], ms * 1e-3)[0]:
return self.DOSTRUE

return self.DOSFALSE

def Read(self, ctx):
fh_b_addr = ctx.cpu.r_reg(REG_D1)
buf_ptr = ctx.cpu.r_reg(REG_D2)
Expand Down
Loading