chapter8/CH8PRG6.SRC:

05          *= $3000 ARBITRARY START
10 ;THIS ROUTINE PRINTS A LINE TO THE PRINTER BY CALLING SIO E459
20 SIOV     =  $E459 ;  SIO VECTOR
30 CR       =  $9B ;   EOL
40 PRNTID   =  $40 ;   PRINTER SERIAL BUS ID
45 MODE     =  $4E ;   NORMAL MODE
50 PTIMOT   =  $001C ;   TIMEOUT LOCATION
60 DDEVIC   =  $300 ;  DEVICE SERIAL BUS ID
70 DUNIT    =  $301 ;  SERIAL UNIT NUMBER
80 DCOMND   =  $302 ;  SIO COMMAND
90 DSTATS   =  $303 ;  SIO DATA DIRECTION
0100 DBUFLO =  $304 ;  BUFFER LOW ADDRESS
0110 DBUFHI =  $305 ;  BUFFER HIGH ADDRESS
0120 DTIMLO =  $306 ;  SIO TIMEOUT
0130 DTIMHI =  $307
0140 DBYTLO =  $308 ;  BUFFER LENGTH
0150 DBYTHI =  $309
0160 DAUX1  =  $30A ;  AUXILARY BYTE---PRINTER MODE
0170 DAUX2  =  $30B ;  AUXILARY BYTE---NOT USED 
0180 ;
0190 MESS   .BYTE   "EXAMPLE 12",CR
0200 ;
0220        LDA   #PRNTID ; SET BUS ID
0230    STA   DDEVIC   
0240        LDA   #1 ; SET UNIT NUMBER
0250    STA   DUNIT
0260        LDA   #MODE
0270        STA   DAUX1 ; PRINTER MODE NORMAL
0275        LDA   #1
0280        STA   DAUX2 ; UNUSED
0290        STA   DTIMHI ; TIMEOUT<256 SECS
0300        LDA   PTIMOT ; SET SIO TIMEOUT FOR PRINTER
0310        STA   DTIMLO
0320        LDA   #MESS&255
0330        STA   DBUFLO ; SET MESS AS BUFFER
0340        LDA   #MESS/256
0350        STA   DBUFHI
0360        LDA   #$80 ; SET SIO DATA DIRECTION FOR
0370        STA   DSTATS ; PERIPHERAL TO RECEIVE
0380        LDA   #'W ; SIO COMMAND WRITE
0390        STA   DCOMND
0410        JSR   SIOV ; CALL SIO
0420        BMI   ERROR
0430 GOOD     BRK
0440 ERROR    BRK

Back to previous page