C128-GRAPHICS-WITH-STYLE --------------------------------------------------------------------------------------------------- TOOL: Built-in ML-Monitor {Commodore C128} Language: Machine Language {Assembler} Extra: none Author: Misel Zivanovic Note: (C) 21th of OCTOBER 2026 - www.lived.ch, mzretro.ch Doc Revision: 1.0 Last update: 13:11 21.10.2026 --------------------------------------------------------------------------------------------------- The last example was cool, but when graphics mode was visible and the routine called again to update the drawing color, there was a visible color flashing. It's annoying in many ways. I was thinking how to get rid of it and still achieve the same result {or better! Why not!} The source code is practically the same with some additions to make it looks better! It uses just 12 bytes more than the previous version! --------------------------------------------------------------------------------------------------- SOURCE CODE IN ASSEMBLER {for the built-in ML-Monitor in C128} - NOT suitable for copy/paste, use ML-Code for that further below. --------------------------------------------------------------------------------------------------- . 01400 20 50 14 jsr $1450 - gosub to settings part . 01403 a0 00 ldy #$00 - y register to zero . 01405 a2 00 ldx #$00 - x register to zero . 01407 b9 70 14 lda $1470,y - read byte definition . 0140a 9d 00 20 sta $2000,x - write to first line of the gfx screen . 0140d 9d a0 20 sta $20a0,x - the same, the remaining 160 bytes . 01410 9d 40 21 sta $2140,x - and repeat all for 9 lines . 01413 9d e0 21 sta $21e0,x . 01416 9d 80 22 sta $2280,x . 01419 9d 20 23 sta $2320,x . 0141c 9d c0 23 sta $23c0,x . 0141f 9d 60 24 sta $2460,x . 01422 9d 00 25 sta $2500,x . 01425 9d a0 25 sta $25a0,x . 01428 9d 40 26 sta $2640,x . 0142b 9d e0 26 sta $26e0,x . 0142e 9d 80 27 sta $2780,x . 01431 9d 20 28 sta $2820,x . 01434 9d c0 28 sta $28c0,x . 01437 9d 60 29 sta $2960,x . 0143a 9d 00 2a sta $2a00,x . 0143d 9d a0 2a sta $2aa0,x . 01440 e8 inx - increase x value . 01441 c8 iny - increase y value . 01442 c0 08 cpy #$08 - end reached? . 01444 d0 c1 bne $1407 - no, go back to $1407 . 01446 a0 00 ldy #$00 - yes, do set y to zero again . 01448 e0 a0 cpx #$a0 - check if x is 160 {half the screen} . 0144a d0 bb bne $1407 - no, then repeat the proces until it is . 0144c 20 30 6b jsr $77c4 + SLOW Mode on . 0144f 60 rts - back to BASIC when done . 01450 a9 00 lda #$00 - set BANK 15 {$00 is BANK 15} . 01452 8d 00 ff sta $ff00 - write it to memory register a 01455 8d 20 d0 sta $d020 + black border a 01458 8d 21 d0 sta $d021 + black screen a 0145b 20 b3 77 jsr $77b3 + FAST Mode on . 0145e a9 60 lda #$60 - set the Graphics Mode 2 {split raster capable} . 01460 85 d8 sta $d8 - write the value to register . 01462 a9 02 lda #$02 - set color {red in our case} . 01464 8d e2 03 sta $03e2 - write it to register used by the hires clear routine . 01467 a9 78 lda #$78 - raster line { ( = line number * 8 ) + 48 = dec 120 or hex #$78 } . 01469 8d 34 0a sta $0a34 - write it to the register . 0146c 20 30 6b jsr $6b30 - clears hires screen . 0146f 60 rts - return from the subroutine to . 01403 a0 00 ldy #$00 Add also these 8 bytes if you have decided to type this in. That are the graphics pattern bytes. By changing them, you can create your own! >01470 ff 83 9f bf bf fb ff ff:........ --------------------------------------------------------------------------------------------------- ML-CODE of the assembly listings above} -This can be copy/pasted and will immediately work. No manual corrections necessary! --------------------------------------------------------------------------------------------------- >01400 20 50 14 a0 00 a2 00 b9: p.?.B.Y >01408 70 14 9d 00 20 9d a0 20:P... .? >01410 9d 40 21 9d e0 21 9d 80:.@!.?!.. >01418 22 9d 20 23 9d c0 23 9d:". #.?#. >01420 60 24 9d 00 25 9d a0 25:?$..%.?% >01428 9d 40 26 9d e0 26 9d 80:.@&.?&.. >01430 27 9d 20 28 9d c0 28 9d:'. (.?(. >01438 60 29 9d 00 2a 9d a0 2a:?)..*.?* >01440 e8 c8 c0 08 d0 c1 a0 00:HH?.PA?. >01448 e0 a0 d0 bb 20 c4 77 60:??P? DW? >01450 a9 00 8d 00 ff 8d 20 d0:I...?. P >01458 8d 21 d0 20 b3 77 a9 60:.!P SWI? >01460 85 d8 a9 02 8d e2 03 a9:.XI..B.I >01468 78 8d 34 0a 20 30 6b 60:X.4. 0K? >01470 ff 83 9f bf bf fb ff ff:?..????? ---------------------------------------------------------------------------------------------------