Results 1 to 6 of 6

Thread: Anyone knows the RAD50 formula?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303

    Anyone knows the RAD50 formula?

    Hi all,

    What is RAD50? I think the good old DEC VAX/VMS
    stuffing 2 or 3 chars into one byte or something similar to that.

    So if you have any information/routine that does that, please
    help.

    Jay

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Well,

    I still used to work with RAD50 like a decade ago but I have forgotten how it worked, other than it was an unusual way of packing characters e.g. file name strings.

    I think I may have stuff of some kind at home so I'll take a look.

  3. #3
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Hi,

    I'm sorry I have to disappoint you as all I've found is 2 conversion subroutines: ascii2rad50 and rad502ascii. Unfortunately I wrote them in assembly language at that time and, on top of it, it's not even for the VAX architecture but the for the PDP-11's, an even older machine. I'm not sure if these routines would work in a VAX, maybe yes because they are very simple, but they'd need a full rewriting if you'd have to run them in a pc. For example, the 2 operand instructions work in reversed order (source at the left and destination at the right whereas it's the other way around in a pc).

    Still, if you think they can be useful, just let me know and I'll post them.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303
    don't know assemply, but could you please post it here?

    If I know the logic perhaps I can convert them to VB. I know I
    have done them in the past, but just completely forgot about
    how.

    Thanks for your special effort.

    Regards,

    Jay

  5. #5
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Well, here are the 2 subroutines. I think the instruction codes are self-explicit but let me know if you need some explanation on any of them.

    Here are a few hints:

    1- Both subs are intended for being called from a main Fortran routine.
    2- r0,...,r5 are general purpose registers
    3- #5 means the actual number 5
    4- The n$ signs are labels to branch to
    5- All numbers (except in labels) are octal
    6- sp is the stack pointer and it is used to pass arguments between the program and the subroutines
    7- Semicolons are comments
    8- Register use:

    If r0 contains the number 1000, address 1000 contains the number 4000 and address 4000 contains the number 1, then

    r0 refers to the number 1000

    (r0) refers to the number 1000 as an address, i.e.it refers to the number 4000

    @(r0) refers to the number 1000 as the address of the address of the operand, i.e. it refers to the number 1

    9- When the subroutine is called by the external program, the sp points to an address which has the number of arguments (i.e. 3 for both routines), the next item in the stack is the address of the address of the first argument, and so on.

    If you can figure it out don't forget to post it. Good luck!

    Code:
    	.Title 	R502A
    	.Globl	R502A
    ;	Conversion of Radix-50 2-byte words into ASCII characters
    ;	Fortran call:	CALL R502A(nwd,iarray,str)
    ;	nwd:		number of R50 words to be converted
    ;	iarray:		integer array containing the R50 words
    ;	str:		string to receive the ascii characters
    	.mcall	.regdef
    	.regdef
    R502A:	tst	(r5)+
    	mov	@(r5)+,r1
    	mov	(r5)+,r0
    	mov	(r5),r5
    	mov	r1,r2
    	asl	r2
    	add	r2,r1
    1$:	mov	#Table+10,r3
    	mov	(r0)+,r2
    2$:	tst	-(r3)
    	beq	1$
    	mov	#177777,r4
    	cmp	#174777,r2
    	blo	4$
    3$:	inc	r4
    	sub	(r3),r2
    	bcc	3$
    	add	(r3),r2
    	tst	r4
    	beq	5$
    	cmp	#33,r4
    	blo	6$
    	beq	7$
    4$:	add	#40,r4
    5$:	add	#16,r4
    6$:	add	#11,r4
    7$:	add	#11,r4
    	movb	r4,(r5)+
    	dec	r1
    	bne	2$
    	rts	pc
    Table:	.Word	0,1,50,3100
    	.End
    ***************************************************************
    	.Title 	A2R50
    	.Globl	A2R50
    ;	Conversion of ASCII characters into Radix-50 2-byte words
    ;	Fortran call:	CALL A2R50(nchr,str,iarray)
    ;	nch:		number of ASCII characters to be converted
    ;	str:		string where these characters are located
    ;	iarray:		integer array to receive the R50 words
    	.mcall	.regdef
    	.regdef
    ATOR50:	tst	(r5)+
    	mov	@(r5)+,r3
    	mov	r3,r1
    	mov	(r5),r0
    1$:	tst	r3
    	beq	2$
    	inc	r0
    	dec	r3
    	br	1$
    2$:	mov	r1,r3
    	asl	r3
    	mov	r3,r2
    	clr	r4
    3$:	sub	#3,r2
    	blt	4$
    	inc	r4
    	br	3$
    4$:	mov	r4,r2
    	asl	r4
    	add	r4,r2
    	sub	r2,r3
    	add	r3,r1
    	tst	-(sp)
    	clr	(sp)+
    5$:	tst	r3
    	beq	6$
    	movb	#40,(r0)+
    	dec	r3
    	br	5$
    6$:	mov	(r5)+,r0
    	mov	(r5),r3
    7$:	movb	(r0)+,r2
    	sub	#11,r2
    	cmp	r2,#33
    	beq	9$
    	sub	#11,r2
    	cmp	r2,#47
    	bgt	8$
    	cmp	r2,#34
    	bge	9$
    8$:	sub	#16,r2
    	beq	9$
    	sub	#40,r2
    	ble	13$
    	cmp	r2,#32
    	bgt	13$
    9$:	tst	-(sp)
    	bne	10$
    	mov	r2,-(sp)
    	br	11$
    10$:	add	r2,-(sp)
    	cmp	2(sp),#1
    	beq	11$
    	mov	(sp)+,(r3)+
    	clr	(sp)+
    	br	12$
    11$:	mov	(sp),-(sp)
    	asl	(sp)
    	asl	(sp)
    	add	(sp)+,(sp)
    	asl	(sp)
    	asl	(sp)
    	asl	(sp)
    	inc	2(sp)
    	cmp	(sp)+,(sp)+
    12$:	dec	r1
    	bne	7$
    13$:	rts	pc
    	.End

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303

    too foreign to me

    Thanks krtxmrtz. I did not have any assembly programming
    before so this is very much helpless. I know I have done it
    with C and the call syntax are very much the same. I will have
    to search around to see if I can find the old C program somewhere.

    But what I really want is a way to compress or pack my text
    file so that is the only reason I want the rad50 formula.

    Do you know of a way to compress a file? Does not have to
    be expensive nor very good.

    Again, if I find anything worthwhile, I will let you know.

    Jay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width