40 Best Machine Code Routines for the ZX Spectrum by John Hardman, Andrew D. Hewson

By John Hardman, Andrew D. Hewson

Show description

Read Online or Download 40 Best Machine Code Routines for the ZX Spectrum PDF

Best nonfiction_13 books

Uncanny American Fiction: Medusa’s Face

The uncanny in literature is a little-explored zone. it isn't the supernatural, nor the glorious, and it doesn't depend upon gothic units, even though it usually happens besides those. it truly is primarily the world of the in-between. whilst the interior and outer states without notice correspond, for the protagonists of a fiction or for the reader, their conjunction engages hidden fears and needs, and the uncanny seems.

Protected metal clusters : from fundamentals to applications

Safe steel Clusters: From basics to purposes surveys the basic techniques and power functions of atomically targeted steel clusters secure by way of natural ligands. As this classification of fabrics is now rising because of breakthroughs in synthesis and characterization that experience taken position during the last few years, the ebook presents the 1st reference with a spotlight on those fascinating novel nanomaterials, explaining their formation, and the way, and why, they play an enormous position sooner or later of molecular electronics, catalysis, sensing, organic imaging, and clinical prognosis and treatment.

Additional info for 40 Best Machine Code Routines for the ZX Spectrum

Example text

Comments This routine is not relocatable, the start address being 31955. To copy this routine to another address use the method given for the `RENUMBER' routine. If 31955 is used for the start address of this routine and 32218 is used as the start address of `RENUMBER' they may be held in RAM simultaneously. When shading very irregular shaped regions, a large amount of spare RAM is needed. If this is not available the routine may crash. Machine Code Listing Label Assembly language 42 0 91 124 254 176 208 205 143* 125* 166 254 0 192 1 255 255 197 right Id hl, (23296) call subroutine and (hl) cp O jr nz, left Id hl, (23296) inc l Id (23296),hl jr nz, right 42 0 91 205 143* 125* 166 254 0 32 9 42 0 91 44 34 0 91 32 236 left Id de, O Id hl, (23296) dec I Id (23296),hl 17 0 0 42091 45 34 0 91 Length: 263 Number of Variables: 2 Check sum: 26647 66 Numbers to be entered ld hl, (23296) Id a,h cp 176 ret nc call subroutine and (h1) cp O ret nz Id bc, 65535 push be Region Filling Operation This routine `shades' an area of the screen bounded by a line of pixels on the edge of the screen.

Be is saved on the stack, holding the value of the last byte to be completed in c. The e register is adjusted to address the next bit of each byte. If the rotation is not complete a jump is made to `next bit'. de is loaded with 7, and this is added to hl so that hl points to the last byte of data. The b register is loaded with the number of bytes to be retrieved from the stack. For each byte, the new value is copied into e, and this is POKEd into hl. hl is decremented to point to the next byte, and the counter in the b register is decremented.

At `right', if the accumulator holds 56, the X co-ordinate is incremented. At `save', the X and Y co-ordinates are POKEd into memory, and the routine loops to `here'. Screen Magnify and Copy Length: 335 Number of Variables: 8 Check Sum: 33663 Operation This routine copies a section of the display to another area on the screen, magnifying the copy in the x or y planes. Variables Name Length Location Comment upper y co-ord lower y co-ord right x co-ord 1 1 1 23296 23297 23298 left x co-ord 1 23299 horizontal scale vertical scale 1 1 23300 23301 y co-ordinate of top row y co-ordinate of bottom row x co-ordinate of rightmost column x co-ordinate of leftmost column magnification in x plane magnification in y plane 77 1 23302 new lower co-ord 1 23303 new left co-ord Id b, 1 Id a,l sub h ret c Id (23298),a Id e,a Id hl, (23298) Id c,l Id a,l sub h ret c Id (23298),a push bc Id 1,a Id h, O inc hl push hl pop bc inc e 69 125 148 216 50091 95 42291 77 125 148 216 50291 197 111 38 O 35 229 193 28 add dec e jr z, remainder add hl,bc jr add 29 40 3 9 24 250 remainder Id a,l and 15 Id b,a pop hl Id c,l jr nz, save 125 230 15 71 225 77 32 2 full Id b, 16 6 16 save push hl call subroutine and (hl) jr z, off Id a, 1 229 205 13* 255* 166 40 2 62 1 off pop hl rra rl e rid Id a,1 cp (ix + 3) jr z, next row dec 1 225 203 31 203 19 203 18 125 221 190 3 40 6 45 next bit djnz save push de jr full 16 231 213 24 226 x co-ordinate of leftmost column of area to be copied to y co-ordinate to bottom row of area to be copied to Call RAND USR address Error Checks The routine returns to BASIC immediately if any of the following conditions are true: (i) horizontal scale = O (ii) vertical scale = O (iii) upper co-ord greater than 175 (iv) new lower co-ord greater than 175 (v) lower y co-ord greater than upper y co-ord (vi) left x co-ord greater than right x co-ord However, to keep the routine short, there is no check that ensures that the copied section fits on the screen.

Download PDF sample

Rated 4.31 of 5 – based on 46 votes