Post Reply 
Calculators with Support of the 82240 IR-Printer
06-25-2014, 07:27 PM (This post was last modified: 06-25-2014 07:29 PM by Christoph Giesselink.)
Post: #7
RE: Calculators with Support of the 82240 IR-Printer
For sure the HP-95LX has also the necessary hardware. And with a little software help we can send data to the printer:

Code:

                PAGE    60,132
                TITLE   HP-IR-REDEYE-Interface C-Modul for HP-95LX

;***********************************************************************
; HP-IR-REDEYE-Interface C-Modul,
;
; (c) Christoph Giesselink, 1993
;
; created at 26.03.93
;
; TRANSLATOR: masm 5.1 with /ML switch
;***********************************************************************

.MODEL SMALL,C

.CODE
                ASSUME  CS:_TEXT,DS:NOTHING,ES:NOTHING,SS:DGROUP

; Equations
IRFMAT          equ     0e30ah                  ; IR Format Register
IRCNT           equ     0e30bh                  ; IR Transmit/Receive Register

LBF_MASK        equ     20h                     ; mask for LBF from IRFMAT
LBR_SET         equ     02h                     ; set bit in IRCNT

REDEYE_TYP      equ     01h                     ; IR in Redeye Format


; correction masks
hmask:          db      78h,0e6h,0d5h,8bh       ; Mask for error bits


;**********************************************************************
;
;  Funktionname....:  s_redeye
;
;  Description.....:  send a Byte over the IR interface in
;                     REDEYE-Format
;
;  Input...........:  unsigned char zeichen : byte to send
;
;  Return..........:  void
;
;**********************************************************************

; void s_redeye(unsigned char zeichen);

s_redeye        PROC    zeichen:BYTE

; initialize interface
                mov     dx,IRFMAT               ; at IR Format register
                mov     al,REDEYE_TYP           ; choose type REDEYE
                out     dx,al

                mov     cl,zeichen              ; load character to cl

; calculate correction bits H(i)
                mov     bx,OFFSET hmask         ; H(i)
                mov     al,4                    ; ch = Parity, al = counter
ploop:          test    cl,cs:[bx]              ; value and correctin mask
                jpe     evp                     ; jump on parity even
                stc                             ; set parity odd
evp:            rcl     ch,1                    ; rotate into parity result register
                inc     bx                      ; next mask
                dec     al
                jnz     ploop                   ; until 4 parity bits calculated

; cx = H1-H4,D7-D0,0000
                shl     cx,1                    ; shift 4 bit left
                shl     cx,1
                shl     cx,1
                shl     cx,1
                inc     cx                      ; prepare for first burst

                xor     bx,bx                   ; bh=subevent, bl=event counter
; main loop
main:           in      al,dx                   ; fetch IR state
                and     al,LBF_MASK             ; mask LBF bit
                jnz     main                    ; bit set, wait

                test    cl,1                    ; 1 = send burst
                jz      nburst                  ; no bursts

                mov     al,LBR_SET              ; set burst bit in LBR
nburst:         inc     dx                      ; I/O to IRCNT
                out     dx,al                   ; send
                dec     dx                      ; I/O auf IRFMAT

                xor     bh,1                    ; toggle subevent
                cmp     bl,2                    ; event >= 2
                jnc     b_inc                   ; no
                inc     bl                      ; event 0,1,2
                jmp     SHORT main
b_inc:          and     bh,bh                   ; first half?
                jz      mburst                  ; no
                rol     cx,1                    ; fetch next bit
                jmp     SHORT e_inc
mburst:         xor     cl,1                    ; burst toggle
e_inc:          add     bl,bh                   ; event = event + subevent

                cmp     bl,15                   ; event < 15 ?
                jc      main                    ; character not finished
                xor     cl,cl                   ; no more bursts
                cmp     bx,16                   ; event 16, 2nd half?
                jnz     main

; wait until last bit send
eloop:          in      al,dx                   ; fetch IR state
                and     al,LBF_MASK             ; mask LBF bit
                jnz     eloop                   ; bit set, wait
                ret
s_redeye        ENDP

                END
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Calculators with Support of the 82240 IR-Printer - Christoph Giesselink - 06-25-2014 07:27 PM



User(s) browsing this thread: 1 Guest(s)