tyr-@... (alessandro sanasi) wrote:
original article:http://www.egroups.com/group/vmu-dev/?start=51
> MOV #$80,ACC ; move value $80 into ACC register
> ST 2 ; store it in memory address 2
Those kind of comments are in IMO worse than no comments at all. If
someone doesn't know what the ST instruction does, it's easy enough to
look it up. A comment should tell you about the _purpose_ of the
instruction, not the _function_. For example:
MOV #3,lvs ; start with three lives
not
MOV #3,lvs ; move the number three into address lvs
> fwcall .macro
> mov #<$0123,0
> push 0
> mov #>$0123,0
> push 0
> not1 ext,0
> jmpf \1
> .endm
>
> bios_rflash:
> fwcall $e027
>
> How does macro definition work in the VMU assembler, and how are
those
> macros used? What does stuff like "mov #<$0123,0" or "jmpf \1" do
> exactly? What's the "\1" for in the latter? What's a "fwcall"?
The .macro definition just stores the next lines (up to .endm) into a
macro called "fwcall". The "fwcall $e027" line below will invoke the
macro, which simply means that the lines stored previously are
substituted for the macro call. In the process, all \n where n is a
number are substituted for the nth positional argument to the macro.
So \1 will be replaced with the first argument to the macro, namely
$e027.
As for "mov #<$0123,0", well it moves the low byte of the constant
$0123 into address 0. It's a perfectly normal mov instruction.
Btw, the firmware call macro uses a dirty trick. You are not required
or expected to understand how it works. :-)
> And here:
>
> clr1 ie,7
> mov #$81,ocr
> mov #2,xbnk
> push xram+4
> set1 xram+4,0
> mov #0,$7c
> callf bios_wflash
> callf bios_vflash
> pop xram+4
> pop xbnk
>
> Why is xram+4 pushed on the stack?
Because the "flash access" icon on the LCD should be restored to its
previous state when we're done writing. The 'normal' FLASH write
function (at $100) handles the display of this icon for us, but here we
have to get our hands dirty outselves. (Or simply ignore the icon.
But I think it's nice. :)
> Wouldn't that be the data at address
> $184 or what?
Yes.
> Or why is xbnk set to #2?
Because there's where the icons live.
// Marcus