Gilbert Francois Duivesteijn

The tutorial Lesson 5 - Bit level operations, Self modifying code of ChibiAkumas shows well the bit operations on the screen. This is shown on an Amstrad CPC and there, the video memory is directly accessible. To do the same on an MSX, we need to do a bit more steps:
Below is a small example of this (as BIN file).
Step 1: Type in the source code on a PC or Mac:
x
; ==[ Constants ]===============================================
ORGADR      equ $c000
CHGMOD      equ $005f; Function : Switches to given screenmode; Input    : A  - screen mode; Registers: All
LDIRVM      equ $005c; Function : Block transfer from memory to VRAM ; Input    : BC - blocklength;            DE - Start address of VRAM;            HL - Start address of memory; Registers: All
LDIRMV      equ $0059; Function : Block transfer from VRAM to memory ; Input    : BC - blocklength;            DE - Start address of memory;            HL - Start address of VRAM; Registers: All
VDPData     equ $98VDPControl  equ $99VramCache   equ $c400
; ==[ Header ]==================================================
    ; Place header before the binary.    org ORGADR - 7    ; BIN header, 7 bytes    db $fe    dw FileStart    dw FileEnd - 1    dw Main    ; org statement after the header    org ORGADR
; ==[ Program ]=================================================
FileStart:Main:    ; Go to screen 1    ld a, 1    call CHGMOD
    ; Make a copy of the pattern table in RAM.    ld hl, $0000    ld de, VramCache    ld bc, $0800    call LDIRMV
    ;===========================================================    ld hl, VramCache  ; Start of the cache in RAM    ld bc, $0800      ; Block size: 256 characters * 8 byteAgain:    ld a, (hl)    ; uncomment one of the 3 lines below to see the effect    ; and %11110000    ; keep bits that are 1    ; or %11110000    ; set bits that are 1    xor %11110000     ; invert bits that are 1         ld (hl), a    inc hl    dec bc    ld a, b    or c    jr nz, Again      ; loop over given block size    ;===========================================================
    ; Copy to the pattern table in VRAM    ld hl, VramCache    ld de, $0000    ld bc, $0800    call LDIRVM        ret
FileEnd:
Step 2: Compile with VASM
x
$ vasmz80_oldstyle bitleveloperations_bin.asm -chklabels -nocase -Dvasm=1 -Fbin -L out.sym -o out.romor with Glass (you can choose)
x
$ java -jar Glass.jar bitleveloperations_bin.asm -L out.sym out.rom
Step 3: run with openMSX. Set the floppy drive to the build directory and in MSX Basic type:
xxxxxxxxxxbload"out.bin"
Step 4: Run your program. In basic, type:
xxxxxxxxxxdef usr=&hc000a=usr(0)

Congrats, you have a template for your ChibiAkumas tutorial. Change the code between the ==== lines and ... happy learning!