Skip to content

WAIT command implementation #21

@BleuLlama

Description

@BleuLlama

I've attempted to add support for WAIT for my project, and I'm kinda stuck...

I'm implementing a minimal simulation of the Super Serial card, which has a 6551 ACIA. I've shoved my hooks in for PEEK and POKE to the four addresses for the ACIA, and that all works great, I can send and receive from JSBASIC to my project javascript code.

The BASIC program I'm using though has a WAIT call, which (to my understanding) on real hardware will sit and block on a bit changing. In this case, it's waiting for a bit to be set to indicate that it received a character from the serial-attached laserdisc player. Here's the original BASIC:

40000 REM PLAY VIDEO CLIP
40010 IF NOT DISC THEN RETURN
40020 FOR I = 1 TO LEN (VC$)
40030 IF MID$ (VC$,I,1) = "/" THEN POKE 49320,13: WAIT 49321,8:J = PEEK (49320): GOTO 40060
40040 POKE 49320, ASC ( MID$ (VC$,I,1))
40060 NEXT I
40070 RETURN

So it should write out to the serial port (POKE 49320,13) then WAIT for a character to be received. In the meantime, I've replaced it with this:

40030 IF MID$ (VC$,I,1) = "/" THEN GOTO 40100

40100 POKE 49320,13
40110 J = PEEK( 49321 )
40120 IF J <> 8 THEN GOTO 40110
40130 J = PEEK( 49320 )
40140 GOTO 40060

So i implemented it such that it sits in a loop, waiting for the byte to change... but obviously this doesn't work since it can't yield.

Do you have any suggestions or thoughts about how to implement this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions