This is a table of contents of the sample source code contained in this file. Feel free to make use of the code contained here for use in your own commands. This helps save time, instead of trying to invent something that has already been done for you. Just use GeoWrite to cut and paste any of these examples into your own source code.
BLANKING AND RESTORING THE 40 COLUMN SCREEN 2
RstrWindow 2
BlnkWMessage 3
BlnkNMessage 4
SENDING DATA TO THE PRINTER 5
InitPrinter 6
ByteToPrinter 7
COLORING THE 80 COLUMN SCREEN 8
Coloring Icons (example) 8
CloseCommand (example) 8
icnClrScrap 9
icnClrCombos 9
DoColorFrame 10
GIVE geoSHELL COLOR IN 40 COLUMNS 11
Color40 11
Add40R0 (used with Color40) 12
SEARCHING THE COMMAND BUFFER 13
FindSkip 13
IncR0 14
;here is the code that will call the routines to blank the 40 column
;screen and restore them after your command finishes it's task.
;This method puts a messag
;here is the code that will call the routines to blank the 40 column
;screen and restore them after your command finishes it's task.
;This method puts a message on the bottom of the 40 column screen and
;also deals with proper handling if the routine is run on an 80 column 128.
;You will be able to use memory from $a000 to $bdff.
;If you need the additional 320 bytes that the message on the bottom uses,
;then use BlnkNMessage in place of BlnkWMessage. BlnkNMessage can be found
;on the following page. Be sure to call RstrWindow before exiting your command.
;Also, test your command for anything that might happen while the screen is
;blanked. You must be able to call RstrWindow to get the window back on the
;screen for the user.
... ;any code ahead of this...
jsr BlnkWMessage ;blank the screen with a message
;at the bottom.
jsr DoYourThing ;this calls your own code.
jsr RstrWindow ;put the geoSHELL window back.
... ;any more additional code....
RstrWindow:
jsr StartMouseMode ;turn the mouse back on.
bit screenmode ;is this 80 column mode?
bmi 50$ ;branch if so. (80 columns didn't blank)
jsr ClearScreen ;clear the screen.
jsr ReDoWindow ;redraw the window and it's contents.
;this is all taking place while the
;screen is still blanked, until we
jsr FixColors ;put the color back on the screen.
jmp R_Icons ;do this because the icon gets killed.
;this routine blanks the 40 column screen and displays a message at the
;bottom. If in 80 column mode, it will put the same message in the
;geoSHELL window since the screen does not have to be blanked. The message
;will also be placed in the 40 column window in addition to the bottom of
;the screen.
BlnkWMessage:
jsr ClearMouseMode ;shut the mouse off for now.
LoadW r0,#prgrsText ;point at our message.
lda #(IN_ONE|TR_CR)
jsr OtherMessage ;put it on 40 or 80 columns.
bit screenmode ;now check for 80 columns.
bmi 20$ ;branch if so and skip the rest.
LoadW r0,#(24*40) ;blank only the upper 24 card rows.
LoadW r1,#COLOR_MATRIX
lda screencolors ;get the current screencolors.
and #%00001111 ;put the background color into
sta r2L
asl a
asl a
asl a
asl a
ora r2L ;the foreground also.
sta r2L
jsr FillRam ;and color the screen.
PushB windowBottom ;make sure that PutString can
LoadB windowBottom,#199 ;get down to the bottom of the screen.
LoadW r0,#prgrs40Text ;point r0 for PutString.
jsr PutString ;use GEOS to print this string.
PopB windowBottom ;restore this.
rts ;and return.
prgrs40Text:
.byte GOTOXY
.word 24 ;start printing at the 24th pixel.
;adjust this for the length of
;your message.
.byte 198
;put your message here, but leave a leading and trailing space in
;the message so that the background pattern doesn't brush up against
;the message, for a better appearance.
prgrsText:
.byte " Put Your Message Here... ",0
;this routine blanks the 40 column screen and allows you to use the
;entire foreground screen memory area since this routine does not
;put a message at the bottom of the screen.
;80 column mode is still dealt with properly here. The message in this
;routine will only appear in the window on both the 40 and 80 column screens
;and not at the bottom of the screen like it does with BlnkWMessage.
BlnkNMessage:
jsr ClearMouseMode ;shut the mouse off for now.
LoadW r0,#prgrsText ;point at our message.
lda #(IN_ONE|TR_CR)
jsr OtherMessage ;put it on 40 or 80 columns.
bit screenmode ;now check for 80 columns.
bmi 20$ ;branch if so and skip the rest.
LoadW r0,#(25*40) ;blank the entire screen.
LoadW r1,#COLOR_MATRIX
lda screencolors ;get the current screencolors.
and #%00001111 ;put the background color into
sta r2L
asl a
asl a
asl a
asl a
ora r2L ;the foreground also.
sta r2L
jsr FillRam ;and color the screen.
rts ;and return.
prgrsText:
.byte "Put Your Message Here...",0
;These routines will allow you to send data to a printer whether it
;be connected through the serial port or the user port with a geoCable.
;Just let InitPrinter and ByteToPrinter know which device y
;These routines will allow you to send data to a printer whether it
;be connected through the serial port or the user port with a geoCable.
;Just let InitPrinter and ByteToPrinter know which device you want data
;sent to. This example uses a variable printDest to identify that. If
;bit 7 is set, data goes to serial, bit 6 set goes to geoCable. If both
;bits are set, data goes to both. The following example will load printDest
;from a parameter the user supplies and proceed to do it's thing.
;One thing to keep in mind with using the printer: If you are sending text
;to a printer and also displaying the same text on the screen using
;geoSHELL routines, the user will get double copies of the data on the
;printer if he is using the @p or @g commands. Normally, your use of the
;printer won't involve sending the same text to the screen anyway.
... ;code leading up to this.
lda ParamTable+0
cmp #'p'
beq 10$
cmp #'g'
beq 20$
jmp MissgFilename ;display a bad parameter.
lda #%10000000
.byte $2c
lda #%01000000
sta printDest
... ;whatever else code you might have.
jsr InitPrinter ;make sure the printer is there.
bit goodflag ;if the printer is not available
;you can deal with it however you wish.
;in this case we will just exit.
bmi 30$ ;branch if printer is ready.
jmp NoMoreCmds ;you might display an error message
;before this exit if needed.
jsr InitForIO
... ;whatever routines you need to load
... ;the accumulator will go here.
... ;usually from a buffer.
jsr ByteToPrinter ;send the byte in the accumulator
;to the printer.
... ;now you either go back and do
... ;some more or just end your command.
jsr Unlsn ;in case we're using the serial printer.