Vampier's quest for assembly [hopefully a n00b guide to assembly]
Needless to say, you should look at the vdp registers
http://map.grauw.nl/resources/video/v9938/v9938.xhtml
and try to do without bios calls
This is the best way to get something good from msx
(apart from using sjasm as assembler
http://home.wanadoo.nl/smastijn/sjasm.html#sjasm4
crossdevelopment rules)
By Google
Well done! 
Now learn about EQU and start making your code more readable.
(edit)
After that you can try some loops:
LD B,<number of iterations> .loop . . DJNZ .loop
or
LD BC,<large number of iterations> .loop . . DEC BC LD A,B OR C JP NZ,.loop
and conditionals:
LD A,<boolean> OR A JP NZ,.true .false . . JP .done .true . . .done
Learning to code in assembly basically consists of 2 parts:
- 1) Understanding how a CPU (in our case: Z80) works on a low level, from a programmer's point of view.
- 2) Understanding how the hardware is organized in a machine with this CPU in it (in our case: the MSX), how to address/use the various parts (for sound, video, disk etc). Again, from a programmer's point of view. Understanding how the hardware works is helpful, but not necessary.
Try not to confuse these: if you become a good assembly coder on MSX, and you have a good understanding of what's 'Z80' and what's 'MSX' while coding, then moving to another Z80-based platform is easy since it involves only 2)
IMHO 1) can be learned quickly, but may take a long time+practice to become really good at. And for the MSX, 2) is more work, because some parts are more complex than the Z80 itself. The most important thing you'll learn is that in assembly, actions that take 1 line in BASIC or other languages, can take long sequences of assembly code. This is because in assembly you do everything in really small, low-level steps. So what's the point? Because those really small, low-level steps are executed really fast. And if something is possible on a machine, you can do it in assembly. But you may not be able to do it (at all, regardless of speed) in higher languages like BASIC.
A suggestion if you want to jumpstart 1) : get a Sinclair ZX Spectrum emulator, and fire up a program called "The Complete Machine Code Tutor". Check out the reviews on WoS site in case you have doubts...
This may seem a weird suggestion, but installing a Spectrum emulator + program is relatively quick/easy, for the ZX Spectrum 2) is dead simple, and The Complete Machine Code Tutor is an extremely easy to follow, interactive way to learn Z80 coding. Probably the most comparable on the MSX is a good debugger that allows direct input of Z80 assembly. But sad to say, it doesn't come close. :P
You can run Spectrum emulator on PC in one window, with various docs/webpages with info in other window(s), and any knowledge you gain you can immediately apply on the MSX if you want to. No need to stick to the Spectrum program until you know everything. As for documentation: :-? datasheets / databooks for the various IC's inside the MSX (and the MSX Technical Databook) are the reference docs you want...
Some sugegstions
;color 15,1,1 LD HL,&HF3E9 LD (HL),15 LD HL,&HF3EA LD (HL),4 LD HL,&HF3EB LD (HL),0 CALL &H62
should better be
;color 15,1,1 LD HL,&HF3E9 LD (HL),15 INC HL LD (HL),4 INC HL LD (HL),0 CALL &H62
while
;let me type in screen2 LD HL,&HFCB0 LD (HL),1 LD HL,&HFCAF LD (HL),1
should better be:
;let me type in screen2 LD A,1 LD (&HFCB0),A LD (&HFCAF),A
The gain here is very small, but when you code real loops the choice of the addressing mode matters a lot
^_^ didn't even think about that
well, you should know also that the vdp has an undocumented video mode (available on almost any msx1 and all msx=>2) where you have only one screen 2 tile bank for the 3 thirds of the video.
This allows you to use less vram and to spend much less time if you want to updae on fly tiles and colors
Some sugegstions
<snip>
should better be
;color 15,1,1 LD HL,&HF3E9 LD (HL),15 INC HL LD (HL),4 INC HL LD (HL),0 CALL &H62
<snip>
If you're nitpicking about speed of initialization code... then this is even faster!
;color 15,1,1 LD HL,&HF3E9 LD (HL),15 INC L LD (HL),4 INC L LD (HL),0 CALL &H62
p/s: shouldn't it be "color 15,4,0"?
If you're nitpicking about speed of initialization code... then this is even faster!
;color 15,1,1 LD HL,&HF3E9 LD (HL),15 INC L LD (HL),4 INC L LD (HL),0 CALL &H62
Nitpick:
;color 15,1,1 LD HL,15+256*4 LD (&HF3E9),HL XOR A LD (&HF3EB),A CALL &H62
So erh... How's it going Vampier? any progress?
Your post triggered me to start too (sjasm + z80 assembly language programming (Lance A. Leventhal 1979)).
The F register in combination with the JR is hard to get used to for me (I probably need practice). But the other stuff seems much simpler than I thought.
well, you should know also that the vdp has an undocumented video mode (available on almost any msx1 and all msx=>2) where you have only one screen 2 tile bank for the 3 thirds of the video.
This allows you to use less vram and to spend much less time if you want to updae on fly tiles and colorsi suppose this counts for screen 4 too ?
Could you tell me some more about this ?

By Vampier
Paragon (1589)
14-02-2010, 20:04