[A83] Re: Official H**s Replacement Commands & Questions & PulseWidthMod
[Prev][Next][Index][Thread]
[A83] Re: Official H**s Replacement Commands & Questions & PulseWidthModulation
> >> HRC1: ex de,hl = push de \ push hl \ pop de \ pop hl ;this should work, I
> >> guess
> >
> >HRC1a (recommended):
> > ex de, hl = push bc \ ld b,d \ ld c,e \ ld d,h \ ld e,l \
> > ld h,b \ ld l,c\ pop bc
>
> Wow! That one is even better!
>
> >> 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...
> >
> >HRC3: push hl = ld iy,0000h \ add iy,sp \ ld (iy+0),l \ ld (iy+1),h
> >HRC3a: pop hl = ld iy,0000h \ add iy,sp \ ld l,(iy+0) \ ld h,(iy+1)
>
> Then why not make HRC1b: ex de,hl = ld iy,0000h \ add iy,sp \ ld (iy+0),l \
> ld (iy+1),h \ ld b,d \ ld c,e \ ld d,h \ ld e,l \ ld h,b \ ld l,c\ pop bc
> \ld iy,0000h \ add iy,sp \ ld l,(iy+0) \ ld h,(iy+1)
>
> However, you loose iy with this. Or does a normal pushpop do that too?
No, a normal push/pop doesn't, but, it makes the code even crappier.
> Otherwise, a push/pop iy will suffice:
Tss,tss, we were going to use the above set push/pop routines,
that results in, no iy register, and thus no mode flags.
>
> HRC3b: push hl = push iy \ ld iy,0000h \ add iy,sp \ ld (iy+0),l \ ld
> (iy+1),h \ pop iy
>
> HRC3c: pop hl = push iy \ ld iy,0000h \ add iy,sp \ ld l,(iy+0) \ ld
> h,(iy+1) \ pop iy ;push/pop iy are 2-byte commands! How crappy!
>
> HRC1c: ex de,hl = push iy \ ld iy,0000h \ add iy,sp \ ld (iy+0),l \ ld
> (iy+1),h \ ld b,d \ ld c,e \ ld d,h \ ld e,l \ ld h,b \ ld l,c\ pop bc \ld
> iy,0000h \ add iy,sp \ ld l,(iy+0) \ ld h,(iy+1) \ pop iy
We should found the crappy coders guild, to compete with hays :-)
(sarcastic humor)
<warning, disclaimer: Don't read this if you are in a pesky mood, or
have a grudge against our local List-Jester ("Nar" for the Dutch people)
from the company we all like so very much (not!).>
Something curious I noticed while browsing the list archives:
Mike $mith. has been on this list for 2 years, and has given exactly 2
more or less productively seeming comments (both the same).
Furthermore, if he has been on this list, he should have learnt at least
how to clear the screen in asm, instead of b@$!(
:-)
>
> ASM Studio 8x for the HRC1c: 17 instructions, 35 bytes and 197 whole clock
> cycles instead of 1 instruction, one byte, 4 cycles!!! That's a
> un-speed-gain of 97.9695% and an un-size ratio of 97 1/7%! How efficient!
> Even more efficient than TI-BASIC! That's a reason to step-over to ASM, you
> hays guys! Oh, sorry, it's too hard to learn...
>
> >Ha ha ha, good joke
> >(more serious comments below)
> >
> >
> >> 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?)
> >> 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?
> >Yes: 'bit' does the trick, but z is set on '0' and nz on '1'
> >Example:
> >
> >BHL_Plus_DE:
> > add hl,de
> > bit 7,h ; the 8th bit
> > ret nz
>
> ;That's what I need.
> ;I want to make a printer driver together with the EDE1400. It needs a 2400
> ;baud 8 bits, no parity, 1 stop bit (does it always to be '1' (or '0')?)
> ;serial signal (to convert it to a correct parallel signal). If I can adjust
> ;the program so that I can get 2400 baud, it's easy! 1 cycle is 6000000/4 =
> ;1.5 megabaud, so I probably need 625 cycles per bit. Enough time to play
> ;with.
>
> > inc b
> > res 7,h ; the 8th bit
>
> ;My guess: the above makes that bit 0.
>
> > set 6,h ; the 7th bit
>
> ;Makes 7th bit 1(?)
>
> > ret
>
> ;Thanks, you, and Dan Weiss, and Kirk Meyer.
>
> >in C:
> >
> > if(hl == 0x8000){ file://bit 7 is set;
> > b++;
> > hl = 0x4000 // reset bit 7, set bit 6
> > }
> >
> >compare the following if you don't get it
> >
> >bit from h: bits from l:
> >7(8000h) 7(80h)
> >6(4000h) 6(40h)
> >5(2000h) 5(20h)
> >4(1000h) 4(10h)
> >3(800h) 3(8h)
> >2(400h) 2(4h)
> >1(200h) 1(2h)
> >0(100h) 0(1h)
>
> I'm not a C programmer, and I don't understand much of this, but what does
> the file://bit do in the if(hl == ... ?
>
> >Even more serious comments below:
> >>
> >> PWM:
> >>
> >> Didn't test it, but this should work. The 'on' pulse is a bit longer than
> >> the 'off' pulse.
> >>
> >> begin:
> >> ld c,0
> >> loop:
> >> bcall(_getky)
> >> cp kDown
> >> call z, incc ;speed down
> >> cp kUp
> >> call z, decc ;speed up
> >> cp kClear
> >> ret z
> >> ld a,C3 ;off
> >> out(00),a
> >> call wait
> >> ld a,C0 ;on
> >> call wait
> >> jp loop
> >> incc:
> >> inc c \ ret
> >> decc:
> >> dec c \ ret
> >> wait:
> > ld b,c
> >> ei
> >waitloop:
> > halt \ djnz waitloop \ ret
> >>
> >
> >AFAIK, b is being decremented along the djnz, so I made b being
> >loaded from c each time
>
> That's a better solution than my push/pop. Thanks. Also, thanks to the
> others again. Kirk Meyer for making me discover the world of $-2.
>
> --Ronald--
>
>
>
>
>
References: