C128-DO-THIS-WHEN-TIME-IS-READY! -------------------------------------------------------------------------------------------------- TOOL: C128 - ML-MONITOR Language: ASSEMBLER Extra: - Author: Misel Zivanovic Note: (C) 29th JAN 2026 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- I can imagine how this could be used in games to, e.g. generate an enemy or more than one and then just let them do whatever they are supposed to do in their specific, individual speed. Combining that with the RND Generator, you could spawn an enemy at random time and also keep them alive for a curtain amount of time! I think that is something we could try the upcoming lessons! {no warranties that it'll happen!} However, let's get busy with this first: {to start with SYS 4864 from BASIC} {execution can be stopped with RUN/STOP RESTORE} EXPLANATION TEXT HERE and you can copy the ML part below into C128 ML-Monitor! d 1300 . 01300 a9 93 lda #$93 CHR$(147) . 01302 20 d2 ff jsr $ffd2 or delete screen . 01305 a9 32 lda #$32 1st accumulator value #50 {counting down and resetting to 50, later} . 01307 a9 00 lda #$00 2nd accumulator value #00 {counting up...} . 01309 ce 06 13 dec $1306 decrement the 1st accumulator value and . 0130c d0 11 bne $131f jump to $131f as long as accumulator is larger than 0 . 0130e ad 00 04 lda $0400 execute this when accumulator has a value of 0 {$1309 is counting down} . 01311 8d 00 04 sta $0400 show the accumulator value on screen {note: the existing value is read . 01314 ee 00 04 inc $0400 at the position $0400, dec 1024} and then increment by one} . 01317 a9 32 lda #$32 when that is done, reset the 1st accumulator value back to $32, dec 50 . 01319 8d 06 13 sta $1306 write that value to the address. . 0131c 4c 09 13 jmp $1309 and go back to repeat the loop . 0131f a0 00 ldy #$00 here is our delay counter . 01321 a2 00 ldx #$00 a nested loop which is also using the aid counter {2nd accumulator value} . 01323 e8 inx this is practical because the program is running further and delay . 01324 d0 fd bne $1323 can be used more efficient . 01326 c8 iny increment y register . 01327 c0 20 cpy #$20 until it reaches $20, dec 32 . 01329 d0 f6 bne $1321 when y register has a value of $20, dec 32 . 0132b ee 08 13 inc $1308 increment our 2nd accumulator value {delay counter} . 0132e ad 08 13 lda $1308 read the 2nd counter and check . 01331 c9 10 cmp #$10 its value {play with the cmp #$?? and see how it is effecting the process!} . 01333 f0 03 beq $1338 When $10, dec 16 is reached, branch to change the color. . 01335 4c 09 13 jmp $1309 back to loop from scratch if not . 01338 ee 20 d0 inc $d020 change the border color . 0133b a9 00 lda #$00 reset the 2nd counter to 0 . 0133d 8d 08 13 sta $1308 write the value . 01340 4c 09 13 jmp $1309 and loop all over again m 1300 1340 >01300 a9 93 20 d2 ff a9 32 a9:I. R?I2I >01308 00 ce 06 13 d0 11 ad 00:.N..P.M. >01310 04 8d 00 04 ee 00 04 a9:....N..I >01318 32 8d 06 13 4c 09 13 a0:2...l..? >01320 00 a2 00 e8 d0 fd c8 c0:.B.HP?H? >01328 20 d0 f6 ee 08 13 ad 08: PVN..M. >01330 13 c9 10 f0 03 4c 09 13:.I.P.l.. >01338 ee 20 d0 a9 00 8d 08 13:N PI.... >01340 4c 09 13 ff ff ff 00 00:l..???.. ---------------------------------------------------------------------------------------------------