Includes the *HELP text itself - 1456 bytes (8.8%)


§1. Parse a *HELP command.

help.png

 The help command responds to "*HELP GRAPHICS" and "*HELP SPRITES" as well as just "*HELP"
.handleStarHelp = $8349
    PHA                                                 }
    TYA                                                 } remember A,Y
    PHA                                                 }
    JSR .getPrivateWorkspaceAddress                     
    JSR .OSNEWL                                         

    Print title string
    LDX #0                                              
-
    LDA .titleString,X                                  
    JSR .OSWRCH                                         
    INX                                                 
    CMP #0                                              print until zero byte
    BNE -                                               

    Check for parameter to *HELP
    LDA (.stringInputBufferAddressLow),Y                
    CMP #$0D                                            
    BNE .starHelpHasAParameter                          if (parameter found) then branch

    Print plain *HELP string to show items that can be *HELPed
    JSR .printInlineCounted                             display following message
    !byte 23                                            length of message to print
    !text "  Graphics",.charLF,.charCR                  
    !text "  Sprites",.charLF,.charCR                   

    JMP .exitRestoringAXY                               

.starHelpHasAParameter = $8383
    TYA                                                 
    PHA                                                 remember Y
    LDX #.graphicsNameTable - .commandNameTable         point to start of graphics name table
    JSR .checkForCommandMatch                           
    BNE .checkForStarHelpSpritesCommand                 if (not *HELP GRAPHICS) then branch

    Show GXR On / Off state, and flood On / Off state
    LDA .privateWorkspaceHigh                           
    BNE .gotWorkspace                                   if (got workspace) then branch

    JSR .printInlineCounted                             display following message
    !byte 9                                             length of message to print
    !text "  GXR Off"                                   
    JMP .afterFloodMessage                              

.gotWorkspace = $83a0
    JSR .printInlineCounted                             display following message
    !byte 16                                            length of message to print
    !text "  GXR On, Flood "                            
    LDY #.workspaceOffsetOptions                        
    LDA (.privateWorkspaceLow),Y                        
    AND #$C0                                            
    BNE .floodIsOn                                      if (workspace[options] has bit 6 or
                                                        7 set) then branch

    Flood is off
    JSR .printInlineCounted                             display following message
    !byte 3                                             length of message to print
    !text "Off"                                         
    JMP .afterFloodMessage                              

.floodIsOn = $83c6
    JSR .printInlineCounted                             display following message
    !byte 2                                             length of message to print
    !text "On"                                          

.afterFloodMessage = $83cc
    JSR .OSNEWL                                         
    JSR .OSNEWL                                         print two newlines [NOTE: These
                                                        could be in the help text, saving 2
                                                        bytes]
    LDX #<.graphicsHelpText                             
    LDY #>.graphicsHelpText                             
    JSR .printHelpYX                                    print graphics help

.checkForStarHelpSpritesCommand = $83d9
    PLA                                                 
    TAY                                                 recall Y
    LDX #.spritesNameTable - .commandNameTable          
    JSR .checkForCommandMatch                           
    BEQ +                                               if (found match) then branch
    JMP .exitRestoringAXY                               no match. finish up.

+
    LDA .privateWorkspaceHigh                           
    BEQ .printSpritesHelp                               

    Show sprite status / memory
    Print "  Sprite status"
    JSR .OSNEWL                                         
    LDX #<.spriteStatusText                             
    LDY #>.spriteStatusText                             
    JSR .printHelpYX                                    

    LDY #.workspaceOffsetSpritePages                    
    LDA (.privateWorkspaceLow),Y                        
    PHA                                                 
    LDX #0                                              
    JSR .printNumberA                                   

    JSR .printInlineCounted                             display following message
    !byte 25                                            length of message to print
    !text " page(s) sprite w/s",.charCR,.charLF,"    "  

    PLA                                                 
    BEQ .printSpritesHelp                               

    JSR .getFreeSpace                                   

    LDA .vduTempStoreDE                                 
    LDX .vduTempStoreDF                                 
    JSR .printNumberXA                                  

    JSR .printInlineCounted                             display following message
    !byte 19                                            length of message to print
    !text " byte(s) free",.charCR,.charLF,"    "        

    LDY #.workspaceOffsetNumberOfSprites                
    LDA (.privateWorkspaceLow),Y                        get number of sprites
    JSR .printNumberA                                   print number

    JSR .printInlineCounted                             display following message
    !byte 20                                            length of message to print
    !text " sprite(s) defined",.charCR,.charLF          

.printSpritesHelp = $845d
    JSR .OSNEWL                                         

    LDX #<.spritesHelpText                              
    LDY #>.spritesHelpText                              
    JSR .printHelpYX                                    

.exitRestoringAXY = $8467
    LDX .currentlySelectedROM                           recall X
    PLA                                                 }
    TAY                                                 } recall Y and A
    PLA                                                 }
    RTS                                                 

§2. graphicsHelpText.

