nice one.
for the record,when doing ASM we use an ASSEMBLER, not a compiler. And the process of making a binary is called ASSEMBLING, not compiling. That's all "C" talk
"This blog is not (yet) about making a full featured graphical action game with cool music and sound effects."
Quite the understatement. Such a game would be hard to do with a high-level language as well, let alone by moving bits around in asm.
nice one.
for the record,when doing ASM we use an ASSEMBLER, not a compiler. And the process of making a binary is called ASSEMBLING, not compiling. That's all "C" talk Smile
@ro: Thanks, I changed it in the blogpost.
Quite the understatement. Wink Such a game would be hard to do with a high-level language as well, let alone by moving bits around in asm.
@wolf_ Just to temper expectations
But in the end it is the intention to be able to make a simple game. I'll get there ... eventually
@Pbk71, You write "This blog will be only about MSX-1 computers as that was the model that I owned..."
but on screenshots MSX BASIC version 3.0 - this version was on MSX2+
Some time ago I wrote a small guide to introduce ASM to people who already knows some high level language.
It's focused on conditional statements, which on my personal experience I had most difficult at start.
Not the most optimized code, the focus here is being easy to understand.
Feel free to use it on your blog, if you wish:
PS: sorry about the wall of code. Is there any way to make it collapsible?
if(A == 14) { // do something } // rest of code cp 14 ; compares A with 14, setting Z flag jp z, .then jp .restOfCode .then: ; do something .restOfCode: ; rest of code ----------------------------------------- if(A == 14) { // do something } else { // do other thing } // rest of code cp 14 jp z, .then jp .else .then: ; do something jp .restOfCode .else: ; do other thing .restOfCode: ; rest of code ----------------------------------------- if(A == 14 && B == 98) { // do something } else { // do other thing } // rest of code cp 14 jp z, .equalA jp .else .equalA: ld a, b cp 98 jp z, .equalB jp .else .equalB: ; do something jp .restOfCode .else: ; do other thing .restOfCode: ; rest of code ----------------------------------------- if(A == 14 && B == 98) { // do something } else if (C == 145) { // do other thing } // rest of code cp 14 jp z, .equalA jp .elseIf .equalA: ld a, b cp 98 jp z, .equalB jp .elseIf .equalB: ; do something jp .restOfCode .elseIf: ld a, c cp 145 jp z, .equalC jp .restOfCode .equalC: ; do other thing .restOfCode: ; rest of code ----------------------------------- if (A >= 15) { // do something } // rest of code cp 15 jp nc, .then jp .restOfCode .then: ; do something .restOfCode: ; rest of code ----------------------------------- if (A < 15) { // do something } // rest of code cp 15 jp c, .then jp .restOfCode .then: ; do something .restOfCode: ; rest of code ---------------------------------- for(B=10; B>0; B--) { // do something } // rest of code ; reverse loops are easier (and faster) on assembly ld b, 10 .loop: ; do something djnz .loop ---------------------------------- for(B=0; B<10; B++) { // do something } // rest of code ld b, 0 .loop: ; do something inc b ld a, b ; cp only works with A register, so we have to copy B to A cp 10 jp nz, .loop ; rest of code ------------------------------------- function byte Sum(byte A, byte B) { A = A + B; return A; } A = 7; B = 99; A = Sum(A, B); ; define subroutine Sum: add b ; sums A and B, output of add is always the A register ret ; call subroutine ld a, 7 ld b, 99 call Sum
@Pbk71, You write "This blog will be only about MSX-1 computers as that was the model that I owned..."
but on screenshots MSX BASIC version 3.0 - this version was on MSX2+
@GreyWolf: Good point. I just start up WebMSX/MSXPen and use it fo MSX-1 programming. But the default seems to be MSX2+. I've updated the screenshots in the blog.
Some time ago I wrote a small guide to introduce ASM to people who already knows some high level language.
@albs_br: Thanks! These are very handy routines and I'm sure that I can use them at some point in my blog.
I also made this small code snippet to understand how the comparisons with signed/unsigned numbers work in Assembly.
It's a bit tricky, specially the signed numbers, and I always had difficult, so it may be of help for many people.
Thanks again! There's a lot to learn about assembly and this is all very usefull.
Hi all,
I've just published my second blogpost on my blog about learning machine code (in fact assembly...) for the MSX.
My plan was to provide some basic knowledge and then show how you can program the famous 'Hello world!' program.
But I've decided to split the blog in 2 parts. In the first part that I've just posted I provide the basic knowledge I think an beginning assembly programmer needs. And that already got quite a long post
I hope you like it and please comment if there's information that's not correct. Please keep in mind that it is not supposed to be a complete overview. It should give a beginner the right amount of information to get started.
And don't forget... I'm a beginner too. This is my way of learning MSX/Z80 assembly. Please let me know if I got something wrong, so that I can correct it in the blogposts.