?login_element?

Subversion Repositories NedoOS

Rev

Rev 1764 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.     module ScreenViewer
  2. PGT EQU 0               ; начало таблицы шаблонов screen2
  3. CT EQU #2000
  4. display:
  5.  
  6.         ld a,2                  ; screen2
  7.         call CHGMOD
  8.     ;ld hl,MSX1paletteData
  9.         ;call set_palette_registre
  10.  
  11.         ld hl,outputBuffer
  12.         ld ix,outputBuffer + 0x2000
  13.  
  14.         ld a,3                  ; 3 сегмента экрана
  15. loop3:
  16.         ex af,af'
  17.         push hl
  18.         ld c,0                 
  19. loop256:
  20.         ld b,8
  21.         push hl
  22. loop8:
  23.         ld a,(hl)
  24.         ld (ix+0),a
  25.         ld de,#0100
  26.         add hl,de
  27.         inc ix
  28.         djnz loop8
  29.         pop hl
  30.         inc hl
  31.         dec c
  32.         jr nz,loop256
  33.         pop hl
  34.         ld de,2048
  35.         add hl,de
  36.         ex af,af'
  37.         dec a
  38.         jr nz,loop3
  39.  
  40.         ld hl,outputBuffer + 0x2000
  41.         ld de,PGT
  42.         ld bc,6144
  43.         call LDIRVM
  44.        
  45.         ;jr keywait
  46.  
  47.         ld bc,768
  48.         ld hl,outputBuffer+6144
  49.         ld de,outputBuffer + 0x2000
  50. colorloop2:
  51.         push bc
  52.         ld b,8
  53.         ld a,(hl)
  54.         call convertpalete
  55. colorloop1:
  56.         ld (de),a
  57.         inc de
  58.         djnz colorloop1
  59.         inc hl
  60.         pop bc
  61.         dec bc
  62.         ld a,b
  63.         or c
  64.         jr nz,colorloop2
  65.  
  66.         ld hl,outputBuffer + 0x2000
  67.         ld de,CT
  68.         ld bc,6144
  69.         call LDIRVM
  70.  
  71. keywait:       
  72.         RST #30                 ; Читает один символ из буфера клавиатуры. Если буфер пуст,
  73.         db 0                    ; выводит курсор и ждет нажатия клавиши.
  74.         dw #009F                ; CHGET A = код символа      
  75.  
  76.         xor a                   ; screen0
  77.         call CHGMOD
  78.     call TextMode.loadFont
  79.     call TextMode.init
  80.     jp History.back
  81.         ret
  82. convertpalete:
  83.         push hl
  84.         push de
  85.         push bc
  86.         ld b,a
  87.         and #07
  88.         ld hl,colors0
  89.         bit 6,b
  90.         jr z,col0
  91.         ld hl,colors1
  92. col0:
  93.         ld d,0
  94.         ld e,a
  95.         add hl,de
  96.         ld a,(hl)
  97.         and a
  98.         rlca
  99.         rlca
  100.         rlca
  101.         rlca
  102.         ld c,a
  103.         ld a,b
  104.         rrca
  105.         rrca
  106.         rrca
  107.         and #07
  108.         ld hl,colors0
  109.         bit 6,b
  110.         jr z,col00
  111.         ld hl,colors1
  112. col00:
  113.         ld d,0
  114.         ld e,a
  115.         add hl,de
  116.         ld a,(hl)
  117.         or c
  118.         pop bc
  119.         pop de
  120.         pop hl
  121.         ret
  122.  
  123. calcxy:
  124.         ld a,e
  125.         and #18
  126.         or #40
  127.         ld h,a
  128.         ld a,e
  129.         and #07
  130.         rrca
  131.         rrca
  132.         rrca
  133.         add a,d
  134.         ld l,a
  135.         ret
  136. ;-----------------------------------------------------------------------------------
  137. ; Routine to set colors palette MSX1 like
  138.  
  139. VDP_DW  equ     #00007
  140. RG16SAV equ     #FFEF
  141.  
  142. MSX1palette:
  143.         ld      a,(VDP_DW)
  144.         ld      c,a             ; C= CPU port connected to the VDP writing port #1
  145.  
  146.         xor     a               ; Set color 0 ...
  147.         di
  148.         out     (c),a
  149.         ld      (RG16SAV),a
  150.         ld      a,#80+16        ; ...into register 16 (+80h)
  151.         out     (c),a
  152.         ei
  153.  
  154.         inc     c               ; C= CPU port connected to the VDP writing port #2
  155.         ld      b,31
  156.         ld      hl,MSX1paletteData
  157.         otir
  158.         ret
  159.  
  160. set_palette_registre:
  161.         xor a
  162.         out (#99),a             ; номер регистра цвета
  163.         ld a,#90                ; reg 16(#10) +7бит=1(запись)
  164.         nop
  165.         out (#99),a
  166.         ld a,16                 ; сколько регистров
  167.         ld c,#9A                ; Color Palette Register
  168. set_palette_loop:
  169.         outi                    ; SET RED BLUE
  170.         outi                    ; SET GREEN
  171.         dec a
  172.         jr nz, set_palette_loop
  173.         ret
  174.  
  175. MSX1paletteData:
  176.         db      00h,0   ; Color 0
  177.         db      00h,0   ; Color 1
  178.         db      11h,5   ; Color 2
  179.         db      33h,6   ; Color 3
  180.         db      26h,2   ; Color 4
  181.         db      37h,3   ; Color 5
  182.         db      52h,2   ; Color 6
  183.         db      27h,6   ; Color 7
  184.         db      62h,2   ; Color 8
  185.         db      63h,3   ; Color 9
  186.         db      52h,5   ; Color A
  187.         db      63h,6   ; Color B
  188.         db      11h,4   ; Color C
  189.         db      55h,2   ; Color D
  190.         db      55h,5   ; Color E
  191.         db      77h,7   ; Color F
  192. ;----------------------------------------------------------------------------------
  193.  
  194. WRTVRM:
  195.         rst #30
  196.         db 0           
  197.         dw #004D               
  198.         ret
  199. LDIRVM:                         ; копирует блок данных из RAM в VRAM
  200.         RST #30
  201.         db 0
  202.         dw #005C
  203.         ret
  204. CHGMOD:
  205.         rst #30
  206.         db 0
  207.         dw #005F
  208.         ret
  209.  
  210. colors0:
  211.         db #01,#04,#08,13,#02,7,10,14
  212. colors1:
  213.         db #01,#05,#09,13,#03,7,11,15
  214.     endmodule