Search the web
Sign In
New User? Sign Up
vzemu · The VZ color computer mailing list
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
VARPTR & USR(X)   Message List  
Reply | Forward Message #5877 of 6694 |
Re: VARPTR & USR(X)

I don't think the full extended basic is an option since I am trying
to squeeze a program into 4K (it might be too large for that already).
There is one extended basic on the German VZ site if I remember
right. Not sure if it's the same one you are talking about.

If VARPTR still executes when it's pre-tokenized outside the VZ then I
could just do that. USR is listed in the VZ300 manual. Is that a
mistake?

No need to look up the CLS # code. Using existing code is fine... if
it's available. The code I posted is CLS # without figuring out the
character. I had that in the basic subroutine.

The assembly I posted has a tiny issue... or should I call it a big
issue. SCRNSIZE 512... Yeah... like that will work on an 8 bit.
I also didn't preserve registers but I'm not sure if I need to.
The fixes are below for a full CLS # USR call. Now the string to hold
it will need to be longer than the max line length for the VZ editor.
Around 37 bytes +-. Just remember that I haven't programmed a Z80 in
years... this could be wrong. Oh, and no validation of the parameter
takes place.


USRPARM equ 31009 ;location USR parameters are passed
SCREEN equ 28672 ;screen address

start:
PUSH AF ;store registers, this should have been 1 instruction
PUSH BC
PUSH HL
LD HL,chartable ;point to the character table
LD BC,USRPARM ;load the USR call parameter.
ADC HL,BC
LD A,(HL)
LD B,0 ;loop counter. we want 255 loops x 2 for screen size
LD HL,SCREEN ;point to the screen
loop1: ;clear 1st half of screen with this loop
LD (HL),A ;store the character in screen memory
INC HL ;point to the next screen address
DJNC loop1 ;decriment b and loop if it's not 0
loop2: ;clear 2nd half of screen with this loop
LD (HL),A ;store the character in screen memory
INC HL ;point to the next screen address
DJNC loop2 ;decriment b and loop if it's not 0
POP HL ;restore registers
POP BC
POP AF
RET
chartable: ;contains character codes for CLS # 0-8
DEFB 96,143,159,175,191,207,223,239,255


--- In vzemu@yahoogroups.com, "Leslie Milburn"
<lwm317_ebayaccount@...> wrote:
>
> 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
> >
> >
> >
> >
>





Tue Aug 5, 2008 1:12 pm

jdiffendaffer
Offline Offline
Send Email Send Email

Forward
Message #5877 of 6694 |
Expand Messages Author Sort by Date

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...
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 5, 2008
4:41 am

ARGH!! Don't even tell me I see a problem already. Easily fixed though....
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 5, 2008
4:49 am

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 ...
Leslie Milburn
cdb4w
Offline Send Email
Aug 5, 2008
7:45 am

I don't think the full extended basic is an option since I am trying to squeeze a program into 4K (it might be too large for that already). There is one...
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 5, 2008
1:12 pm

Ok, I figured out a way around not having VARPTR. If I know the start address of the code and the string is on the first line I can figure out the location....
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 7, 2008
4:51 am

Hi James, I am in the process of scanning/uploading all of the Ve Zee Newsletters. I was going to let everyone know once all 12 issues were up but as I think ...
Leslie Milburn
cdb4w
Offline Send Email
Aug 8, 2008
8:15 am

That is very helpful, thank you! The string for VARPTR should be at 5983 ($175F) in the VZ ROM according to this... so I copied a ROM image from JVZ200, loaded...
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 8, 2008
8:52 pm

The following commands are still missing from the hacked ROM file: RANDOM RESUME ON SYSTEM ERL ERR STRING$ MEM FRE$ POS CINT CSNG CDBL FIX I'll see about...
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 8, 2008
9:08 pm

Well, I patched the rest of the commands in ROM and tested several of them. They seemed to work but I make no guarantees all were patched correctly (first...
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 9, 2008
2:55 am

After looking at this page: http://personal.nbnet.nb.ca/mclays/level2.html FRE is not supposed to use $ so it's ok the way it is and it tests ok....
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 9, 2008
3:19 am

I used the BASIC program from the newsletter to verify that all the ROM patches had been made correctly. It looks to me like there is plenty of room in the...
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 9, 2008
9:30 pm

Hi James, Do not forget that unfortunately we have token collision situations in the wonderful world of the VZ. And so some programs written for some flavours...
Leslie Milburn
cdb4w
Offline Send Email
Aug 10, 2008
4:28 am

Actually, this is something I wanted to do a couple years ago but didn't have the info. It was just easy once I read that article. These are just the commands...
James Diffendaffer
jdiffendaffer
Offline Send Email
Aug 10, 2008
5:37 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help