Commodore MPS-801
Dot Matrix Printer
Some simple examples for using printer in BASIC:
This example prints UpperCase characters:
OPEN2,4
PRINT#2,"TEXT"
CLOSE2
This example prints LowerCase characters:
OPEN2,4,7
PRINT#2,"Text"
CLOSE2
This example prints list of BASIC program in LowerCase characters:
(it is possible to use more BASIC commands to send it to printer)
OEN2,4,7:REM LOWERCASE
CMD2
LIST
CLOSE2
Before printing test if is printer online:
10 OPEN2,device,2:CLOSE2:IF ST<>0 THEN PRINT"TURN ON PRINTER!":GETKEY A$:GOTO10
20 REM **** CONTINUE ****
Of course are many and many models to use, Centronics printers, color printers and more...
Printing VIC-IIe screen in assembler (no graphics, text only):
printpage:
lda #0
jsr setnam
lda #4
ldx #4
ldy #7
jsr setlfs
jsr open
ldx #$04
jsr ckout
lda #00
ldx #04
sta $fb
stx $fc
ldx #00
xup:
ldy #00
yup:
lda ($fb),y
jsr decode // decodes SCREENCODES to PETSCII
jsr bsout
iny
cpy #40
bne yup
lda #$0d
jsr bsout
lda $fb
sta $fe
clc
adc #$28
cmp $fe
bcs no
inc $fc
no:
sta $fb
inx
cpx #24
bne xup
jsr clrch
lda #4
jsr klose
rts
klose:
lda #$0d
jsr bsout
lda #$0d
jsr bsout
jsr clrch
lda #4
jsr close
rts
decode:
and #127
cmp #32
bmi low
jmp c1
low:
adc #64
rts
c1:
cmp #32
bpl c2
jmp low
c2:
cmp #64
bmi eot
c3:
cmp #96
bmi c4
jmp c5
c4:
cmp #64
bmi eot
adc #31
rts
c5:
cmp #96
bmi eot
sbc #64
eot:
rts
Need you new ribbon for your own dot matrix printer?
Here's link: http://www.e-sklep-laser-sinex.pl/index.html?search=ok&prod_name=mps801
(it's in Polish language, but it's no problem to translate, e.g. with Google Translator and order it in English). This link is especially for MPS-801 dot matrix printer, but there are more printer types available.