home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / MRFiles / GS3DVPAK.ARC / COLOR80SRC (.txt) < prev    next >
Encoding:
GEOS ConVerT  |  2019-04-13  |  13.6 KB  |  466 lines

  1. Color80src
  2. PRG formatted GEOS file V1.0
  3. CONVERTED WITH GEOSHELL V2.2
  4. Write Image V2.1
  5. geoWrite    V2.1
  6. ;*****************************************
  7. ;    Color80src
  8. ; transient command source code. This command
  9. ; may be used to set the screen colors while using
  10. ; geoSHELL in 80 column mode.
  11. ;    Copyright 1994 by Maurice Randall
  12. ;    Charlotte, Mich. 48813
  13. ;    For Use Only By Registered Owners Of The
  14. ;    geoSHELL Programmer's Development Package
  15. ;*****************************************
  16. .if    Pass1
  17. .noglbl
  18. .noeqin
  19. .include    geosSym
  20. .include    geosMac
  21. .eqin
  22. .glbl
  23. .endif
  24.     .psect
  25. Color80:
  26.     bit    screenmode    ;what mode are we in?
  27.     bmi    10$    ;branch if 80 columns.
  28.     bvc    5$    ;branch if 128-40.
  29.     jmp    Mode_64    ;handle the 64.
  30.     jmp    Mode_40_128    ;handle the 128-40.
  31.     jmp    Mode_80_128    ;go for it.
  32. ;a few equates are defined here.
  33. lftmonlocation    = 10
  34. uppmonlocation    = 48
  35. lftsquare    = 44
  36. topsquare    = 48
  37. toptext        = topsquare+6
  38. ;color selections are stored here.
  39. tempBackground:
  40.     .block    1
  41. tempShell:
  42.     .block    1
  43. tempText:
  44.     .block    1
  45. tempPad:
  46.     .block    1
  47. tempBorder:
  48.     .block    1
  49. ;tell the 64 user that this command only works in 128 mode.
  50. Mode_64:
  51.     jsr    Only128
  52.     jmp    NoMoreCmds    ;this was in the original source.
  53.             ;Only128 now jumps thro
  54. ;tell the 64 user that this command only works in 128 mode.
  55. Mode_64:
  56.     jsr    Only128
  57.     jmp    NoMoreCmds    ;this was in the original source.
  58.             ;Only128 now jumps through NoMoreCmds
  59.             ;making this step unnecessary.
  60. ;tell the user that this command only works in 80 column mode.
  61. Mode_40_128:
  62.     LoadW    r0,#only80text
  63.     lda    #(IN_THREE|TR_CR)
  64.     jsr    OtherMessages
  65.     jmp    NoMoreCmds
  66. only80text:
  67.     .byte    "This is an 80 column command!",0
  68. onlycolortext:
  69.     .byte    "Issue the RGB command first!",0
  70. MonitorPic:
  71. MonPicWidth = picW
  72. MonPicHeight = picH
  73. SolidSquare:
  74. squarewidth = picW
  75. squareheight = picH
  76. EmptySquare:
  77. ;there is a real icon here. It is actually
  78. ;a blank photo scrap.
  79. BlankSquare:
  80. MonitorPic:
  81. MonPicWidth = picW
  82. MonPicHeight = picH
  83. SolidSquare:
  84. squarewidth = picW
  85. squareheight = picH
  86. EmptySquare:
  87. ;there is a real icon here. It is actually
  88. ;a blank photo scrap.
  89. BlankSquare:
  90. Mode_80_128:
  91.     bit    videomode    ;are we in color mode?
  92.     bmi    10$    ;branch if so.
  93.     LoadW    r0,#onlycolortext
  94.     lda    #(IN_THREE|TR_CR)
  95.     jsr    OtherMessages    ;tell the user to use RGB mode.
  96.     jmp    NoMoreCmds    ;and exit.
  97.     ldx    #0
  98. Mode_80_128:
  99.     bit    videomode    ;are we in color mode?
  100.     bmi    10$    ;branch if so.
  101.     LoadW    r0,#onlycolortext
  102.     lda    #(IN_THREE|TR_CR)
  103.     jsr    OtherMessages    ;tell the user to use RGB mode.
  104.     jmp    NoMoreCmds    ;and exit.
  105.     ldx    #0
  106.     lda    backcolor,x    ;move the current colors
  107.     sta    tempBackground,x    ;to a temporary storage area.
  108.     cpx    #5
  109.     bne    20$
  110.     jsr    unsetPrompt    ;eliminate the cursor blink.
  111. ;at this point we will set our own colors for color80 independently
  112. ;of those that may already be set.
  113.     LoadB    brdrcolor,#LT80GREY
  114.     jsr    SetBrdrColor    ;change the border color.
  115.     LoadB    backcolor,#LT80GREY ;set the background color.
  116.     LoadB    textcolor,#BLACK80 ;set the text color.
  117.     jsr    ClearScreen    ;now ClearScreen will use our new colors.
  118.     jsr    i_BitmapUp    ;display the picture of the monitor.
  119.     .word    MonitorPic
  120.     .byte    lftmonlocation
  121.     .byte    uppmonlocation
  122.     .byte    MonPicWidth
  123.     .byte    MonPicHeight
  124.     jsr    SetColTable    ;color the little monitor.
  125.     jsr    SetIcons    ;set up our own icons.
  126.     jsr    AddText    ;display neccessary text to the screen.
  127.     jsr    DispColors    ;display the color bar.
  128.     rts        ;exit to main loop and let GEOS
  129.             ;get user input for the icons.
  130. SetIcons:
  131.     LoadW    r0,#IconTable
  132.     jsr    DoIcons    ;point GEOS to our little icons.
  133.     LoadW    otherPressVector,#$00 ;make sure this is zero'd for
  134.             ;this command. (geoSHELL leaves the
  135.             ;mouse running)
  136.     jsr    MouseOff
  137.     LoadB    mouseBottom,#168    ;keep the mouse off the lower part
  138.             ;of the screen. Or it will do
  139.             ;funny things to the screen.
  140.     jmp    MouseUp
  141. IconTable:
  142.     .byte    22
  143.     .word    0
  144.     .byte    0
  145. IconPointer:
  146.     .word    SolidSquare
  147.     .byte    lftsquare
  148.     .byte    topsquare
  149.     .byte    squarewidth
  150.     .byte    squareheight
  151.     .word    DoColorSource
  152.     .word    EmptySquare
  153.     .byte    lftsquare
  154.     .byte    topsquare+16
  155.     .byte    squarewidth
  156.     .byte    squareheight
  157.     .word    DoColorSource
  158.     .word    EmptySquare
  159.     .byte    lftsquare
  160.     .byte    topsquare+32
  161.     .byte    squarewidth
  162.     .byte    squareheight
  163.     .word    DoColorSource
  164.     .word    EmptySquare
  165.     .byte    lftsquare
  166.     .byte    topsquare+48
  167.     .byte    squarewidth
  168.     .byte    squareheight
  169.     .word    DoColorSource
  170.     .word    EmptySquare
  171.     .byte    lftsquare
  172.     .byte    topsquare+64
  173.     .byte    squarewidth
  174.     .byte    squareheight
  175.     .word    DoColorSource
  176.     .word    EmptySquare
  177.     .byte    lftsquare
  178.     .byte    topsquare+80
  179.     .byte    squarewidth
  180.     .byte    squareheight
  181.     .word    DoExit
  182. ;the icon table from the previous page continues here.
  183. ColorIcons:
  184.     .word    BlankSquare
  185.     .byte    16,152,3,8
  186.     .word    DoCBar
  187.     .word    BlankSquare
  188.     .byte    19,152,3,8
  189.     .word    DoCBar
  190.     .word    BlankSquare
  191.     .byte    22,152,3,8
  192. ;the icon table from the previous page continues here.
  193. ColorIcons:
  194.     .word    BlankSquare
  195.     .byte    16,152,3,8
  196.     .word    DoCBar
  197.     .word    BlankSquare
  198.     .byte    19,152,3,8
  199.     .word    DoCBar
  200.     .word    BlankSquare
  201.     .byte    22,152,3,8
  202.     .word    DoCBar
  203.     .word    BlankSquare
  204.     .byte    25,152,3,8
  205.     .word    DoCBar
  206.     .word    BlankSquare
  207.     .byte    28,152,3,8
  208.     .word    DoCBar
  209.     .word    BlankSquare
  210.     .byte    31,152,3,8
  211.     .word    DoCBar
  212.     .word    BlankSquare
  213.     .byte    34,152,3,8
  214.     .word    DoCBar
  215.     .word    BlankSquare
  216.     .byte    37,152,3,8
  217.     .word    DoCBar
  218.     .word    BlankSquare
  219.     .byte    40,152,3,8
  220.     .word    DoCBar
  221.     .word    BlankSquare
  222.     .byte    43,152,3,8
  223.     .word    DoCBar
  224.     .word    BlankSquare
  225.     .byte    46,152,3,8
  226.     .word    DoCBar
  227.     .word    BlankSquare
  228.     .byte    49,152,3,8
  229.     .word    DoCBar
  230.     .word    BlankSquare
  231.     .byte    52,152,3,8
  232.     .word    DoCBar
  233.     .word    BlankSquare
  234.     .byte    55,152,3,8
  235.     .word    DoCBar
  236.     .word    BlankSquare
  237.     .byte    58,152,3,8
  238.     .word    DoCBar
  239.     .word    BlankSquare
  240.     .byte    61,152,3,8
  241.     .word    DoCBar
  242. ;this routine just puts the text on the screen that you see when
  243. ;this routine just puts the text on the screen that you see when
  244. ;you execute color80. GEOS PutString is used for this.
  245. AddText:
  246.     jsr    i_PutString
  247.     .word    8*lftsquare+48
  248.     .byte    toptext
  249.     .byte    "Background Color"
  250.     .byte    GOTOXY
  251.     .word    8*lftsquare+48
  252.     .byte    toptext+16
  253.     .byte    "Shell Color"
  254.     .byte    GOTOXY
  255.     .word    8*lftsquare+48
  256.     .byte    toptext+32
  257.     .byte    "Text Color"
  258.     .byte    GOTOXY
  259.     .word    8*lftsquare+48
  260.     .byte    toptext+48
  261.     .byte    "Pad Color"
  262.     .byte    GOTOXY
  263.     .word    8*lftsquare+48
  264.     .byte    toptext+64
  265.     .byte    "Border Color"
  266.     .byte    GOTOXY
  267.     .word    8*lftsquare+48
  268.     .byte    toptext+80
  269.     .byte    "Exit",0
  270. ;here's where we draw the colorbar that is near the bottom.
  271. DispColors:
  272.     jsr    i_FrameRectangle    ;first build a fra
  273. ;here's where we draw the colorbar that is near the bottom.
  274. DispColors:
  275.     jsr    i_FrameRectangle    ;first build a frame around the area.
  276.     .byte    151
  277.     .byte    160
  278.     .word    127
  279.     .word    512
  280.     .byte    255
  281.     lda    textcolor    ;put the text color into the
  282.     asl    a    ;high nybble.
  283.     asl    a
  284.     asl    a
  285.     asl    a
  286.     ldx    #0
  287.     sta    cbarColors,x    ;and build a table of colors
  288.     clc        ;with each possible background
  289.     adc    #1    ;color in the low nybble.
  290.     inx        ;we're building the table because
  291.     cpx    #16    ;textcolor can vary.
  292.     bne    10$
  293.     LoadW    r0,#cbarTable    ;use a geoSHELL routine to put the
  294.     LoadW    r1,#cbarColors    ;colorbar colors on the screen.
  295.     jsr    ColorScreen
  296.             ;originally, some more code was
  297.             ;going in here, that's why the jsr
  298.             ;followed by an rts.
  299. ;this is a table of compressed bytes that ColorScreen recognizes.
  300. ;refer to the appendix and the ColorScreen routine for info on
  301. ;how this works. You might call this table a 'color scrap'.
  302. cbarTable:
  303.     .byte    19,16    ;start at row 19, column 16.
  304.     .byte    1    ;do the next
  305.     .byte    16    ;16 commands one time.
  306.     .byte    3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7
  307.     .byte    3,8,3,9,3,10,3,11,3,12,3,13,3,14,3,15
  308.     .byte    0    ;a zero command ends the scrap.
  309. ;this is a table of color combinations that ColorScreen reads
  310. ;to use with the compressed bytes above. This table is constructed above.
  311. cbarColors:
  312.     .block    16
  313. colorsource:        ;identifies the area that is currently
  314.     .block    1    ;selected, such as 'Border Color'.
  315. ;this is jumped to when the user clicks on one of the area icon
  316. colorsource:        ;identifies the area that is currently
  317.     .block    1    ;selected, such as 'Border Color'.
  318. ;this is jumped to when the user clicks on one of the area icons.
  319. DoColorSource:
  320.     MoveB    r0L,colorsource    ;GEOS sets r0L. We save it here.
  321.     jsr    ClearSquares    ;make all the icons point to an
  322.             ;empty icon picture.
  323.     lda    colorsource
  324.     asl    a
  325.     asl    a
  326.     asl    a
  327.     jsr    SetSquare    ;set one pointer to the icon
  328.             ;that has been clicked on.
  329.     jmp    SetIcons    ;and let GEOS redraw the icons.
  330. ;this is jumped to when the user clicks on 'exit'.
  331. DoExit:
  332.     ldx    #0
  333.     lda    tempBackground,x    ;put all selected colors into
  334.     sta    backcolor,x    ;the table that geoSHELL sees.
  335.     cpx    #5
  336.     bne    10$
  337.     jsr    ClearScreen    ;clear the entire screen.
  338.     jsr    ReDoWindow    ;and get the geoSHELL window back.
  339.     jsr    R_Icons    ;make sure the default icon is set.
  340.     jmp    ExitCommand    ;and exit cleanly.
  341. ;point all icons in the table at an empty square.
  342. ClearSquares:
  343.     ldx    #0
  344.     lda    #[EmptySquare
  345.     sta    IconPointer,x
  346.     lda    #]EmptySquare
  347.     sta    IconPointer+1,x
  348.     adc    #8
  349.     cpx    #40
  350.     bcc    10$
  351. ;point the desired icon at a solid square.
  352. SetSquare:
  353.     lda    #[SolidSquare
  354.     sta    IconPointer,x
  355.     lda    #]SolidSquare
  356.     sta    IconPointer+1,x
  357. ;when the user clic
  358. ;when the user clicks on a color in the colorbar, GEOS jumps here.
  359. DoCBar:
  360.     lda    r0L
  361.     sbc    #6
  362.     ldx    colorsource    ;get the current area that we will change.
  363.     sta    tempBackground,x    ;and store the color there.
  364.     jsr    SetColTable    ;this should have been made to just
  365.     rts        ;jump through to the next routine.
  366. ;here is where we change the colors on the color80 screen as the
  367. ;user selects a different color for a certain area. This will
  368. ;alter the color table that ColorScreen will use when it colors
  369. ;the little monitor that is drawn on the screen.
  370. SetColTable:
  371.     lda    tempBorder
  372.     asl    a
  373.     asl    a
  374.     asl    a
  375.     asl    a
  376.     ora    tempBackground
  377.     sta    ColMon0
  378.     lda    tempShell
  379.     asl    a
  380.     asl    a
  381.     asl    a
  382.     asl    a
  383.     ora    tempPad
  384.     sta    ColMon1
  385.     lda    tempText
  386.     asl    a
  387.     asl    a
  388.     asl    a
  389.     asl    a
  390.     ora    tempPad
  391.     sta    ColMon2
  392.     LoadW    r0,#ColMonTable    ;point r0
  393.     LoadW    r1,#ColMon0    ;and r1
  394.     jmp    ColorScreen    ;and recolor the little monitor.
  395. ;this is the color scrap that is used to color the little monitor.
  396. ColMo
  397. ;this is the color scrap that is used to color the little monitor.
  398. ColMonTable:
  399.     .byte    uppmonlocation/8+1
  400.     .byte    lftmonlocation+2
  401.     .byte    1,4
  402.     .byte    27,0,53,255,3,0,21,1
  403.     .byte    3,6
  404.     .byte    3,0,53,255,3,0,1,1,19,2,1,1
  405.     .byte    1,9
  406.     .byte    3,0,53,255,3,0,21,1,3,0,53,255,27,0,53,255,27,0
  407.     .byte    0
  408. ;and this is the table of colors that is used with the color scrap
  409. ;for the little monitor.
  410. ;for this we only need three different color combinations to 
  411. ;color the little monitor on the screen.
  412. ;this table is built as the user clicks on the colorbar.
  413. ColMon0:
  414.     .block    1
  415. ColMon1:
  416.     .block    1
  417. ColMon2:
  418.     .block    1
  419. DDD@!! 
  420. ta    ColMon0
  421.     lda    tempShell
  422.     asl    a
  423.     asl    a
  424.     asl    a
  425.     asl    a
  426.     ora    tempPad
  427.     sta    ColMon1
  428.     lda    tempText
  429.     asl    a
  430.     asl    a
  431. ta    ColMon0
  432.     lda    tempShell
  433.     asl    a
  434.     asl    a
  435.     asl    a
  436.     asl    a
  437.     ora    tempPad
  438.     sta    ColMon1
  439.     lda    tempText
  440.     asl    a
  441.     asl    a
  442.     asl    a
  443.     asl    a
  444.     ora    tempPad
  445.     sta    ColMon2
  446.     LoadW    r0,#ColMonTable    ;point r0
  447.     LoadW    r1,#ColMon0    ;and r1
  448. ta    ColMon0
  449.     lda    tempShell
  450.     asl    a
  451.     asl    a
  452.     asl    a
  453.     asl    a
  454.     ora    tempPad
  455.     sta    ColMon1
  456.     lda    tempText
  457.     asl    a
  458.     asl    a
  459.     asl    a
  460.     asl    a
  461.     ora    tempPad
  462.     sta    ColMon2
  463.     LoadW    r0,#ColMonTable    ;point r0
  464.     LoadW    r1,#ColMon0    ;and r1
  465.     jmp    Colo
  466.