News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Shining

Stuck with RUN Basic- program from ASM

Started by Shining, 14:32, 19 July 13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Shining

Hello all, my introduction in "off-topic" will follow later cause I first want to fix this damn problem  ;) :

I'm fixing some old code of mine but I'm a little bit stuck:

I need to load and run a Basic- Program out of ASM.

When I load the program using cas_in_open, cas_in_direct and cas_in_close and then return to BASIC I can "run" the program.

Is there a way to jump to the basic-program after cas_in_close ? I tried to jump to &EA78 ( RUN on 6128 ) with no success.

Or is there perhaps another, better solution ?


TGS is back

Download my productions at:
cpc.scifinet.org

HAL6128

I think it's complex situation running running BASIC programs out of ASM. It depends how the BASIC program is initialized because of different variables  and enviroment settings (e.g. symbol after xx will change RAM limits after initializing and those settings will be stored / located in different places in RAM depending on it's boundaries). It's not trivial. Just poke the RAM from &170 to the end with tokens won't help the program run. But I don't know what is needed more to get a BASIC program run. Maybe poke some more right RAM settings after &A6FC?
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

arnoldemu

I have some code that will do this. I will find it for you.

A easier idea would be to have the basic program from the start. Call your binary code. And let this return back to basic. Then basic takes over again and calls your program again when it's done?

Your code could return a code to tell basic what to do.

Could you do this instead?

It would be more compatible this way.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Urusergi

Quote from: Shining on 14:32, 19 July 13
Is there a way to jump to the basic-program after cas_in_close ? I tried to jump to &EA78 ( RUN on 6128 ) with no success.

Hello! 8)

I think this code should do the job (only CPC6128, of course):

CALL &B900
LD HL,KB_ASC
JP &C0B4
KB_ASC DB &52,&55,&4E,&0D


Saludos!

arnoldemu

;; length is the length of your program in bytes


ld hl,(length)
ld bc,&170
add hl,bc
ld c,0
call kl_rom_select
ld a,(&c002)
cp 0
jp z,cpc464
ld (&ae66),hl
ld (&ae68),hl
ld (&ae6a),hl
ld (&ae6c),hl
cp 1
jp z,cpc664
jp &ea78        ;; run BASIC CPC6128
.cpc664
jp &ea7d        ;; run BASIC CPC664
.cpc464
ld (&ae83),hl
ld (&ae85),hl
ld (&ae87),hl
ld (&ae89),hl
jp &e9bd        ;; run BASIC CPC464
.length
defw 0

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

HAL6128

...hey, it works!!
Very interesting.
(Thanks also from my side although I hadn't post the topic. ;D )
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

arnoldemu

Where the code says "CPC6128" this *should* also work for Plus.
But I didn't test this.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod