Categories
CoCo Urbane

I Integrated the Editor

My dad used to say, “There’s the easy way, there’s the hard way, and then there’s Earl’s way that makes the hard way look easy.” I patched my input driver to replace “E” with ‘RUN”ED2’ in the input buffer. ED2 just says EXEC&H7C00. Hey, it works. lol.

Categories
CoCo Urbane

A New Problem

I tried to squeeze the last line out of a bit of code that was rarely used. It didn’t work. I did it as simply as I could. It worked. While I was at it I saw that I had told my program that there were 26 alphanumeric chars instead of 36. Meant to be.

Categories
CoCo Urbane

A Problem with Urbane

My latest problem was my fancy input driver which changed long names into pairs of characters changed hex numbers like &H7C00 into something like &AA. Boo. I fixed it in a way that fixed the output driver, too. Atta-boy Earl.

Categories
CoCo Urbane

urbane for cocos works

My program is designed for a 64k Coco 2. It runs in ROM mode and uses hi-ram and the top K of lo-ram for itself. At present, once you run it, it returns to Direct mode. Now all characters in names are significant. SAM=5:SAUL=6:?SAM returns 5. My next step is to integrate the editor.

Categories
CoCo Urbane

CRUNCH AND UNCRUNCH FOR COCO’S URBANE

Lines going up from the cursor now are shown in their crunched version. Going down they are shown in their uncrunched version.

Categories
CoCo Urbane

RULES FOR COCO URBANE EDITOR

LEFT ARROW MOVES LEFT. RIGHT MOVES RIGHT. SHIFT-LEFT IS BKSP. SHIFT-RIGHT IS DEL. UP MOVES UP. DOWN MOVES DOWN. SHIFT-UP EXITS. SHIFT-DOWN TOGGLES INSERT. ENTER OPENS A LINE. ALT ENTER DELETES A LINE. ALT IS SHIFT-CLEAR. ON VCC ALT IS SHIFT-HOME. ALT PRINTS NEXT CHARACTER.

Categories
CoCo Urbane

URBANE for the Coco2

So far I have a screen editor loosely based on FLEXIKEY.
*
LEFT ARROW MOVES LEFT. RIGHT MOVES RIGHT.
SHIFT-LEFT IS BKSP. SHIFT-RIGHT IS DEL.
*
UP MOVES UP. SHIFT-DOWN TOGGLES INSERT.
DOWN MOVES DOWN. SHIFT-UP EXITS.
ENTER OPENS LINE. ALT THEN ENTER DELETES LINE.
*
ALT is SHIFT-CLEAR. ON Vcc it is SHIFT-HOME.
*
ALT THEN SHIFT-RIGHT IS ]. ALT THEN ALT IS \.
ALT THEN SHIFT-DOWN IS [. ALT THEN UP IS up-arrow.
ALT THEN SHIFT-UP IS left-arrow.

Categories
Uncategorized

More on using CoCoDskUtil

April 16, 2016
I have discovered that you don’t actually have to close Vcc or all your PC editors in order to avoid errors when you work on a .DSK image file in CoCoDskUtil. You do need to navigate away from the folder in question in CoCoDskUtil, and open a different .DSK file in CoCoDskUtil. If you did it right, you did that when you left CoCoDskUtil last time. Then you need to close the files in the folder in your PC editors, and eject the .DSK file from Vcc. Once you have made your changes to the .DSK image file you need to navigate away from that folder in CoCoDskUtil and load a new .DSK image in CoCoDskUtil. Then you can insert the .DSK image file file you have been working on into Vcc.
back

Categories
Android

Double <enter-key>s in EditTexts

This Example responds to double <enter-key>s. In addition to the three Android classes used in the previous Example, it uses a MotionEvent.

EmptyEnter.java

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;

public class EmptyEnter extends Activity {
  EditText editText;
  boolean lastCharWasEnter;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    editText=(EditText)findViewById(R.id.editText);
    lastCharWasEnter=false;
    
    editText.setOnTouchListener(new View.OnTouchListener() {
      @Override
      public boolean onTouch(View view, MotionEvent event) {
        lastCharWasEnter=false;
        return false;
      }
    });
    
    editText.addTextChangedListener(new TextWatcher() {
      public void beforeTextChanged
      (CharSequence s, int start, int count, int after) {
      }
      public void onTextChanged
      (CharSequence s, int start, int before, int count) {
        //check if exactly one char was entered and it was an 
        if (before==0 && count==1 && s.charAt(start)=='\n') {
          lastCharWasEnter=!lastCharWasEnter;
          if (lastCharWasEnter) return;
          Integer startInteger=new Integer(start);
          Intent intent=new Intent("enter");
          intent.putExtra("Start", startInteger.toString());
          mySendBroadcast(intent);
        }
        else lastCharWasEnter=false;
      }
      public void afterTextChanged(Editable s) {
      }
    });
  }

  private void mySendBroadcast(Intent intent) {
    //Can't instantiate LocalBroadcastMananager in Anonymous context
    LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
  }
  
  @Override
  public void onResume() {
    super.onResume();
    // Register messageReceiver to receive messages.
    LocalBroadcastManager.getInstance(this).registerReceiver
    (startReceiver, new IntentFilter("enter"));
  }

  // handler for received Intents for the "enter" event 
  private BroadcastReceiver startReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
      // Extract data included in the Intent
      int start=Integer.parseInt(intent.getStringExtra("Start"));
      //replace the <enter>s
      editText.getText().replace(start-1, start+1,"");
      //respond to the double <enter-key>
      editText.getText().replace(start-1, start-1,"<>");
    }
  };
  
  @Override
  protected void onPause() {
    // Unregister since the activity is not visible
    LocalBroadcastManager.getInstance(this).unregisterReceiver(startReceiver);
    super.onPause();
  }
}
Categories
Android

New Way to Handle <enter-key>s in Edittexts

A dependable way to respond to the <enter-key> in an EditText is with a TextWatcher, a LocalBroadcastManager, and a BroadcastReceiver. I think you need to add the v4 support library to use the LocalBroadcastManager. I use the tutorial at vogella.com: 7.3 “Local broadcast events with LocalBroadcastManager” because of its complete concise code Example. In onTextChanged before is <the index of the end of the change before the change>minus start. When in the TextWatcher the UI thread is busy updating editText’s editable, so we send an Intent to wake up the BroadcastReceiver when the UI thread is done updating editText.

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.text.Editable;
in onCreate:
editText.addTextChangedListener(new TextWatcher() {
  public void onTextChanged
  (CharSequence s, int start, int before, int count) {
    //check if exactly one char was added and it was an <enter>
    if (before==0 && count==1 && s.charAt(start)=='\n') {
    Intent intent=new Intent("enter")
    Integer startInteger=new Integer(start);
    intent.putExtra("Start", startInteger.toString()); // Add data
    mySendBroadcast(intent);
in the BroadcastReceiver's onReceive:
int start=Integer.parseInt(intent.getStringExtra("Start"));
editText.getText().replace(start, start+1,""); //remove the <enter>
//respond to the <enter> here