Bitmap printer output in VICE

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Bitmap printer output in VICE

Post by srowe »

Can someone give me the correct command line to get a BMP file of the printer output? I've tried

Code: Select all

$ xvic -memory none -iecdevice4 -device4 1 -pr4drv mps803 -pr4output graphics -pr4txtdev 0 -prtxtdev1 /tmp/output
but no file is written. I'm sure I had this working with an older version of VICE, currently running 3.4.
User avatar
mathom
Vic 20 Dabbler
Posts: 80
Joined: Wed Aug 07, 2019 11:37 am
Location: Centennial, Colorado
Occupation: Software Engineer

Re: Bitmap printer output in VICE

Post by mathom »

This could be your problem:

https://sourceforge.net/p/vice-emu/bugs/1281/

You might want to check it out and add any new info. The devs are starting a push to do the next release by the end of the year.

...mathom...
...mathom...
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bitmap printer output in VICE

Post by groepaz »

did you trigger a formfeed and/or close the emulator? else no output is produced.
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Bitmap printer output in VICE

Post by srowe »

groepaz wrote: Sun Oct 18, 2020 11:43 am did you trigger a formfeed and/or close the emulator? else no output is produced.
Closed VICE, no file is created.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bitmap printer output in VICE

Post by groepaz »

I am investigating this ... apparently "iecdevice" actually never worked with xvic. Try to enable virtual device traps (-virtualdev), that should make it work (please confirm).
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Bitmap printer output in VICE

Post by srowe »

That seems to work, I get the following output from VICE

Code: Select all

Serial Interface: Error - Flush printer #4,0 while closed - ignoring.
Serial Interface: Auto-opening printer #4,0.
and a bitmap file created.

I did get the following when I quit VICE

Code: Select all

Exiting...
Sound: Closing device `pulse'
corrupted double-linked list
Aborted (core dumped)
I'll see if it's reproducible.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Bitmap printer output in VICE

Post by srowe »

Seems reproducible

Code: Select all

Exiting...
Sound: Closing device `pulse'
[Thread 0x7fffe5a37700 (LWP 10352) exited]
corrupted double-linked list

Thread 1 "xvic" received signal SIGABRT, Aborted.
0x00007ffff6b13a7a in raise () from /lib64/libc.so.6
(gdb) where
#0  0x00007ffff6b13a7a in raise () at /lib64/libc.so.6
#1  0x00007ffff6afc524 in abort () at /lib64/libc.so.6
#2  0x00007ffff6b55ff8 in  () at /lib64/libc.so.6
#3  0x00007ffff6b5c89a in  () at /lib64/libc.so.6
#4  0x00007ffff6b5cc4c in unlink_chunk.isra () at /lib64/libc.so.6
#5  0x00007ffff6b5dc0d in malloc_consolidate () at /lib64/libc.so.6
#6  0x00007ffff6b5e400 in _int_free () at /lib64/libc.so.6
#7  0x000000000046f98b in drivecpu_shutdown ()
#8  0x000000000046e545 in drive_shutdown ()
#9  0x0000000000428a9a in machine_shutdown ()
#10 0x00007ffff6b15ecc in __run_exit_handlers () at /lib64/libc.so.6
#11 0x00007ffff6b15ffa in  () at /lib64/libc.so.6
#12 0x00000000004376d9 in  ()
#13 0x00000000004ffaaa in ui_exit ()
#14 0x0000000000500f55 in ui_main_window_delete_event ()
#15 0x00007ffff79b63e4 in _gtk_marshal_BOOLEAN__BOXEDv () at /lib64/libgtk-3.so.0
#16 0x00007ffff711ffc6 in _g_closure_invoke_va () at /lib64/libgobject-2.0.so.0
#17 0x00007ffff713b66d in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
#18 0x00007ffff713c1b2 in g_signal_emit () at /lib64/libgobject-2.0.so.0
#19 0x00007ffff79654e4 in gtk_widget_event_internal () at /lib64/libgtk-3.so.0
#20 0x00007ffff7830f3b in gtk_main_do_event () at /lib64/libgtk-3.so.0
#21 0x00007ffff75402d5 in _gdk_event_emit () at /lib64/libgdk-3.so.0
#22 0x00007ffff75700d2 in gdk_event_source_dispatch () at /lib64/libgdk-3.so.0
#23 0x00007ffff7038665 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#24 0x00007ffff70389e8 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#25 0x00007ffff7038a6c in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#26 0x00000000004ff7e1 in ui_dispatch_events ()
#27 0x000000000050988a in vsyncarch_postsync ()
#28 0x0000000000434d65 in vsync_do_vsync ()
#29 0x0000000000454e22 in vic_raster_draw_handler ()
#30 0x0000000000453a93 in vic_cycle ()
#31 0x0000000000446431 in maincpu_mainloop ()
#32 0x000000000042902b in main_program ()
#33 0x00007ffff6afdb0b in __libc_start_main () at /lib64/libc.so.6
#34 0x0000000000415c5a in _start ()
(gdb) 
I'll run it through valgrind.

[edit]

Looks like there's some problems in the printer shutdown code

