1541 Emulation

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

1541 Emulation

Post by chysn »

Currently, my VIC-20 workflow involves:

(1) Write the software in Eclipse
(2) Assemble it with 6502Overdrive
(3) (sometimes, but not always, generate a BASIC loader program)
(4) Write the file to SD card
(5) Eject the SD card and insert it into my SD2IEC
(6) Load the file on the VIC-20 from the SD cart
(7) Run it
(8) Eject the SD card and insert it into my MacBook
(9) Back to step 1

Okay, so... is there a way to get the SD card of out this workflow? Maybe have USB hardware to the IEC port and have the MacBook emulate a 1541?
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 1541 Emulation

Post by Mike »

I don't exactly know the size and type of the project(s) you're working at and for sure my reply doesn't directly address your question, but in your list, ...
chysn wrote:(1) Write the software in Eclipse
(2) Assemble it with 6502Overdrive
(3) (sometimes, but not always, generate a BASIC loader program)
(4) Write the file to SD card
[...]
... around point 3, I am missing the step "(x) check the software in emulation on PC/Mac until most obvious bugs are ironed out".

In that case, the sheer number of full turn-around cycles you're implying here is minimized and most of the development takes place on the PC/Mac only. Of course this requires you have an up-to-date emulator installed on your big machine, are willing to use it, and you trust its emulation capability.

The only time I'd need to go with the extended cycle you're describing is when I stumble upon (unexpected) behaviour of real hardware that isn't fully replicated by emulation.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: 1541 Emulation

Post by chysn »

Mike wrote: Sun Feb 16, 2020 3:50 pm ... around point 3, I am missing the step "(x) check the software in emulation on PC/Mac until most obvious bugs are ironed out".
Heh... I knew that was going to come up.

The fact of the matter is, I don't know how to use VICE. I don't know how to load my programs into it, or what "disk images" have to do with anything. They seem to be files and not directories, so I'm not sure how to add anything to them from outside the VIC-20 emulation. The only thing in VICE I have any use for is petcat.

I know this can all be remediated with the appropriate documentation. When I read through something that seems useful*, I find that what I see on the MacOS version looks absolutely nothing like what's shown in the tutorials or documentation, or whatever. It's not like my VICE version is really old (3.1). It's that they seem to have given up on MacOS. And also the keyboard differences are super-annoying. But I love petcat.

Okay, yeah, that all sounds very get-off-my-lawn-whippersnapper, now that I read it back. But if I could figure out how to actually load the programs I make into VICE, that would be quite the coup.

* Like this: https://wpguru.co.uk/2014/06/how-to-loa ... e-in-vice/
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 1541 Emulation

Post by Mike »

As a first measure, try dragging a *.prg file or *.d64 disk image from a folder into the main window of VICE and see what happens.

You'll have to acquaint yourself with:
  • positional vs. symbolic mapping of the keyboard,
  • true drive emulation (TDE) on (most accurate, but only works within disk images!) vs. TDE off (much faster, and can also use host directories as "disks"),
  • how to setup different memory sizes (unexpanded, +3K, +8K or more),
  • how to setup the joystick,
  • how to explicitly change *.d64 images during program execution (i.e. "change disks" !) in 'Peripheral Settings'
*.d64 files are containers that hold the whole of a 1541 disk, sector based, within themselves, including the directory. Just imagine the contents of tracks 1..35, with all their sectors, concatenated into such a file and you're right. The emulation can easily seek within that file, when either the 1541 emulation (with TDE on) or VDrive (with TDE off) is active.

In the first case (TDE on), VICE fully emulates the 1541. Only the emulated DOS has direct access to the *.d64 file and reads it as if there was a magnetic media really. The emulated DOS processes the sectors and sends (or receives) the data from an emulated IEC bus between emulated 1541 and emulated VIC-20. Doesn't get much more accurate than that. Even the clock frequency difference between 1541 (1 MHz) and PAL (~1.10 MHz) or NTSC (~1.03 MHz) VIC-20 is taken care of.

