Author Topic: HOW TO EVALUATE COMMAND AFTER RETURN?  (Read 372 times)

0 Members and 1 Guest are viewing this topic.

Offline MIRKOSOFT

  • C128 user
  • ******
  • Posts: 809
  • Age: 33
  • Location: Zvolen
  • Activity:
    4.8%
  • Country: sk
  • Reputation: 188
  • Gender: Male
  • C128 programmer
  • With us since: 13/02/2009
    YearsYearsYearsYears
    • View Profile
    • MIRKOSOFT
HOW TO EVALUATE COMMAND AFTER RETURN?
« on: July 22, 2012, 12:02 AM »
Hi!


My keyboard driver is finishing but needs to evaluate BASIC/MONITOR commands...


- When I hit RETURN/ENTER


Thank you very much for everything!


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster, more intelligent and more powerful... is targetted to programmation...

64ever 128her
sixty-for-ever one-twenty-either

C128 = C64² + more

http://www.mirkosoft.sk

Offline Hydrophilic

  • 128D user
  • *******
  • Posts: 1225
  • Age: 41
  • Location: Earth... still!
  • Activity:
    2.2%
  • Reputation: 232
  • Gender: Male
  • With us since: 25/01/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
    • H2Obsesson
Re: HOW TO EVALUATE COMMAND AFTER RETURN?
« Reply #1 on: July 23, 2012, 07:59 AM »
BASIC and the Monitor both call the KERNAL to read the keyboard then execute the command.
 
It sounds like you want to do it backwards?  Have the keyboard call BASIC and Monitor?
 
For BASIC, you might want to look at vector $302 which is for the immediate mode loop.  It's job is to read the keyboard and then either insert the line into a program (if it starts with a line number) or execute the code immediately (no line number).  By default, it points to $4dc6.  And that code starts of like this...
 
Code: [Select]
LDX #$FF ;flag no line number
STX $3C ;curlin (high)
JSR $4F93 ;input a line to buf ($200)
;.YX = address-1 of end of buf ($1ff)
STX $3D ;txtPtr (low)
STY $3E ;(high)
...
So I guess you could make a routine that does the same thing, except replace JSR $4F93 with your keyboard code, and then JMP to the STX/STY shown above.  And of course update the vector to point to your routine.
 
The problem is BASIC does not set a bank before it does JMP ($302), so the computer could be configured for real BANK 14 or alternate BANK 14 (RAM 1 instead of RAM 0) or possibly BANK 15 (rare/bug).  In otherwords, the vector will have to point to Common RAM because you don't know what memory configuration will be active.
 
Of course you can JMP to your own routine which does the first part then JMP past the first part of $4dc6 to avoid the vector at the start... but once BASIC does its thing, it will JMP to the vector again...
 
For the Monitor, it is even worse.  There is no vector for 'MonMain' at $b08b.  All the routines in Monitor will JMP directly to this address after they execute!  There is a vector at $32e that will execute a monitor command (in .A) but this happens AFTER the keyboard is read.  I think you would have to write your own Monitor.  If you find another way, let us know!!
I'm kupo for kupo nuts!

Offline MIRKOSOFT

  • C128 user
  • ******
  • Posts: 809
  • Age: 33
  • Location: Zvolen
  • Activity:
    4.8%
  • Country: sk
  • Reputation: 188
  • Gender: Male
  • C128 programmer
  • With us since: 13/02/2009
    YearsYearsYearsYears
    • View Profile
    • MIRKOSOFT
Re: HOW TO EVALUATE COMMAND AFTER RETURN?
« Reply #2 on: July 28, 2012, 09:53 PM »
Hi Robert!


I tried many things, but I mean I didn't understand it correctly...


I tried to replace vector to my own code... but my code is base on IRQ...


Then always after hit RETURN/ENTER it has not response...


Can you explain me how to use vector if is my driver routine as IRQ?


Many many thanks.


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster, more intelligent and more powerful... is targetted to programmation...

64ever 128her
sixty-for-ever one-twenty-either

C128 = C64² + more

http://www.mirkosoft.sk

