Previous Thread
Next Thread
Print Thread
Page 7 of 11 1 2 5 6 7 8 9 10 11
Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9

I managed to get something working that would save the printer output bytes to separate files so you could launch a viewer on them, like gv for postscript output.

A delay of 30 seconds will separate files.


Code
lp0 = manager:machine().luaprinters[1]
filenamebase=lp0:getprintername()
filenamecount=0
idlewaitperiod=30*60
idlecount=0


function feedchars(ch)
local idleflag=0
repeat
nextchar = lp0:getnextchar()
if nextchar >= 0 then 
  idleflag=1
  if f == nil then
    filenamecount = filenamecount+1
    currentfilename = filenamebase..string.format("%04d",filenamecount)..".ps"
    f=io.open(currentfilename,"w")
    idlecount=0
  end
  f:write(string.char(nextchar))
 end 
until nextchar < 0
if idleflag==0 then
  if f~=nil then
    idlecount=idlecount+1 
    if idlecount%(60*5)==0 then print ("idle: "..idlecount/60) end
  end
else
  idlecount=0 -- reset idlecount
end
if idlecount > idlewaitperiod then
  idlecount=-1
  f:close()
  f=nil
  os.execute('gv "'..currentfilename..'" &')
  print('gv '..currentfilename)
end
end

function framedispatch() for i,j in pairs(dispatchlist) do j() end end
emu.register_frame(framedispatch)
dispatchlist={feedchars}



Code
idle: 5.0
idle: 10.0
idle: 15.0
idle: 20.0
idle: 25.0
idle: 30.0
gv 2020-09-20 14-14-25 ct486-board4-lpt-lpt-centronics-luaprinter0004.ps

Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9
I managed to convert the ap2000 driver into using my luaprinter routines to do the page saving:

They look a little "squashed" since the aspect ratio is off because it's 120x72. 120x144 would probably look more normal.

Some page samples:

[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]

putting the first page into gimp and stretching it to 120x144:
[Linked Image from i.imgur.com]

testing to see how many lines on a page:
[Linked Image from i.imgur.com]

Joined: Mar 2006
Posts: 1,060
Likes: 1
L
Very Senior Member
Offline
Very Senior Member
L
Joined: Mar 2006
Posts: 1,060
Likes: 1
This is amazing stuff! Are you going to submit this upstream as a PR soon? I kinda want to play with it...

LN


"When life gives you zombies... *CHA-CHIK!* ...you make zombie-ade!"
Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9
Hi LN,

Thanks! Yes, I'm almost there... 8-)

I finally figured out how to blast out my screwed up github repository with "git push --force" and that completely replaced everything. Yay!

Coming soon to a theater near you 8-)

Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9
If you want to have a look at luaprinter, I have a branch at:

https://github.com/goldnchild/mame/tree/luaprinter

I need to clean it up and figure out the proper way of doing things using the device_interface mix-in.


[Linked Image from i.imgur.com]


One weird thing that the ap2000 is doing is that it's missing descenders when it prints in the Roman font. I thought initially that it wasn't getting the full 9 bits of the printhead, but it prints draft just fine as well as the Sans Serif.

Ramiro Polla (the uber-hacker behind the ap2000 driver) was cool enough to send me his ap2000 disassembly so maybe I can figure out why.

Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9
I thought I'd make a font from the pictures in the Imagewriter manual, since I always liked that font, and it doesn't look too bad.

Code
chars = {
"        "..
"        "..
"        "..
"        "..
"        "..
"        "..
"        "..
"        "..
"        ",
"   x    "..
"   x    "..
"   x    "..
"   x    "..
"        "..
"        "..
"   x    "..
"        "..
"        ",
"  x x   "..
"  x x   "..
"  x x   "..
"        "..
"        "..
"        "..
"        "..
"        "..
"        ",
"  x  x  "..
"  x  x  "..
" xxxxxx "..
"  x  x  "..
" xxxxxx "..
"  x  x  "..
"  x  x  "..
"        "..
"        ",
...
"   x    "..
"  x x   "..
" x   x  "..
"x     x "..
"xxxxxxx "..
"x     x "..
"x     x "..
"        "..
"        ",
" xxxxx  "..
" x    x "..
" x    x "..
" xxxxx  "..
" x    x "..
" x    x "..
" xxxxx  "..
"        "..
"        ",
...
}

