Overview Features Coding ApolloOS Performance Forum Downloads Products Order Contact

Welcome to the Apollo Forum

This forum is for people interested in the APOLLO CPU.
Please read the forum usage manual.
Please visit our Apollo-Discord Server for support.



All TopicsNewsPerformanceGamesDemosApolloVampireAROSWorkbenchATARIReleases
Information about the Apollo CPU and FPU.

A Little Peek Inside Monam, the 68080 Debugger.

Tommo Noorduin

Posts 129
05 Jan 2023 19:55


A little peek inside monam.
Just a few steps, nothing fancy.

Even your grandma could do this.
 
 
Programs/Developer/DevPac already is on apollo-os and coffin.
Or use the complete package release from here EXTERNAL LINK 
Only the overwriting of 'monam' with the new 080 version of monam is need to be done.
This zip contains that. EXTERNAL LINK  <-  (edit: fixed broken link)
 
 

 
Start DEBUG from workbench or
MONAM from cli.
 

 
Monam gets launched and you see a fileselector.
load 'monam'
 
You should see a grey screen that uses full screen.
not? press <LEFT_AMIGA>M (this switches between monam & workbench)
  You are probably runnin coffin.
 
You should see a white bug as pointer.
not? click MOUSE_LEFT (this selects monam to read the keyboard)
 

 
press <ENTER>, we do not want a commandline.
 
We see the fullscreen divided in 3 sections, called windows.
-The top one 'Registers' shows the cpu-state.
-Right 'Memory' shows ram, as hexidecimal numbers & text.
-Left 'Disassembly' shows ram, but tries to show that as instructions.
 
Repeating pressing <TAB> selects the next as active window.
 
Both Left (win2) and right (win3) shows the same (hexidecimal)number top_left.
That is a place inside of memorie that just got our program in we selected to load.
 
The top (win1) shows the cpu state that program gets. It has 3 highlighted values.
 
The first highlight is on 'd0' and is '1' if you pressed ENTER at the commandline.
If you entered DUDE there, 'd0' would be '5' and you could see that text presented
by the next highlight 'a0' that would point to that.
Below that is the last highlight 'a7'. This pointer is always used as 'stack' , a
place in ram where values that need to be saved are stored for a (short) time.
 
The last line (win1) shows the first instruction that this program wants to do.
In this case 'bra i0000094'
Before that is 'pc:' and a value. pc means Program Counter, that always point to
the current instruction in ram, the value is that location.
In win2 you see the pc as '>' just before 'bra i0000094'.
 
<CONTROL>Z
 
The previous highlight are gone, new highlights would show change, but in this
case no memory or registers was changed.
You see bra is gone and now and the top_left value in win2 now points to 'i0000094',
win2 changed to the new location of the '>'  That is where 'bra i0000094' wanted it to be.
Next is 'movem.l d0/a0,l0004304  ;value 0000 0000 0000 0000'
 
<CONTROL>Z
 
No new highlights, but 'd0' & 'a0' where place in memory. To see that we go where they are placed.
 
<TAB> until you are on win3.
 
They where placed on 'l0004304'.
 
<AMIGA>A  (<AMIGA> is always the right one for monam)
 
Centred below a window pops up. 'Window start address?'
 
m0 ENTER  or  l0004304 ENTER
 
Now we see some highlighting. The '1' and the value in 'a0' are there.
Move the cursors-keys and see what happens.
'move.l #$126e,d0' is next
 
<CONTROL>Z
 
The highlight from win3 is gone and 'd0' highlight. Only the '126e' was changed there.
'move.l #$10001,d1'
 
<CONTROL>Z
 
We see 10001 was moved to 'd1'
next: 'movea.l 4.w,a6 ;00000004 xxxx xxxx'  (x is whatever is now on place 4)
 
<CONTROL>Z
 
'a6' indeed got that xxxx xxxx value.
  lets see what is there...
 
  <AMIGA>5
 
  win3 splits in win3 & win5
 
  <AMIGA>A  Centred below a window pops up. 'Window start address?'
  a6 ENTER
  UP-ARROW about 5 times
  <AMIGA>T      change win 'T'ype
 
  you see that a jmp-table is there.
  you can move the cursors to explore more. and also <AMIGA>T.
 

 
okay, back to the program.
'move.l a6,l0004300' followed by 'jsr -$6c(a6)'
 
<CONTROL>Z
 
the value from a6 is now placed just before where 'd0' & 'a0' where placed before. ('l0004300' 'l0004304')
and could be seen in win3. Also in win2 'jsr -$6c(a6)' is changed to 'jsr _LVOAllocMem(a6)'
 
We can look up the documentation about LVOAllocMem and see it needs 'd0' & 'd1'to be set.
'd0' informs us that $126e bytes are wanted (that is 4718 bytes)
'd1' informs AllocMem if the program wants fast or chip.
 
  lets see what that routine does to the stack...
 
  <TAB> to win3
  <AMIGA>S    win5 disapears as win3 no longer Splits.
  <AMIGA>A    Centred below a window pops up. 'Window start address?'
  A7<ENTER>
  <AMIGA>O
 
  That now shows memorie relative to that address, so it always start at 0.
 
  UP-ARROW until the 0 is about half on the screen.
 
  You might see some highligh is just before the 0.
 
okay, back to the program.
'jsr _LVOAllocMem(a6)'
 
<CONTROL>T
 
'jsr _LVOAllocMem(a6)' is changed back to 'jsr -$6c(a6)' in win2
4 highlights in win1, 'd0' 'd1' 'a0' 'a1' got changed.
and there is some changed highlight in win3, that is the stack used by AllocMem.
The right_bottom screen corner shows how long it took the os to do that job.
The first value is in micro seconds and the other in cpu_clock_cycles.
 

 
'd0' always gives a result back from the os, in this case the location of a requested
memory block of 4718 bytes long.
So lets look at that.
 
  <AMIGA>A    Centred below a window pops up. 'Window start address?'
  D0<ENTER>
 
We got a nice cleared place to store the variables that this program uses.
 
 
That is all for today.
 
 
You now can
<AMIGA>Q Quit
or
<CONTROL>R Run the program.
Then you notice we now have 2 monam's running by <LEFT_AMIGA>M
(One you started and the other was loaded by that)
or
reset
 
 
 
Note:
Progress of MonAm can be found here:
080 Debugger - MonAm 3.09b - Anniversary
EXTERNAL LINK


Kamelito Loveless

Posts 257
08 Jan 2023 14:19


Crongrats, I need to print this.

posts 2