Offline Hydrophilic

  • 128D user
  • *******
  • Posts: 1225
  • Age: 41
  • Location: Earth... still!
  • Activity:
    2.2%
  • Reputation: 232
  • Gender: Male
  • With us since: 25/01/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
    • H2Obsesson
Re: HOW TO EVALUATE COMMAND AFTER RETURN?
« Reply #3 on: July 29, 2012, 07:55 AM »
Normally, the MONITOR / BASIC will call the keyboard via KERNAL to read keys, including RETURN.  The IRQ routine reads RETURN just like any other key, and puts CHR$(13) in the keyboard buffer.  It is MONITOR / BASIC that actually calls KERNAL to read the keyboard and they (MONITOR/BASIC) will execute the commands when they read RETURN / CHR$(13).
 
If I understand you correctly, you want to do it backwards!  You want the IRQ routine to call MONITOR / BASIC routines.  It is not designed that way.  There are a few vectors I mentioned that might work, but probably not.  I do not know how to explain it better.
 
I'm not saying it is impossible, but because the ROM was not designed that way (the IRQ does not call execute routines), it will be very difficult.  If you find a way (or if anybody else knows), I'm sure many people would be very interested.  At least me.
 
Good luck!
I'm kupo for kupo nuts!

Offline MIRKOSOFT

  • C128 user
  • ******
  • Posts: 809
  • Age: 33
  • Location: Zvolen
  • Activity:
    4.8%
  • Country: sk
  • Reputation: 188
  • Gender: Male
  • C128 programmer
  • With us since: 13/02/2009
    YearsYearsYearsYears
    • View Profile
    • MIRKOSOFT
Re: HOW TO EVALUATE COMMAND AFTER RETURN?
« Reply #4 on: July 29, 2012, 08:12 AM »
Thank you Robert!


BTW...


I'm experimenting to use BASIC/MONITOR direct commands (no line numbers) at once...


If is used non-Basic command in the program, of course error happens...


But for example, using BASIC commands and MONITOR commands without switch to MONITOR...
like:


PRINT"THIS TEXT IS TEST" <CR>
THIS TEXT IS TEST


READY.
M4000 8000 <CR>
>4000 00 00 00 00 00 00 00 00 ........
etc...


I want to design FN keys to use in BASIC/MONITOR the same... of course for now my driver supports 16 FN keys + HELP + Shift+RUN/STOP...


To finish driver is needed to experiment with commands... and then two simple routines which I want to do next day...


Only for information - how to use CURSOR FLASHING.. I have problem with that:


By switching 80 to 40 - with my own shortcut - in 80 cursor flashes also when is active 40


when I'm in 40 sometimes flashes NOT and using shortcut 40 to 80 is the problem same....


These little bugs I want to fix and when will be everything done, I'll publish it...


Cheers,


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster, more intelligent and more powerful... is targetted to programmation...

64ever 128her
sixty-for-ever one-twenty-either

C128 = C64² + more

http://www.mirkosoft.sk

Offline MIRKOSOFT

  • C128 user
  • ******
  • Posts: 809
  • Age: 33
  • Location: Zvolen
  • Activity:
    4.8%
  • Country: sk
  • Reputation: 188
  • Gender: Male
  • C128 programmer
  • With us since: 13/02/2009
    YearsYearsYearsYears
    • View Profile
    • MIRKOSOFT
Re: HOW TO EVALUATE COMMAND AFTER RETURN? - DRIVER BEFORE FINISH
« Reply #5 on: August 13, 2012, 07:46 PM »
Hi!


I tried all possibilities and result is bad...


My keyboard driver works as IRQ, and serves all keyboard entered characters and additional functions.


I tried to add executing of BASIC command at RETURN/ENTER pressing and...


I hit RETURN and my driver is not responding...


No key is possible to display - changes BASIC executive routine IRQ or other needed things?


As first - RETURN executes command not, only <CR> (CHR$13) prints, no more and keys are dead...


Can anybody help me?


Many thanks.


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster, more intelligent and more powerful... is targetted to programmation...

64ever 128her
sixty-for-ever one-twenty-either

C128 = C64² + more

http://www.mirkosoft.sk

 



Back to top