Mercurial > hg > Members > kono > nitros9-code
changeset 3192:5e48668f30b2
dmem.asm: Annotate comments, remove trailing whitespace
Annotated comments from original source listing in "Inside OS9 Level II".
CRC identical.
author | Neal Crook <foofoobedoo@gmail.com> |
---|---|
date | Mon, 29 May 2017 22:19:42 +0100 |
parents | 147d2267d9b8 |
children | 489617e567c5 |
files | level2/cmds/dmem.asm |
diffstat | 1 files changed, 90 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/level2/cmds/dmem.asm Mon May 29 20:15:36 2017 +0100 +++ b/level2/cmds/dmem.asm Mon May 29 22:19:42 2017 +0100 @@ -1,8 +1,13 @@ ******************************************************************** * DMem - Dump memory from system * +* dmem <block> <offset> [<length>] ! dump +* dmem -<proc#> <offset> [<length>] ! dump +* * $Id$ * +* From "Inside OS9 Level II", by Kevin Darling +* * Edt/Rev YYYY/MM/DD Modified by * Comment * ------------------------------------------------------------------ @@ -18,107 +23,116 @@ use defsfile endc -tylg set Prgrm+Objct +tylg set Prgrm+Objct atrv set ReEnt+rev rev set $00 edition set 2 - mod eom,name,tylg,atrv,start,size + mod eom,name,tylg,atrv,entry,msize -u0000 rmb 1 -u0001 rmb 1 -u0002 rmb 1 -u0003 rmb 2 -u0005 rmb 3 -u0008 rmb 64 -u0048 rmb 1 -u0049 rmb 447 -u0208 rmb 4296 -size equ . +acc rmb 2 +input rmb 1 +offset rmb 2 +dlen rmb 2 +id rmb 1 +prcdsc rmb 512 +buffer rmb 4296 +msize equ . + +dat equ prcdsc+$40 name fcs /DMem/ fcb edition -L0012 clr <u0000 - clr <u0001 -L0016 lda ,x+ +hexin clr <acc + clr <acc+1 + +hexin01 lda ,x+ cmpa #C$SPAC - beq L0046 + beq hexrts cmpa #C$CR - beq L0046 + beq hexrts suba #$30 cmpa #$0A - bcs L002A - anda #$07 + bcs hex2 0-9 + anda #$07 A-F adda #$09 -L002A lsla +hex2 lsla lsla lsla lsla - sta <u0002 - ldd <u0000 - rol <u0002 + sta <input + ldd <acc get accumulator + rol <input rolb rola - rol <u0002 + rol <input rolb rola - rol <u0002 + rol <input + rolb + rola + rol <input rolb rola - rol <u0002 - rolb - rola - std <u0000 - bra L0016 -L0046 leax -1,x - ldd <u0000 + std <acc + bra hexin01 +hexrts leax -1,x + ldd <acc rts -start lbsr L0128 - lbeq L0119 - cmpa #'- - bne L006D - leax 1,x - bsr L0012 +entry lbsr skipspc skip leading spaces + lbeq badnum ..was it CR? + cmpa #'- else is it #id? + bne entry0 ..no + + leax 1,x yes, skip '-' + bsr hexin get id number tfr b,a pshs x - leax >u0008,u - os9 F$GPrDsc - lbcs L00BC + leax >prcdsc,u + os9 F$GPrDsc get that process descriptor + lbcs error puls x - bra L0073 -L006D bsr L0012 - clr <u0048 - stb <u0049 -L0073 lbsr L0128 - lbeq L0119 - lbsr L0012 - std <u0003 - lbsr L0128 - beq L0092 - lbsr L0012 + bra entry1 + +entry0 bsr hexin get block # + clr <dat set in fake DAT image + stb <dat+1 + +entry1 lbsr skipspc get offset + lbeq badnum + lbsr hexin + std <offset + lbsr skipspc get possible offset + beq entry2 + + lbsr hexin cmpd #$1000 - bls L0095 + bls entry3 ldd #$1000 - bra L0095 -L0092 ldd #$0100 -L0095 std <u0005 - leax >u0048,u - tfr x,d - ldy <u0005 - ldx <u0003 + bra entry3 +entry2 ldd #$0100 + +entry3 std <dlen + + leax >dat,u + tfr x,d D=DAT image pointer + ldy <dlen Y=count + ldx <offset X=offset within DAT image pshs u - leau >u0208,u - os9 F$CpyMem + leau >buffer,u + os9 F$CpyMem puls u - bcs L00BC - ldy <u0005 - leax >u0208,u + bcs error + + ldy <dlen + leax >buffer,u point within buffer lda #$01 - os9 I$Write -L00BB clrb -L00BC os9 F$Exit + os9 I$Write + +bye clrb +error os9 F$Exit HelpTxt fcc "Use: DMem <block> <offset> [<length>] ! dump" fcb C$LF @@ -126,17 +140,18 @@ fcb C$CR HelpTxtL equ *-HelpTxt -L0119 leax >HelpTxt,pcr -L011D ldy #HelpTxtL +badnum leax >HelpTxt,pcr + ldy #HelpTxtL lda #$02 - os9 I$WritLn - bra L00BB -L0128 lda ,x+ + os9 I$WritLn + bra bye + +skipspc lda ,x+ cmpa #C$SPAC - beq L0128 + beq skipspc leax -1,x cmpa #C$CR - rts + rts emod eom equ *