Believe it or not, I did not know how to program in MSX z80 assembler up until Feb 12 2010. I had done several attempts which basically ended as soon as I started…. It was pretty frustrating to read about registers, stacks pointers and other terms I did not know anything about.
Anyway after asking Bifi which assembler was a good one to start with I downloaded WBASS2
http://www.xs4all.nl/~wbsoft/msx/
An assembler allows you to program into ‘human readable’ text which is translated directly into machine language which are the 1’s and 0’s that control your chips.
After starting WBASS2 I read the tutorial (WBass manual... only in Dutch) and worked through it until half way. I decided to just start typing what I was told (actually I used the copy/paste function in openMSX through catapult) and was surprised by the structure of assembly… I knew why I couldn’t get started… it doesn’t work like anything close to MSX basic!
I was left with more questions than answers after this brief introduction to assembly. So Bifi gave me a head spinning lecture about registers, pointers and BIOS calls (I know you die hard assembly guys like to stay away from BIOS calls :P)
I am starting to think about an MSXDevX Entry which I was going to use a hybrid screen 2 mode for (screen1 freedom on screen2 but with the benefits of 16 colors per char) Bifi gave me a program for this quite some time ago and it always bugged me to see how slow it was. So I started looking at the BASIC program:
10 COLOR15,0,0:SCREEN2:POKE &HFCB0,1:POKE&HFCAF,1 20 FOR I=0TO2047:J=PEEK(PEEK(4)+256*PEEK(5)+I) 30 VPOKEI,J:VPOKEI+2048,J:VPOKEI+4096,J 40 VPOKE I+8192,248:VPOKEI+10240,31:VPOKEI+12288,244:NEXT I 50 WIDTH 32
So Call Screen 2 and copy the charset to the 3 portions of screen2 (look up how screen2 works if you want to know :P) And as an added bonus make it look nice to illustrate the 3 different areas.
Anyway to stop bugging Bifi all the time I skimmed over http://www.worldofspectrum.org/Z80.html a bit (hey z80 is z80, only the bios calls are different as far as I’m concerned)
So I just started fiddling around with assembly and a great resource I got (from Bifi again) on BIOS calls: http://map.grauw.nl/resources/msxbios.php
ORG &HC000 ;color 15,1,1 INITCO: LD HL,&HF3E9 LD (HL),15 LD HL,&HF3EA LD (HL),4 LD HL,&HF3EB LD (HL),0 CALL &H62 ;let me type in screen2 INIT: LD HL,&HFCB0 LD (HL),1 LD HL,&HFCAF LD (HL),1 ;init charset (copy from ram to vram) SETCHR: LD HL,7103 LD DE,0 LD BC,2048 CALL &H5C LD HL,7103 LD DE,2048 LD BC,2048 CALL &H5C LD HL,7103 LD DE,4096 LD BC,2048 CALL &H5C ;set colors SETCOL: LD A,&HF8 LD BC,2048 LD HL,8192 CALL &H56 LD A,&H1F LD BC,2048 LD HL,&H28 CALL &H56 LD A,&HF4 LD BC,2048 LD HL,&H30 CALL &H56 ;exit RET
After assembling this in memory I went to basic and typed:
10 defusr=&hc000 11 screen2:u=usr(0) 12 width 32
And tears of joy (just kidding) appeared... EUREKA!!!! I DID IT!!! My first assembly program was born!
It's still top/down thinking though.
Until this far :) more to come
(also a thanks to n_n and Max Iwamoto for support)