[rescue] Sun ASIC Manuals

Malte Dehling mdehling at gmail.com
Thu Apr 28 17:28:20 EDT 2022


Hi Arno,

thanks a lot for the detailed explanation!  I wasn’t aware that the cg3 can
use other clock frequencies besides the ones for which it has oscillators
(which is just the two 1152x900 modes.)  This will be fun to play with!

In case you’re interested, I’ve included the full cg3 fcode exactly as
contained in the classic obp v2.12r53 at 0x1128c+0x0c5c below.  This let’s
you modify it, retokenize and produce a modified prom for the classic
should anyone wish to do so (and as long as you don’t increase the size of
the resulting binary!)

Cheers,
Malte

\ fd 03 4ffa 00000c5c
fcode-version1
hex

offset16

" cgthree" xdrstring " name" attribute " display" device-type

headers

: copyright ( 0800 )
    " Copyright (c) 1992 by Sun Microsystems, Inc. "
;

: sccsid ( 0801 )
    " @(#)s4cg3.fth 1.11 93/03/12"
;

-1 value my-sbus-addr ( 0802 )
-1 value clk-adr ( 0803 )
-1 value dac-adr ( 0804 )
-1 value /frame ( 0805 )
0 value display-width ( 0806 )
0 value display-height ( 0807 )
0 value romentry ( 0808 )
0 value clksel ( 0809 )
100000 is /frame

: s4dac-map ( 080a )
    my-sbus-addr 400000 + 20 map-sbus is dac-adr my-sbus-addr 1000 + 20
    map-sbus is clk-adr
;

: s4frame-map ( 080b )
    my-sbus-addr 800000 + /frame map-sbus is frame-buffer-adr
;

: s4video-map ( 080c )
    s4dac-map s4frame-map
;

: s4dac-unmap ( 080d )
    dac-adr 20 free-virtual -1 is dac-adr clk-adr 20 free-virtual -1 is
    dac-adr
;

: s4frame-unmap ( 080e )
    frame-buffer-adr /frame free-virtual -1 is frame-buffer-adr
;

: s4video-unmap ( 080f )
    s4frame-unmap s4dac-unmap
;

: status@ ( 0810 )
    dac-adr 11 + c@
;

: monitor-type@ ( 0811 )
    status@ 4 >> 7 and
;

: setclk ( 0812 )
    clk-adr c!
;

: clksetting ( 0813 )
    romentry setclk
;

: setreg ( 0814 )
    dac-adr + c!
;

: video-off ( 0815 )
    20 clksel or 10 setreg
;

: video-on ( 0816 )
    60 clksel or 10 setreg
;

-1 value toggle-colors? ( 0817 )

: setcolor ( 0818 )
    0 setreg swap rot 4 setreg 4 setreg 4 setreg
;

: s4video-blink-screen ( 0819 )
    video-off 20 ms video-on
;

: s4video-remove ( 081a )
    video-off s4video-unmap
;

: diag-type ( 081b )
    diagnostic-mode?
    if
        type cr
    else
        2drop
    then
;

: frame-test ( 081c )
    s4frame-map frame-buffer-adr /frame memory-test-suite s4frame-unmap
;

: s4video-selftest ( 081d )
    " Testing Sbus framebuffer" diag-type 0 display-status ffffffff mask !
    0 group-code ! version 20000 <
    if
        frame-buffer-adr 0= frame-buffer-adr -1 = or
        if
            frame-test
        else
            " A framebuffer is in use -- no test" diag-type 0
        then
    else
        frame-buffer-adr frame-test swap is frame-buffer-adr
    then
;

ff000000 value foregnd ( 081e )
ffffff value backgnd ( 081f )

: init-fore/background ( 0820 )
    backgnd lbsplit setcolor foregnd lbsplit setcolor
;

: init-colors ( 0821 )
    64 41 b4 1 setcolor ff h# 0 h# 0 2 setcolor ff ff h# 0 3 setcolor h# 0
    ff h# 0 4 setcolor h# 0 ff ff 5 setcolor h# 0 h# 0 ff 6 setcolor ff
    h# 0 ff 7 setcolor ff ff ff fe setcolor
;

: init-color-map ( 0822 )
    init-fore/background init-colors
;

: init-dac ( 0823 )
    4 0 setreg ff 8 setreg 5 0 setreg 0 8 setreg 6 0 setreg 70 8 setreg 7 0
    setreg 0 8 setreg
;

: oldsetcolor ( 0824 )
    setcolor
;

: setcolor ( 0825 )
    dup ff =
    if
        2over 2over bljoin is foregnd
    then
    dup 0=
    if
        2over 2over bljoin is backgnd
    then
    oldsetcolor
;

external

: r1024x768x60 ( 0826 )
    " 08,02,37,37,03,155,21,04,39,167,0,7,60,1024,768" " 1024-768-60"
    xdrstring " params" attribute
;

: r1024x768x70 ( 0827 )
    " 08,02,37,37,03,153,21,04,37,165,0,12,70,1024,768" " 1024-768-70"
    xdrstring " params" attribute
;

: r1024x768x77 ( 0828 )
    " 06,02,36,36,03,160,21,05,41,169,0,17,77,1024,768" " 1024-768-77"
    xdrstring " params" attribute
;

