TEXT-TRANSFER -------------------------------------------------------------------------------------------------- TOOL: Built-In ML-Monitor {Commodore C128} Language: Assembler Extra: none Author: Misel Zivanovic Note: (C) 11th DEC 2025 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- How to transfer text from one location to another! Note how i am calling it Text-Transfer, however you could also call it a DATA-TRANSFER because that is what we are doing here! You can literally transfer all from A -> B with this little code! --------------------------------------------------------------------------------------------------- monitor <--- Left upper corner of the screen {$0400, dec 1024} monitor pc sr ac xr yr sp ; fb000 00 00 00 00 f8 a 01300 a2 00 ldx #$00 a 01302 bd 00 04 lda $0400,x a 01305 e8 inx a 01306 9d cf 06 sta $06cf,x a 01309 e0 07 cpx #$07 a 0130b d0 f5 bne $1302 a 0130d 60 rts a 0130e j 1300 monitor (line 18) this code is transferring our 'monitor' from the left upper corner to line 18! now you know how to get something from somewhere and use or re-use it! --------------------------------------------------------------------------------------------------- ALL EXPLAINED: a 01300 a2 00 ldx #$00 This is setting the x register to 0 a 01302 bd 00 04 lda $0400,x loading data from $0400 {dec, 1024} and up {thx to x register} a 01305 e8 inx now we increase the counter for the next run a 01306 9d cf 06 sta $06cf,x data are transferred to this location $06cf and up {x} a 01309 e0 07 cpx #$07 not more then 7 bytes a 0130b d0 f5 bne $1302 as long as we don't have it DO LOOP a 0130d 60 rts Return To Subroutine {If this would have been called from BASIC a 0130e then it would've go back to BASIC after the code execution. In case you wonder, this would go too: a 01300 a2 00 ldx #$00 This is setting the x register to 0 a 01302 bd 00 04 lda $0400,x loading data from $0400 {dec, 1024} and up {thx to x register} a 01305 9d cf 06 sta $06cf,x data are transferred to this location *$06cf and up {x} a 01308 e8 inx now we increase the counter for the next run ... *you would need to use +1 byte now because X-register is not incremented previously! The correct address would be $06d0,x {instead of $06cf} --------------------------------------------------------------------------------------------------- MACHINE-LANGUAGE-MONITOR CODE LISTING: {If you paste this code into ML-Monitor of C128, then you can avoid manual corrections which} {are practically mandatory when you paste the assembled code from above} {This below is exactly the same code as above!} --------------------------------------------------------------------------------------------------- m 1300 >01300 a2 00 bd 00 04 e8 9d cf:B....H.O >01308 06 e0 07 d0 f5 60 00 00:...PU...