Looking at Pascal and C, I also know that the real speed comes from assembly. I puzzled a small routine that writes a value X times to memory ( a kind of fill routine). Turbo Pascal is kind enough to substitute variable for their values when using inline. The issue I have is with the jump routine. How do I indicate in turbopascal inline that it should jump to a label, whose location I don't know. In the code below, if B is not zero, we need to jump back to increment HL and decr B again, etc.
Any suggestions are welcome!
{ (byte)rep : the number of repeats }
{ (byte)cr : the value to be written }
{ (int)addr : the start address }
Inline (
$3a/rep { ld a, (rep)}
$47/ { ld b,a }
$3a/char/ { ld a,(cr) }
$2A/addr/ { ld HL,addr}
$77/ { ld (HL),A
$23/ { inc HL)
$5/ { dec b }
$C2/ { jp nz,wri }
C9 { ret )
);
!login ou Inscrivez-vous pour poster
