Author Topic: Hi-Speed Autotype-test  (Read 1785 times)

0 Members and 1 Guest are viewing this topic.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Hi-Speed Autotype-test
« on: 19:28, 20 December 10 »
Hello together,
I just had the idea to POKE autotype strings into CPC's keyboard buffer and so send it to CPC screen.

The positive aspect is:
- The autotype speed is enormous!

The negative aspect is:
- Works only in BASIC / when BASIC's keyboard buffer is used
- Different addresses for 464 and 6128 roms

Perhaps someone knows a all-in-one solution for that?

I split the string into an array splitted by ENTER char.
This array I send line-by-line into the keyboard buffer and when sent, I press the "Enter" key.
I release the enter key a few VSYNCs later and continue with the next line.

Example: (I just used JEMU but it's possible in every emulator!)

like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: Hi-Speed Autotype-test
« Reply #1 on: 20:39, 20 December 10 »
BTW.: I had no turbo function enabled!
With a turbo (300% speed) it works like this:


Here's the code I added to JEMU:
Code: [Select]
    public void vSync() {
        if (basictypelength != -1) {
            basicchecktype++;
            if (basicchecktype == 1) {
                BasicAutoType();
            }
            if (basicchecktype == 2) {
                keyboard.keyReleased(KeyEvent.VK_ENTER);
            }
            if (memory.readByte(BUFFER_START) == 0) {
                basicchecktype = 0;
            }
        }
        if (frameSkip == 0) {
            display.updateImage(true);
        }
        syncProcessor(psg.getSoundPlayer());
    }
    String[] basictypetext;
    int basictypelength = -1;
    int basicchecktype = 0;
    int basictypepos = 0;
    protected int BUFFER_START = 0xac8a;
    protected int BUFFER_START_6128 = 0xac8a;
    protected int BUFFER_START_464 = 0xaca4;

    public void BasicAutoType(String input) {
        input = input.replace("" + (char) 0x0d, "");
        basictypetext = input.split("" + (char) 10);
        basictypelength = basictypetext.length - 1;
        basictypepos = 0;
    }

    public void BasicAutoType() {
        if (basictypetext == null) {
            basictypelength = -1;
            return;
        }
        if (basictypepos > basictypelength) {
            basictypepos = 0;
            basictypelength = -1;
            basictypetext = null;
            return;
        }
        BasicPutText(basictypetext[basictypepos++]);
    }

    public void BasicPutText(String input) {
        if (input.length() > 255) {
            return;
        }
        for (int i = 0; i < 255; i++) {
            memory.writeByte(BUFFER_START + i, 0);
        }
        for (int i = 0; i < input.length(); i++) {
            memory.writeByte(BUFFER_START + i, (int) input.charAt(i));
        }
        keyboard.keyPressed(KeyEvent.VK_ENTER);
        basicchecktype = 1;
    }
« Last Edit: 20:42, 20 December 10 by Devilmarkus »
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 17.113
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
    • Awards
Re: Hi-Speed Autotype-test
« Reply #2 on: 10:48, 23 December 10 »
Turbo is cheating :D But it's really fast indeed. The method is clever too - what's the mem limit?
like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: Hi-Speed Autotype-test
« Reply #3 on: 19:46, 23 December 10 »
Turbo is cheating :D But it's really fast indeed. The method is clever too - what's the mem limit?

Logically the basic memory incl. linenumbers...
And each line of text can only have 255 chars max.
(Like CPC text input from basic interpreter)
like
0
No reactions
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release