Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > VICE: attach disk image and run .prg file from OS filesystem
2016-05-30 20:20
Compyx

Registered: Jan 2005
Posts: 631
VICE: attach disk image and run .prg file from OS filesystem

With VICE (2.4.27 on Linux), I'm trying to figure out how to attach a D64 image to drive 8 (with TDE) while running a .prg file from my OS file system.

I've tried a wide variety of command line options, but I either get a message about extra arguments on the command line, or VICE tries to load the .prg file from the attached disk image, which obviously fails as well.

Does anyone know how to do this? I'm trying to keep my assemble-run-debug cycle as fast as possible.

/Compyx
 
... 56 posts hidden. Click here to view all posts....
 
2016-06-03 14:18
Compyx

Registered: Jan 2005
Posts: 631
After putting together some of the advice here, I managed to come up with a solution that works for my specific use case:

* Edit with, and run make from, VIM.
* Inject prg file(s) into VICE, attach disk images, start prg
* Edit source, rebuild and run
All this with VICE running as a 'server'

Part of my Makefile now looks like this:
ASM=64tass
ASM_FLAGS=-C -a -I src -I data
X64=/usr/local/bin/x64

TARGET=bdp6.prg

$(TARGET):
	$(ASM) $(ASM_FLAGS) -o $(TARGET) src/main.s
	c1541 -format bdp6,focus d64 bdp6.d64 -write $(TARGET)
	c1541 -attach bdp6.d64 -write data/sentinel-bob.koa sentinel.koa
	c1541 -attach bdp6.d64 -write data/druid.ami "[b]druid"

inject: $(TARGET)
	echo 'l "bdp6.prg" 0' | nc localhost 6510
	echo 'attach "focusgfx.d64" 8' | nc localhost 6510
	echo 'g 080d' | nc localhost 6510

.PHONY:
session:
	$(X64) -remotemonitor -chdir `pwd`


I had to install the 'vim-dispatch' plug-in to get asynchronous behaviour for VIM when running :make (actually :Make!)

So now I just do (inside VIM):
# just once:
:Make! session
# every time I need to run my code:
:Make! inject


That `:Make! inject` now takes less than a second, including assembling my code and generating the d64.

Of course the Makefile needs some cleaning, but I got a very quick assemble-run-debug cycle. Even quicker when I remap some keys in VIM ;)

So thanks guys, I just managed to turn VIM into something of a C64 IDE.

Edit: well, it almost works, need to find a way to stop/reset the emulation before injecting data and running it. Perhaps a custom kernal to speed up the 'reset' command.
2016-06-03 15:05
MagerValp

Registered: Dec 2001
Posts: 1078
Quote: Didn't try that one. I'm going to assume it's faster than exomizer. Exomizer is as fast as shit going through a coffee filter (Dutch figure of speech).

Use the -m flag with a small value to speed up exomizer significantly (at the cost of compression efficiency):
$ time exomizer sfx 0x1000 -q -o test.exo efloader.prg
real	0m2.120s
user	0m2.097s
sys	0m0.019s
$ stat -f %z test.exo 
23203

$ time exomizer sfx 0x1000 -q -m 4096 -o test.exo efloader.prg  
real	0m0.732s
user	0m0.722s
sys	0m0.007s
$ stat -f %z test.exo 
24176

$ time exomizer sfx 0x1000 -q -m 256 -o test.exo efloader.prg 
real	0m0.487s
user	0m0.476s
sys	0m0.009s
$ stat -f %z test.exo 
26778

Decrunch is still slow, but I'm too lazy to keep two packers around.
2016-06-03 16:39
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:
Wouldn't it be possible to pipe commands and files into a running VICE instance, such as a reset-load-run combination? For me, VICE startup times themselves feel pretty long already, no matter if auto-running a program or not.

like a codenet -like program that uses the remote monitor interface? yeah, i also wonder why noone did that yet, its trivial afterall :)
2016-06-04 09:09
Perplex

Registered: Feb 2009
Posts: 255
Quoting Groepaz
as long as 202 blocks works, sure - however in demo you often want to use d000-ffff too, and then the problem starts :)

Works fine with option -autostartprgmode 1
2016-06-04 10:06
Compyx

Registered: Jan 2005
Posts: 631
Well, after adding `echo 'g fce2' | nc localhost 6510` before any load commands to my Makefile, everything seems to work fine.

When I issue 'reset 0' (soft reset) through the remote monitor using netcat I need to `sleep 3` to allow the reset to finish, otherwise VICE hangs on subsequent monitor commands.

Never knew how easy it was to use the remote monitor ;)


And -autostartprgmode 1 does indeed work with files over $cfff, so that takes care of the $d000-$ffff problem.
2016-06-04 11:33
chatGPZ

Registered: Dec 2001
Posts: 11386
however, injecting to RAM does introduce its own set of quirks. been there :)
2016-06-04 17:33
Perplex

Registered: Feb 2009
Posts: 255
You should be able to do a reset without sleep (or at least with a much shorter sleep duration) using a patched kernal like iAN CooG described in post #34.
2016-06-05 16:46
Slajerek

Registered: May 2015
Posts: 63
You can use my just released C64 Debugger, I copy PRG directly to RAM not using virtual devices there.

Something like this should work:

C64Debugger -prg "full path to file.prg" -d64 "full path to disk image.d64" -jmp x0810 -wait 500

Will wait 500ms to ensure kernel settle, then attach disk, then load PRG into RAM and finally JMP to $0810.

By the way I have included a patch for fast kernel boot, but forgot to add command line setting :)
2016-06-05 17:45
Compyx

Registered: Jan 2005
Posts: 631
Looks promising, I'll check it out.

But what I'm after is controlling VICE from my editor of choice, VIM, without having to boot x64 every time I change some code. I now have that working using a Makefile, netcat, telnet and a VIM plugin. Still need to patch the kernal like iAN suggested though for quicker reset.

So far it's working fine, but I still kind of expect it to blow up in my face at any moment ;)
2016-06-08 13:03
Compyx

Registered: Jan 2005
Posts: 631
After patching the kernal like iAN suggested, I now have an assemble & run time of less than a second. Pretty sweet!

If it still works fine after a few days, I might as well put my findings in an article on codebase64.
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Trap/Bonzai
St0rmfr0nt/Quantum
iAN CooG/HVSC
Airwolf/F4CG
saimo/RETREAM
Alakran_64
Chesser/Blazon
Fresh
t0m3000/hf^boom!^ibx
MWR/Visdom
WVL/Xenon
Walt/Bonzai
csabanw
Mike
Freeze/Blazon
Mihai
Case/Padua
Guests online: 105
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.182 sec.