Skip to content

Commit

Permalink
fixed and works
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Apr 15, 2022
1 parent a5dfacc commit ce9950a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/emscriptenio.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ void initialize_screen( )

//if ( screen_cols == 0 && ( screen_cols = tgetnum( "co" ) ) == -1 )
// screen_cols = DEFAULT_COLS;
EM_ASM_({
window['globalvars']['screen_cols'] = $0;
}, screen_cols);
screen_cols = EM_ASM_INT({ return window['globalvars']['screen_cols']; });

//if ( screen_rows == 0 && ( screen_rows = tgetnum( "li" ) ) == -1 )
screen_rows = DEFAULT_ROWS;
Expand Down
16 changes: 5 additions & 11 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ void z_read_char( int argc, zword_t * argv )
void jsrInputCharacter(int c, int timeout)
{
zword_t arg_list[2] = {0,0};
EM_ASM_({
window['argstore']['a0'] = $0;
}, arg_list[0]);
arg_list[0] = EM_ASM_({ return window['argstore']['a0']; });

if( c==-1 && z_call( 1, arg_list, ASYNC ) == 0 ) {
EM_ASM_({
Expand Down Expand Up @@ -204,10 +202,8 @@ void jsrZSReadARead(int terminator, char *cbuf) {
// recover argv and in_size from previous block
zword_t *argv;
int in_size;
EM_ASM_({
window['argstore']['argv'] = $0;
window['argstore']['in_size'] = $1;
}, argv, in_size);
argv = EM_ASM_INT({ return window['argstore']['argv']; });
in_size = EM_ASM_INT({ return window['argstore']['in_size']; });
#endif
script_line( ( h_type > V4 ) ? &cbuf[2] : &cbuf[1] );
record_line( ( h_type > V4 ) ? &cbuf[2] : &cbuf[1] );
Expand Down Expand Up @@ -329,10 +325,8 @@ int get_line( char *cbuf, zword_t timeout, zword_t action_routine )
void jsrGetLine(char* cbuf, char* buffer, int read_size, int c, int timeout, int action_routine ) {
int status = 0;
zword_t arg_list[2];
EM_ASM_({
window['argstore']['arg_list'][0] = $0;
window['argstore']['arg_list'][1] = $1;
}, arg_list[0], arg_list[1]);
arg_list[0] = EM_ASM_INT({ return window['argstore']['arg_list'][0]; });
arg_list[1] = EM_ASM_INT({ return window['argstore']['arg_list'][1]; });
if( c == -1 && ( status = z_call( 1, arg_list, ASYNC ) ) == 0 ) {
/*if ( load_variable( 16 ) != 0 ) {
z_print_obj( load_variable( 16 ) );
Expand Down

0 comments on commit ce9950a

Please sign in to comment.