PLUS4-C128-TO-COMMODORE-PLUS4 -------------------------------------------------------------------------------------------------- TOOL: MERLIN 7501 ASSEMBLER {Commodore PLUS4} Language: Assembler Extra: none Author: Misel Zivanovic Note: (C) 01st August 2026 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- Today we will convert this little program and make it Commodore Plus4 compatible. This is the last thing I made for the C128 in Machine Language Monitor. Converting this to Plus4? ...should not be a problem. We could actually extend it a bit because it's easier to do that with real assembly editor! {btw. I'll leave that part to you, hehe} If nothing else, it can be adapted to your needs much better with this MERLIN 7501 source code further below, than just with the ML-Assembly code! Commodore C128 original source {written in built-in ML-Monitor of C128}: --------------------------------------------------------------------------------------------------- . 01300 a2 00 ldx #$00 . 01302 bd 00 04 lda $0400,x . 01305 c9 20 cmp #$20 . 01307 f0 17 beq $1320 . 01309 a9 20 lda #$20 . 0130b 9d 00 04 sta $0400,x . 0130e bd f0 04 lda $04f0,x . 01311 c9 20 cmp #$20 . 01313 f0 13 beq $1328 . 01315 a9 20 lda #$20 . 01317 9d f0 04 sta $04f0,x . 0131a e8 inx . 0131b e0 f0 cpx #$f0 . 0131d d0 e3 bne $1302 . 0131f 60 rts . 01320 a9 51 lda #$51 . 01322 9d 00 04 sta $0400,x . 01325 4c 0e 13 jmp $130e . 01328 a9 51 lda #$51 . 0132a 9d f0 04 sta $04f0,x . 0132d 4c 1a 13 jmp $131a . 01330 00 brk --------------------------------------------------------------------------------------------------- {MERLIN 7501 ASSEMBLER source code}: 100 com $3000 110 list 120 ldx #$00 130 .loop 140 lda $0c00,x 150 cmp #$20 160 beq .j1st 170 lda #$20 180 sta $0c00,x 190 .ret1 200 lda $0cf0,x 210 cmp #$20 220 beq .j2nd 225 lda #$20 230 sta $0cf0,x 240 .next 250 inx 260 cpx #$f0 270 bne .loop 280 rts 290 .j1st 300 lda #$51 310 sta $0c00,x 320 jmp .ret1 330 .j2nd 340 lda #$51 350 sta $0cf0,x 360 jmp .next 370 end --------------------------------------------------------------------------------------------------- SOME ADDITIONAL COMMENTS: 100 com $3000 - start address, dec 12288 110 list - list the compiled/assembled code 120 ldx #$00 - reg x to zero 130 .loop - jump lable 140 lda $0c00,x - read the screen from $0c00, 3072 150 cmp #$20 - check if it is #$20 {dec 32, space} 160 beq .j1st - if yes, then jump to .j1st mem address 170 lda #$20 - if it wasn't 10 then make it #$20! 180 sta $0c00,x - and write the value to screen coordinates 190 .ret1 - jmp lable 200 lda $0cf0,x - read the screen location from $0cf0 210 cmp #$20 - is it #$20 from there? 220 beq .j2nd - yes, then jump to j2nd and do the job there 225 lda #$20 - value #$20 to accumulator 230 sta $0cf0,x - write that value to x location of the screen 240 .next - jump lable 250 inx - increment x register 260 cpx #$f0 - is x already #$f0 {dec 240}? 270 bne .loop - not equal to #$f0, then cycle the loop until it is 280 rts - and when it is, return to BASIC 290 .j1st 300 lda #$51 - small ball 310 sta $0c00,x - this will add a small ball where empty space was {within range} 320 jmp .ret1 330 .j2nd 340 lda #$51 - small ball 350 sta $0cf0,x - this will add a small ball where empty space was {within range} 360 jmp .next 370 end --------------------------------------------------------------------------------------------------- Very small and very practical code! Hope It'll come handy in your 8-bit retro projects projects! ---------------------------------------------------------------------------------------------------