Code: Select all

Sound: Closing device `pulse'
==13616== Invalid read of size 1
==13616==    at 0x4C63F2: output_graphics_line_data (output-graphics.c:96)
==13616==    by 0x4BE5D7: bmpdrv_write (bmpdrv.c:223)
==13616==    by 0x4C6645: UnknownInlinedFun (output-graphics.c:177)
==13616==    by 0x4C6645: output_graphics_close (output-graphics.c:167)
==13616==    by 0x4C5B43: close_pr (interface-serial.c:267)
==13616==    by 0x4C5BEF: interface_serial_detach (interface-serial.c:496)
==13616==    by 0x4C603A: interface_serial_shutdown (interface-serial.c:519)
==13616==    by 0x428A58: machine_shutdown (machine.c:294)
==13616==    by 0x5BAEECB: __run_exit_handlers (in /usr/lib64/libc-2.29.so)
==13616==    by 0x5BAEFF9: exit (in /usr/lib64/libc-2.29.so)
==13616==    by 0x4376D8: archdep_vice_exit (archdep_atexit.c:119)
==13616==    by 0x4FFAA9: ui_exit (ui.c:1890)
==13616==    by 0x500F54: ui_main_window_delete_event (uicommands.c:225)
==13616==  Address 0x6f7f5a0 is 0 bytes inside a block of size 480 free'd
==13616==    at 0x4835900: free (vg_replace_malloc.c:540)
==13616==    by 0x4C68E1: output_graphics_shutdown (output-graphics.c:270)
==13616==    by 0x4BFFB8: printer_shutdown (printer.c:113)
==13616==    by 0x428A58: machine_shutdown (machine.c:294)
==13616==    by 0x5BAEECB: __run_exit_handlers (in /usr/lib64/libc-2.29.so)
==13616==    by 0x5BAEFF9: exit (in /usr/lib64/libc-2.29.so)
==13616==    by 0x4376D8: archdep_vice_exit (archdep_atexit.c:119)
==13616==    by 0x4FFAA9: ui_exit (ui.c:1890)
==13616==    by 0x500F54: ui_main_window_delete_event (uicommands.c:225)
==13616==    by 0x4EE43E3: ??? (in /usr/lib64/libgtk-3.so.0.2404.4)
==13616==    by 0x56BFFC5: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.2)
==13616==    by 0x56DB66C: g_signal_emit_valist (in /usr/lib64/libgobject-2.0.so.0.6000.2)
==13616==  Block was alloc'd at
==13616==    at 0x4834753: malloc (vg_replace_malloc.c:309)
==13616==    by 0x42704D: lib_malloc (lib.c:571)
==13616==    by 0x4C6545: output_graphics_open (output-graphics.c:155)
==13616==    by 0x4C2074: UnknownInlinedFun (drv-mps803.c:437)
==13616==    by 0x4C2074: drv_mps803_open (drv-mps803.c:414)
==13616==    by 0x4C5E04: open_pr.isra.3 (interface-serial.c:202)
==13616==    by 0x4C5ECE: write_pr (interface-serial.c:246)
==13616==    by 0x4D5AD3: fsdrive_write (fsdrive.c:257)
==13616==    by 0x4D502E: serial_trap_send (serial-trap.c:179)
==13616==    by 0x433696: traps_handler (traps.c:253)
==13616==    by 0x44B6C4: maincpu_mainloop (6510dtvcore.c:1729)
==13616==    by 0x42902A: main_program (main.c:286)
==13616==    by 0x5B96B0A: (below main) (in /usr/lib64/libc-2.29.so)
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bitmap printer output in VICE

Post by groepaz »

so what *exactly* did you do? :)

edit: nvm, i can reproduce it

edit++: thehell, and now i cant anymore. please tell! and please provice a commandline starting with -default :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Bitmap printer output in VICE

Post by srowe »

VICE built with --enable-native-gtk3ui --with-pulse --enable-cpuhistory, run with

Code: Select all

xvic -memory none -virtualdev -iecdevice4 -device4 1 -pr4drv mps803 -pr4output graphics -pr4txtdev 0 -prtxtdev1 test_output
Enter the following program

Code: Select all

10OPEN4,4
20PRINT#4,"TESTING"
30CLOSE4
then quit VICE, poof.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bitmap printer output in VICE

Post by groepaz »

thats not enough to reproduce it reliably... for some reason it worked (as in crashed) exactly once for me, subsequent tests work fine (no crash). thats why i asked for a commandline starting with -default :) and please test it a few times (preferably by autostarting your little test program, so i dont have to type it all the time)

made a ticket about it for the time being: https://sourceforge.net/p/vice-emu/bugs/1336/
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Bitmap printer output in VICE

Post by srowe »

-autostart and -autoload affect the reproducibility for me too, it only happens when I type the program in.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bitmap printer output in VICE

Post by groepaz »

try the next nightly build, it should be fixed in r38886
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Bitmap printer output in VICE

Post by srowe »

I created a patch with the fix from svn, it now doesn't crash.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bitmap printer output in VICE

Post by groepaz »

sounds good :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Post Reply