home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / asmlib.lbr / MTR.AZM / MTR.ASM
Encoding:
Assembly Source File  |  1991-06-25  |  18.8 KB  |  724 lines

  1. ;----------------------------------------------------------------
  2. ; This program tests the DRC-II card. It tests all 4 banks of 64 k.
  3. ;
  4. ; Since this program uses the ASMLIB library, it is easily modified and
  5. ; added to. All the rouines and code have been written as simply and as
  6. ; linearly as possible to allow mods and additions.
  7. ;
  8. ;            Written        R.C.H.        19/01/84
  9. ;            Last Update    R.C.H.        19/01/84
  10. ;----------------------------------------------------------------
  11. ;
  12. ;        ASMLIB library routine names
  13. ;
  14.     extrn    prolog,nibasc,pdacc,dispatch,inline
  15.     extrn    quit,listout,consout,crlf,clear
  16.     extrn    pdde,delay,cst,bell,cie,coe,caps
  17.     extrn    randinit,rand8,pmenu,phde,hexasc,phacc
  18.     extrn    xyinline,setxy,atoasc
  19.     extrn    ionum,tname,pstring,cursor,pstr
  20.     extrn    setatt,ramwbt,rambpt
  21.     extrn    lzb,nolzb,blzb,clkrd
  22. ;
  23.     maclib    z80
  24. ;
  25. ; Memory test variables
  26. ;
  27. t9t1    equ    50000            ; interrupts iteration size
  28. t9t2    equ    500               ; port addressing iteration size
  29. t9t3    equ    1            ; walking bit iteration size
  30. t9t4    equ    1            ; barber pole test iteration size
  31. t9t5    equ    05               ; ldir / lddr iteration test size
  32. ctc0    equ    08ch
  33. ctc1    equ    ctc0+1
  34. ctc2    equ    ctc0+2
  35. ctc3    equ    ctc0+3
  36. bnk$max    equ    3            ; test banks 00,01,02,03
  37. mstart    equ    00000h            ; test memory ending at
  38. mend    equ    0bfffh            ; test memory starting at
  39. ;
  40. super$start:
  41.     call    prolog
  42.     jmp    start
  43.     nop
  44.     nop                ; make on an 8 address boundary
  45. ;
  46. ; This is the interupt interrupt table that must start on an address
  47. ; boundary of 8
  48. ;
  49. vectors:
  50.     dw    int0
  51.     dw    int1
  52.     dw    int2
  53.     dw    int3            ; interrupt address vectors
  54. ;
  55. start:
  56. ; Initializations
  57. ; Clear all the ram storage areas used by this test
  58.     lxi    h,sram
  59.     mvi    m,00
  60.     mov    e,l
  61.     mov    d,h
  62.     inx    d            ; bump for the destination
  63.     lxi    b,eram-sram-1        ; the size
  64.     ldir
  65. ;
  66.     mvi    a,bnk$max        ; indicate maximum bank
  67.     sta    t9$bnk
  68.     call    sel$bnk            ; force a select and display of bank 0
  69. ;
  70. ; shift initialized random number seed to the real seed.
  71.     lxi    h,iseed
  72.     lxi    d,seed
  73.     lxi    b,6
  74.     ldir                ; shift the initialized seed
  75. ;
  76. ;----------------------------------------------------------------
  77. ; The DRC-II is tested by the following things.
  78. ;
  79. ; 1) Fast interrupts from a CTC on SBC-800. This can cause problems
  80. ;    if DRC-II decoding and refresf circuitry is faulty.
  81. ; 2) Port decoding by quickly writing to ports F0..FE to check for
  82. ;    a faulty port decoder chip of excess glitches on the bus.
  83. ; 3) Walking bit test up memory and down memory.
  84. ; 4) Barber pole memory test up and down memory.
  85. ; 5) Test with a repeated number of LDIR Z-80 instructions.
  86. ; 6) Test with a number of LDDR instructions.
  87. ;
  88. ; These tests are meant to be the most demanding that the DRC-II can
  89. ; ever experience. This is meant to show up marginal boards.
  90. ;----------------------------------------------------------------
  91. ;
  92.     call    clear
  93.     call    t9$overlay        ; display the overlay
  94.     lxi    d,140bh
  95.     sded    cur$cur            ; save the current cursor address
  96.     call    cursor            ; set up
  97.     mvi    a,'*'
  98.     call    dispatch
  99.     xra    a
  100.     sta    t9$no            ; save the test number as 00
  101. ;
  102. test9$start:
  103.     lded    cur$cur
  104.     call    cursor            ; reset to the current cursor position
  105.     call    do$test9        ; do the actual test
  106. ;
  107. ;     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108. ; This section must bump the number of loops counter
  109. ; then must display it on the screen.
  110. ; When all tests have been done for a bank, the next bank must be selected
  111. ; and dislayed on the screen.
  112. ; After this it must move the test indicator star to the next
  113. ; test in the loop.
  114. ;
  115.     lded    cur$cur
  116.     push    d            ; save for later use
  117.     mov    a,d            ; get X value
  118.     adi    16            ; point to the loop counter x value
  119.     mov    d,a            ; save back
  120.     call    cursor            ; set it up
  121. ; Get the loop value, bump, save, write
  122.     lda    t9$no            ; get test 9 test number, 0..4
  123.     lxi    h,t9$loops        ; point to the loop counters
  124.     mov    e,a
  125.     mvi    d,00            ; use t9$no to index into loop values
  126.     dad    d
  127.     dad    d            ; Now HL -> an individual loop value
  128.     mov    e,m
  129.     inx    h
  130.     mov    d,m
  131.     inx    d            ; Bump the value
  132.     mov    m,d            ; save
  133.     dcx    h
  134.     mov    m,e            ; save all
  135. ; DE = loops done
  136.     call    pdde            ; print as a decimal
  137. ;
  138. ; Move the test indicator star.
  139.     pop    d            ; restore cursor address
  140.     call    cursor            ; set up
  141.     mvi    a,' '
  142.     call    dispatch        ; clear it
  143. ; Go to the next test position.
  144.     lded    cur$cur
  145.     mov    a,e            ; get y address
  146.     cpi    19            ; last ??
  147.     jrz    t9$restart
  148.     inr    e
  149.     inr    e            ; points to next test
  150. ; Bump the test number
  151.     lda    t9$no
  152.     inr    a            ; indicate next test in progress
  153.     jr    t9$restart$over
  154. t9$restart:
  155.     lxi    d,140bh
  156.     xra    a            ; re-set to test number 00
  157. t9$restart$over:
  158.     sta    t9$no            ; save the test number
  159.     push    psw
  160.     sded    cur$cur            ; save the address
  161.     call    cursor            ; set the cursor
  162.     mvi    a,'*'
  163.     call    dispatch
  164. ; Select the next bank to be tested
  165.     pop    psw
  166.     ora    a            ; bank zero again ??
  167.     cz    sel$bnk            ; select next bank then
  168. ; Now check for the end of tests.
  169. ;
  170.     call    chk$abrt
  171.     jmp    test9$start
  172. ;
  173. chk$abrt:
  174.     call    cst
  175.     rz                ; 00 = No character there
  176.     call    cie            ; Else we get the typed character
  177.     pop    h            ; clear the stack
  178. ;
  179.     call    inline
  180.     db    0dh,0ah,'Bye$'
  181.     jmp    0e000h            ; jump to monitor warm start
  182. ;
  183. ; This routine must select a memory bank in the range 0..3. The bank
  184. ; number is saved in t9$bnk and used for display when an error happens
  185. ; also the number is used to increment to get the actual bank number.
  186. ;
  187. sel$bnk:
  188.     lxi    d,01906h        ; line 6, col 25
  189.     call    cursor            ; set the cursor up
  190. ; Now get the last bank number and send it.
  191.     lda    t9$bnk            ; check if > maximum
  192.     cpi    bnk$max          ; too far ??
  193.     jrnz    sel$bnk1
  194.     mvi    a,0ffh            ; use bank 00 next time
  195. sel$bnk1$
  196.     inr    a            ; get the next bank for testing
  197.     sta    t9$bnk
  198.      out    0ffh            ; send it
  199.     call    lzb
  200.     call    phacc            ; display the bank number
  201.     call    blzb            ; display standard
  202.     ret
  203. ;
  204. ; This is the actual memory testing section
  205. ; This decodes the test that must be done then jumps to it.
  206. ; A return is done from the test if all is well else the test
  207. ; will jump to test9$fail for an error.
  208. ;
  209. do$test9:
  210.     lxi    h,test9$table
  211.     lda    t9$no            ; get the test number
  212.     mov    e,a
  213.     mvi    d,00
  214.     dad    d
  215.     dad    d            ; Now HL -> and address to go to
  216.     mov    e,m            ; get low address
  217.     inx    h
  218.     mov    d,m            ; get high address
  219.     push    d            ; put address on stack
  220.     ret                ; goto the address
  221. ;
  222. test9$table:    ; A table of routine addresses
  223.     dw    test9$test1        ; Interrupts
  224.     dw    test9$test2        ; Port decoding
  225.     dw    test9$test3        ; Walking Bit
  226.     dw    test9$test4        ; Barber pole
  227.     dw    test9$test5        ; LDIR / LDDR
  228. ;
  229. ;----------------~~~~~~~~~~~~~~~~----------------
  230. ;    The memory test routines
  231. ;~~~~~~~~~~~~~~~~----------------~~~~~~~~~~~~~~~~
  232. ;
  233. ; Do an interrupt response test. This initializes the
  234. ; SBC-800 CTC channel 3 for fast interrupts then counts for
  235. ; the iteration size to complete the test. When done the interrupts
  236. ; are disabled.
  237. ; If no SBC-800 there then this test returns immediately.
  238. ;
  239. ;
  240. test9$test1:
  241. ; Fill memory with a random value.
  242.     lxi    d,seed
  243.     call    randinit        ; initialize random number generator
  244.     lxi    d,seed
  245.     call    rand8
  246.     lhld    mem$start
  247.     mov    m,a            ; send the byte into ram
  248.     mov    e,l
  249.     mov    d,h            ; get a copy
  250.     inx    d            ; point to next byte in ram
  251.     lbcd    mem$size        ; get memory size
  252.     ldir                ; fill memory.
  253. ; Now we start the Interrupt test by enabling interrupts on CTC channel 3
  254. ;
  255. ; Set up interrupt vectors.
  256.     lxi    h,t9t1            ; get iteration size
  257.     shld    int$count        ; clear the interrupt counter
  258.     lxi    d,vectors
  259.     mov    a,e            ; low 8 bits of address
  260.     out    ctc0            ; send. This is accepted as a vector
  261.     mov    a,d            ; high 8 bits
  262.     stai                ; put into interrupt register of Z80
  263. ; Initialize the CTC for interrupts on channel 3 only
  264.     mvi    a,085h            ; timer mode with interrupts
  265.     out    ctc3            ; in timer mode, clk is from the bus
  266.     mvi    a,20            ; count down value
  267.     out    ctc3            ; put in the value
  268.     im2                ; enable interrupts NOW
  269.     ei
  270. ;
  271. ; Perform wait till int$count = 00 and exit then.
  272. ;
  273. t9t1$loop:
  274.     lhld    int$count
  275.     mov    a,h
  276.     ora    l            ; H = L = 0 ??
  277.     jnz    t9t1$loop
  278.     jmp    stop$ctc
  279. ;
  280. ; These are the interrupt service routines
  281. int0:
  282. int1:
  283. int2:
  284.     call    stop$ctc        ; stop the CTC
  285.     call    inline            ; display a message now
  286.     db    0dh,0ah,'SBC-800 Illegal Interrupt$'
  287.     ret                ; return to the main loop
  288. ;
  289. int3:
  290.     lhld    int$count
  291.     dcx    h
  292.     shld    int$count
  293. ; Check if this is the end of the cycle
  294.     mov    a,l
  295.     ora    h            ; does H = L = 00 ??
  296.     jz    stop$ctc
  297. ; If not a stop then keep on.
  298.     ei                ; re-enable interrupts
  299.     reti                ; return from interrupt
  300. ;
  301. stop$ctc:    ; Clear the CTC 
  302.     di                ; stop interrupts
  303.     call    dumret
  304.     mvi    a,2
  305.     out    ctc3            ; stop the timer NOW
  306.     mvi    a,45            ; tell it a time constant follows
  307.     out    ctc3
  308.     mvi    a,13            ; the constant
  309.     out    ctc3            ; this starts it counting ONLY
  310.     ei                ; re-enable interrupts for any pending
  311. ;
  312. ; Since we have stopped the CTC , now we can check if memory got corrupted
  313. ; while the interrupts were enabled and running.
  314. ;
  315.     lhld    mem$start
  316.     lbcd    mem$size        ; load registers
  317.     dcx    b            ; check 1 byte less
  318. ;
  319. t1$chk$loop:
  320.     mov    a,m            ; get current byte
  321.     inx    h            ; point to next byte
  322.     cmp    m            ; does m(HL) = m(HL+1) ??
  323.     jnz    test9$fail        ; on a fail, print again.
  324.     dcx    b
  325.     mov    a,c
  326.     ora    b            ; does B = C = 00 ??
  327.     jnz    t1$chk$loop        ; loop till BC = 0
  328. ; Clear the check symbol
  329.     ret
  330. ;
  331. dumret:
  332.     reti                ; clear pending CTC status
  333. ;
  334. ;
  335. ; ~~~~~~~~~~~~~~~~----------------~~~~~~~~~~~~~~~~
  336. ; This test does many output instructions to port addresses close to the
  337. ; bank select port of the DRC-II in the hope that this will trigger the 
  338. ; DRC-II to glitch and de-select itself. This is usually caused by faulty
  339. ; port decoding logic.
  340. ; ports user are f0..fe
  341. ; ----------------~~~~~~~~~~~~~~~~----------------
  342. ;
  343. test9$test2:
  344.     lxi    h,t9t2            ; port iteration size
  345. test9$test2$loop:
  346.     call    chk$abrt        ; look for a key press
  347.     push    h            ; save loop counter
  348.     mvi    b,0eh            ; number of ports
  349.     mvi    c,0f0h            ; start port address
  350. port$loop:
  351.     call    send$port        ; send port (HL) times
  352.     call    chk$abrt        ; look for an exit command
  353.     inr    c
  354.     djnz    port$loop
  355. ; Check for end of tests
  356.     pop    h            ; restore counter
  357.     dcx    h
  358.     mov    a,l
  359.     ora    h            ; see if H = L = 0 ???
  360.     jrnz    test9$test2$loop
  361.     ret                ; keep on till done
  362. ;
  363. ; Now the subroutine
  364. send$port:
  365.     push    b            ; save
  366.     mvi    b,255            ; loop size
  367.     outir                ; send m(HL) -> p(C) for (B) times
  368.     pop    b
  369.     ret
  370. ;
  371. ; This is the walking bit test. This is taken from the
  372. ; ASMLIB library which is a routine by Leventhals' book 'Z-80 Subroutines'
  373. ;
  374. test9$test3:
  375.     lxi    b,t9t3            ; number of loops
  376. ; the loop. Load registers, call the routine, exit if an error.
  377. test9$test3$loop:
  378.     push    b            ; save it
  379.     call    chk$abrt
  380.     lded    mem$start        ; start of memory
  381.     lhld    mem$end            ; end of memory
  382.     call    ramwbt            ; do the test
  383.     pop    b
  384.     jc    test9$fail         ; error exit if a failure.
  385.     dcx    b
  386.     mov    a,c
  387.     ora    b            ; does B = C = 00 ????
  388.     jrnz    test9$test3$loop
  389.     ret                ; do a return when all loop pass
  390. ;
  391. ; ~~~~ Barber Pole Test ~~~~
  392. ;
  393. ; This is the barber pole test. This is taken from the
  394. ; ASMLIB library which is a routine by Leventhals' book 'Z-80 Subroutines'
  395. ;
  396. test9$test4:
  397.     lxi    b,t9t4            ; number of loops
  398. ; the loop. Load registers, call the routine, exit if an error.
  399. test9$test4$loop:
  400.     push    b            ; save it
  401.     call    chk$abrt
  402.     lded    mem$start        ; start of memory
  403.     lhld    mem$end            ; end of memory
  404.     call    rambpt            ; do the test
  405.     pop    b
  406.     jc    test9$fail         ; error exit if a failure.
  407.     dcx    b
  408.     mov    a,c
  409.     ora    b            ; does B = C = 00 ????
  410.     jrnz    test9$test4$loop
  411.     ret                ; do a return when all loops pass
  412. ;
  413. ; ~~~~ LDIR / LDDR test. ~~~~
  414. ; This moves a byte up and down the total available memory and then checks
  415. ; is for accuracy. On each iteration the byte is loaded from the random number
  416. ; generator so that a wide range of test values is checked. 
  417. ; Each iteration does an LDIR then a check, an LDDR then a check.
  418. ;
  419. test9$test5:
  420.     lxi    b,t9t5            ; get the number of loops
  421. t9t5$loop:
  422.     push    b            ; save
  423. ; Do the LDIR test first
  424.     lxi    d,seed            ; get a random number 
  425.     call    rand8            ; A = random number
  426.     lbcd    mem$size        ; get size of memory to test
  427.     dcx    b            ; one less
  428.     lhld    mem$start        ; get start address
  429.     mov    m,a            ; load the seed
  430.     mov    e,l
  431.     mov    d,h            ; copy into DE for the destination
  432.     inx    d            ; bump by one to propogate up ram
  433.     ldir                ; do the move.
  434.     mov    e,a            ; save check value
  435.     call    chk$abrt
  436.     lhld    mem$start
  437.     lbcd    mem$size
  438.     dcx    b            ; one byte less
  439. ; Now the check of the byte in memory. Use a Z-80 auto check.
  440.     mvi    a,'I'
  441.     call    coe
  442.     mvi    a,8
  443.     call    coe
  444. t9t5$loop2:
  445.     call    chk$abrt        ; abort ????
  446.     mov    a,e            ; restore checking value
  447.     cci                ; check m(HL) = A
  448.     jnz    t9t5$error
  449.     mov    e,a            ; save
  450.     mov    a,c
  451.     ora    b            ; does B = C = 0 ??
  452.     jnz    t9t5$loop2
  453. ;
  454. ; **** Now do the LDDR checking. This is done in a similar way ****
  455. ;
  456.     lxi    d,seed            ; get a random number 
  457.     call    rand8            ; A = random number
  458.     lbcd    mem$size        ; get size of memory to test
  459. ;    dcx    b            ; one less
  460.     lhld    mem$end          ; get start address
  461.     mov    m,a            ; load the seed
  462.     mov    e,l
  463.     mov    d,h            ; copy into DE for the destination
  464.     dcx    d            ; deduct one to propogate down ram
  465.     lddr                ; do the move.
  466.     mov    e,a            ; save the check value
  467.     call    chk$abrt
  468.     lhld    mem$start
  469.     lbcd    mem$size
  470.     dcx    b            ; one byte less to test
  471. ;
  472.     mvi    a,'D'            ; indicate a Decrementing test
  473.     call    coe
  474.     mvi    a,8            ; backspace
  475.     call    coe
  476. ; Now the check of the byte in memory. Use a Z-80 auto check.
  477. t9t5$loop3:
  478.     call    chk$abrt
  479.     mov    a,e            ; restore checking value
  480.     cci                ; check m(HL) = A
  481.     jnz    t9t5$error
  482.     mov    e,a            ; save
  483.     mov    a,c
  484.     ora    b            ; does B = C = 0 ??
  485.     jnz    t9t5$loop3
  486. ; Decrement the iteration counter and check for end of this test.
  487.     pop    b            ; restore iteration counter
  488.     dcx    b            ; one less loop to do
  489.     mov    a,c
  490.     ora    b            ; check if the iteration is done
  491.     jnz    t9t5$loop
  492. ; Clear old I or D when here
  493.     mvi    a,' '            ; blank it
  494.     call    coe
  495.     ret                ; exit if all done
  496. ;
  497. ;
  498. t9t5$error:
  499.     pop    b            ; restore stack
  500.     jmp    test9$fail
  501. ;
  502. ; If a test fails then this routine is called. It increments the
  503. ; fail counter, displays the value and also the address where the fail
  504. ; occurred. This is the error section.
  505. ;
  506. ; On calling here HL -> error address in memory
  507. ;
  508. test9$fail:
  509.     push    h            ; save the failure address
  510. ; Index to the fail column
  511.     lded    cur$cur            ; get current cursor address
  512.     mov    a,d            ; get X address
  513.     adi    23            ; add 23 to get to the fail column
  514.     mov    d,a
  515.     call    cursor            ; get there
  516. ; Now get the number of fails, bump, save, display
  517.     lxi    h,t9$fails        ; point to start of fail table
  518.     lda    t9$no            ; get the test number
  519.     mov    e,a
  520.     mvi    d,00            ; load an index
  521.     dad    d
  522.     dad    d            ; now HL -> fail number for this test
  523.     mov    e,m
  524.     inx    h
  525.     mov    d,m            ; now DE = number of fails
  526.     inx    d            ; bump
  527.     mov    m,d
  528.     dcx    h
  529.     mov    m,e            ; saved now
  530. ; Now display it
  531.     call    pdde            ; display as a decimal.
  532. ; Now we need to display the address where the fail occurred
  533.     call    inline
  534.     db    '      $'        ; Use spaces to get there
  535.     pop    d            ; restore HL -> DE for display
  536.     call    phde            ; display it as hex
  537. ; Now we display the bank where it happened.
  538.     call    inline
  539.     db    '   bank ($'
  540.     lda    t9$bnk            ; get the bank number
  541.     call    lzb
  542.     call    phacc            ; print it
  543.     call    nolzb
  544.     mvi    a,')'
  545.     call    coe
  546. ;
  547. ; After all this, bump the total number of fails, save and then display.
  548.     lxi    d,0d15h            ; col 13, line 21
  549.     call    cursor
  550.     lhld    t9$total$fails
  551.     inx    h
  552.     shld    t9$total$fails
  553.     xchg
  554.     call    pdde            ; display as a decimal
  555.     call    blzb            ; go back to standard blanking
  556.     ret                ; all done
  557. ;
  558. ;----------------------------------------------------------------
  559. ; Major section to display the test 9 overlay that has all the parameters 
  560. ; etc on it. This also displays the time start and a few other things to 
  561. ; improve the niceness of the program.
  562. ;----------------------------------------------------------------
  563. ;
  564. t9$overlay:
  565.     lxi    d,t9$menu
  566.     call    pmenu            ; display the text in one go
  567. ; Put a line under the double line test headings
  568.     lxi    d,010ah            ; col 1 , line 10
  569.     call    cursor
  570.     mvi    b,61            ; do 61 times
  571.     mvi    a,'-'            ; send this character
  572.     call    pstr            ; print a string of characters entry
  573. ;
  574. ; Now display the iteration size values
  575.     call    blzb            ; select standard blanking
  576.     lxi    d,1c0bh            ; X=28, Y=11
  577.     call    cursor
  578.     lxi    d,t9t1            ; first test size display
  579.     call    pdde            ; display as a decimal
  580. ;
  581.     lxi    d,1c0dh            ; X=28, Y=13
  582.     call    cursor
  583.     lxi    d,t9t2            ; second test size display
  584.     call    pdde            ; display as a decimal
  585. ;
  586.     lxi    d,1c0fh            ; X=28, Y=15
  587.     call    cursor
  588.     lxi    d,t9t3            ; third test size display
  589.     call    pdde            ; display as a decimal
  590. ;
  591.     lxi    d,1c11h            ; X=28, Y=17
  592.     call    cursor
  593.     lxi    d,t9t4            ; fourth test
  594.     call    pdde
  595. ;
  596.     lxi    d,1c13h            ; X=28, Y=19
  597.     call    cursor
  598.     lxi    d,t9t5            ; fourth test
  599.     call    pdde
  600. ;
  601. ; Put a line under the tests, this places them in a table
  602.     lxi    d,0114h
  603.     call    cursor
  604.     mvi    a,'-'
  605.     mvi    b,61
  606.     call    pstr
  607. ;
  608. ; Display the time now
  609.     lxi    d,03004h
  610.     call    cursor
  611.     lxi    d,tim$buf        ; locate a time string buffer
  612.     call    clkrd
  613. ;
  614.     call    nolzb            ; display time without lzb
  615.     lda    hrs
  616.     ani    03fh            ; mask off top bits
  617.     call    phacc
  618.     mvi    a,':'            ; a spacer
  619.     call    dispatch
  620.     lda    mins
  621.     call    phacc
  622.     mvi    a,':'
  623.     call    dispatch
  624.     lda    secs
  625.     call    phacc
  626. ; Now get memory start address and save
  627.     lxi    d,01a04h
  628.     call    cursor
  629.     lxi    d,mstart
  630.     sded    mem$start        ; save the start address
  631.     call    phde            ; display without LZB
  632. ; Get the memory end address, display, save then calculate the memory size 
  633. ; to be tested.
  634.     lxi    d,01a05h
  635.     call    cursor
  636. ; Load 0bfffh as the memory end address
  637.     lxi    d,mend          ; memory end
  638.     sded    mem$end
  639.     call    phde
  640. ; Now the memory size
  641. ;    lxi    h,0bffh            ; save as the memory size
  642.     lxi    h,mend - mstart      ; memory start - end
  643.     shld    mem$size        ; save the memory size
  644. ;
  645.     call    blzb
  646.     ret
  647. ;
  648. iseed    db    5,89,90,198,5,245
  649. ;
  650. t9$menu:
  651.     db    26,01,'Memory Test - ROM Version$'
  652.     db    21,04,'From$'
  653.     db    23,05,'To$'
  654.     db    36,04,'Time Start$'
  655.     db    38,05,'Time End$'
  656.     db    21,06,'Bank$'
  657.     db    03,08,'Test$'
  658.     db    16,08,'Current  Iterations  Loops  Fails  Fail Address$'
  659.     db    18,09,'Test      Size$'
  660.     db    01,11,'Interrupts$'
  661.     db    01,13,'Port Addressing$'
  662.     db    01,15,'Walking Bit$'
  663.     db    01,17,'Barber Pole$'
  664.     db    01,19,'LDIR / LDDR$'
  665.     db    01,21,'Total Fails$'
  666.     db    01,23,'Press Any Key To Quit$'
  667.     db    0ffh
  668. ;
  669.     dseg
  670. ;
  671. ; Simple data atorage areas. Use the D switch in the linker
  672. ; to set these after assembly.
  673. ;
  674. sram:                    ; start of ram
  675. ;
  676. seed:    db    0,0,0,0,0,0         ; random number seed value
  677. t9$no:    db    00            ; test 9 section #
  678. t9$bnk:    db    00            ; memory board bank number
  679. t9$loops:
  680.     db    00,00            ; section loop counter
  681.     db    00,00            ; section loop counter
  682.     db    00,00            ; section loop counter
  683.     db    00,00            ; section loop counter
  684.     db    00,00            ; section loop counter
  685. ;
  686. t9$fails:
  687.     db    00,00            ; number of fails
  688.     db    00,00            ; number of fails
  689.     db    00,00            ; number of fails
  690.     db    00,00            ; number of fails
  691.     db    00,00            ; number of fails
  692. ;
  693. t9$total$fails:
  694.     db    00,00            ; total number of fails
  695. ;
  696. mem$start:
  697.     db    00,00
  698. ;
  699. mem$end:
  700.     db    00,00
  701. ;
  702. mem$size:
  703.     db    00,00
  704. ;
  705. int$count:
  706.     db    00,00            ; number of interrupt cycles
  707. ;
  708. cur$cur:
  709.     db    00,00            ; current cursor position
  710. ;
  711. tim$buf:
  712.     db    00,00,00,00
  713. hrs    db    00
  714. mins    db    00
  715. secs    db    00
  716. ;
  717. eram:                    ; end of ram
  718. ;
  719. ;
  720.     end
  721.  
  722.  
  723.