.title unhex ; ; Authors: E.F.Beadel, Jr., Manager ; C.A.U.S.E. Instructional Computer Center ; SUNY at Oswego ; Oswego, NY 13126 ; phone: 315/341-3055 ; ; and ; ; T.J.Weslowski, Instructor ; Computer Science Department ; SUNY at Oswego ; Oswego, NY 13126 ; ; Date: 10-aug-83 ; ;************************************************************ ; ; This fortran callable routine converts its two character ; arguments which represent a hexidecimal byte to the ; actual byte. ; ; called by the call ; =UNHEX(,) ; ; where = in integer or byte variable identifier ; = byte or integer identifier representing ; the high hex digit ; = byte or integer identifier representing ; the low hex digit. ; ;************************************************************ ; twice = 2 .mcall .exit UNHEX:: cmp (5),#2 ;syntax for 2 arguments bne abort tst (5)+ ;skip into pointer table ctr=1 .rept twice movb @(5)+,r1 ;fetch a datum character bic #177400,r1 ;remove upper byte garbage. cmp r1,#'9 ;is this a digit??? .enabl lsb ble 1$ ;if so, goto 1$ sub #'A-10.,r1 ;convert to a 4-bit pattern br 2$ ;and skip next conversion. 1$: sub #'0,r1 ;Convert to a 4-bit pattern. 2$: .dsabl lsb .if eq ctr-1 mov r1,r0 ;if first character, put pattern .rept 4 ;in r0 and shift to where it belongs. asl r0 .endr ‡F Äæˆ & dþG ‡F úÖ ÷`‡=bicb("17,char(j))/16 ! get upper nybble lnyb=bicb("360,char(j)) ! and lower nybble unyb=hex(unyb) ! convert to hex character lnyb=hex(lnyb) ! " line(cptr)=unyb !Save in output buffer line(cptr+1)=lnyb ! " cptr=cptr+2 ! Adjust buffer pointer. if(cptr .lt. 64) goto 11 ! Skip output if buffer not full write(51,52)lnctr,line ! Dump the buffer 52 format(i4,':',64a1) lnctr=lnctr+1 ! Ad