' L : Length of field (Default character "$" exclused).
'
'
' This routine accepts only the numbers from 0 to 9 and characters
' from A to F.
' (Plus RETURN to end and BACKSPACE to delete the last character.)
' Characters "$"(for binary numbers) is for default.
' It is therefore more fool-proof than the normal INPUT command.
'
'
'
' Basic routine written in 1994 by Christian Mumenthaler
' Revisioned for Hexadecimal Numbers by Luca Ferraris - 02/95
' This routine is Public Domain. Use it wherever you want to.
'
'
NA$="$"
Z=Len(NA$)
L1=L-Z
Print NA$+Space$(L1);
Cmove -L1,0
Curs On
A1=Asc("0") : A2=Asc("F")
Repeat
A$=Inkey$
A$=Upper$(A$)
A=Asc(A$)
If((A>=A1 and A<=A2)) and Z<=L
Print A$;
NA$=NA$+A$
Inc Z
End If
If A$=Chr$(8) and Z>0
Z=Z-1
Cmove -1,0 : Print " "; : Cmove -1,0
NA$=Left$(NA$,Len(NA$)-1)
End If
Until A$=Chr$(13)
Curs Off
A#=Val(NA$)
End Proc[A#]
Hallo from Luca Ferraris (aldo@di.unito.it)
-------------------------------------------
March 95
ni> I need a procedure to unpack PowerPacked datafiles. These are data banks and to use'em I need to unpack'em! My problem is that I need to do that (too long to explain why... note I own AmosPro!) using Amos 1.31 and without extensions! I can't use a lot of memory too.
Hmmm... Some time ago I wrote some workarounds for PowerPacker saving
using Ppload and Ppsave of the compiler extension. I don't know, if
these are already in the amos creator compiler but they are in the
professional compiler. Another problem is that the bank needs the
double space to load than normally.
BTW: For many reasons, I prefer Turbo Imploder to PowerPacker, which
only needs once the memory to load /and/ decrunch and is incredibly
fast! :-)
Try out this one: It only needs the music (Sload!) and the compiler
extension. It's a universal routine for AMOS PP banks, normal PP
banks, normal AMOS banks and binary data. If you want to load a bank
into chip ram, use negative bank numbers.
Procedure PACLOAD[F$,BK]
BANK=Abs(BK) : If BK<0 Then CP=2 Else CP=0
If F$="" Then Print "Error: No filename!" : Stop
If Exist(F$)=0 Then Print "Error: File not found" : Stop
Open In 1,F$
A$=Input$(1,4) : B$=Input$(1,4)
LF=Lof(1)
If A$="PP20"
Pof(1)=LF-4
B$=Chr$(0)+Input$(1,3)
LE=Leek(Varptr(B$))
Erase BANK : Reserve As Work BANK,LF+16
ST=Start(BANK)
Poke$ ST,"PPbk"
Doke ST+4,BANK
Doke ST+6,CP
Loke ST+8,LE+8
Loke ST+12,LF-8
Pof(1)=0
Sload 1 To ST+16,LF
Close 1
Bsave "RAM:PACSAVE.xxx",ST To ST+LF+16
Erase BANK
Ppload "RAM:PACSAVE.xxx",BANK
Kill "RAM:PACSAVE.xxx"
ST=Start(BANK)
Copy ST-8,ST+LE-8 To ST
Poke$ ST-8,"Work "
Pop Proc
End If
If A$="PPbk"
Close 1
Erase BANK : Ppload F$,BANK
Pop Proc
End If
If A$="AmBk" or A$="AmSp" or A$="AmIc" or A$="AmBs"
Close 1
Load F$,BK
Pop Proc
End If
If CP=0
Reserve As Work BANK,LF
Else
Reserve As Chip Work BANK,LF
End If
Pof(1)=0
Sload 1 To Start(BANK),LF
Close 1
End Proc
Once upon a time I used this procedure to pack ordinary pp20 files
rather then the amos pp banks. It uses bank 16 as temporary bank, so
do not store anything there ;-)
Procedure PACSAVE[F$,BK,EF]
LE=Length(BK)
Reserve As Work 16,LE-8
ST=Start(16)
Copy Start(BK),Start(BK)+LE To ST-8
Ppsave "RAM:PACSAVE.xxx",16,EF
Erase 16
Open In 1,"RAM:PACSAVE.xxx"
LE=Lof(1)
Reserve As Work 16,LE-16
ST=Start(16)
Pof(1)=16
Sload 1 To ST,LE-16
Close 1
Kill "RAM:PACSAVE.xxx"
Bsave F$,ST To ST+LE-16
Erase 16
End Proc
ni> If u know the format of packed files, just write it down, Ill write the procedure I need.
The first longword is 'PP20' or 'PX20' (?) for encoded files, then
follows the packed data. The stupid thing about PowerPacker is that
it saves the length of the original data in the last four bytes or
better to say, the upper three bytes of the last longword. Very odd
indeed (and a real mess if you want to rip these files :-{ ).
Bye, Chris Hodges <chris@surprise.rhein-ruhr.de> __ __
A500/290/CD/'30er; German Extension-Coder __ /// / / _____
GCS d H s-:++ !g p? !au a18 w++ v? C+++ \\\/// / /_/ ___/ LOGOUT