ZX Review #7-8-9-10
08 ноября 1997

Retro - 40 best treatments: Removal of REM-strings.

<b>Retro</b> - 40 best treatments: Removal of REM-strings.
    7.3. Removal of REM-strings


  Length: 132

  Number of variables: 0

  Checksum: 13809

  Purpose: This program removes all comments from 
BEYSIKprogrammy. 

  Subroutine call:

     RANDOMIZE USR address

  Error checking: If no-BASIC program, the procedure returns to 
BASIC without any action. 

  Comment: The procedure ROM
which is used to delete characters, is not running
very quickly and therefore routine "removal REM-lines" running 
slow. 


   LISTING machine code
Assembly label number to VVODA147.


       LD HL, (23635) 42 83 92

       JR CHECK 24 31
NEXT_L PUSH HL 229

       INC HL 35

       INC HL 35

       LD C, (HL) 78

       INC HL 35

       LD B, (HL) 70
NXT_CH INC HL 35

       LD A, (HL) 126

       CP 33254 1933

       JR C, NXT_CH 56250

       CP 234 254 234

       JR NZ, SEARCH 32 26

       INC BC 3

       INC BC 3

       INC BC 3

       INC BC 3

       POP HL 225
DEL_L PUSH BC 197

       CALL 4120 205 24 16

       POP BC 193

       DEC BC 11

       LD A, B 120

       OR C 177

       JR NZ, DEL_L 32246
CHECK LD DE, (23,627) two hundred thirty-seven 91 75 92

       AND A 167

       SBC HL, DE 237 82

       RET NC 208

       ADD HL, DE 25

       JR NEXT_L 24214
SEARCH INC HL 35

       LD A, (HL) 126

       CP 13254 1913

       JR NZ, N_ENT 32 8
ENT_FD POP HL 225

       ADD HL, BC 9

       INC HL 35

       INC HL 35

       INC HL 35

       INC HL 35

       JR CHECK 24231
N_ENT CP 14254 1914

       JR NZ, N_NUMB 32 7

       INC HL 35

       INC HL 35

       INC HL 35

       INC HL 35

       INC HL 35

       JR SEARCH 24,231
N_NUMB CP 33254 1933

       JR C, SEARCH 56,227

       CP 34254 1934

       JR NZ, N_QUOT 32 8
FD_QT INC HL 35

       LD A, (HL) 126

       CP 34254 1934

       JR NZ, FD_QT 32250

       JR SEARCH 24,215
N_QUOT CP 58254 1958

       JR NZ, SEARCH 32,211

       LD D, H 84

       LD E, L 93
FD_ENT INC HL 35

       LD A, (HL) 126

       CP 13254 1913

       JR Z, ENT_FD 40209

       CP 33254 1933

       JR C, FD_ENT 56246

       CP 234 254 234

       JR NZ, N_QUOT 32236

       LD H, D 98

       LD L, E 107
DEL_CH PUSH BC 197

       CALL 4120 205 24 16

       POP BC 193

       DEC BC 11

       LD A, (HL) 126

       CP 13254 1913

       JR NZ, DEL_CH 32245

       POP HL 225

       INC HL 35

       INC HL 35

       LD (HL), C 113

       INC HL 35

       LD (HL), B 112

       DEC HL 1943

       DEC HL 1943

       DEC HL 1943

       JR CHECK 24160

  Error control: if the number
bytes to copy is 0
or the first line is already there,
the program returns to BASIC.
The program does not check if there is enough memory for the 
new line. The program requires 10 bytes per byte of data plus 
five bytes Line numbers, pointers

length, etc. In addition, the used subroutine ROM also uses a 
large working area - take this into account. If the available 
memory is not enough, signs line will be installed correctly 
and BASIC listing is not reliable.


  Comment: The time involved in work of this program is 
proportional to the amount of memory for copying.



   LISTING machine code
Assembly label number to VVODA147.


       LD DE, (23296) 237 91 0 91

       LD BC, (23298) 237 75 February 1991

       LD A, B 120

       OR C 177

       RET Z 200

       LD HL, (23635) 42 83 92

       LD A, (HL) 126

       CP 0254 0

       JR NZ, CONT 32 6

       INC HL 35

       LD A, (HL) 126

       CP 1 254 1

       RET Z 200

       DEC HL 1943
CONT PUSH HL 229

       PUSH BC 197

       PUSH DE 213

       SUB A 151

       CALL 3976 205 136 1915

       EX DE, HL 235

       LD A, 1 January 1962

       CALL 3976 205 136 1915

       EX DE, HL 235

       CALL 3976 205 136 1915

       EX DE, HL 235

       CALL 3976 205 136 1915

       EX DE, HL 235

       LD A, 228 62 228

       CALL 3976 205 136 1915

       EX DE, HL 235
NEXT_B POP DE 209

       LD A, (DE) 26

       PUSH DE 213

       LD C, 47 14 47
HUNDR INC C 12

       LD B, 100 6100

       SUB B 144

       JR NC, HUNDR 48250

       ADD A, B 128

       LD B, A 71

       LD A, C 121

       PUSH BC 197

       CALL 3976 205 136 1915

       EX DE, HL 235

       POP BC 193

       LD A, B 120

       LD C, 47 14 47
