--- title: "2068 Display Block Moves" type: "article" slug: "2068-display-block-moves" url: "http://localhost/article/2068-display-block-moves/" markdown_url: "http://localhost/article/2068-display-block-moves.md" published_at: "2020-10-27T21:14:50+00:00" modified_at: "2026-06-27T09:15:53+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "In the Z80 microprocessor used in the 2068 is a command called LDIR that may be used to quickly move defined blocks of data from one RAM location to another. The routine listed below moves all or portions of the screen display (DFILE1) to RAM address 30000, from which it may then be moved back…" category: - name: "Update Magazine" slug: "update-magazine" taxonomy: "category" url: "http://localhost/category/periodicals/update-magazine/" post_tag: - name: "Best of Timex/Sinclair 2068 Articles and Documents" slug: "ts2068best" taxonomy: "post_tag" url: "http://localhost/tag/ts2068best/" - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "Full Text" slug: "fulltext" taxonomy: "post_tag" url: "http://localhost/tag/fulltext/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Robert Hartung" slug: "robert-hartung" taxonomy: "indiv" url: "http://localhost/indiv/robert-hartung/" publication: "Update Magazine" publication_r: id: 10283 title: "Update Magazine" type: "periodical" url: "http://localhost/periodical/update-magazine/" authors: "Robert Hartung" authors_r: - name: "Robert Hartung" slug: "robert-hartung" taxonomy: "indiv" url: "http://localhost/indiv/robert-hartung/" issues_articles: - id: 26516 title: "Update October 1993" type: "issue" url: "http://localhost/issue/ts-2068-up-date-october-1993/" pages: "19" pubdate: "October 1993" related_articles: - id: 22193 title: "2068 Block-Move Error" type: "article" url: "http://localhost/article/2068-block-move-error/" archive_link: false volumeissue: "vn" article_media: - id: 59979 title: "2068 Display Block Moves" type: "computer_media" url: "http://localhost/computer_media/2068-display-block-moves/" --- # 2068 Display Block Moves In the Z80 microprocessor used in the 2068 is a command called LDIR that may be used to quickly move defined blocks of data from one RAM location to another. The routine listed below moves all or portions of the screen display (DFILE1) to RAM address 30000, from which it may then be moved back to the display file. Because of the manner in which pixels and attributes are addressed in DFILE1, the simplest way to define a block to be moved is either the whole DFILE1 file, or the top, middle, or bottom third of the file. A pixel-by-pixel or line-by-line block-move requires much more complex definitions. Some uses for this technique might be to insert text or graphics into a menu or to do animated displays. While the number of such displays stored in RAM is limited, many more may be saved to disk. This is a revision of an original article I wrote for the May-June 1985 SyncWare News. ``` 1 CLEAR 29999 10 PRINT "0 - Load SCRN display file"'"1 - Full-screen store"'"2 - Top screen store"'"3 - Middle screen store"'"4 - Bottom screen store" 20 PAUSE 0: LET k$=INKEY$: IF k$="" THEN GO TO 20 30 IF k$="0" THEN CLS : LOAD "SCRN" CODE : PRINT "Any key to continue": PAUSE 0: RUN 40 IF k$="1" THEN LET STP=16384: LET INS=INT (STP/256) : LET NOB=6192: LET INB=INT (NOB/256): GO TO 80 50 IF k$="2" THEN LET STP=16384: LET INS=INT (STP/256): LET NOB=204S: LET INB=INT (NOB/256): GO TO 80 60 IF k$="3" THEN LET STP=163S4+2048: LET INS=INT (STP/256): LET NOB=2048: LET INB=INT (NOB/256) : GO TO 80 70 IF k$="4" THEN LET STP=16384+4096: LET INS=INT (STP/256): LET NOB=2096: LET INB=INT (NOB/256) 80 CLS : REM Create screen-fill 90 FOR n=1 TO 704: PRINT "\`.";:NEXT n 100 FOR n=0 TO 21: PRINT AT n,0;n: NEXT n 110 REM Defines selected lines/cols and copies from DFILEl to RAM 120 POKE 65356,1: REM LD BC,no. of bytes to move 130 POKE 65357,NOB-(256*INB) : REM n LSB 140 POKE 65358,INB: REM n MSB 150 POKE 65359,17: REM LD DE,destination address 30000 160 POKE 65360,48: REM n LSB 170 POKE 65361,117: REM n MSB 180 POKE 65362,33: REM LD HL,source address 190 POKE 65363,STP-(256*INS) : REM n LSB 200 POKE 65364, INS: REM n MSB 210 POKE 65365,237: REM ED prefix 220 POKE 65366,176: REM LDIR block-move 230 POKE 65367,201: REM RETurn 240 RANDOMIZE USR 65356: REM Call block-move routine 250 PRINT #0;AT 1,0; "Any key to continue": PAUSE 0 260 REM Moves RAM data to DFILE1 270 CLS 280 POKE 65357, NOB-(INB*256) : REM LSB no. bytes 290 POKE 65358, INB: REM MSB nobytes 300 POKE 65360,STP-(256*INS) : REM LSB dest 310 POKE 65361, INS: REM MSB dest 320 POKE 65363,48: REM LSB source in RAM (30000) 330 POKE 65364,117: REM MSB sou rce in RAM (30000) 340 RANDOMIZE USR 65356 350 PRINT #0;"Key 5 to save or m for menu" 360 PAUSE 0: IF INKEY*="5" THEN PRINT #0;AT 0,0,,,,: GO TO 9998 370 RUN 9997 SAVE "SCRNmove" LINE 1: STOP 9998 SAVE "SCRN "CODE STP,NOB 9999 RUN ``` ## Source Code: 2068 Display Block Moves ``` 1 CLEAR 29999 10 PRINT "0 - Load SCRN display file"'"1 - Full-screen store"'"2 - Top screen store"'"3 - Middle screen store"'"4 - Bottom screen store" 20 PAUSE 0: LET k$=INKEY$: IF k$="" THEN GO TO 20 30 IF k$="0" THEN CLS : LOAD "SCRN" CODE : PRINT "Any key to continue": PAUSE 0: RUN 40 IF k$="1" THEN LET STP=16384: LET INS=INT (STP/256) : LET NOB=6192: LET INB=INT (NOB/256): GO TO 80 50 IF k$="2" THEN LET STP=16384: LET INS=INT (STP/256): LET NOB=204S: LET INB=INT (NOB/256): GO TO 80 60 IF k$="3" THEN LET STP=163S4+2048: LET INS=INT (STP/256): LET NOB=2048: LET INB=INT (NOB/256) : GO TO 80 70 IF k$="4" THEN LET STP=16384+4096: LET INS=INT (STP/256): LET NOB=2096: LET INB=INT (NOB/256) 80 CLS : REM Create screen-fill 90 FOR n=1 TO 704: PRINT "`.";:NEXT n 100 FOR n=0 TO 21: PRINT AT n,0;n: NEXT n 110 REM Defines selected lines/cols and copies from DFILEl to RAM 120 POKE 65356,1: REM LD BC,no. of bytes to move 130 POKE 65357,NOB-(256*INB) : REM n LSB 140 POKE 65358,INB: REM n MSB 150 POKE 65359,17: REM LD DE,destination address 30000 160 POKE 65360,48: REM n LSB 170 POKE 65361,117: REM n MSB 180 POKE 65362,33: REM LD HL,source address 190 POKE 65363,STP-(256*INS) : REM n LSB 200 POKE 65364, INS: REM n MSB 210 POKE 65365,237: REM ED prefix 220 POKE 65366,176: REM LDIR block-move 230 POKE 65367,201: REM RETurn 240 RANDOMIZE USR 65356: REM Call block-move routine 250 PRINT #0;AT 1,0; "Any key to continue": PAUSE 0 260 REM Moves RAM data to DFILE1 270 CLS 280 POKE 65357, NOB-(INB*256) : REM LSB no. bytes 290 POKE 65358, INB: REM MSB nobytes 300 POKE 65360,STP-(256*INS) : REM LSB dest 310 POKE 65361, INS: REM MSB dest 320 POKE 65363,48: REM LSB source in RAM (30000) 330 POKE 65364,117: REM MSB sou rce in RAM (30000) 340 RANDOMIZE USR 65356 350 PRINT #0;"Key 5 to save or m for menu" 360 PAUSE 0: IF INKEY*="5" THEN PRINT #0;AT 0,0,,,,: GO TO 9998 370 RUN 9997 SAVE "SCRNmove" LINE 1: STOP 9998 SAVE "SCRN "CODE STP,NOB 9999 RUN ```