Jump to content
  • entries
    46
  • comments
    9
  • views
    48,144

dCalc - testing the event detection loop


k-Pack

1,129 views

Most of a computer's time is spent waiting for some thing to happen, figuring out what happened, and then doing something because something happened. What makes a GOS work is its ability to easily detect the event. The dCalc program is being written to detect when an icon is clicked and which icon is clicked.

 

The video shows a test run of the EVENT detection loop. When an icon is clicked the icon number is displayed in register A until the next icon is pressed. Each icon has its own number. Subroutines for those numbers will be added later. The Quit icon directs the program to the EXIT function and jumps to BASIC's READY prompt.

 

 

Event Test.wmv

 

To do this the EVENT function is called until an event happens. When an event is detected the type of event number is placed in the location EVENTTYPE. For an icon event the EVENTTYPE will be 1. EVENT will also pass information in locations EVENTTYPE +1 to EVENTTYPE +4. This program only uses information from EVENTTYPE +1 where the icon number is stored. For the test REGA = PEEK(EVENTTYPE+1).

 

In order to verify the icon number the subroutine to print REGA was written. The routine receives the number (REGA) and converts it to a String so that Diamond's SYSDRAW function will put it on the screen. Letting the number remain left justified made things easier but the string (REGA$) still had to be padded with trailing blanks to overwrite larger numbers. And don't forget to add the CHR$(255) to the end of the string.

 

Next up is to build a number for register X. That should involve building a text string based on the icon numbers and converting it to a number. When X can be transferred to A, the real math can begin.

 

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...