.graphicsHelpText = $846d
    !text "  GXR commands"                      ,$0D    
    !text "GXR"                                 ,$0D    
    !text "NOGXR"                               ,$0D    
    !text "FLOOD"                               ,$0D    
    !text "NOFLOOD"                             ,$0D    
    !text $0D                                           
    !text $08,$08,"Plot codes"                  ,$0D    
    !text "00 Line"                             ,$0D    
    !text "08 Line (LPO)"                       ,$0D    
    !text "10 Dot-dash (R)"                     ,$0D    
    !text "18 Dot-dash (R,LPO)"                 ,$0D    
    !text "20 Line (FPO)"                       ,$0D    
    !text "28 Line (BEO)"                       ,$0D    
    !text "30 Dot-dash (C,FPO)"                 ,$0D    
    !text "38 Dot-dash (C,BEO)"                 ,$0D    
    !text $0D                                           
    !text "40 Point"                            ,$0D    
    !text "48 Fill L&R to Non-bg"               ,$0D    
    !text "50 Triangle"                         ,$0D    
    !text "58 Fill R to bg"                     ,$0D    
    !text "60 Rectangle"                        ,$0D    
    !text "68 Fill L&R to fg"                   ,$0D    
    !text "70 Parallelogram"                    ,$0D    
    !text "78 Fill R to Non-fg"                 ,$0D    
    !text $0D                                           
    !text "80 Flood to Non-bg"                  ,$0D    
    !text "88 Flood to fg"                      ,$0D    
    !text "90 Circle outline"                   ,$0D    
    !text "98 Circle fill"                      ,$0D    
    !text "A0 Circular arc"                     ,$0D    
    !text "A8 Circular segment"                 ,$0D    
    !text "B0 Circular sector"                  ,$0D    
    !text "B8 Block copy/move"                  ,$0D    
    !text $0D                                           
    !text "C0 Ellipse outline"                  ,$0D    
    !text "C8 Ellipse fill"                     ,$0D    
    !text "D0"                                  ,$0D    
    !text "D8"                                  ,$0D    
    !text "E0"                                  ,$0D    
    !text "E8 Sprite plot"                      ,$0D    
    !text "F0"                                  ,$0D    
    !text "F8"                                  ,$0D    
    !text $0D                                           
    !text $08,$08,"Set dot-dash repeat length"  ,$0D    
    !text "*FX 163,242,k : k=0,1-64"            ,$0D    
    !text $0D                                           
    !text $08,$08,"Define patterns"             ,$0D    
    !text "VDU 23,k,b,b,b,b,b,b,b,b with k="    ,$0D    
    !text "2,3,4,5 : full setting"              ,$0D    
    !text "6       : dot-dash line"             ,$0D    
    !text "11      : default setting"           ,$0D    
    !text "12,13,14,15 : simple setting"        ,$0D    
    !text $0D                                           
    !text "VDU 23,27,0,n,0;0;"                ,$0D    ;
    !text "  Choose sprite n for plotting"      ,$0D    
    !text "VDU 23,27,1,n,0;0;"                ,$0D    ;
    !text "  Get sprite n from screen"          ,$0D    
    !text $0D                                           
    !text $08,$08,"Select colour pattern"       ,$0D    
    !text "GCOL a,c"                            ,$0D    
    !text "a<16 solid colour c"                 ,$0D    
    !text "a=16-21 : pattern 1"                 ,$0D    
    !text "a=32-37 : pattern 2"                 ,$0D    
    !text "a=48-53 : pattern 3"                 ,$0D    
    !text "a=64-69 : pattern 4"                 ,$0D    
    !byte 0                                             

§3. spriteStatusText.

.spriteStatusText = $882d
    !text "  Sprite status"                     ,$0D    
    !byte 0                                             

§4. spritesHelpText.

.spritesHelpText = $883e
    !text "  Sprite commands"                   ,$0D    
    !text "SSPACE n"                            ,$0D    
    !text "SCHOOSE n"                           ,$0D    
    !text "SDELETE n"                           ,$0D    
    !text "SEDIT n"                             ,$0D    
    !text "SEDIT n,m"                           ,$0D    
    !text "SGET n"                              ,$0D    
    !text "SLOAD filename"                      ,$0D    
    !text "SMERGE filename"                     ,$0D    
    !text "SNEW"                                ,$0D    
    !text "SRENUMBER n,m"                       ,$0D    
    !text "SSAVE filename"                      ,$0D    
    !byte 0                                             

§5. Print a help message.

.printHelpYX = $88c8
    STX .vduTempStoreDA                                 } store YX in tempStoreDA/DB
    STY .vduTempStoreDB                                 }
    LDY #0                                              Y=0 throughout this routine
-
    LDA .vduTempStoreDA                                 }
    PHA                                                 }
    LDA .vduTempStoreDB                                 } remember tempStoreDA/DB
    PHA                                                 }

    LDA (.vduTempStoreDA),Y                             get next character
    CMP #.charCR                                        
    BNE +                                               if (not carriage return) then branch

    JSR .OSNEWL                                         print newline
    LDA #' '                                            }
    JSR .OSWRCH                                         }
    JSR .OSWRCH                                         } indent by three spaces
    JSR .OSWRCH                                         } [NOTE: could be a string, using
                                                        } .printInlineCounted]
+
    JSR .OSWRCH                                         print character

    PLA                                                 }
    STA .vduTempStoreDB                                 } restore tempStoreDA/DB
    PLA                                                 }
    STA .vduTempStoreDA                                 }
    JSR .incTempStoreDADB                               move pointer on to next character

    LDA (.vduTempStoreDA),Y                             check for terminator
    BNE -                                               if (terminator not found) then
                                                        branch back
    RTS