From: Jonno Downes on 6 Aug 2010 18:02 Hi, I want to load a M/L "stub" into RAM - the stub is too big to fit into $c000-$cfff so I am loading it in to $4000 I thought I could just reduce MEMSIZ ($37/$38) and call CLR but after doing that, I get a "?OUT OF MEMORY ERROR" whenever I try and add a line of BASIC text. Here is a screenshot showing a) the M/L I am using to reset MEMSIZ and call CLR ($A65E) - I have stubbed the rest of the code with an RTS b) what BASIC does after calling this (via sys16384) http://www.flickr.com/photos/jonnosan/4867280212/sizes/l/ What should I be doing to make sure basic keeps clear of the are $4000- $7FFF? Cheers Jonno
From: MagerValp on 7 Aug 2010 11:35 On 7 Aug, 00:02, Jonno Downes <jonno...(a)gmail.com> wrote: > I want to load a M/L "stub" into RAM - the stub is too big to fit into > $c000-$cfff so I am loading it in to $4000 > I thought I could just reduce MEMSIZ ($37/$38) and call CLR but after > doing that, I get a "?OUT OF MEMORY ERROR" whenever I try and add a > line of BASIC text. > > Here is a screenshot showing > a) the M/L I am using to reset MEMSIZ and call CLR ($A65E) - I have > stubbed the rest of the code with an RTS > b) what BASIC does after calling this (via sys16384) > > http://www.flickr.com/photos/jonnosan/4867280212/sizes/l/ > > What should I be doing to make sure basic keeps clear of the are $4000- > $7FFF? You will need to perform a NEW as well, to reset $2d-$30 et al, so call $a644 instead of a65e.
From: Jonno Downes on 7 Aug 2010 19:23 On Aug 8, 1:35 am, MagerValp <magerv...(a)gmail.com> wrote: > > > What should I be doing to make sure basic keeps clear of the are $4000- > > $7FFF? > > You will need to perform a NEW as well, to reset $2d-$30 et al, so > call $a644 instead of a65e. I there any way of retaining the running program? What I'd like is to have a BASIC program that does something like 1) load (into hi mem) the ML helper 2) call the helper init routine (SYS16384) 3) do a bunch of other things that use the other routines in the ML helper but maybe I need to move "step 3" above (the code that uses the ML helper routines) into a different BASIC file and then chain it. BTW (for the benefit of anyone following along at home) someone pointed out via email that the first instruction at $A65E does a BNE (it goes to an error routine unless Z flag is set - under BASIC, this is testing that there are no parameters following CLR) so I should really be calling $A660 instead.
From: rusure on 7 Aug 2010 19:59 On Aug 6, 4:02 pm, Jonno Downes <jonno...(a)gmail.com> wrote: > Hi, > > I want to load a M/L "stub" into RAM - the stub is too big to fit into > $c000-$cfff so I am loading it in to $4000 > I thought I could just reduce MEMSIZ ($37/$38) and call CLR but after > doing that, I get a "?OUT OF MEMORY ERROR" whenever I try and add a > line of BASIC text. It's been a LONG time since I coded this kind of thing... I load a program that resides at the top of the default BASIC program memory as well as other commercial programs that load into the block beginning at $C000. This process is initiated by another ML program that starts out in C128 mode. The installation of the program residing in BASIC program memory adjusts the memory size at $38, the bottom of strings at $34, and the IRQ vector at $314 and $315. I don't know what operations are performed when the other programs are installed. I don't recall any CLR or NEW operations in my code.
From: rusure on 8 Aug 2010 00:20 On Aug 7, 5:23 pm, Jonno Downes <jonno...(a)gmail.com> wrote: > On Aug 8, 1:35 am, MagerValp <magerv...(a)gmail.com> wrote: > > > > > > What should I be doing to make sure basic keeps clear of the are $4000- > > > $7FFF? > > > You will need to perform a NEW as well, to reset $2d-$30 et al, so > > call $a644 instead of a65e. > > I there any way of retaining the running program? > What I'd like is to have a BASIC program that does something like > 1) load (into hi mem) the ML helper > 2) call the helper init routine (SYS16384) > 3) do a bunch of other things that use the other routines in the ML > helper > > but maybe I need to move "step 3" above (the code that uses the ML > helper routines) into a different BASIC file and then chain it. > > BTW (for the benefit of anyone following along at home) someone > pointed out via email that the first instruction at $A65E does a BNE > (it goes to an error routine unless Z flag is set - under BASIC, this > is testing that there are no parameters following CLR) so I should > really be calling $A660 instead. That's commonly done in BASIC programs without a need for NEWing or CLRing. The only need for a NEW operation is if you need to edit a BASIC program after loading ML above the current top of BASIC. After BASIC programs LOAD ML programs, they continue processing from the beginning of the BASIC code. Without checking to see if the ML has been LOADed, the BASIC program will LOAD the ML over and over. Usually BASIC that LOADS ML looks like this: 10 if i > < 0 then 500 100 i=1 200 load"stub",8,1 500 rem rest of program When line 10 is first executed, the value of i is 0. i is set to 1 in line 100. stub is LOADed in line 200. The program continues processing in line 10 with 1 as the value of i. The conditional transfer of control is made to a line after the LOAD of the ML.
|
Next
|
Last
Pages: 1 2 Prev: Ms. Pac-Man speed-up hack for the Commodore 64 Next: PLA replacement C16 |