home *** CD-ROM | disk | FTP | other *** search
/ Outlet 54 / outlet-54.mgt / r4 < prev    next >
Text File  |  2021-04-18  |  20KB  |  1 lines

  1.        Exit: into 1E73 GO TO 2, which puts the line and         statement numbers in svs determining the next statement to be   executed and returns to 1B76 STMT RET.                                 Output parameters: HL holds the RETURN line number               - D holds the statement number.                                                                                             ripple see precision                                                                                                            R I STORE 365F (3645 read-in)                                      Jumps from:                                                      3645 read-in                                                                                                                RND key (A5) see also commands, functions and operators,    KEYBOARD SCANNING, 022C extended mode table (b)                         The T key in E mode without shift produces the function RND; like PI and INKEY$, it is a function without an argument - from the point of view of BASIC. In fact it uses the 2-byte     value in 5C76 SEED as argument to produce a random number.              On execution, 24FB SCANNING indexes into the scanning   function table at 2596 to find the executive routine 25F8 S RND.        0C35 PO TRSP it doesn't require trailing space                                                                              rounding see precision                                                                                                          RSLT ZERO 370E (36C4 exp)                                          Exit from:                                                       36C4 exp through                                                3705 N NEGTV (twice)                                                                                                        RS NRMLSE 32B1 (3297 re-stack)                                     Jumps from:                                                      3297 re-stack                                                                                                               RS STORE 32BD (3297 re-stack)                                      Exit from:                                                       3297 re-stack                                                                                                               RSTK LOOP 32B2 (3297 re-stack)                                     Jumps from:                                                      auto                                                                                                                        RUN key (F7) see also commands, functions and operators,    KEYBOARD SCANNING                                                       The R key in K mode produces the command RUN. The       command requires a line number as operand, but if none is given in the BASIC it assumes zero.                                           The command is read by 1B29 STMT L 1 referring through  the syntax offset table 1A48 to the syntax parameter table 1A7A.1AAB P RUN calls 1C0D CLASS 03 to collect the line number and   then jumps to the executive routine 1EA1 RUN.                           Introduction - exemplar of execution considering                               multiple statements                                                                                          RUN subroutine 1EA1                                                 Called only from 1AAB P RUN in the syntax parameter     table; executes the RUN X command, equivalent to CLEAR: RESTORE 0: GO TO X. X is zero if no line number is supplied; RESTORE    operates with zero whether one was supplied or not.                    Input parameters: none                                           - X is last value on the calculator stack.                     Action: call 1E67 GO TO, which sets the svs so that the  return to the statement loop from 1EDC CLEAR will execute from  the start of line X                                                     - call 1E45 REST RUN with zero, to set the DATA pointer in 5C57 DATADD to the start of the program.                            Exit: to 1EAF CLEAR RUN (misprinted), which deletes all  variables, clears the screen, and goes on to 1B76 STMT RET whichhandles the jump to line X.                                            Output parameters: none                                          - X has gone from the calculator stack.                        Rems:                                                            1E42 RESTORE uses REST RUN entry point                          1EAF CLEAR RUN no change to RAMTOP                              1EDC CLEAR 2 always counts as last statement in BASIC                        line - any following cannot be executed                                                                        running, run-time see FLAGS bit 7                                                                                               run-time errors see 1F15 REPORT 4                                                                                                                        -----                                                                                                  SA ALL 075A (0605 SAVE ETC)                                        Jumps from:                                                      0692 SA DATA 1                                                  0710 SA TYPE 3                                                                                                              SA BIT 1 0514 (04C2 SA BYTES)                                      Jumps from:                                                      0525 SA 8 BITS                                                  auto                                                           Rems:                                                            0511 SA BIT 2 timing loop for "off" or "on" bytes                                                                           SA BIT 2 0511 (04C2 SA BYTES)                                      Jumps from:                                                      051C SA OUT                                                                                                                 SA BLANK 0629 (0605 SAVE ETC)                                      Jumps from:                                                      auto                                                                                                                        SA BYTES subroutine 04C2 see also 0556 LD BYTES, ports (EAR input etc), program/data block, timing                                  Records a string of bytes on cassette tape, either a    header block or a program/data block. The actual recording      consists of:                                                           - a leader, 5 seconds for a header block or 2 seconds fora data block, pulsing at about 800 hz and signalled by RED/CYAN stripes in the border                                                  - a single sync pulse                                           - a single flag byte, zero for a header and FF for a datablock                                                                  - the bytes of the header or data block                         - the parity byte.                                               Each of the bytes is recorded bit by bit, long pulses   for bit one of 2 * 1710d T states, about 1024d hz, and short    pulses for bit zero of 2 * 855d T states, about 512d hz, and    signalled by YELLOW/BLUE stripes in the border.                         The_parity_byte is a device to check that no bytes are  missed or incorrect when a file is loaded from tape. It isn't   infallible, but its failure rate is low. Before SAVing starts,  the parity byte is made to match the first byte to be saved, theheader/data flag (SA START). Each byte SAVed is XORed           cumulatively with this parity byte (SA LOOP P); when all the    bytes of the block have been saved the parity byte is also      output to the tape (SA PARITY). On loading, the parity byte is  first zeroed (058F LD SYNC), then XORed with each new byte as itis loaded (05CA LD 8 BITS). When everything has loaded, the     parity byte is finally XORed with the last byte on the tape, theSAVed parity byte, and this should give zero.                          Input parameters: DE holds the length; the number of     bytes, excluding the flag and parity byte                               - IX holds the address of the first byte to be recorded         - A holds a header/data flag; zero for a header, FF for a data block.                                                          Action: stack the return address 053F SA/LD RET; all RETswill go to there                                                        - make a pulse counter 1F80h; this will actually produce2080h/8320d half pulses taking 8320 * 2168 = 18,037,760d T      states, a little over 5 seconds, for the header                         - if the hi bit of the header/data flag is zero jump on to SA FLAG; header                                                      - (data block) reset the pulse counter to 0C98h; it willproduce 0D98h/3480d half pulses taking 3480 * 2168 = 7,544,640d T states, a little over 2 seconds, for a data block                    _04D0_SA_FLAG: increment the length and decrement the    start; to allow for the flag                                            - turn off the interrupt; the keyboard scan would upset the timing                                                              - prepare a port signal 00000010b/02; zero in bit 3     turns MIC on, 010 in the lo bits makes the border RED                   - make the delay counter a low number; the 2 in the portsignal is convenient, but any low number would have done.              _04D8_SA_LEADER: a one-line delay loop; 13d T states for each turn with the delay counter, but only 8 for the exit. With delay counter C the delay is 13 * C - 5d T states; so on entry, with only two turns, 21d                                                - output the port signal                                        - XOR it with 00001111b/0Fh; changing 00000010b/02 MIC  on and RED to 00001101b/0Dh MIC off and CYAN and back for each  half pulse.                                                             - make the delay counter A4h/164d                               - decrement the pulse counter                                   - if it isn't zero yet jump back to SA LEADER; this timethe delay loop will take 13 * 164 - 5 = 2127d T states, to whichmust be added 41d for the rest of the half-pulse loop, so each  half pulse takes 2168d T states                                         - (the lo byte of the pulse counter has reached zero)   decrement the hi byte and the delay counter                             - if the hi byte isn't_negative yet jump back to the SA LEADER delay loop; using JP P instead of JR NZ gives the loop anextra turn. The reason for using it is to make the timing exact,because JP is slightly faster than JR. This time the delay will be 13d T states less, which exactly compensates for the         additional m/c, and the half pulse again takes 2168d T states           - (the pulse counter is negative, all the pulses have   been output) make a new delay counter 2Fh/47d.                         _04EA_SA_SYNC_1: an exactly similar delay loop; on entry it will take 13 * 47 - 5 = 606d T states, which with the 61d    inclusive from the last OUT makes 667d                                  - output the port signal; it will be on/RED again after an even number of loops                                                 - make the signal 00001101b/0Dh for off/CYAN                    - make a new delay counter 37h/55d.                            _04F2_SA_SYNC_2: another identical delay loop; 55d turns of this one plus the 25d T states inclusive from the last OUT   makes 13 * 55 - 5 + 25 = 735d T states from on to off                   - output the signal for off/CYAN                                - make a new delay counter 3Bh/59d and port signal      00001110b/0Eh; bit 4 signalling MIC off and the lo bits         signalling 110b/06 YELLOW                                               - get the header/data flag; the first code byte to be   output, and also used as the starter for the parity bit                 - jump on to SA START; the entry point for the loop     extending from SA LOOP down to the end of SA 8 BITS, each turn  of which will save one code byte in the L register. The loop    will be taken out of order, for clarity's sake.                        _0507_SA_START: save the parity; at the start it is 00   for a header, FFh for a program/data block                              - make a port signal 00000001b/01 MIC on/BLUE                   - set carry as the marker for an 8-bit loop (see index  entry after the end of the alphabet)                                    - jump on to SA 8 BITS.                                        _0525_SA_8_BITS: rotate the code byte left; the carry    goes into its lo bit, its hi bit goes into the carry                    - if the resulting byte isn't zero jump back to SA BIT  1, the inner bit-saving loop, see below; it still has bits to besaved. It can't be zero till eight turns are complete, because  of the set carry on entering the loop, but a zero bit comes in  from the right after each bit pulse loop, because of the XOR in SA OUT                                                                  - (it is zero, that code byte is finished with) count   down the block length counter                                           - step on the code byte pointer                                 - set the delay counter to 31h/49d                              - if port 7FFE shows BREAK or SPACE is being pressed,   return; to SA LD/ RET                                                   - if the hi byte of the counter isn't yet_negative jump back to SA LOOP to save another code byte; it reaches zero when the block has all been saved, but there is still the parity byteto save                                                                 - (everything has been saved) make a final delay counter3Bh/59d.                                                               _053C_SA_DELAY: another delay loop; the delay is 59 * 13 - 5 = 762d T states, recording a little silence on the tape justto make sure the last bit's "off" is recognizable                       - return; to SA LD/RET.                                        _04FE_SA_LOOP: test the length counter                           - if it is zero, jump on to SA PARITY; this must be the parity byte                                                             - get the new code byte at the pointer.                        _0505_SA_LOOP_P: XOR the new code byte with the parity   byte; continues the loop into SA START to save the new code     byte, see above.                                                       _050E_SA_PARITY (entered from SA LOOP after all the code bytes of the header or data block have been saved and counted   down): put the parity in the code byte                                  - jump back to SA LOOP P; the parity byte as code byte  is there XORed with itself as parity byte, which must give zero,but the result is put in H which up to now has held the parity  byte, and this H is never used again.                                  _0514_SA_BIT_1 (the inner loop, outputting individual    bits, is entered here from SA 8 BITS and is turned twice, once  for the "on" half-pulse and again via SA BIT 2 for the "off". Onentry carry is set for a long pulse representing a one, NC for ashort pulse representing zero, and the carry flag isn't         disturbed throughout both turns of the loop, so both the on and off halves are long or short accordingly): start with a delay   loop; using the counter set at                                            3Bh/59d in SA SYNC 2 for the very first entry, making a delay of 59 * 13 - 5 = 762 T states, plus 82d inclusive since the last OUT in SA SYNC 2 makes 844d                                      31h/49d in SA 8 BITS for the first entry of each      subsequent code byte, making a delay of 49 * 13 - 5 = 632 T     states, plus 208d inclusive since the last OUT in SA OUT makes  840d                                                                      3Eh/62d in SA OUT for the "off" loop of each bit,     making a delay of 62 * 13 - 5 = 801 T states, plus 42d inclusivesince the last OUT in SA OUT makes 843d                                   3Dh/61d in SA OUT (reduced after the JR) for the "on" loop of each bit after the first in the byte, making a delay of 61 * 13 - 5 = 788 T states, plus 55d inclusive since the last   OUT in SA OUT makes 843d                                                - if carry isn't set (zero bit) jump on to SA OUT; the  jump takes 12d T states, a total of 855d - give or take a few!          - ("one" bit) make a delay counter 42h/66d.                    _051A_SA_SET: another delay loop; this one is 66 * 13 - 5= 853d, plus 7 for not jumping and another 7 to load the        counter, a total of 1710d, making the longer pulse for the      "one".                                                                 _051C_SA_OUT: output the port signal                             - make a delay counter 3Eh/62d                                  - if the flag shows NZ jump back to SA BIT 2; the Z flagremains at NZ from SA 8 BITS to here on the "on" turn of the bitpulse loop                                                              - (the flag was zeroed in SA BIT 2, so if it is now Z   this must be the "off" turn) decrement the delay counter to     equalize the half-pulse lengths                                         - clear the carry; this NC will be rotated into the codebyte as a zero                                                          - make the port signal 01; MIC on and BLUE                      - continue into SA 8 BITS to collect the next bit.             _0511_SA_BIT_2 (the start of the "off" half-pulse): make a port signal 0Eh; MIC off and YELLOW, a value carried in the C register from SA SYNC 2 to the end of the routine                       - make a Z flag from the hi bit of the delay counter; itis never as much as 80h, so reading it makes the flag without   disturbing the carry, etc                                               - re-enter SA BIT 1.                                           Exit: RET, from SA 8 BITS on a BREAK or from SA DELAY; itwill be to 053F SA/LD RET which was preloaded on the machine    stack. This restores the original border colour and enables the interrupt.                                                             Output parameters: none.                                        Called from:                                                     0970 SA CONTRL                                                 Exit from:                                                       0991 SA 1 SEC                                                  Rems:                                                            058F LD SYNC parity zeroed initially                            05A9 LD LOOP parity is last byte loaded                         05CA LD 8 BITS new byte XORed with parity byte                  0970 SA CONTRL header saved with parity byte                                                                                SA CODE 06C3 (0605 SAVE ETC)                                       Jumps from:                                                      06A0 SA SCR$                                                                                                                SA CODE 1 06E1 (0605 SAVE ETC)                                     Jumps from:                                                      06C3 SA CODE