TENS INC C 12

       LD B, 10 June 1910

       SUB B 144

       JR NC, TENS 48250

       ADD A, B 128

       LD B, A 71

       LD A, C 121

       PUSH BC 197

       CALL 3976 205 136 1915

       POP BC 193

       EX DE, HL 235

       LD A, B 120

       ADD A, 48 198 1948

       CALL 3976 205 136 1915

       EX DE, HL 235

       LD A, 14 62 14

       LD B, 6 6 6
N_ZERO PUSH BC 197

       CALL 3976 205 136 1915

       POP BC 193

       EX DE, HL 235

       SUB A 151

       DJNZ N_ZERO 16247

       POP DE 209

       PUSH HL 229

       DEC HL 1943

       DEC HL 1943

       DEC HL 1943

       LD A, (DE) 26

       LD (HL), A 119

       POP HL 225

       INC DE 1919

       POP BC 193

       DEC BC 11

       LD A, B 120

       OR C 177

       JR Z, ENTER 40 10

       PUSH BC 197

       PUSH DE 213

       LD A, 44 62 44

       CALL 3976 205 136 1915

       EX DE, HL 235

       JR NEXT_B 24173
ENTER LD A, 13 62 13

       CALL 3976 205 136 1915

       POP HL 225

       LD BC, 0 1 0 0

       INC HL 35

       INC HL 35

       LD D, H 84

       LD E, L 93

       INC HL 35
POINT INC HL 35

       INC BC 3

       LD A, (HL) 126

       CP 14254 1914

       JR NZ, END? 32 12

       INC BC 3

       INC BC 3

       INC BC 3

       INC BC 3

       INC BC 3

       INC HL 35

       INC HL 35

       INC HL 35

       INC HL 35

       INC HL 35

       JR POINT 24237
END? CP 13254 1913

       JR NZ POINT 32233

       LD A, C 121

       LD (DE), A 18

       INC DE 1919

       LD A, B 120

       LD (DE), A 18

       RET 201
2

  How it works:

  In a couple of registers DE loads the address of bytes to copy
and a pair of registers loaded BC number of bytes to copy.
If BC contains 0, the program
returns to BASIC.

  In a couple of registers, the address is loaded HL-BASIC 
program. As the battery is loaded a byte from address specified 
in HL. This byte line number. If

it is not 0, the first line of not
exists and the program jumps to CONT. If the high byte
contain 0, the accumulator is loaded least significant byte. If 
this value set to 1, the first line already exists and

the program returns to BASIC.

  Address high byte numbers
string is stored on the stack.
Preserved the number of bytes to copy, then the address data. In
battery is loaded 0 (high byte of a new line number).
Caused by routine ROM, located at 3976, inserts the character 
with the battery, at the address set in the HL. 

  In HL reduced the value stored at this before this
operation. In a battery is loaded, and this value is inserted 3 
times. The first unit - is the low byte line number

the following two - the length of the pointer
line. In the battery and then load the character code DATA and 
is value is entered in a row.


  Address of the next byte of data
recovered from the stack and
loaded into the DE. This itself bytes
loaded into the accumulator and the contents stored in the DE 
again stack. The C-register is loaded

value of 1 less than the code
symbol 0. C-register is increased, and the B-register value is 
loaded 100. B-register is subtracted from the battery and, if 
the result is negative, the routine returns to HUNDR. 

  B-register is added to the battery (so the battery has a 
positive value). This value is then

loaded into the B-register. As the battery is loaded content
C-register, and BC remains at
stack. Calling routines ROM
(3976), is inserted into the symbol that is stored in the 
battery, the address contained in the HL. BC register pair is 
recovered from the stack, and a battery load value B-register. 
The above-mentioned method is then repeated for the B = 10. 
Battery is then increased by 48 and the resulting character is 
inserted into the string. 

  The above-described subroutine interpolate decimal 
representation occurs bytes Data in the expression of DATA. Now

should be inserted into a binary
representation. This value is marked with the code NUMBER
(CHR 14), which is introduced first, followed by five zeros. 
The value of bytes copied is placed in a cell to replace third 
zero. DE increases pointing to the next byte of data. The 
number of bytes to copy is removed from the stack in the BC and 
this value decreases. If the result is 0, a transition is made 
to the ENTER, otherwise the contents register pairs BC and DE 
again pushed onto the stack, the expression

DATA includes a comma, and the program returns to NEXT_B.

  This procedure code ENTER
(End of line) is added to
marking the end of the expression of DATA.
In HL load address of the beginning
line, and BC is set to
0. HL increased, indicating
pointer to low byte strings, and this new address is copied 
into the DE. HL increased, pointing to the byte pointer line. 
HL and BC then incremented, and the battery is loaded symbol, 
located on address in HL.


  If the battery contains the code
14 - the number is found, the HL and BC
increases by 5, jumping over the number and pointing to the
character following behind him. Subroutine then proceeds to
POINT.

  If the battery does not contain
values ​​of 14 and 13, the transition to a POINT.

  Completion of the formation line is executed by putting the 
