First steps in ASM, but I (probably) need some guidance

Heh, that selfmodifying code thing was exactly what I meant. It sounded horribly complicated when I started typing it out, though. And you're totally right. I'll just stick with programs like the one that started this thread for a while. Probably safer for my poor horrible-code-let's-it-crash-every-two-minutes-MSX, too.

Here are Pascal routines I wrote for enabling colour and speeding up my Pascal programs . Some of them contain inline code with the assembler code in (* *) - parenthesis. You should call BIOS routines like this, i.e. using CALSLT, otherwise you can get problems due to expanded slots.

If output happens in many places, then I suggest, that you use this method:
- Use EQU to define a name to port you want to be able to modify (for example #99)
- Compile your code to binary
- Change the port number to something else
- Compile your code to another binary
- Load both binarys to forexample VRAM
- Make a little compare program, that makes a table of addresses, that differ from each other.
- Include this table and a code that changes the addresses to end of your program and compile again.

Common understanding is, that it is VERY hard and VERY bad idea to write self modifying code, but that understanding is not from MSX world. On other platforms CPU commonly uses cache memory, that usually can not handle this kind of code without complex tricks, that usually work on some machines and not on others. On MSX self modifying code is ok, just remember, that you can't execute it from ROM.

What I recall, is that the VDP of the MSX2 NEOS adapter (that's the device we're dealing with, to upgrade an MSX1 to MSX2) is on ports #88, #89, #8A, #8B. Or in any case, the module uses #88-#89 -- it meant it could interfere with this network interface.

@Tanni
As you use inline code in pascal, your vpeek and vpoke could have been 10000000 times faster
accessing directly to the VDP. I know this imply the use of 99h and 98h, but
who cares ???
Probably it is better compiling twice the code and having two versions of the same program
(where, bytheway, the second version will be used by almost NONE ) rather than
hanging yourself and the performance of your code in the name of "MSX standard".

Heh, that's weird. My F700D has an MSX2+ switch. I always assumed it switched the VDP chip too; a V9938 for the MSX2, and a V9958 for the MSX2+. I altered the program that started this post to display the bits for VDP S#1, where the VDP type is also stored.

In both the MSX2 and MSX2+ modes, I get 00000100. Bits 1 - 5 make up the identification number, so 00010 is left. Looks like my F700D's V9938 is out of work. If it's still inside, that is.

Tanni: Looking at your code, I can only draw one conclusion.. I have a long, looooong way to go. In the last couple of weeks, a lot of code that was wizardry to me makes quite a lot of sense now, so maybe in the future I'll understand yours as well.

Heh, that's weird. My F700D has an MSX2+ switch. I always assumed it switched the VDP chip too; a V9938 for the MSX2, and a V9958 for the MSX2+. I altered the program that started this post to display the bits for VDP S#1, where the VDP type is also stored.

In both the MSX2 and MSX2+ modes, I get 00000100. Bits 1 - 5 make up the identification number, so 00010 is left. Looks like my F700D's V9938 is out of work. If it's still inside, that is.
Typical of the MSX2+ upgrade as available in the Netherlands in the early nineties: the MSX2+ switch in MSX 2 machines upgraded to 2+ do only switch between MSX 2 and MSX 2+ ROMS. There is just one vdp inside: the v9958. This works because the v9958 is a 9938 with extensions. With the MSX 2+ ROMS the Basic is extended with for example Basic extensions for screen 10-12. Often also KUN/Turbo Basic is builtin. In MSX2 mode the machine behaves exactly as when the machine had a v9938.
The MSX2+ upgrade consists of the exchange of the vdp with a v9958, the MSX2+ ROMS and a register at port F4 to remember warm start condition.
The origin of the MSX2+ ROM is a ROM dump of a Japanese MSX2+ machine, adapted to European keyboard and character set. Not entirely legal , very popular in combination with a memory upgrade and a 7 MHz clock
Recognizing a MSX2+ consists of first checking the MSX2 ROM signature in the BIOS and then checking the version number in the vdp itself.
By letting MSX2 programs seeing a MSX2 BIOS signature they will run . Nearly all programs check for the version to be 2 and not > 2.