[A83] Re: Official H**s Replacement Commands & Questions & PulseWidthMod
[Prev][Next][Index][Thread]
[A83] Re: Official H**s Replacement Commands & Questions & PulseWidthModulation
>From: "Ronald Teune" <rtwolf@gmx.net>
>Reply-To: assembly-83@lists.ticalc.org
>To: "Assembly 83" <assembly-83@lists.ticalc.org>
>Subject: [A83] Official H**s Replacement Commands & Questions &
>PulseWidthModulation
>Date: Mon, 2 Jul 2001 14:38:53 +0200
>
>
>HRC1: ex de,hl = push de \ push hl \ pop de \ pop hl ;this should work, I
>guess
>HRC2: ld a,xx = push bc \ ld b,xx \ ld a,b \ pop bc
>More crap coming soon, maybe...
>Feel free to add other commands...
Wow... Those commands are pretty crappy. :)
Actually, the only real h**s replacement command is changing the .db line
that contains the game's title, then changing the .db line containing the
author.
>
>Question:
>1 What does ldir do? Does it copy the graph buffer to the screen? In
> ionm.z80 it's used to run a module stored in saferam1 (graph buffer?)
It replaces (de) with (hl), then decreases bc. Then it does it again and
again until bc = 0. This copies chunks of memory, also can be used to set
memory ranges to a single value.
>2 Is there a command that extracts bits from a variable? I think 'bit' does
> the trick, so bit 1 is the first bit of a and bit 2 is the 2nd bit of a
> and bit 3 the 3rd, ... and I think it sets the zero flag for 1 and the
> nonzero flag for 0. Is this correct?
bit 0, = first bit
bit 7, = last bit.
bit supports single registers and (hl)/(ix)/(iy). (ix and iy of course have
offsets)
It returns the zero flag for 0, and nz for 1.
set turns a bit on, res turns a bit off. Bits are arranged from right to
left:
76543210
.db %........
>
>PWM:
>
>Didn't test it, but this should work. The 'on' pulse is a bit longer than
>the 'off' pulse.
>
>begin:
> ld b,0
>loop:
> bcall(_getky)
> cp kDown
> call z, incb ;speed down
> cp kUp
> call z, decb ;speed up
> cp kClear
> ret z
> ld a,C3 ;off
> out(00),a
> call wait
> ld a,C0 ;on
> call wait
> jp loop
>incb:
> inc b \ ret
>decb:
> dec b \ ret
>wait:
> ei \ halt \ djnz wait \ ret
If b=0 then it waits 256 times, not 0. Also, B is getting reset to 0 by the
djnz. Use this instead:
Wait: ei \ push bc
WaitLoop: halt \ djnz waitloop \ pop bc \ ret
Also, I think halt is a poor choice for sound here, you will end up with
lower pitches. use a subloop involving nops or something faster.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com