contents of BC in the cell pointer string length. To the 
desired address points DE. At the end of of the procedure 
executes, returned to BASIC. 






Other articles:

TR-DOS for beginners - The end.

Computer novella - Prince of Persia.

Computer novella - Laser team (the game Laser Squad).

Crossing Dragon - Game Rapscallion.

Crossing Dragon - Playing The Runes of Zendos.

Crossing Dragon - Playing The Saga.

Crossing Dragon - Game Witch's Cauldron.

Crossing Dragon - Create Adventyuru. Review of the editors.

Crossing Dragon - Create a dictionary to Adventyurnoy game.

Program, which we choose - The possible consequences of using undocumented commands.

Program, which we choose - About noticed irregularities in some programs and suggestions for future versions.

Program, which we choose - A proposal to all the authors of software, printers, memory dump. Programmers protect discs from being copied.

Program, which we choose - A few suggestions to improve the assembly.

Program, which we choose - Suggestions for refining ZX Word v2.5.

Program, which we choose - The "Spectrum emulator" v1.2.

Program, which we choose - What could want in a perfect assembly.

Retro - 40 best procedures: Copying data in memory.

Retro - 40 best procedures: Exchange token.

Retro - 40 best procedures: Determination addresses BASIC string.

Retro - 40 best procedures: Determination of the length of BASIC programs.

Retro - 40 best procedures: Determination of the amount of free memory.

Retro - 40 best procedures for: Search and replace strings.

Retro - 40 best procedure: Find the string.

Retro - 40 best procedures: Search for the string.

Retro - 40 best procedures: the list of variables.

Retro - 40 best procedures: an increase and up the screen.

Retro - 40 best treatments: Removal of REM-strings.

Retro - 40 best procedures: Remove the block of the program.

Expert Tips - Game Fredloader.

Expert Tips - Game Robin of Sherwood: The Touchstones of Rhianon.

Expert Tips - Game Scorpions: Die Machines.

Expert Tips - Game Terropods.

page iS-DOS - Description of system restarts IS DOS.

Forum - An algorithm for recognizing characters.

Forum - Time undocumented command processor Z80.

Forum - The concept of a high-color screen resolution.

Forum - A few Pokes to a game. Program Hacman96.

Forum - As for the new DOS and BIOS settings for the Spectrum.

Forum - Multicolor program on any computer model. Using the 2 nd screen Multicolor'a. Demonstration of the text. Electronic journals.

Forum - Project ZX Config.

Forum - Improve Art Studio. Ideas on file compression.

Forum - ZX Spectrum emulator for IBM. About the hexadecimal system. Program ZX-Stars. Oddities in the Elita

Forum - The effects on the curb and Multicolor.

reader-reader - ZX Spectrum 128 - new opportunities, new challenges.

reader-reader - With 'Light'. Spectrum and expert system.

reader-reader - The printer driver for the Scorpion.

reader-reader - Print numbers in different number systems.

reader-reader - Programming arcade game with scrolling screen.

reader-reader - The procedure for printing labels assembler XAS to monitor debugger STS 4.3.

Studies - attribute scrolling text. "Gasilka" screen. A simplified version of the procedure, "Curtain". Procedure is enriched with pictures. Procedure display images on the points.

Studies - Graphic effect "color bars".

Studies - Driver screen printing 64 characters per line.

Studies - Set of protective boot.

Studies - Address to the drive mode IM 2. Working with non-standard disc format.

Studies - Print the character, magnified by 8 times. The program "pouring" screen. The procedure for screen-saver on the points. Clear screen in Terminator'e. Search strings in memory. System character set conversion.

Studies - Program - cataloger of disks.

Studies - Program the output values of the amplitude channel music. coprocessor on the curb.

Studies - Program the output image.

Studies - The program plugs sprite.

Studies - Cleanup of the specified window screen.

Studies - The program sort the array in ascending order. The procedure for filling the screen specified attribute. Procedure display pictures. The effect of moving towards the stars. "Shower", coming from the upper left corner of the screen. The procedure of "shedding" pictures on the pixel lines. The program of "pulling" the picture at an angle of 45 degrees. Three procedures "Scroll".

Studies - The printing of numbers.

Studies - The procedure for drawing a character with attributes.

Studies - The procedure for display pictures. Fade-OUT effect (picture goes beyond the edge of the screen). Visual effect "Fountain." Fade-OUT effect, mimicking the TV off. Procedure "Ignition" pictures. The program continuously drawing a picture.

Studies - The procedure for drawing a line.

Studies - The procedure for making optimal symbol table.

Studies - scrolling lines of text in the specified window. Attribute scroller. Diagonal scrolling.

Studies - sprite scroller. Procedure display screen.

Studies - Short procedure indicating the amplitude channel music. coprocessor. Way to subtract a constant from a register pair HL.

Studies - The formula for calculating the day of the week.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Programmers - adventure: a sensible approach to passing.
tales - Various funny stories.
Iron - an overview of the microprocessor Zilog Z380, continued.
Advertising - Advertisements and announcements ...
Search - search for game programs.

В этот день...   29 April