home *** CD-ROM | disk | FTP | other *** search
- u
- DOTBASIC DOCUMENTATION
- Part 3
-
-
- Welcome back! Let's get on with
- screen manipulation:
-
-
- CUT: .TC,x1,x2,y1,y2,loc
- PASTE: .TP,x1,x2,y1,y2,loc
- --------------------------
-
- CUT and PASTE are able to stash
- and restore any size portion of the
- screen to or from any location, even
- under I/O.
-
- The data is stored sequentially in
- memory with each cell's screen code
- and color code stored one after
- another. This formula reveals how much
- memory is consumed by CUT:
-
- bytes = (x2-x1+1)*(y2-y1+1)*2
-
- PASTE requires that you specify
- the area to be filled. As long as you
- use the same SIZE area as the cut
- data, you can PASTE it wherever you
- want, oodles of times.
-
-
- NOTE: DotBASIC has a better way! PASTE
- requires that the dimensions of the
- PASTEd "object" are the same as the
- CUT. This can be a hassle!
-
- So we have added OBJECT commands.
-
- First off, you must assign a
- location in memory for your objects.
- As with CUT and PASTE, the location
- can be anywhere, even under I/O.
-
-
- OBJECT SET: .OS,location
- ------------------------
-
- This sets a place for NEW ojects
- and zeros the number of objects
- present.
-
-
- OBJECT LINK: .OL,location
- -------------------------
-
- This links the Object commands to
- a location in memory without zeroing
- the number of objects present --
- perfect when you BLOAD an Object File.
-
-
- OBJECT CUT: .OC,x1,x2,y1,y2
- ---------------------------
-
- The cut object is placed in the
- next slot in the object area. The
- end+1 of the object area is returned
- in FP (for checking memory and
- BSAVEing).
-
-
- OBJECT PASTE: .OP,index,x,y
- ---------------------------
-
- This puts the indexed object on
- the screen, with x/y being the
- position of the upper left corner.
-
-
- OBJECT DELETE: .OD
- ------------------
-
- This removes the last object.
-
-
- OBJECT NUMBER: O#
- -----------------
-
- Returns the number of objects in
- the collection in I%.
-
-
-
- CHECK KEYPRESS: .KP,string
- --------------------------
-
- This routine quickly scans your
- string and checks if any of those keys
- are being pressed at the moment. If
- one is, that key's position within the
- string will be returned in I%.
-
- Example: SYS ML+60,"dragon"
-
- If an "a" was being pressed, I%
- would return a value of 3. If no keys
- were being pressed, I% returns zero.
- Although the CRSR/RETURN keys already
- offer a means of "keyboard support",
- do not forget to add the convenience
- of hotkeys to your program!
-
- BIG NOTE: Some mouse buttons are
- mistaken for keyboard presses!
-
- Mouse Usually Can also be
- Button Seen as Mistaken for
- ------ ------- ------------
- Left SPACE <RShift> .MBCZ <F1>
- Right nothing \+97531 <Delete>
- Middle b.arrow *PIYRW <Return>
-
-
- LET GO: .KR
- -----------
-
- This command will wait until the
- user is not holding either of the
- mouse buttons (or their equivalents)
- down, even if it takes all day.
-
-
- COPYMEM:(,start,end+1,destination)
- ----------------------------------
- COPY MEM: .CP,params
- SWAP MEM: .SW,params
- COPY I/O INTACT: .CI,params
- COPY CHR EXPOSED: .CC,params
-
- COPY MEM is the classic command.
- All ROMS are lifted and a raw memory
- transfer is performed. The speed:
- approximately 28 cycles per byte.
-
- SWAP MEM will swap the area of
- memory with that at the destination,
- at a rate of 41 cycles per byte.
-
- COPY I/O INTACT will lift the
- ROMS, but leave the $d000 area alone.
- This would be useful in copying the
- color RAM or the VIC-chip's settings.
-
- COPY CHAR EXPOSED will lift the
- ROMS, but expose the Character-ROM in
- the $d000 area so you can copy it.
-
- These routines all work under the
- protection of a SEI. When done, all
- ROMS are switched back in regardless
- of what location 1 held when called.
- In fact, this goes for all routines
- that switch out the ROMS.
-
- [Note:] Routines that operate under
- an SEI and may take over 1/60 of a
- second to complete, like STASH and
- COPYMEM, take a short break every so
- often to let the interrupt "pass by".
- While this isn't really important, it
- does keep the mouse moving fluidly
- even during large memory transfers.
-
-
- REGULAR MENU:
- .MU,x1,x2,y1,y2,u,h,"hotkeys"
- -----------------------------
-
- This command creates a highlight
- bar that moves in sync with the mouse
- pointer, until a selection is made.
- When an item is clicked on, SL% will
- return that "selection" number, which
- will be anywhere from 1 to 25.
-
- U is the color of unhighlighted
- items in the menu. The highlight bar
- is colored H. If you do not want the
- text to reverse or un-reverse as the
- bar moves, add 128 to H.
-
- You can also use the CRSR/RETURN
- keys instead of a mouse or joystick.
- In order to provide a more natural
- menu interface, the "Keyboard Enable"
- variable at MV+20 is temporarily
- zeroed during menus. The CRSR keys are
- then read manually to move the
- highlight bar, one move per press,
- like we're all used to.
-
- The HOTKEY string allows direct
- selection of menu items. For example,
- if you have hotkeys of "loadst*r", and
- the user presses "d", the fourth item
- is selected and the highlight bar is
- moved there. If there was no such
- item, SL% still returns a 4 but the
- highlight bar would not change.
-
- MENUS can have "regions active"
- without the need to POKE to MV+10 or
- MV+11. Clicking on an active region
- from a menu will return the region
- number (plus 128) in SL%. The HOTKEYS
- would return "region-like" values.
-
- The H+64 feature of menus will
- only work if "honor hotkey colors" is
- enabled. A HOTKEY COLOR is just ANY
- color within the text of a menu which
- is neither the highlight nor
- un-highlight color. That leaves you
- with 14 colors to make your menu's
- hotkeys stand out, and stay that way.
-
- Related Variables: (& defaults)
-
- MV+10 Menu Type (192)
- MV+12 Global Escape (0)
-
- MV+12 holds the ASCII code for
- what you'd like to designate as the
- escape key for ALL your menus. SL%
- returns a zero when the escape key is
- pressed, except in one instance...
-
- MV+10 dictates how your regular
- menus will behave. Each bit stands for
- a specific menu feature. Just add up
- the values for the features you want
- and POKE that number to MV+10.
-
- +128 Automatic Caging of Mouse
- + 64 Automatic Point-to-First
- + 32 Must Select
- + 16 Escape Equal-to-Last
- + 8 Honor Hotkey Colors
- + 4 Dual Response
- + 2 Un-highlight after Select
- + 1 Stray-to-Exit
-
- +128 causes the mouse to be confined
- within the menu's borders. After a
- selection is made, the previous
- cage is restored. If auto-caging
- is not enabled, the user may be
- able to click on the area outside
- of the menu, which would return
- zero in SL% (unless it is an
- active region).
-
- +64 causes the mouse to be put at
- the rightmost cell of the first
- item the instant a regular menu is
- called.
-
- +32 causes nothing to happen if the
- user clicks on the area outside of
- the menu. The menu remains active
- as it waits for a real selection.
-
- +16 causes the escape key, when
- pressed, to automatically select
- the last item in your menu - just
- as if you pressed its hotkey. This
- saves some code if "Close this
- Menu" is the last item in your
- menus - especially when using the
- ON GOTO command.
-
- +8 causes the highlight bar to not
- change the colors of characters
- that have neither the Highlight
- nor Un-highlight color applied to
- them.
-
- This is an interesting way to
- inform users of your menu's
- hotkeys. To use this feature
- properly, you must make sure the
- entire menu area is colored in the
- Un-hilight color, except for the
- hotkey-characters.
-
- Merely PRINTing your menu items
- and calling the menu won't work
- right on older versions of the
- KERNAL. The areas on the right
- sides of your items might be
- colored white, or have the cursor
- color or background color applied
- to them. It's best to use BOX to
- draw a rectangle of spaces, THEN
- print your menu items.
-
- +2 causes the highlight bar to be
- removed after a selection is made.
-
- +1 causes the menu to be aborted if
- the mouse strays from the menu
- area. SL% is returned as zero if
- this happens.
-
-
- TEXT INPUT:
- .IN,x,y,t,c,length,default$
- ---------------------------
-
- When called, the default string is
- printed at X,Y followed by a blinking
- cursor. The user can CRSR through the
- text, INSERT, DELETE, HOME, or CLR at
- will. Most normal characters are
- allowed, except for those fearsome
- quotation marks. The string is
- returned in W$.
-
- T is the text color and C is the
- cursor color. LENGTH is the maximum
- number of characters allowed, which
- cannot and will not exceed 80. The
- default string will be cut short if it
- exceeds the allowed LENGTH.
-
- A nice thing about this INPUT is
- that it automatically clears out the
- space it needs, which is handy for
- inputting over fields that might
- contain old data.
-
- If you want to input in REVERSE,
- add 128 to X. If you want to allow
- only numbers to be entered, add 128 to
- Y. If you want to allow numbers AND
- the decimal and minus symbols, add 192
- to Y.
-
- The Keyboard Enable variable at
- MV+20 is temporarily zeroed during the
- INPUT routine. It looks silly if the
- arrow pointer moves back and forth as
- you are CRSRing through the text.
-
- The Enhanced version (below) now
- also returns the cursor position (upon
- exit) in C%.
-
-
- ENHANCED INPUT:
- .IE,x,y,t,c,len,s,out$,def$
- ---------------------------
-
- Just like REGULAR INPUT, the
- default string is printed at X,Y. T is
- the text color and C is the cursor
- color. L is the maximum length
- allowed, which can not and will not
- exceed 80. The user can CRSR through
- the text, HOME, CLR, INSERT, and
- DELETE at will.
-
- If you want to input in REVERSE,
- add 128 to X. If you want to allow
- only numbers to be entered, add 128 to
- Y. If you want to allow numbers AND
- the decimal and minus symbols, add 192
- to Y.
-
- S is the STARTing location of the
- blinking cursor. For example, if S was
- 7, then the cursor would pop up over
- the 8th character of the default
- string. Why not the 7th? Well, zero is
- used to represent the leftmost (1st)
- character. If you positioned your
- INPUT against the left border, you'd
- see that S corresponds to the usual
- 0-39 Cell-X values.
-
- If S exceeds the length of the
- default string, the cursor would pop
- up right after the end of the default
- string. Since this string can never
- exceed 80 characters, any S value
- above 80 ensures the cursor will start
- off at its "normal" position at the
- end of the default string.
-
- OUT$ allows you to specify extra
- keys you want to act like RETURN. For
- example, you might have a list of
- figures and would like to be able to
- use CRSR UP/DOWN to move through each
- one, and then press F1 to signify when
- you're done altering the lot.
-
- The string is returned in W$. I%
- tells you WHICH exit-key was pressed.
- It is zero when RETURN is used, and
- any other value means that specific
- key from OUT$ was pressed to exit.
-
- Since the incoming keypresses are
- checked against OUT$ first, you could
- use CRSR LEFT, RIGHT, HOME, or ANY key
- to act as a special RETURN key. Of
- course, using LEFT and RIGHT as exit
- keys means they couldn't be used to
- move the blinking cursor within the
- current line of input. However, if you
- had a bunch of values in rows and
- columns, using all 4 CRSR keys to move
- through items would be handy!
-
-
- Don't touch that dial! Part 3 is
- chock full of good stuff!
-
-
-