SHARE
TWEET

full screen STACKDRAW (2/3 of frame)

vito-Z80 Jun 5th, 2020 (edited) 916 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     device zxspectrum128
  2. ; Author: Serdjuk
  3. ; Assembly: sjasmplus
  4. spAddr: equ endProgram + 200
  5. sSP:    equ endCode
  6.     org #8000
  7. begin:
  8.     ld sp,spAddr
  9.     call sin
  10.     ld a,#1d
  11.     call setBank
  12.     ld hl,#D800
  13.     ld de,#D801
  14.     ld bc,767
  15.     ld (hl),5
  16.     push bc
  17.     ldir
  18.     xor #0a
  19.     call setBank
  20.     pop bc
  21.     ld (hl),5
  22.     dec de
  23.     dec de
  24.     lddr
  25. repeat:
  26.     ei
  27.     halt
  28. autoBank:  
  29.     ld a,#17
  30.     xor #0a
  31.     ld (autoBank+1),a
  32.     call setBank
  33.     call showVerticalLines
  34.     jr repeat
  35. ;----------------------------------------------------
  36. setBank:
  37.     ld bc,#7ffd
  38.     out (c),a
  39.     ret
  40. ;----------------------------------------------------
  41. sin:
  42.     ld hl,sinTable
  43.     exx
  44.     LD ix,bitTable
  45.     LD DE,#61bc  ;32700
  46.     LD HL,#FF77  ;K*SIN
  47. GENSIN0
  48.     LD A,D
  49.     ld b,a
  50.     ld c,1
  51.     and 7
  52. moveBit:
  53.     rlc c
  54.     dec a
  55.     jr nz,moveBit
  56.     LD (IX),c
  57.     ld a,b
  58.     exx
  59.     ld (hl),a
  60.     inc l
  61.     exx
  62.     RLA
  63.     SBC A,A
  64.     LD B,A,C,D
  65.     adc HL,BC ;tweaking
  66.     RR C
  67.     RRCA
  68.     RR C
  69.     ADD HL,BC
  70.     LD B,H,A,L
  71.     ex DE,HL
  72.     SRA B
  73.     RRA
  74.     SRA B
  75.     RRA
  76.     SRA B
  77.     RRA
  78.     LD C,A
  79.      ;OR A
  80.     SBC HL,BC
  81.     ex DE,HL
  82.     INC LX
  83.     jr nz,GENSIN0
  84.     ret
  85. showVerticalLines:
  86.     ld hl,sinTable
  87.     inc l
  88.     ld (showVerticalLines+1),hl
  89.     ld l,(hl)
  90.     dec h
  91.     ld (sSP),sp
  92.     ld sp,#C000+#1800
  93.     ld e,3
  94. full:
  95.     ld a,l
  96.     add 64-8
  97.     ld l,a
  98.  
  99.     ld d,8
  100. part:
  101.     ld a,l
  102.     sub 63
  103.     ld l,a
  104.     ld a,8
  105. line:
  106.     ex af,af
  107.     ld a,l
  108.     add 8
  109.     ld l,a
  110.     ex af,af
  111.     ld b,(hl)
  112.     ld c,b
  113.     dup 16
  114.     push bc
  115.     edup
  116.     dec a
  117.     jr nz,line
  118.     dec d
  119.     jr nz,part
  120.     dec e
  121.     jr nz,full
  122.     ld sp,(sSP)
  123.     ret
  124. ;-----------------------------------------------------
  125. endCode:   
  126.     align 256
  127. bitTable:
  128.     block 256,0
  129. sinTable:
  130.     block 256,0
  131. endProgram: equ $
  132.     display "begin address: ",/A, begin
  133.     display "code length: ",/A, endCode-begin
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top