: r1152x900x66 ( 0829 )
    " 05,01,36,168,03,174,22,06,46,190,0,21,66,1152,900" " 1152x900-66"
    xdrstring " params" attribute
;

: r1152x900x76 ( 082a )
    " 10,02,43,175,03,179,12,04,43,187,0,26,76,1152,900" " 1152x900-76"
    xdrstring " params" attribute
;

: svga60 ( 082b )
    r1024x768x60
;

: svga70 ( 082c )
    r1024x768x70
;

: svga77 ( 082d )
    r1024x768x77
;

headers

: sense-code ( 082e )
    monitor-type@
    case
        7 of r1152x900x66 endof
        6 of r1152x900x76 endof
        5 of r1024x768x60 endof
        4 of r1152x900x76 endof
        3 of r1152x900x66 endof
        0 of r1024x768x77 endof
        drop r1152x900x66 0
    endcase
;

variable dpl ( 082f )

: compare-strings ( 0830 )
    rot tuck <
    if
        drop 2drop 0
    else
        comp 0=
    then
;

: long? ( 0831 )
    dpl @ 1 + 0<>
;

: convert ( 0832 )
    begin
        1 + dup >r c@ a digit
    while
        >r a * r> + long?
        if
            1 dpl +!
        then
        r>
    repeat
    drop r>
;

: number? ( 0833 )
    >r 0 r@ dup 1 + c@ 2d = dup >r - -1 dpl !
    begin
        convert dup c@ 2e =
    while
        0 dpl !
    repeat
    r>
    if
        swap negate swap
    then
    r> count + =
;

: number ( 0834 )
    number? drop
;

: /string ( 0835 )
    over min >r swap r@ + swap r> -
;

: +string ( 0836 )
    1 +
;

: -string ( 0837 )
    swap 1 + swap 1 -
;

: left-parse-string ( 0838 )
    >r over 0 2swap
    begin
        dup
    while
        over c@ r@ =
        if
            r> drop -string 2swap exit
        then
        2swap +string 2swap -string
    repeat
    2swap r> drop
;

: left-parse-string' ( 0839 )
    left-parse-string 2 pick 0=
    if
        2swap
    then
;

: cindex ( 083a )
    0 swap 2swap bounds
    ?do
        dup i c@ =
        if
            nip i -1 rot leave
        then
    loop
    drop
;

: right-parse-string ( 083b )
    >r 2dup + 0
    begin
        2 pick
    while
        over 1 - c@ r@ =
        if
            r> drop rot 1 - -rot exit
        then
        2swap 1 - 2swap swap 1 - swap 1 +
    repeat
    r> drop
;

100 alloc-mem constant tmp-monitor-string ( 083c )
100 alloc-mem constant tmp-pack-string ( 083d )
variable tmp-monitor-len ( 083e )

external

: monitor-string ( 083f )
    tmp-monitor-string tmp-monitor-len @
;

headers

: parse-line ( 0840 )
    f 0
    do
        2c left-parse-string tmp-pack-string pack dup number swap drop -rot
        dup 0=
        if
            leave
        then
    loop
    2drop
;

: cal-tim ( 0841 )
    is display-height is display-width xdrint " vfreq" attribute dup is
    romentry xdrint " romentry" attribute dup is clksel xdrint
    " oscillator" attribute 1e 14
    do
        i setreg
    loop
    ff 1e setreg h# 1 1f setreg
;

external

: update-string ( 0842 )
    2dup tmp-monitor-string swap move dup tmp-monitor-len !
;

headers

: set-fbconfiguration ( 0843 )
    update-string parse-line cal-tim
;

external

: set-resolution ( 0844 )
    $find
    if
        execute
    then
    set-fbconfiguration 8 dup xdrint " depth" attribute display-width * 8 /
    xdrint " linebytes" attribute display-width xdrint " width" attribute
    display-height xdrint " height" attribute
;

headers

: cg3-display-init ( 0845 )
    clksetting 200 ms init-dac init-color-map
;

: cg3-toggle-cursor ( 0846 )
    fb8-toggle-cursor toggle-colors?
    if
        init-fore/background
    then
;

external

: reinstall-console ( 0847 )
    display-width display-height over char-width / over char-height /
    fb8-install
;

headers

: cg3-install ( 0848 )
    default-font set-font s4video-map my-args dup 0<>
    if
        set-resolution
    else
        2drop tmp-monitor-len @ 0=
        if
            sense-code set-resolution
        else
            monitor-string set-resolution
        then
    then
    video-off c xdrint " cursorshift" attribute frame-buffer-adr xdrint
    " address" attribute reinstall-console
    ['] s4video-blink-screen is blink-screen
    ['] video-on is reset-screen cg3-display-init
    ['] cg3-toggle-cursor is toggle-cursor
;

: cg3-probe ( 0849 )
    my-address is my-sbus-addr my-sbus-addr my-space 1000000 reg 5 0 intr
    s4video-map monitor-type@ xdrint " monitor-sense" attribute sense-code
    set-resolution video-off cg3-display-init s4video-unmap
    ['] cg3-install is-install
    ['] s4video-remove is-remove
    ['] s4video-selftest is-selftest
;

cg3-probe

end0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sunhelp.org/pipermail/rescue_sunhelp.org/attachments/20220428/386f30c7/attachment-0001.html>


More information about the rescue mailing list