home *** CD-ROM | disk | FTP | other *** search
-
- AVAIL.DOC
-
- A HACK AND A CHALLENGE!
- AVAIL is one of the most used utilities on my system. So I decided to
- rewite (or HACK, if you prefer) it in ASMB Language as a learning experience.
- This version runs the same as the original, except uses much less stack, and
- gives the correct total largest hunk. Values differ due to less RAM usage.
- It is 372 bytes. Anyone want to try a smaller version? Well, anyway, it
- lives again as a test file for BTOA/ATOB encode/decode.
-
-
- AVAIL.AB is the above program encoded by BTOA (Binary to ASCII).
-
-
- ATOB decoding
- -------------
-
- >ATOB
-
- READ file: AVAIL.AB
- WRITE file: AVAIL (Y/N) Y
-
- Thats it! AVAIL is decoded and placed in your current directory.
- Alternately, for a different WRITE file:
-
- >ATOB
-
- READ file: AVAIL.AB - Encoded files with file.AB
- WRITE file: AVAIL (Y/N) N - No, don't use that name
- WRITE file: RAM:A - Put it in RAM: named "A"
- >
-
- and AVAIL is decoded to RAM: with the filename "A".
-
-
- BTOA encoding
- -------------
-
- >BTOA
-
- READ file: RAM:A - "A" is the binary file
- ATOB name: A (Y/N) N - Name ATOB uses when decoded
- ATOB name: AVAIL - Tell the receiver the real name
- WRITE file: RAM:A.AB (Y/N) N - No, not the default path:filename
- WRITE file: RAM:AVAIL.AB - Save the ASCII file
- >
-
- and RAM:A has been encoded in file RAM:AVAIL.AB. When it is decoded,
- ATOB will default to the ATOB name "AVAIL".
-
-
- Randy Lilly N3ET @ N3ET.PA.USA.NA (send me a note)
- 752 S Carldon St
- Allentown, PA 18103
-
-
- ---
- *Avail.ASM Randy Lilly 871220
-
- _LVOAvailMem EQU -$D8
- _LVOCloseLibrary EQU -$19E
- _LVOOutPut EQU $FFFFFFC4
- _LVOForbid EQU $FFFFFF7C
- _LVOWrite EQU -$30
- _LVOPermit EQU -$8A
- NOPAGE
-
- LF1:
- LEA DB(PC),A4
- MOVE.L A4,A1 ;DosNam
- MOVEQ #0,D0
- MOVE.L 4,A6
- JSR -$228(A6) ;-552 _LVOOpenLibrary
- MOVE.L D0,(A4)+
- MOVE.L D0,A6
- JSR _LVOOutPut(A6)
- MOVE.L D0,(A4)
- MOVE.L 4,A6
- JSR _LVOForbid(A6)
- MOVEQ #0,D6
- MOVE.L D6,D7
- MOVE.L 322(A6),A0 ;$14C
-
- LF2: ;Get maximum totals
- TST.L (A0)
- BEQ.S LF5
- MOVE.L 24(A0),D0 ;Upper
- SUB.L 20(A0),D0 ;-Lower
- BTST.B #1,15(A0) ;MEMF_CHIP
- BEQ.S LF3
- ADD.L D0,D7
- LF3:
- BTST.B #2,15(A0) ;MEMF_FAST
- BEQ.S LF4
- ADD.L D0,D6
- LF4:
- MOVE.L (A0),A0
- BRA LF2
-
- DOA1
- BSET.L #17,D3 20000
- DOA
- MOVE.L D3,D1
- JMP _LVOAvailMem(A6)
-
- LF5:
- MOVEQ #2,D3 ;MEMF_CHIP
- BSR DOA
- MOVE.L D0,D5
- * MOVEQ #2,D1 ;$20002 MEMF_CHIP|MEMF_LARGEST
- BSR DOA1
- MOVE.L D0,A5
- MOVEQ #4,D3 ;MEMF_FAST
- BSR DOA
- MOVE.L D0,D4
- * MOVEQ #4,D1 ;$20004 MEMF_FAST|MEMF_LARGEST
- BSR DOA1
- MOVE.L D0,A1
- JSR _LVOPermit(A6)
-
- LEA HEADER(PC),A0
- BSR.S LF8
-
- MOVE.L A5,-(SP)
- MOVE.L D7,-(SP)
- MOVE.L D7,-(SP)
- SUB.L D5,(SP)
- MOVE.L D5,-(SP)
- PEA MCHIP(PC)
- BSR.S LF7
-
- MOVE.L A1,-(SP)
- MOVE.L D6,-(SP)
- MOVE.L D6,-(SP)
- SUB.L D4,(SP)
- MOVE.L D4,-(SP)
- PEA MFAST(PC)
- BSR.S LF7
-
- MOVE.L A1,-(SP)
- CMPA.L (SP),A5
- BLS.S LF6
- MOVE.L A5,(SP)
- LF6:
- ADD.L D4,D5
- ADD.L D6,D7
- MOVE.L D7,-(SP)
- MOVE.L D7,-(SP)
- SUB.L D5,(SP)
- MOVE.L D5,-(SP)
- PEA MTOTAL(PC)
- BSR.S LF7
- LEA 60(SP),SP
-
- MOVE.L -(A4),A1
- MOVE.L 4,A6
- JMP _LVOCloseLibrary(A6)
-
- LF7
- LEA FMT(PC),A0 ;Format
- LF8
- MOVE.L A1,-(SP)
- LEA 8(SP),A1 ;Buff
- LEA L8(PC),A2 :Operation
- LEA LF1(PC),A3 ;NewBuff
- MOVE.L A3,D2 ;Buff
- MOVE.L 4,A6
- JSR -522(A6) ;RawDoFormat
- MOVE.L (A4),D1 ;FH
- MOVEQ #47,D3 ;Size
- MOVE.L DB(PC),A6
- JSR _LVOWrite(A6)
- MOVE.L (SP)+,A1
-
- L8:
- MOVE.B D0,(A3)+
- RTS
-
- DB DC.B 'dos.'
- MYOUT DC.B 'library',0
- FMT DC.B '%.5s %9ld %9ld %9ld %9ld',$A,0
- MCHIP DC.B 'chip '
- MFAST DC.B 'fast '
- MTOTAL DC.B 'total'
- HEADER DC.B 'Type Available In-Use Maximum Largest',$A,0
- END
-
-