SCREEN-COPY-AND-PASTE-WITH-RANDOM-VALUES-{DOC-1} -------------------------------------------------------------------------------------------------- TOOL: EDASS-128 Editor/Assembler {Commodore C128} Language: Assembler Extra: - Author: Misel Zivanovic Note: (C) 29th April 2026 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- Previous routine was randomly deleting the screen content. Now i thought it would be a nice feature to have something like a full screen copy/paste assembler routine to combine it or not. Both will give a nice effect! My plan is involving several steps which will result in having different modules. Each for a specific purpose to achieve all goals which are wanted here! NOTE: I am having all the same start addresses here because i programmed modules individually. At the end, I will put them together as one file and list the start addresses {.txt file #2} That way, these modules can be used from BASIC and give your program a nice touch. No additional sweating involved, just use SYS {address} to get what you need* and that's all. * INFORMATION: The content.asm isn't really useful for anything else. It's just to demonstrate how the modules could or can be used in this demonstration. MODULE NUMBER 1 {disk name: transfer.asm}, done --------------------------------------------------------------------------------------------------- 1. copy process {content and colors} --------------------------------------------------------------------------------------------------- *= $1300 ; change start .obj m ; according to .bank 15 ; your needs ; ;------------------------------------- ; transfer the content and colors ;------------------------------------- ldx #$00 wroom lda $0400,x ; text/graphics sta $2000,x lda $04c8,x sta $20c8,x lda $0590,x sta $2190,x lda $0658,x sta $2258,x lda $0720,x sta $2320,x ; lda $d800,x ; color map sta $2400,x lda $d8c8,x sta $24c8,x lda $d990,x sta $2590,x lda $da58,x sta $2658,x lda $db20,x sta $2720,x ; inx cpx #$c8 ; 200 chars bne wroom rts ; back to basic --------------------------------------------------------------------------------------------------- MODULE NUMBER 2 {disk name: rnd-del.asm} --------------------------------------------------------------------------------------------------- 2. random deletion process of existing content {OPTIONAL} {Why optional? Because if you don't delete the content, you'll see how it is replaced!} {However, deletion actually also looks nice! Well, you can call it or not, or do a combo} --------------------------------------------------------------------------------------------------- *= $1300 ; change start .obj m ; according to .bank 15 ; your needs ; lda #$00 sta value sta $ff00 ; bank 15 ;------------------------------------- ; generate random numbers ;------------------------------------- lda #$ff ; random numbers sta $d40e ; check compute sta $d40f ; mapping c128 lda #$80 ; for more info. sta $d412 ;------------------------------------- ; delete screen content [rnd] ;------------------------------------- loop1 ldy #$00 loop2 lda $d41b ; read random # tax lda #$20 ; space to delete sta $0400,x ; screen 1st part sta $0600,x ; screen 3rd part lda $d41b ; get new rnd # tax lda #$20 sta $0500,x ; screen 2nd part sta $06e8,x ; screen 4th part iny cpy #$08 ; repeat 8x bne loop2 lda #$e0 ; wait on the a1 cmp $d012 ; raster line bne a1 ; to slow things lda value tay iny tya sta value cpy #$85 ; repeat all bne loop1 ; $85, dec 133 ; times jsr $c142 ; clear screen rts ; back to basic ; value .byte 0 --------------------------------------------------------------------------------------------------- MODULE NUMBER 3 {disk name: content.asm} --------------------------------------------------------------------------------------------------- 3. new screen content {$fbfc0, dec 49088 > $bff7, dec 49143, Com. Electron. ltd. msg., 3x 255 chars} --------------------------------------------------------------------------------------------------- *= $1300 ; change start .obj m ; according to .bank 15 ; your needs ;------------------------------------- ; content copied from $bfc0 to $0400 ;------------------------------------- lda #$00 sta $ff00 ; bank 15 jsr $c142 ; clear screen ; lda #14 ; small char set ; jsr $ffd2 ; unused ; outer lda #$00 ; counters a ldy #$00 ; y loop1 ldx #$00 ; x loop2 lda $bfc0,x ; msg location chr sta $0400,y ; screen start col sta $d800,y ; color map start inx iny cpx #$37 ; msg 55 chars bne loop2 cpy #$04 bne loop1 lda outer+1 ; repeat 3x (all) cmp #$02 ; do not put 3! beq done ; or higher here! ; inc chr+2 ; inc high byte inc col+2 ; inc high byte inc outer+1 ; inc high byte jmp outer ; done lda #$00 ; reset counters sta outer+1 ; to std values lda #$04 ; for the next sta chr+2 ; run lda #$d8 ; no not go over sta col+2 ; the screen or rts ; color map value --------------------------------------------------------------------------------------------------- MODULE NUMBER 4 {disk name: paste-old.asm} --------------------------------------------------------------------------------------------------- Randomly pasting of the content/colors to the screen we previously transferred to this locations! PLEASE NOTE: There are many different ways to achieve this existing. Especially by using zero page pointers and low/high byte involvement. I use this method because i assume you'll better see what we are actually doing to get the work done. At some later point we can grab the pointers by the balls to save a few bytes... hehe... --------------------------------------------------------------------------------------------------- *= $1300 ; change start .obj m ; according to .bank 15 ; your needs ; lda #$00 sta value sta $ff00 ; bank 15 ;------------------------------------- ; generate random numbers ;------------------------------------- lda #$ff ; random numbers sta $d40e ; check compute sta $d40f ; mapping c128 lda #$80 ; for more info. sta $d412 ;------------------------------------- ; transfer screen content & colors ;------------------------------------- loop1 ldy #$00 loop2 lda $d41b ; read random # tax lda $2000,x ; read saved data sta $0400,x ; screen 1st part lda $2400,x sta $d800,x ; lda $2100,x sta $0500,x ; screen 3rd part lda $2500,x sta $d900,x ; lda $d41b ; get new rnd # tax lda $2200,x sta $0600,x ; screen 2nd part lda $2600,x sta $da00,x ; lda $22e8,x sta $06e8,x ; screen 4th part lda $26e8,x sta $dae8,x iny cpy #$08 ; repeat 8x bne loop2 lda #$e0 ; wait on the a1 cmp $d012 ; raster line bne a1 ; to slow things lda value tay iny tya sta value cpy #$85 ; repeat all bne loop1 ; $85, dec 133 ; times ldx #$00 full lda $2000,x ; text/graphics sta $0400,x lda $20c8,x sta $04c8,x lda $2190,x sta $0590,x lda $2258,x sta $0658,x lda $2320,x sta $0720,x ; lda $2400,x ; color map sta $d800,x lda $24c8,x sta $d8c8,x lda $2590,x sta $d990,x lda $2658,x sta $da58,x lda $2720,x sta $db20,x ; inx cpx #$c8 ; 200 chars bne full rts ; back to basic ; value .byte 0 ---------------------------------------------------------------------------------------------------