Program uploads image O memory P n = 3 2 kb .
It is recommended that you first read Part 1.
It is highly recommended that you read Part 2.
In a nutshell, the algorithm is as follows:
1) in the RAM PP memory introduce a program that, using means of direct memory access to the CPU , copies the contents 3 2 kb About memory P P (including your own code!) In any area of RAM CPU USER mode size of the same 3 2 kb;
2) in the memory of the RAM of the CPU (RAM of the USER mode) we enter a program that transfers 3 2 kb clones (also located in the RAM of the USER mode ) through the interface “Joint C2” to the COM port of the PC .
* The “Joint C2” port, as well as the “Local Area Network” port, are the only two external ports in the UKSC that are accessible from the main processor trunk. The remaining external I / O ports are accessible from the peripheral processor backbone.
=================================================== ================================
1) carry out a full reset of the computer
2) in the PP monitor, start the PP program
3) in the CPU monitor, start the CPU program
====================== ============================ ================================
PP program
P forwards 16384 words of RAM RAM to addresses 000000-077777 to RAM RAM to addresses 010000-107777 .
address macro code
020000 012700 MOV # 000000, R0 ; PP RAM read in addresses 000000-077777
020 002 000000
020004 012737 MOV # 004000, @ # 177010 ; write it in the RAM of the CPU to the addresses 010000-107777
020006 004000 ; (010000/2 = 004000)
020010 177010
020012 012701 MOV # 040000, R1 ; forward 040000 words (100000 bytes)
020014 040000
The L1: ; repeat
020016 012037 MOV (R0) +, @ # 177014 ; forward the next word from RAM
020020 177014 ; at address R0 in the RAM of the CPU at the address {177010} * 2
; and perform an offset of 2 bytes R0: = R0 + 2
020022 005237 INC @ # 177010 ; perform offset
020024 17 7010 ; { 177010 } * 2 : = ({ 177010 } + 1) * 2
020026 077105 SOB R1, L1 ; decrease the word counter R1: = R1-1
; until 040000 words are transmitted (100000 bytes)
020030 000000 HALT ; end
Before starting it is necessary to check that PSW = 000200 (otherwise, there may be a failure in the control of the RAP device if the program is interrupted by an interrupt that draws characters on the screen) .
In addresses 020000-020030 RAM RAM is initially located "000000" . If this is not the case (it may depend on the specific firmware version of the UKNTs ROM), then the program must be located in any other free range of addresses.
The contents of some RAM RAM cells (system variables of the software monitor) may vary depending on the previous operation of the computer .
=================================================== ================================
CPU program
It transfers 32768 bytes of the image of the RAM RAM from the addresses 000000-077777, uploaded to the USER- RAM RAM at the addresses 010000-107777 , to the data port of the source “ Joint C2 ”.
address macro code
001000 012700 MOV # 010000, R0 ; we send the contents of the RAM of the CPU
001002 010000 ; at the addresses 010000-107777
001004 012701 MOV # 100000, R1 ; send 100000 bytes (040,000 words)
001006 100000
L2 :; repeat
L3: ; repeat
001010 105737 TSTB @ # 176574 ; check source readiness
001012 176574 ; (bit # 7 = 1) of junction C2
001 014 100 375 BPL L3 ; until the source is ready (bit # 7 = 1)
001016 112037 MOVB (R0) +, @ # 176576 ; forward the next byte of the image ROM ROM PP
001020 176576 ; In Joint C2
; and perform an offset of 1 byte R0: = R0 + 1
001022 077106 SOB R1, L2 ; decrease the byte counter R1: = R1-1
; until 100,000 bytes (040,000 words) transmitted
001024 000000 HALT ; end
Before starting it is necessary to check that PSW = 000200 (otherwise, the program may crash due to the transition to processing an unexpected interrupt) .
Program runtime 32768 bytes / (9600 baud / 11 bits) = 38 sec.
=================================================== ================================