home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
029.lha
/
explore
/
xplor.asm
< prev
next >
Wrap
Assembly Source File
|
1987-04-02
|
5KB
|
275 lines
*---------------------------------------------------------------------------
* XPLOR.ASM
*
* A program to explore the various structures of the Amiga.
* Starting with Execbase....
*
*---------------------------------------------------------------------------
begin jmp start
include "macros.basic"
use libs ;include library functions
use doslib ;All libraries listed will be
* use intib ;enabled for opening/closing
* use gfxlib ;with the 'dolibs' and 'exit'
* use dfontlib ;macros.
* use clistlib
* use layerslib
* use ffplib
* use translib
* use mathdoublib
* use speechlib
* use iconlib
use b2h ;binary to hex ASCII
use prt ;print
* use scnull ;scan for NULL
* use copy ;copy memory
* use scm ;compare strings
* use sln ;get length of string
* use ins ;INSTRING function
* use dbug ;debugging routines
* use arg ;arg parser routines
use leadspc ;replace leading ASCII 0 to spaces (ldspc)
include "macros.opt"
include "macros.data"
XTRN Output
XTRN Write
XTRN Permit
XTRN Forbid
*--------------
* Subroutines
*--------------
CNOP 0,4
menu printz #menutext
rts
nxtnode move.l flink,a0 ;get next node address
move.l a0,nodeptr ; and make it current
move.l (a0),flink ;get new link
rts
dmplist cmp.l #0,flink ;see if link is zero
beq endump ;if zero, then we are at end of list
move.l nodeptr,a0 ;get node address
binhex a0,buff ;convert address to hex string
ldspc buff ;remove leading zeros
printz #buff ;print address
printz #dash ; and separator
move.l nodeptr,a0 ;recover address of node
adda.l #10,a0 ;point at address of libname
printz (a0) ;print libname
printz #newline
jsr nxtnode ;get next node
bra dmplist ; and go back to process
endump rts
*--------------
* Main Program
*--------------
CNOP 0,4
start dolibs ;open all libraries as per list in 'use'
bne libsok
exit 100
libsok call Forbid(a6)
move.l dos,a6
call Output(a6)
move.l d0,stdout
move.l (AbsBase),d1 ;get Execbase pointer
move.l #9,d0 ;loop counter
move.l #exbase,a1 ;start of table of offsets
loop1 add.l d1,(a1)+ ;generate list addresses
dbf d0,loop1 ; in list table
main jsr menu ;choose list to look at. (Stub now)
*--------------------
* Dump library list
*--------------------
libr move.l (liblist),a0 ;get pointer to library node
move.l a0,nodeptr ; and save it
move.l (a0),flink ;save link to next node
jsr nxtnode ;set up for first lib node
jsr dmplist
printz #libsdone
*------------------
* Dump device list
*------------------
devs move.l (devlist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #devsdone
*--------------------
* Dump resource list
*--------------------
res move.l (reslist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #resdone
*---------------------
* Dump TaskReady list
*---------------------
trdy move.l (trdylist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #trdydone
*----------------------
* Dump Taskwaiting list
*----------------------
twait move.l (twtlist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #twtdone
*----------------------
* Dump Memory list
*----------------------
memory move.l (memlist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #memdone
*----------------------
* Dump Memory list
*----------------------
irpt move.l (intrlist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #irptdone
*----------------------
* Dump Memory list
*----------------------
ports move.l (portlist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #portsdone
*----------------------
* Dump Memory list
*----------------------
semlist move.l (smlist),a0
move.l a0,nodeptr
move.l (a0),flink
jsr nxtnode
jsr dmplist
printz #semdone
*----------------------
done move.l AbsBase,a6
call Permit(a6)
exit 0 ;normal return
*===============================*
SECTION BSS
CNOP 0,4
stdout ds.l 1
flink ds.l 1
nodeptr ds.l 1
SECTION CODE
exbase dc.l 0 ;Address of Execbase
memlist dc.l $142 ;Table of offsets for system lists
reslist dc.l $150 ; These are offsets from Execbase
devlist dc.l $15e ; and Execbase will be added to each
intrlist dc.l $16c ; offset to give an absolute address
liblist dc.l $17a ; for the head of each list.
portlist dc.l $188
trdylist dc.l $196
twtlist dc.l $1a4
smlist dc.l $214
buff dc.b ' ',0
dash dc.b ' - ',0
newline dc.b 10,0
libsdone dc.b 10,' End of Library list',10,10,0
devsdone dc.b 10,' End of Device list',10,10,0
resdone dc.b 10,' End of Resource list',10,10,0
trdydone dc.b 10,' End of TaskReady list',10,10,0
twtdone dc.b 10,' End of TaskWaiting list',10,10,0
memdone dc.b 10,' End of Memory list',10,10,0
irptdone dc.b 10,' End of Interrupt list',10,10,0
portsdone dc.b 10,' End of Port list',10,10,0
semdone dc.b 10,' End of Semaphore list',10,10,0
menutext dc.b ' Menu stuff.... stub now.',10,10,0
end