C128-MULTICOLOR-HIRES-GRAPHICS {TILES} --------------------------------------------------------------------------------------------------- TOOL: EDASS-128-ASSEMBLER-EDITOR-40-80-COLUMN {Commodore C128} Language: ASSEMBLY Extra: none Author: Misel Zivanovic Note: (C) 22nd of OCTOBER 2026 - www.lived.ch, mzretro.ch Doc Revision: 1.2 First created: lived.ch, 15:35 13.03.2024 Last update: 12:24 22.10.2026 --------------------------------------------------------------------------------------------------- This one was made back in March 2024 and I found it now. I literally made a decision back in November 2023 to start learning assembler and because C128 was my first Personal Computer, it wasn't a difficult part to decide how this will go... Today, I would probably write the whole code slightly different. Back then however, i was totally happy to have managed to do what you see below. In other words, I wasn't able to do it smarter! I could fix the process though, because I do not like how the transition/switch is happening. It could be better and probably I'll use the same 12 bytes I used in the previous lesson. {"mcgfx2u.asm" is updated EDASS-128 source file! Just a few bytes more, but strikes with full impact!} Worth mentioning is the fact that I needed like a century to finally figure out how to deal with the colors and what to include to have it executed properly. Nobody was messing with C128 back in the days. Everything was just C64 and that is why there is no information around related to graphics and C128 {well, it is, in BASIC} Was this the correct way to do it? Who can tell, right! It's working and it's also all we need to know! *************************************************************************************************** NEXT: ORIGINAL DOC with some minor adaptations and addition {e.g. the byte exporter} *************************************************************************************************** C128_LRMC_FullScreen_Assembly - {Low Resolution Multi Color} lived.ch, 15:35 13.03.2024 --------------------------------------------------------------------------------------------------- Change tiles with #keys 1 to 8 Press "D" for a default picture Press ENTER to quit and return to BASIC / EDASS 128. --------------------------------------------------------------------------------------------------- NOTE: To create the tiles, I was using SPRDEF and then exported the data accordingly in 2x2 bytes! Find the export routine i wrote for it at the bottom of this document! It is 3x3, but as you can imagine, suitable also for 2x2 or 3x1 or 1x1 --------------------------------------------------------------------------------------------------- FLOPPY DISK CONTENT {updated on 22nd of October 2026!} --------------------------------------------------------------------------------------------------- diR 0 "for edass-128 " 1a 2a 21 "mcgfx2.asm" prg 21 "mcgfx2u.asm" prg 2 "tiles-demo.bas" prg 5 "mcgfx2.bl" prg 0 "----------------" seq 0 "lowres multicol " seq 0 "example for c128" seq 0 "for edass-128 " seq 0 "editor-assembler" seq 0 "----------------" seq 0 "www.mzretro.ch " seq 0 "www.lived.ch " seq 0 "----------------" seq 594 blocks free. ready. --------------------------------------------------------------------------------------------------- = mcgfx2.bl is to load with bload and start with sys 4864 {update 22.10.2026: or use the BASIC program "tiles-demo.bas"} No EDASS-128 needed for this and you can see the source code with built-in ML-Monitor and change a few things like colors, modify tiles from $1632. Use M listing command for that in ML Monitor One line is 2 repeating characters, 2 lines are drawn That makes 16 bytes each line or every 32 bytes a new tile is starting NOTE: this here is true only for the mcgfx2.asm and NOT for mcgfx2u.asm as it was updated} >01632 95 68 e3 c2 c2 ce fe ea:.HCBBN.J - Tile 1 first line >0163a 56 29 cb 83 83 b3 bf ab:v)K..S.K - Tile 2 first line >01642 2a ea fe ce c2 c2 e3 68:*J.NBBCH - Tile 1 second line >0164a a8 ab bf b3 83 83 cb 29:HK.S..K) - Tile 2 second line >01652 78 7a bb 78 bb 7b bb 78:XZ.X...X - Tile 1 3rd line >0165a 2d ad ee 2d ee ed 2e ed:-MN-NM.M - etc. >01662 bb 78 bb 7b b8 7b bb 7a:.X..X..Z Please note that there is a default tile which i am reading here Basically, i am loading other tiles into default tile memory location and show the default one which then isn't a default anymore because the values were changed Because default is overwritten, you can load it back by pressing on "D" on your keyboard --------------------------------------------------------------------------------------------------- PROJECT: mcgfx2.asm *= $1300 .obj m .bank 15 ;-------------------- ; ;lived.ch, 13.03.2024 ; ;-------------------- ;init graphics ;-------------------- jsr init0 ;set everything ;-------------------- ;drawing part ;-------------------- cycle ldy #$00 ;reset counters ldx #$00 jmp draw loop lda linea,y sta $2000,x ;1st sta $20a0,x ; sta $2280,x ;3rd sta $2320,x ; sta $2500,x ;5th sta $25a0,x ; sta $2780,x ;7th sta $2820,x ; sta $2a00,x ;9th sta $2aa0,x ; sta $2c80,x ;11th sta $2d20,x ; sta $2f00,x ;13th sta $2fa0,x ; sta $3180,x ;15th sta $3220,x ; sta $3400,x ;17th sta $34a0,x ; sta $3680,x ;19th sta $3720,x ; sta $3900,x ;21st sta $39a0,x ; sta $3b80,x ;23rd sta $3c20,x ; sta $3e00,x ;25th sta $3ea0,x lda lineb,y sta $2140,x ;2nd sta $21e0,x ; sta $23c0,x ;4th sta $2460,x ; sta $2640,x ;6th sta $26e0,x ; sta $28c0,x ;8th sta $2960,x ; sta $2b40,x ;10th sta $2be0,x ; sta $2dc0,x ;12th sta $2e60,x ; sta $3040,x ;14th sta $30e0,x ; sta $32c0,x ;16th sta $3360,x ; sta $3540,x ;18th sta $35e0,x ; sta $37c0,x ;20th sta $3860,x ; sta $3a40,x ;22nd sta $3ae0,x ; sta $3cc0,x ;24th sta $3d60,x ; jmp more draw jmp loop more inx iny cpy #$10 bne draw ldy #$00 cpx #$a0 bne draw ; jsr init2 ;jump graph 4 or jmp start ;not, for graph 3 ; ;full gfx screen ;---------------------------- ;end ;---------------------------- ; init0 lda #$00 ;bank 15 sta $ff00 lda #$a0 ;graphic 3 sta $d8 ;mode lda #$03 ; sta $83 ;multicolor col84 lda #$0f sta $84 ;color 2,x col85 lda #$0b sta $85 ;color 3,x col86 lda #$0c sta $86 ;color 1,x colbord lda #$00 sta $d020 ;border color colscrn lda #$00 sta $d021 ;screen color coltxt lda #$0e sta $f1 ;text color lda #$a0 ;mc 3 graphic jsr $6acd ;deletion 'cos jsr $6ad0 ;graph 4 is buggy jsr $6ad3 ;and causing jsr $6a5c ;troubles jsr $6b30 rts ;init2 lda #$e0 ;switch mode ; sta $d8 ;graph/text ; lda #144 ;raster (12) ; sta $0a34 ; rts ; start nop keyctrl jsr $ffe4 cmp #$0d ;enter exit beq exit cmp #$31 ;1 beq tile1 cmp #$32 beq tile2 cmp #$33 ;3 beq tile3 cmp #$34 beq tile4 cmp #$35 ;5 beq tile5 cmp #$36 beq tile6 cmp #$37 ;7 beq tile7 cmp #$38 beq tile8 cmp #$44 ;d beq tiledef jmp keyctrl ;------------------------ ; exit lda #$00 sta $d8 rts ;------------------------ ; tile1 jmp load1 tile2 jmp load2 tile3 jmp load3 tile4 jmp load4 tile5 jmp load5 tile6 jmp load6 tile7 jmp load7 tile8 jmp load8 tiledef jmp loaddef ; ;load tiles data ; ;main execution routine ; load1 ldx #$00 t1r lda t1a,x sta linea,x lda t1b,x sta lineb,x inx cpx #$10 bne t1r lda #$00 sta col84+1 lda #$06 sta col85+1 lda #$0e sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; load2 ldx #$00 t2r lda t2a,x sta linea,x lda t2b,x sta lineb,x inx cpx #$10 bne t2r lda #$05 sta col84+1 lda #$0d sta col85+1 lda #$0c sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; load3 ldx #$00 t3r lda t3a,x sta linea,x lda t3b,x sta lineb,x inx cpx #$10 bne t3r lda #$01 sta col84+1 lda #$0b sta col85+1 lda #$0c sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; load4 ldx #$00 t4r lda t4a,x sta linea,x lda t4b,x sta lineb,x inx cpx #$10 bne t4r lda #$02 sta col84+1 lda #$01 sta col85+1 lda #$07 sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; load5 ldx #$00 t5r lda t5a,x sta linea,x lda t5b,x sta lineb,x inx cpx #$10 bne t5r lda #$09 sta col84+1 lda #$07 sta col85+1 lda #$06 sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; load6 ldx #$00 t6r lda t6a,x sta linea,x lda t6b,x sta lineb,x inx cpx #$10 bne t6r lda #$0c sta col84+1 lda #$0e sta col85+1 lda #$06 sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; load7 ldx #$00 t7r lda t7a,x sta linea,x lda t7b,x sta lineb,x inx cpx #$10 bne t7r lda #$00 sta col84+1 lda #$0f sta col85+1 lda #$0c sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; load8 ldx #$00 t8r lda t8a,x sta linea,x lda t8b,x sta lineb,x inx cpx #$10 bne t8r lda #$06 sta col84+1 lda #$07 sta col85+1 lda #$0e sta col86+1 lda #$0a sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; loaddef ldx #$00 defr lda defa,x sta linea,x lda defb,x sta lineb,x inx cpx #$10 bne defr lda #$0f sta col84+1 lda #$0b sta col85+1 lda #$0c sta col86+1 lda #$00 sta colbord+1 lda #$00 sta colscrn+1 lda #$09 sta coltxt+1 jsr init0 jmp cycle ; ;----------------------------------- ;graphics data ;----------------------------------- ; ;default tile ;tiles editor multicolor 1.0.5 ; ; linea .byte $95,$68,$e3,$c2,$c2,$ce .byte $fe,$ea .byte $56,$29,$cb,$83,$83,$b3 .byte $bf,$ab lineb .byte $2a,$ea,$fe,$ce,$c2,$c2 .byte $e3,$68 .byte $a8,$ab,$bf,$b3,$83,$83 .byte $cb,$29 ; ; ;new set of tiles ; ;tile1 t1a .byte $78,$7a,$bb,$78,$bb,$7b .byte $bb,$78 .byte $2d,$ad,$ee,$2d,$ee,$ed .byte $2e,$ed t1b .byte $bb,$78,$bb,$7b,$b8,$7b .byte $bb,$7a .byte $2e,$ed,$ee,$ed,$2e,$ed .byte $ee,$ad ; ;tile1 t2a .byte $8d,$65,$99,$a6,$a9,$89 .byte $27,$97 .byte $72,$59,$66,$9a,$6a,$62 .byte $d8,$d6 t2b .byte $6b,$9b,$9b,$9b,$9b,$26 .byte $a9,$24 .byte $e9,$e6,$e6,$e6,$e6,$98 .byte $6a,$18 ; ;tile1 t3a .byte $3c,$55,$55,$55,$3c,$be .byte $be,$3c .byte $f3,$f5,$f5,$f5,$f3,$ab .byte $ab,$f3 t3b .byte $3c,$aa,$aa,$3c,$7d,$7d .byte $7d,$3c .byte $f3,$fa,$fa,$f3,$57,$57 .byte $57,$f3 ; ;tile1 t4a .byte $a9,$2f,$2a,$02,$02,$82 .byte $6a,$af .byte $6a,$f8,$a8,$80,$80,$82 .byte $a9,$fa t4b .byte $af,$6a,$82,$02,$02,$02 .byte $2a,$2f .byte $fa,$a9,$82,$80,$80,$80 .byte $a8,$f8 ; ;tile1 t5a .byte $2a,$91,$ba,$ba,$aa,$48 .byte $aa,$86 .byte $a8,$8a,$a2,$8a,$aa,$23 .byte $aa,$12 t5b .byte $23,$84,$aa,$c8,$aa,$a2 .byte $8a,$a2 .byte $c8,$92,$aa,$21,$aa,$ae .byte $ae,$46 ; ;tile1 t6a .byte $a8,$08,$0f,$07,$1e,$de .byte $be,$9e .byte $2a,$20,$f0,$d1,$b5,$b7 .byte $be,$b6 t6b .byte $9e,$be,$de,$1e,$1e,$07 .byte $0f,$08 .byte $b6,$be,$b7,$b5,$b4,$d0 .byte $f0,$20 ; ;tile1 t7a .byte $65,$ab,$65,$01,$47,$45 .byte $11,$67 .byte $59,$ea,$59,$40,$d1,$51 .byte $44,$d9 t7b .byte $ab,$67,$d3,$f7,$d9,$6a .byte $6a,$59 .byte $ea,$d9,$c7,$df,$67,$a9 .byte $a9,$65 ; ;tile1 t8a .byte $a0,$4c,$0c,$57,$05,$1a .byte $4c,$15 .byte $0a,$31,$30,$d5,$50,$a4 .byte $31,$54 t8b .byte $42,$15,$4c,$1a,$05,$57 .byte $0c,$4c .byte $81,$54,$31,$a4,$50,$d5 .byte $30,$31 ; ;deftile defa .byte $95,$68,$e3,$c2,$c2,$ce .byte $fe,$ea .byte $56,$29,$cb,$83,$83,$b3 .byte $bf,$ab defb .byte $2a,$ea,$fe,$ce,$c2,$c2 .byte $e3,$68 .byte $a8,$ab,$bf,$b3,$83,$83 .byte $cb,$29 --------------------------------------------------------------------------------------------------- EXPORT ROUTINE: {BASIC 7.0, Commodore C128} To export single 8 bytes values from SPRDEF. Cannot be used to export sprites! {unless you are planning to make weird 8 bytes sprites and then stick them together} *************************************************************************************************** Export pattern: 1 2 3 x x x ->row 1 - 8x24 bits {3 characters} 4 5 6 x x x ->row 2 - 8x24 bits {3 characters} *************************************************************************************************** NOTE [IMPORTANT]: That EDASS-128 cannot show all 8 bytes {the exported line here} at once in 40-column screen! The remaining 2 bytes will be outside of the visible screen area, but still present! By using the 80-column screen, this little disadvantage can be avoided! Also, with VICE, you can copy the screen content of your EDASS-128 source code. The mentioned {invisible} two bytes will NOT BE COPIED in 40-column-screen-mode! {USE 80-COLUMN SCREEN INSTEAD!} *************************************************************************************************** list 10 l1$=" .byte ":l2$=" .byte ":scnclr 12 char0,0,0:fora=0to2:char0,0,0+a,l1$ 14 l1$=" .byte ":sprcolor2,3:color0,1 16 forb=3584+ato3605+astep3:dd=peek(b) 18 gosub 34 20 printright$(hex$(dd),2);:next:next 22 for a=0to2:char0,0,4+a,l2$ 24 l2$=" .byte " 26 forb=3608+ato3629+astep3:ee=peek(b) 28 gosub 42 30 printright$(hex$(ee),2);:next:next 32 char 0,0,16:end 34 p$=",$":ifb=3584thenp$="$" 36 ifb=3585thenp$="$" 38 ifb=3586thenp$="$" 40 print p$;:return 42 p$=",$":ifb=3608thenp$="$" 44 ifb=3609thenp$="$" 46 ifb=3610thenp$="$" 48 print p$;:return ready. *************************************************************************************************** Example Tile, Byte Export: {screenshot 1} .byte $15,$5a,$76,$7d,$7d,$7d,$7d,$7d .byte $54,$a5,$99,$69,$69,$69,$69,$69 .byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $7d,$7d,$7d,$7d,$7d,$74,$50,$15 .byte $69,$69,$69,$69,$69,$19,$05,$54 .byte $00,$00,$00,$00,$00,$00,$00,$00 ***************************************************************************************************