Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!petunia!news From: slobasso@raven.calpoly.edu) (I don't know ;-) Newsgroups: comp.sys.cbm Subject: Re: ML help!!! Message-ID: <27584a47.2324@petunia.CalPoly.EDU> Date: 2 Dec 90 00:26:47 GMT References: <1990Nov30.161424.2348@uoft02.utoledo.edu> Reply-To: slobasso@raven.calpoly.edu.UUCP (I don't know ) Organization: Cal Poly State University -- San Luis Obispo Lines: 44 In article grx0644@uoft02.utoledo.edu writes: |I wrote an assembly program for my c128. Its a simple program that writes the |time on the screen in the upper left hand corner. To be useful, it is started |by a sys statement and returns basic when finished. It uses the cassette buffer |as its home. I want to have the C128 to execute this program as part of the |C128's normal routine so I don't have to keep sending a sys command. is there |a way to patch something the normal operating routine that will cause the |computer to JSR to my routine and then RTS back to what ever it was doing, |without interupting any basic programs that may be executing at the same time? The best way to do this is to make a ML program run while other things run is to link it into an interrrupt. I use the IRQ RAM vector. $0314-0315 When your program is done rather than returning (rts) you just jmp to where the Vector usually points. here's a sample that changes the border color of the 40col screen . 01800 78 SEI ;these 7 lines set up the interrupt vector . 01801 A9 0D LDA #$0D ;LSB of address . 01803 8D 14 03 STA $0314 . 01806 A9 18 LDA #$18 ;MSB of address . 01803 8D 15 03 STA $0315 . 0180B 58 CLI . 0180C 60 RTS ; note that the program starts at the address used above . 0180D CE 20 D0 DEC $D020 ;this is your actual program, it finishes by . 01810 4C 65 FA JMP $FA65 ;jumping to FA65 (EA31 for the C64) this program will run while a basic or ML program is running w/o interrupting it. Try to have the program as small as possible since it is executed very often. For instance a clock need only be updated once every second. I think that the interrupt will get called 60 times a second. -- --- | I took a course in speed reading and was Steve LoBasso | able to read War and Peace in twenty minutes. slobasso@polyslo.CalPoly.EDU | It's about Russia. ucbvax!voder!polyslo!slobasso | -- Woody Allen