Hi James,
Firstly I would suggest that you install Steve Olney's Extended BASIC as it
gives you most of the missing TRS80 commands including VARPTR and will
probably make your life a lot eaiser. Hopefully someone has that available
somewhere as I will not get around to the software uploads for quite a while
yet.
Secondly Larry Taylor wrote an article in one of the magazines (was it
Australian Electronics Monthly ??) to provide a CLSn command.
I will try and see if I can find it and scan it in.
Leslie.
----- Original Message -----
From: "James Diffendaffer" <jdiffendaffer@...>
To: <vzemu@yahoogroups.com>
Sent: Tuesday, August 05, 2008 2:41 PM
Subject: [vzemu] VARPTR & USR(X)
> Ok... the manual isn't the greatest so let me see if I have this right
>
> The program I'm porting uses the TRS-80 CoCo/MC-10 command CLS# to
> clear the screen to a particular color. The VZ spit that back and I
> wrote a basic subroutine to duplicate it but I want to use VARPTR to
> place a USR function in a string so it's fast.
>
> VARPTR returns the location of the string structure whitch is the
> string length followed by the actual location of the data held by the
> string. At least if it duplicates the Model 1.
>
> structaddress = VARPTR(MyString$)
> stringaddress = (structaddress+1)+((structaddress+2) * 256)
>
> Then poke the bytes of the machine code into the string.
>
> POKE the string address into 30862-30863 since in now contains our USR
> function.
>
> 31009-10 holds the parameter X value on a USR(X) call.
>
> So... the assembly code I need should be something like this:
>
> ;I'll deal with syntax when I get there
> USRPARM equ 31009 ;location USR parameters are passed
> SCRNSIZE equ 512 ;32 characters * 16 rows = screen size
> SCREEN equ 28672 ;screen address
>
> start:
> LD A,USRPARM ;load the USR call parameter low byte, high is unused.
> LD B,SCRNSIZE ;screen size in bytes for counter
> LD HL,SCREEN
> loop:
> LD (HL),A ;store the character in screen memory
> INC HL
> DJNC loop
> RET
>
> Does that look reasonable? Should be pretty small byte wise. I'm
> guessing under 20 bytes.
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>