Post Reply 
41CL: Second set of Main RAM
04-26-2014, 02:37 PM (This post was last modified: 04-28-2014 06:42 AM by Ángel Martin.)
Post: #1
41CL: Second set of Main RAM
Quick on the heels of the previous topic ( 41CL: Second Set of Extended memory ) - here comes the follow-up dealing with MAIN memory, i.e. Data registers and Programs.

The method is exactly the same, but one must be careful not to swap the RAM with an invalid copy in the higher page: the status register c in particular is very sensitive to this experiments and balks at improper values!

Therefore it's important to "prime the pump" before executing MMSWAP for the first time - and that's the mission of MMCOPY: use it to copy the current contents of the main RAM to the upper page.

MMSWAP includes status registers c,d, and e - but none of the others. This scheme provides compatible key assignments but leaves alone the program pointer.

Stating the obvious, make sure MMSWAP runs from ROM (HEPAX, or otherwise) - or else you'll get nice pyrotechnics and a likely MEMORY LOST event.

Below the program listings for MMCOPY:


1    LBL "MMCOPY    
2    13    register c address
3    ENTER^    
4    3    three status registers
5    XEQ 03    copy block
6    "MAIN"    main memory
7    AVIEW    provide feedback
8    192    origin address
9    ENTER^    
10    320    number of registers
11    LBL 03    
12    STO M    save counter in M
13    X<>Y    address-1
14    1024    
15    X<>Y    
16    +    adress-2
17    LASTX    
18    LBL 01    
19    PEEKR    read value in adr-1
20    X<>Y    
21    RDN    
22    POKER    write in in adr-2
23    X<> T    
24    E     
25    ST+ Z    increase adr-1
26    +    increase adr-2
27    DSE M    decrease counter
28    GTO 01    loop back if not done
29    "DONE"    block is done
30    AVIEW    
31    END

and here's the combined MMSWAP and XMSWAP together (lots of shared code):


1    LBL "MMSWAP"    
2    3    registers c, d, and e
3    STO M    
4    13    reg(c) address
5    XEQ 03    
6    "MAIN"    
7    AVIEW    
8    320    all memory
9    STO M    
10    192    origin
11    GTO 03    
12    LBL "XMSWAP"    
13    "XF/M"    base block
14    AVIEW    provide feedback
15    CF 00    base block
16    64    origin
17    XEQ 00    swap block
18    "EM-1"    first EM module
19    AVIEW    provide feedback
20    SF 00    larger block
21    513    origin
22    XEQ 00    swap block
23    "EM-2"    second EM module
24    AVIEW    provide feedback
25    SF 00    larger block
26    769    origin
27    LBL 00    swap block
28    X<> M    address to M
29    128    base size
30    FS?C 00    larger block?
31    239    extended size
32    X<> M    store in M
33    LBL 03    
34    RCL X    origin
35    1024    offset address
36    +    destination
37    LBL 01    
38    PEEKR    read destination value
39    X<> Z    
40    PEEKR    read source value
41    R^    lift for compare
42    X=Y?    are they equal?
43    SF 00    flag it so
44    RDN    undo lift
45    FS?C 00    equal values?
46    GTO 02    yes, skip writing
47    X<> T    position them crossed
48    POKER    write them back
49    RDN    
50    X<> Z    position them crossed
51    POKER    write them back
52    LBL 02    merge code
53    RDN    locate addreses in X, Y
54    E    
55    ST+ Z    increase adr-1
56    +    increase adr-2
57    DSE M    decrease counter
58    GTO 01    loop back if not done
59    "DONE"    block is done
60    AVIEW    
61    END


PS. The attached pdf contains both programs in a nicer format - does anybody know how to get the code properly formatted in the post window???
Find all posts by this user
Quote this message in a reply
04-27-2014, 06:40 AM
Post: #2
RE: 41CL: Second set of Main RAM
Forgot to mention that this is also the perfect method to recover from a MEMORY LOST event: simply swap the Main Memory and your lost configuration is back on line.

Another method to "prime the pump": instead of using MMCOPY you can simply copy the RAM block at 0x800 into 0x081. This is faster but does both main and extended memory - thus not so specific.

with "800>801" in ALPHA, XEQ "YMCPY".
Find all posts by this user
Quote this message in a reply
04-28-2014, 06:43 AM (This post was last modified: 04-28-2014 06:45 AM by Ángel Martin.)
Post: #3
RE: 41CL: Second set of Main RAM
Updated programs (now including register 10(+) for complete flags compatibility between sets) are attached below, and also in the new versions of the RAMPAGE, AMC_OSX and Power_CL Manuals soon available at TOS.

Attached File(s)
.pdf  Swapping RAM_V3.pdf (Size: 142.78 KB / Downloads: 17)
Find all posts by this user
Quote this message in a reply
Post Reply 

User(s) browsing this thread: 1 Guest(s)