?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. objectsData:    ; moved from variables since this part of the program is used only 1 time at start !!! takes 344 bytes, 320 is required!
  2. ;       Concurso juegos ASM 2021
  3.         module TITLE_2
  4. run:
  5.         ld a,1
  6.         call clearAttributes
  7.         call clearScreen
  8.  
  9.         ld hl,path
  10.         ld (pathAddress),hl
  11.         ld a,#80
  12.         ld (byteValue),a
  13.         ld hl,#5900
  14.         ld de,#5901    
  15.         ld bc,#ff
  16.         ld (hl),e
  17.         ldir
  18.         call process
  19. ;-------------------------------------------------------------
  20.         ld hl,#0406
  21.         ld (textColor),hl
  22.         ld de,#5028
  23.         ld hl,text
  24.         call printText2x1
  25. aPoint:
  26.         ld hl,#4242
  27.         ld (#5942),hl
  28.         ld hl,#4842
  29.         ld a,%00001111
  30.         ld c,%11110000
  31.         ld b,8
  32. .aP:
  33.         ei
  34.         halt
  35.         ld (hl),a
  36.         inc l
  37.         ld (hl),c
  38.         dec l
  39.         inc h
  40.         djnz .aP
  41.         call waitAnyKey
  42.         ld a,SYSTEM.MAIN_MENU_INIT
  43.         ret
  44. ;-------------------------------------------------------------
  45. process:
  46.         ld ix,(pathAddress)
  47.         ld b,8
  48.         ld a,(byteValue)        ; top-left bit
  49.         cp %11111111            ; full byte
  50.         jr nz,.loop - 1
  51.         inc ix
  52.         ld (pathAddress),ix     ; next address of path
  53.         dec ix
  54.         ld c,a
  55. .loop:
  56.         ei
  57.         halt
  58.         halt
  59. ;       halt
  60.         ld a,(ix)               ; get cell (symbol)
  61.         or a
  62.         ret z
  63.         push bc
  64.         call .fillPath
  65.         pop bc
  66.         ld a,c
  67.         rrca
  68.         jr z,.fin
  69.         or c
  70.         ld c,a
  71.         djnz .loop
  72. .fin:
  73.         ld a,(byteValue)
  74.         ld c,a
  75.         rrca
  76.         or c
  77.         ld (byteValue),a
  78.         jr process
  79.  
  80. .fillPath:
  81.         ld a,(ix)
  82.         inc ix
  83.         or a
  84.         ret z
  85.         ld l,a
  86.         ld b,c
  87.         ld h,#48
  88.         call .symbol
  89.         ld c,b
  90.         sla c
  91.         jr nz,.fillPath
  92.         ret
  93. .symbol:
  94.         ld a,h
  95.         cpl
  96.         and 7
  97.         add #48         ; high byte of second third
  98.         ld d,a
  99.         ld e,l
  100.         push hl
  101.         ld a,c
  102. ; reverse bits in A
  103. ; 17 bytes / 66 cycles
  104. ; Posted by John Metcalf
  105. ; http://www.retroprogramming.com/2014/01/fast-z80-bit-reversal.html
  106.         ld l,a    ; a = 76543210
  107.         rlca
  108.         rlca      ; a = 54321076
  109.         xor l
  110.         and 0xAA
  111.         xor l     ; a = 56341270
  112.         ld l,a
  113.         rlca
  114.         rlca
  115.         rlca      ; a = 41270563
  116.         rrc l     ; l = 05634127
  117.         xor l
  118.         and 0x66
  119.         xor l     ; a = 01234567
  120. ; end of reverse bits in A
  121.         ld l,a
  122.         ld a,(de)
  123.         or l
  124.         ld (de),a
  125.         pop hl
  126.         ld a,(hl)
  127.         or c
  128.         ld (hl),a
  129.         inc h
  130.         sla c
  131.         ret z
  132.         jr .symbol
  133. ; template:
  134. ;       db 0,1,1,1,1,0,1,1,1,1,1,1,0,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,0
  135. ;       db 0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,0
  136. ;       db 0,1,1,1,1,0,1,1,1,1,0,0,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,0,1,0
  137. ;       db 0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0
  138. ;       db 0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0
  139. ;       db 0,1,0,0,1,1,1,1,1,1,0,1,0,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1
  140. ;       db 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  141. ;       db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  142.  
  143.         ; addresses of low byte screen symbol (cell)
  144. path:
  145.         db 161,129,97,65,33,1,2,3,4,36,68,100,132,164                   ; A
  146.         db 165,166,167,168,169,137,105,73,72,71,70,38,6,7,8,9,10,11     ; S
  147.         db 44,77,46,15,47,79,111,143,175                                ; M
  148.         db 179,178,177,145,113,81,82,83,51,19,18,17                     ; 2
  149.         db 21,53,85,117,149,181,182,183,151,119,87,55,23,22,21          ; 0
  150.         db 25,26,27,59,91,90,89,121,153,185,186,187                     ; 2
  151.         db 189,190,191,158,126,94,62,30,61                              ; 1
  152.         ; bottom line + piece of M
  153.         db 255,254,253,252,251,250,249,248,247,246,245,244,243,242,241,240
  154.         db 239,238,237,236,235,203,234,171,233,139,232,107,231,230,229,228,227,226,225
  155.         db 0    ; end of path
  156. text:
  157.         db "Concurso juegos ASM 2021",TEXT_END
  158.  
  159.         display "TITLE code may used after start program !!!"
  160.         display "TITLE start address: ",/A,run
  161.         display "TITLE code length: ",/A,$ - run
  162.         endmodule