A83: (Unsquish) HEXtoASCII routine (Not checked)


[Prev][Next][Index][Thread]

A83: (Unsquish) HEXtoASCII routine (Not checked)




You are going about this totally wrong... To make a table would be
massive... 256 + 2(256) = 818 byte table, way too ineffecient anyways.
How bout you do this, turn off the last 4 bits (%0000????) and get the
for 0 through F. Get the original value again, turn off the first 4 bits
(%????0000) and then rrd (4 bit shift) then do the same thing. Duh...
hehe, the code may not be correct but I think it is a good start, it is
pretty sloppy (lots of push/pops) but since I just threw it together,
but it has its merit

 ld hl, inputloc
 ld de, outputloc
 ld bc, length

HEXtoASCII:
 ld a,(hl)
 rrd
 and %00001111
 push hl
 ld hl, table
 push de
 ld e, a
 xor a
 ld d, a
 add hl, de
 pop de
 ld a,(hl)
 ld (de), a
 inc de
 pop hl
 ld a,(hl)
 and %00001111
 push hl
 ld hl, table
 push de
 ld e, a
 xor a
 ld d, a
 add hl, de
 pop de
 ld a,(hl)
 ld (de), a
 inc de
 pop hl
 inc hl
 djnz HEXtoASCII 

table .db T0,T1,T2,T3,T4,T5,T6,T7,T9,TA,TB,TC,TD,TE,TF

AtmaZ@aol.com wrote:
> 
> In a message dated 3/2/99 4:33:08 PM Mountain Standard Time, DaBumer2u@aol.com
> writes:
> 
> > > Right, thats what I meant, I was in a hurry (its almost the same thing
> tho,
> >  >  no need to get all defensive) ... oh was that what it was about...well,
> I
> >  >  see very little point in making a program to do this because I have a
> >  >  feeling that there are very few people who want to unsquish programs and
> >  >  don't have a graphlink.  (speaking of which, dasm.zip on ticalc has a
> >  >  bin2hex program in it).  He could (assuming he was at least partially
> > adept
> >  >  at asm), write a quick prog that looked up the progs location and
> > outputted
> >  >  it to another program in "unsquished" form using (I forget who's)
> makehex
> >  >  routines...
> >  >
> >  >  -Dan
> >
> >  I dont think that would be to easy to accomplish.
> >
> >  -Dustin
> >
> 
> <sigh> No graphlink? Damn...the "unsquish" task would be _so_ easy if you did.
> (I mean, Microsloth's Visual Basic could do it!)
> 
> Well, you could make a program that used LDIR in some _very_ creative
> ways...for example, create a byte equivlaency chart (e.g. byte C9 = ASCII
> characters "C" and "9"...anybody care to help me optimize this?), and then
> loop through the program to be unsquished, reading in the bytes, and then
> writing to a seperate program that contained the unsquished ASCII characters.
> Obviously I won't be the one making this--unless somebody is willing to help
> :-)
> 
> This program would require maybe about 1.5K-2.5K of memory (if you're lucky),
> not to mention the space you would need to hold the unsquished program (let's
> say you're unsquishing Diamonds 1.9...you would need, I would estimate, 4500+
> bytes of free RAM to hold the unsquished version.)
> 
> But I repeat Dan's sentiments...
> Why would somebody want to unsquish a program?
> 
> --David

-- 
Scott "_Wrath_" Dial
homosapian@geocities.com
ICQ#3608935
http://www.geocities.com/~homosapian/
________________________________________________________
NetZero - We believe in a FREE Internet.  Shouldn't you?
Get your FREE Internet Access and Email at
http://www.netzero.net/download.html


References: