.MAIN. MACRO V05.06 00:00 Page 1 1 2 ;* 3 ; memmap.mac 4 ; 5 ; Copyright (c) 2002 by Megan Gentry 6 ; 7 ; Abstract: 8 ; This program is designed to locate and report ranges 9 ; of memory in the low 64kb which can be referenced on 10 ; a PDP-11 and report them to the terminal. 11 ; 12 ; The program was designed to be used to map the memory 13 ; on a proto desktop portable pdp-11 which only has a 14 ; 4 line x 40 character LCD screen, which is why it 15 ; displays 3 lines and waits for character input to 16 ; proceed. 17 ;- 18 19 000000 .asect 20 000000 . = 0 21 22 000000 000005 reset ;reset the world 23 000002 000536 br start ; and jump to the code 24 25 000004 000636 .word nxmtrp ; : Address of NXM handler 26 000006 000340 .word 340 ; : PR7 27 28 000300 . = 300 29 30 000300 012700 000646 start: mov #m.head,r0 ;Announce us 31 000304 004767 000226 call ttostr ; ... 32 33 000310 005001 clr r1 ;R1 = Location under test 34 000312 012704 000002 mov #2,r4 ;R4 = Count of lines before wait 35 36 000316 010102 10$: mov r1,r2 ;R2 = Low limit of memory range 37 38 ; Here we look for the end of region of memory which exists 39 ; (we assume that location 0 works) 40 41 000320 000241 20$: clc ;Clear carry (NXM will set carry) 42 000322 105711 tstb @r1 ;Test the location 43 000324 103404 bcs 30$ ;If it is non-existant... 44 000326 010103 mov r1,r3 ;R3 = Hi limit of memory range 45 000330 005201 inc r1 ;Update location under test 46 000332 001372 bne 20$ ; !loop! 47 000334 000407 br 100$ ;When we wrap in 64kb, we're done 48 49 000336 004767 000022 30$: call report ;Report the range (R2,R3) 50 51 ; Here we start looking for the start of the next region of 52 ; responding memory. 53 54 000342 000241 40$: clc ;Clear carry (NXM will set carry) 55 000344 105711 tstb @r1 ;Test the location 56 000346 103363 bcc 10$ ;We've found memory... 57 000350 005201 inc r1 ;Update location under test .MAIN. MACRO V05.06 00:00 Page 1-1 58 000352 001373 bne 40$ ; !loop! 59 ; br 100$ ;When we wrap in 64kb, we're done 60 61 000354 004767 000004 100$: call report ;Report the range (R2,R3) 62 63 000360 000000 110$: halt ;Stop the world... 64 000362 000776 br 110$ ; and don't let it restart... 65 66 67 68 000364 010200 report: mov r2,r0 ;Print out region low address 69 000366 004767 000106 call octout ; ... 70 000372 012700 000662 mov #m.del,r0 ;Print a delimiter 71 000376 004767 000134 call ttostr ; ... 72 000402 010300 mov r3,r0 ;Print out region hi address 73 000404 004767 000070 call octout ; ... 74 000410 112700 000011 movb #11,r0 ;Another delimiter 75 000414 004767 000166 call ttochr ; ... 76 000420 010300 mov r3,r0 ;Determine number of words (octal) 77 000422 160200 sub r2,r0 ; ... 78 000424 005200 inc r0 ; ... 79 000426 004767 000046 call octout ;Print it out 80 000432 012700 000723 mov #m.crlf,r0 ;On to next line 81 000436 004767 000074 call ttostr ; ... 82 000442 005304 dec r4 ;Should we delay a bit? 83 000444 003014 bgt 10$ ;Nope... 84 000446 012700 000666 mov #m.pak,r0 ;Yes, print out a prompt 85 000452 004767 000060 call ttostr ; ... 86 000456 004767 000140 call ttichr ;Get any character (where is that 87 ; found on a keyboard?) 88 000462 012700 000723 mov #m.crlf,r0 ;On to next line 89 000466 004767 000044 call ttostr ; ... 90 000472 012704 000003 mov #3,r4 ;Reset the line count 91 000476 000207 10$: return 92 93 94 95 000500 010046 octout: mov r0,-(sp) ;Save value 96 000502 042716 177770 bic #177770,@sp ;Isolate an octal digit 97 000506 062716 000060 add #^O60,@sp ;Make it printable 98 000512 006000 ror r0 ;Shift right 99 000514 006200 asr r0 ; three bits 100 000516 006200 asr r0 ; for next digit 101 000520 001402 beq 10$ ;If done... print out 102 000522 004767 177752 call octout ;Not yet, recurse !! 103 000526 012600 10$: mov (sp)+,r0 ;Print a digit 104 000530 004767 000052 call ttochr ; ... 105 000534 000207 return ;Unwind the stack and return 106 107 108 109 000536 010146 ttostr: mov r1,-(sp) ;Save R1 for awhile 110 000540 010001 mov r0,r1 ;Save pointer to string 111 000542 112100 10$: movb (r1)+,r0 ;Get a character of string 112 000544 001406 beq 20$ ;If null, add a 113 000546 120027 000200 cmpb r0,#200 ;If a <200>, we're done 114 000552 001413 beq 30$ ; ... .MAIN. MACRO V05.06 00:00 Page 1-2 115 000554 004767 000026 call ttochr ;Print the character 116 000560 000770 br 10$ ; !loop! 117 118 000562 112700 000015 20$: movb #15,r0 ;output a on a 119 000566 004767 000014 call ttochr ; ... 120 000572 112700 000012 movb #12,r0 ; ... 121 000576 004767 000004 call ttochr ; ... 122 000602 012601 30$: mov (sp)+,r1 ;Restore previously saved R1 123 000604 000207 return 124 125 126 127 000606 105737 177564 ttochr: tstb @#177564 ;Terminal ready for output? 128 000612 100375 bpl ttochr ;Nope... 129 000614 110037 177566 movb r0,@#177566 ;Yes... output character 130 000620 000207 return 131 132 133 134 000622 105737 177560 ttichr: tstb @#177560 ;Has a key been typed? 135 000626 100375 bpl ttichr ;Nope... 136 000630 113700 177562 movb @#177562,r0 ;Yes... get it... 137 000634 000207 return 138 139 140 141 000636 052766 000001 000002 nxmtrp: bis #1,2(sp) ;Set PSW for return 142 000644 000002 rti ; from interrupt 143 144 145 146 000646 115 145 155 m.head: .asciz /Memory Map:/ 000651 157 162 171 000654 040 115 141 000657 160 072 000 147 000662 040 055 040 m.del: .ascii / - /<200> 000665 200 148 000666 120 162 145 m.pak: .ascii /Press any key to continue.../<200> 000671 163 163 040 000674 141 156 171 000677 040 153 145 000702 171 040 164 000705 157 040 143 000710 157 156 164 000713 151 156 165 000716 145 056 056 000721 056 200 149 000723 000 m.crlf: .byte 0 150 .even 151 152 000001 .end .MAIN. MACRO V05.06 00:00 Page 1-3 Symbol table M.CRLF 000723 M.PAK 000666 OCTOUT 000500 START 000300 TTOCHR 000606 M.DEL 000662 NXMTRP 000636 REPORT 000364 TTICHR 000622 TTOSTR 000536 M.HEAD 000646 . ABS. 000724 000 (RW,I,GBL,ABS,OVR) 000000 001 (RW,I,LCL,REL,CON) Errors detected: 0 *** Assembler statistics Work file reads: 0 Work file writes: 0 Size of work file: 163 Words ( 1 Pages) Size of core pool: 12800 Words ( 50 Pages) Operating system: RT-11 Elapsed time: 00:00:02.49 ,DK:MEMMAP=DK:MEMMAP