SCREEN-COPY-AND-PASTE-WITH-RANDOM-VALUES-{DOC-2} -------------------------------------------------------------------------------------------------- TOOL: EDASS-128 Editor/Assembler {Commodore C128} Language: Assembler Extra: - Author: Misel Zivanovic Note: (C) 29th April 2026 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- THE 4 MODULES {3 actually!, as the content.asm isn't really a module for anything, but it could be} {if you implement it smarter than i did, haha...} AVAILABLE MODULES: MODULE 1: TRANSFER OF THE CONTENT TO $2000 > SYS 4864 MODULE 2: RANDOM DELETION OF THE CONTENT SYS 4932 MODULE 3: SCREEN FILL with some TEXT SYS 5009 MODULE 4: COPY OLD CONTENT BACK TO THE SCREEN SYS 5077 {this here should be used after the bload of "4-modules.bl"} {check the BASIC DEMO PROGRAM} poke 5001, 0=255 {delay time, deletion} poke 5178, 0-255 {delay time, paste copied screen content} --------------------------------------------------------------------------------------------------- DISK CONTENT: directory WHAT IS IT? HOW TO LOAD? 0 "edass-128 coding" 1a 2a 2 "transfer.asm" prg EDASS-128 FILE - SOURCE CODE !load"name" = in EDASS-128 4 "rnd-del.asm" prg EDASS-128 FILE - SOURCE CODE !load"name" = in EDASS-128 4 "content.asm" prg EDASS-128 FILE - SOURCE CODE !load"name" = in EDASS-128 5 "paste-old.asm" prg EDASS-128 FILE - SOURCE CODE !load"name" = in EDASS-128 12 "4-modules.asm" prg EDASS-128 FILE - SOURCE CODE !load"name" = in EDASS-128 0 "----------------" prg 7 "demo.bas" prg BASIC 7 DEMO - SOURCE CODE load"name" = in BASIC 7.0 {C128} 0 "----------------" prg 2 "4-modules.bl" prg ASSEMBLED CODE {4-modules.asm} bload"name" = in BASIC 7.0 {C128} 0 "----------------" prg start addresses as listed 0 "(c) mzretro.ch" prg before! 0 "misel zivanovic" prg 0 "2026-april" prg 1298 blocks free. --------------------------------------------------------------------------------------------------- LISTING ASSEMBLED CODE: d 1300 1476 . 01300 a2 00 ldx #$00 . 01302 bd 00 04 lda $0400,x . 01305 9d 00 20 sta $2000,x . 01308 bd c8 04 lda $04c8,x . 0130b 9d c8 20 sta $20c8,x . 0130e bd 90 05 lda $0590,x . 01311 9d 90 21 sta $2190,x . 01314 bd 58 06 lda $0658,x . 01317 9d 58 22 sta $2258,x . 0131a bd 20 07 lda $0720,x . 0131d 9d 20 23 sta $2320,x . 01320 bd 00 d8 lda $d800,x . 01323 9d 00 24 sta $2400,x . 01326 bd c8 d8 lda $d8c8,x . 01329 9d c8 24 sta $24c8,x . 0132c bd 90 d9 lda $d990,x . 0132f 9d 90 25 sta $2590,x . 01332 bd 58 da lda $da58,x . 01335 9d 58 26 sta $2658,x . 01338 bd 20 db lda $db20,x . 0133b 9d 20 27 sta $2720,x . 0133e e8 inx . 0133f e0 c8 cpx #$c8 . 01341 d0 bf bne $1302 . 01343 60 rts . 01344 a9 00 lda #$00 . 01346 8d 90 13 sta $1390 . 01349 8d 00 ff sta $ff00 . 0134c a9 ff lda #$ff . 0134e 8d 0e d4 sta $d40e . 01351 8d 0f d4 sta $d40f . 01354 a9 80 lda #$80 . 01356 8d 12 d4 sta $d412 . 01359 a0 00 ldy #$00 . 0135b ad 1b d4 lda $d41b . 0135e aa tax . 0135f a9 20 lda #$20 . 01361 9d 00 04 sta $0400,x . 01364 9d 00 06 sta $0600,x . 01367 ad 1b d4 lda $d41b . 0136a aa tax . 0136b a9 20 lda #$20 . 0136d 9d 00 05 sta $0500,x . 01370 9d e8 06 sta $06e8,x . 01373 c8 iny . 01374 c0 08 cpy #$08 . 01376 d0 e3 bne $135b . 01378 a9 e0 lda #$e0 . 0137a cd 12 d0 cmp $d012 . 0137d d0 fb bne $137a . 0137f ad 90 13 lda $1390 . 01382 a8 tay . 01383 c8 iny . 01384 98 tya . 01385 8d 90 13 sta $1390 . 01388 c0 85 cpy #$85 . 0138a d0 cd bne $1359 . 0138c 20 42 c1 jsr $c142 . 0138f 60 rts . 01390 00 brk . 01391 a9 00 lda #$00 . 01393 8d 00 ff sta $ff00 . 01396 20 42 c1 jsr $c142 . 01399 a9 00 lda #$00 . 0139b a0 00 ldy #$00 . 0139d a2 00 ldx #$00 . 0139f bd c0 bf lda $bfc0,x . 013a2 99 00 04 sta $0400,y . 013a5 99 00 d8 sta $d800,y . 013a8 e8 inx . 013a9 c8 iny . 013aa e0 37 cpx #$37 . 013ac d0 f1 bne $139f . 013ae c0 04 cpy #$04 . 013b0 d0 eb bne $139d . 013b2 ad 9a 13 lda $139a . 013b5 c9 02 cmp #$02 . 013b7 f0 0c beq $13c5 . 013b9 ee a4 13 inc $13a4 . 013bc ee a7 13 inc $13a7 . 013bf ee 9a 13 inc $139a . 013c2 4c 99 13 jmp $1399 . 013c5 a9 00 lda #$00 . 013c7 8d 9a 13 sta $139a . 013ca a9 04 lda #$04 . 013cc 8d a4 13 sta $13a4 . 013cf a9 d8 lda #$d8 . 013d1 8d a7 13 sta $13a7 . 013d4 60 rts . 013d5 a9 00 lda #$00 . 013d7 8d 81 14 sta $1481 . 013da 8d 00 ff sta $ff00 . 013dd a9 ff lda #$ff . 013df 8d 0e d4 sta $d40e . 013e2 8d 0f d4 sta $d40f . 013e5 a9 80 lda #$80 . 013e7 8d 12 d4 sta $d412 . 013ea a0 00 ldy #$00 . 013ec ad 1b d4 lda $d41b . 013ef aa tax . 013f0 bd 00 20 lda $2000,x . 013f3 9d 00 04 sta $0400,x . 013f6 bd 00 24 lda $2400,x . 013f9 9d 00 d8 sta $d800,x . 013fc bd 00 21 lda $2100,x . 013ff 9d 00 05 sta $0500,x . 01402 bd 00 25 lda $2500,x . 01405 9d 00 d9 sta $d900,x . 01408 ad 1b d4 lda $d41b . 0140b aa tax . 0140c bd 00 22 lda $2200,x . 0140f 9d 00 06 sta $0600,x . 01412 bd 00 26 lda $2600,x . 01415 9d 00 da sta $da00,x . 01418 bd e8 22 lda $22e8,x . 0141b 9d e8 06 sta $06e8,x . 0141e bd e8 26 lda $26e8,x . 01421 9d e8 da sta $dae8,x . 01424 c8 iny . 01425 c0 08 cpy #$08 . 01427 d0 c3 bne $13ec . 01429 a9 e0 lda #$e0 . 0142b cd 12 d0 cmp $d012 . 0142e d0 fb bne $142b . 01430 ad 81 14 lda $1481 . 01433 a8 tay . 01434 c8 iny . 01435 98 tya . 01436 8d 81 14 sta $1481 . 01439 c0 85 cpy #$85 . 0143b d0 ad bne $13ea . 0143d a2 00 ldx #$00 . 0143f bd 00 20 lda $2000,x . 01442 9d 00 04 sta $0400,x . 01445 bd c8 20 lda $20c8,x . 01448 9d c8 04 sta $04c8,x . 0144b bd 90 21 lda $2190,x . 0144e 9d 90 05 sta $0590,x . 01451 bd 58 22 lda $2258,x . 01454 9d 58 06 sta $0658,x . 01457 bd 20 23 lda $2320,x . 0145a 9d 20 07 sta $0720,x . 0145d bd 00 24 lda $2400,x . 01460 9d 00 d8 sta $d800,x . 01463 bd c8 24 lda $24c8,x . 01466 9d c8 d8 sta $d8c8,x . 01469 bd 90 25 lda $2590,x . 0146c 9d 90 d9 sta $d990,x . 0146f bd 58 26 lda $2658,x . 01472 9d 58 da sta $da58,x . 01475 bd 20 27 lda $2720,x . 01478 9d 20 db sta $db20,x . 0147b e8 inx . 0147c e0 c8 cpx #$c8 . 0147e d0 bf bne $143f . 01480 60 rts . 01481 00 brk . 01482 ff ??? . 01483 ff ??? --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- BASIC 7.0 - DEMO PROGRAM LISTING Not listed here as it contains gfx elements which cannot be properly displayed here. Find it on a disk... However, what i need to mention are these two commands: graphic 1,1:graphic 0 The main purpose here is not to delete the graphics area {graphic 1,1} and then return back to text mode with {graphic 0}. So what is it? Well, this will indeed do exactly that but more important is that the BASIC start address will be moved from $1c00 to $4000! Why do we need that? Because our area for saving the screen content and color map is starting @ $2000, and if we don't relocate the BASIC start address, BASIC source code would over write our data and the whole things as such would crash because at the first call we would transfer the screen content into the BASIC source code. Ergo, total crash! ---------------------------------------------------------------------------------------------------