;z80 ;zx-spectrum ;assembler ; haiku (c) Gasman 2005 ; sine.asm: generate sine table - 256 steps, range 0x00 - 0x7f stack_a equ 0x2d28 fp_to_a equ 0x2dd5 mksine ld a,64 ; out (254),a ; a good opportunity to set the border to black call stack_a rst 0x28 db 0xc4 ;store 64 into mem 4 db 0xa3 ;push half-pi db 0x01 ;exchange db 0x05 ;divide (-> pi/128) db 0xc3 ;store pi/128 into mem 3 db 0x02 ;discard it (nice but unnecessary?) db 0xa0 ;push 0 db 0x38 ;return ld hl,sine sinelp push hl ; ld h,0x58 ; transform hl to an address in attribute memory, ; srl l ; for the progress bar ; srl l ; srl l ; ld (hl),39 ; print some green rst 0x28 db 0xe3 ;recall pi/128 db 0x0f ;add db 0x31 ;duplicate db 0x1f ;sine db 0xe4 ;recall 64 from mem 4 db 0xa1 ;push 1 db 0x03 ;subtract 1 to give 63 db 0x04 ;multiply db 0xe4 ;recall 64 again db 0x0f ;add again db 0x38 ;return call fp_to_a pop hl ld (hl),a inc l jr nz,sinelp