-- just a quick test to see if it works

rmargin=125
lmargin=5
xpos=lmargin*8
tmargin=5

function printchar(c)
  c = c & 0x7f
  if c==13 or c==10 then xpos=lmargin*8 ypos=ypos+12 return end
  if xpos > rmargin*8 then xpos=lmargin*8 ypos=ypos+12 end
  if c<32 then c=32 end
  for col=0,7 do
    headdots = 0
    for row=0,8 do
      dot = chars[c-32+1]:sub(1+row*8+col,1+row*8+col)
      if dot == " " then dot=0 else dot=1 end
      headdots = headdots | (dot << row)
    end
    renderhead(headdots)      
    print(col.."  "..headdots)
    xpos = xpos+1      
  end
end

function printstring(s) for i=1,s:len() do printchar(string.byte(s,i)) end end



[Linked Image from i.imgur.com]

Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9
I was trying to find something that would print on the BBC Master and found a BeeBug dumpmaster rom.

./mame64 bbcm -printer ap2000 -romimage1 dmpmastr


It kinda works, but it seems to get its workspace corrupted when I do a *LDPIC. You're supposed to be able to hit CTRL+SHIFT+@ (mapped to backslash) to make it dump.

*BPRINT P0 V A D will setup the hotkey but it doesn't dump properly.

*BPRINT I V will do a vertical dump in inverse.
*HELP BPRINT shows you the settings.

Still, it's kinda neat to see it work.

[Linked Image from i.imgur.com]


edit: after fiddling around, I discovered that the rom scrnprnt100 has a good hotkey setup: hit CTRL+P and it prints the screen, CTRL+SHIFT+P and it prints in inverse.

./mame64 bbcm -printer ap2000 -romimage1 scrnprnt100


[Linked Image from i.imgur.com]

Last edited by Golden Child; 10/02/20 07:26 AM.
Joined: Apr 2012
Posts: 314
Likes: 3
Senior Member
Online Content
Senior Member
Joined: Apr 2012
Posts: 314
Likes: 3
Originally Posted by Golden Child
I was trying to find something that would print on the BBC Master and found a BeeBug dumpmaster rom.

./mame64 bbcm -printer ap2000 -romimage1 dmpmastr


It kinda works, but it seems to get its workspace corrupted when I do a *LDPIC. You're supposed to be able to hit CTRL+SHIFT+@ (mapped to backslash) to make it dump.

*LDPIC is a custom graphics loader on the Acorn User Gallery discs which runs in workspace at &900, so not too surprising there's a conflict.

The most popular printing ROMs at the time were Dumpout 3 (dumpout3) and Printmaster (prntmeps), but not sure if they have a hotkey dump feature.


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9

I hacked up a lua script to render Epson JX-80 output from the BBC Dumpmaster rom and it looks pretty good. It supports the JX-80 on printer number 22. 22 is color with square pixels, 0 is black and white, and 5 is 72x72 dpi for square pixels.

The luaprinter wouldn't work unless I set the acknowledge to 1 in device_reset with output_ack(1).

Doubling the dots horizontally on the printout makes it look vivid.

[Linked Image from i.imgur.com]

The output is stretched 200% using gimp to make the aspect look right and rotated 90 degrees to be upright.

[Linked Image from i.imgur.com]


Joined: Feb 2014
Posts: 681
Likes: 9
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 681
Likes: 9
I was thinking, hmmmm can we make pdfs out of the dots. There's a catseye lua library that hacked on can make this:

[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]

It's a bit slow to be practical, gv takes a minute to render the pdf page, but still good fun.

Page 7 of 11 1 2 5 6 7 8 9 10 11

Link Copied to Clipboard
Who's Online Now
2 members (Dorando, Golden Child), 27 guests, and 8 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,992
Posts118,148
Members5,005
Most Online890
Jan 17th, 2020
Forum Host
These forums are hosted by www.retrogamesformac.com
Forum hosted by www.retrogamesformac.com