With TDE off, VICE takes a lot of short-cuts, which reduce the emulation fidelity, but increase the speed a lot. This mostly concerns the use of drive speeders, which require TDE on to function correctly. As a rough hint, if something works with TDE off, on real hardware it will also run with a SD2IEC (instead of a 1541).

The c1541 command line tool included with VICE can be used to transfer files between Mac/PC directories and *.d64 disk image files.

Greetings,

Michael
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: 1541 Emulation

Post by chysn »

I've been getting acquainted with c1541. As a command-line utility, this was easily-integrated into my existing bash build script, which updates my object code, PRG, and git repo in a single step. Now it also deletes then writes the associated PRG files to the .d64 image so I can try things out in VICE.

I've still got a ton to learn about VICE (where are the Stop and Restore keys? Is there a warm restart for when I crash it?), but it's clear that this is going to be a lot faster than going back and forth between the Mac and the VIC.

Thanks, as always!
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 1541 Emulation

Post by Mike »

chysn wrote:[...] c1541 [...] was easily-integrated into my existing bash build script, [...]
Now that was fast!
I've still got a ton to learn about VICE (where are the Stop and Restore keys?
Try [Esc] and [PgUp]. Upon taking a quick peek on a photo of a MacBook keyboard, the function of [PgUp] mostly probably requires the [Fn] key held together with the [Up] cursor key.

Even with positional mapping, it's nearly impossible to replicate the VIC-20 keyboard 1:1 even when there is a numeric keypad. But it's still better than symbolic mapping, IMO - I have a full German keyboard on my laptop here and symbolic mapping would not only confuse Y and Z but also most non-letter/numeral keys would be elsewhere compared to the real layout.
Is there a warm restart for when I crash it?
[command] + R should do as desired (preserving RAM, but restarts the CPU as does a userport reset).

Good luck for your further explorations! :mrgreen:
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: 1541 Emulation

Post by eslapion »

chysn wrote: Sun Feb 16, 2020 4:30 pm The fact of the matter is, I don't know how to use VICE. I don't know how to load my programs into it, or what "disk images" have to do with anything. They seem to be files and not directories, so I'm not sure how to add anything to them from outside the VIC-20 emulation.
I strongly suggest you take a look at DirMaster. Latest release is V3.1.4. Freeware.
Be normal.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: 1541 Emulation

Post by chysn »

eslapion wrote: Mon Feb 17, 2020 8:39 am
chysn wrote: Sun Feb 16, 2020 4:30 pm The fact of the matter is, I don't know how to use VICE. I don't know how to load my programs into it, or what "disk images" have to do with anything. They seem to be files and not directories, so I'm not sure how to add anything to them from outside the VIC-20 emulation.
I strongly suggest you take a look at DirMaster. Latest release is V3.1.4. Freeware.
I will, thanks!
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: 1541 Emulation

Post by srowe »

chysn wrote: Sun Feb 16, 2020 6:00 pm I've still got a ton to learn about VICE (where are the Stop and Restore keys? Is there a warm restart for when I crash it?), but it's clear that this is going to be a lot faster than going back and forth between the Mac and the VIC.
A major benefit is being able to drop into the monitor and inspect memory and registers, even after a crash. I've found bugs that would have been almost impossible to pin point on a real VIC.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: 1541 Emulation

Post by groepaz »

"DirMaster"
... is a program i strongly advice to avoid. it has a history of creating broken .d64 images, and more than once we tracked down a supposed "VICE bug" to a broken D64 created by Dirmaster.

In any case - we have not given up on macOS. quite the contrary - we have a dedicated macOS maintainer now, and he is even providing binaries. you can also install a bleeding edge VICE using "homebrew" now (packages also provided by dqh).

and yes, regarding development... learn VICE, and especially the monitor/debugger. soon enough you will be wondering how you could do anything without it :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Re: 1541 Emulation

Post by Witzo »

I use Droid64 to copy .prg-files to and from .d64-images.
It's a Java GUI. I run it by entering
$ java -jar ./droid64-0.15b.jar
in a terminal, in the directory with the droid64 program.

Site:
http://droid64.sourceforge.net/
Post Reply