1 ; **************************************************************************** 2 ; line7.s - TRDOS 386 (TRDOS v2.0.3) Test Program - 'sysvideo' pixel tests 3 ; ---------------------------------------------------------------------------- 4 ; 5 ; 20/02/2021 6 ; 7 ; **************************************************************************** 8 ; nasm line7.s -l line7.txt -o LINE7.PRG -Z error.txt 9 ; (modified from 'circle5.s', 15/02/2021) 10 11 ; Draw line by using 'sysvideo' bx=0305h 12 13 ; 14/07/2020 14 ; 31/12/2017 15 ; TRDOS 386 (v2.0) system calls 16 _ver equ 0 17 _exit equ 1 18 _fork equ 2 19 _read equ 3 20 _write equ 4 21 _open equ 5 22 _close equ 6 23 _wait equ 7 24 _create equ 8 25 _rename equ 9 26 _delete equ 10 27 _exec equ 11 28 _chdir equ 12 29 _time equ 13 30 _mkdir equ 14 31 _chmod equ 15 32 _rmdir equ 16 33 _break equ 17 34 _drive equ 18 35 _seek equ 19 36 _tell equ 20 37 _memory equ 21 38 _prompt equ 22 39 _path equ 23 40 _env equ 24 41 _stime equ 25 42 _quit equ 26 43 _intr equ 27 44 _dir equ 28 45 _emt equ 29 46 _ldrvt equ 30 47 _video equ 31 48 _audio equ 32 49 _timer equ 33 50 _sleep equ 34 51 _msg equ 35 52 _geterr equ 36 53 _fpstat equ 37 54 _pri equ 38 55 _rele equ 39 56 _fff equ 40 57 _fnf equ 41 58 _alloc equ 42 59 _dalloc equ 43 60 _calbac equ 44 61 _dma equ 45 62 63 %macro sys 1-4 64 ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 65 ; 03/09/2015 66 ; 13/04/2015 67 ; Retro UNIX 386 v1 system call. 68 %if %0 >= 2 69 mov ebx, %2 70 %if %0 >= 3 71 mov ecx, %3 72 %if %0 = 4 73 mov edx, %4 74 %endif 75 %endif 76 %endif 77 mov eax, %1 78 ;int 30h 79 int 40h ; TRDOS 386 (TRDOS v2.0) 80 %endmacro 81 82 ; Retro UNIX 386 v1 system call format: 83 ; sys systemcall (eax) , , 84 85 [BITS 32] ; We need 32-bit intructions for protected mode 86 87 [ORG 0] 88 89 START_CODE: 90 ; clear bss 91 00000000 BF[BC070000] mov edi, bss_start 92 00000005 B90C020000 mov ecx, (bss_end - bss_start)/4 93 ;xor eax, eax 94 0000000A F3AB rep stosd 95 96 ; program message 97 0000000C BE[82030000] mov esi, program_msg 98 00000011 E89D010000 call print_msg 99 100 00000016 30E4 xor ah, ah 101 ;int 16h ; KEYBOARD - READ CHAR FROM BUFFER, WAIT IF EMPTY 102 ; Return: AH = scan code, AL = character 103 00000018 CD32 int 32h ; TRDOS 386 Keyboard interrupt 104 105 ;; Set Video Mode to 13h 106 ;sys _video, 0813h 107 ;cmp eax, 14h 108 ;je short mode_13h_set_ok 109 110 ; set VGA mode by using int 31h 111 0000001A 66B81300 mov ax, 13h ; mode 13h ; 112 0000001E CD31 int 31h ; real mode: int 10h 113 ;jmp short mode_13h_set_ok 114 115 mode_13h_set_ok: 116 ; Set inital values for angle and hypotenuse 117 00000020 B82D000000 mov eax, 45 118 00000025 C605[BE070000]2D mov byte [angle], 45 119 0000002C B08E mov al, 142 120 ;mov [hipotenus], al ; 142 121 ; Set start point of line(s) 122 0000002E C605[C8070000]A0 mov byte [_x0], 160 123 00000035 C605[CC070000]96 mov byte [_y0], 150 124 ; Set initial color 125 0000003C C605[C0070000]1C mov byte [color], 28 126 _new_line_1: 127 00000043 A2[C4070000] mov [hipotenus], al 128 _new_line_2: 129 00000048 A0[BE070000] mov al, [angle] 130 _new_line_3: 131 ; al = angle 132 0000004D E8FD020000 call getcosinus ; get cosine value * 16777216 for angle in AL 133 ; eax= cos(angle) * 16777216 134 00000052 E81A030000 call getxy 135 00000057 A3[D0070000] mov [_x1], eax ; projection of end point on x-axis 136 0000005C A0[BE070000] mov al, [angle] 137 00000061 E8D5020000 call getsinus ; get sine value * 16777216 for angle in AL 138 ; eax= sin(angle) * 16777216 139 00000066 E806030000 call getxy 140 0000006B A3[D4070000] mov [_y1], eax ; projection of end point on y-axis 141 _0: 142 00000070 E84F010000 call drawline 143 waitforkey: 144 00000075 B401 mov ah, 1 145 00000077 CD32 int 32h 146 00000079 7419 jz short getkey 147 0000007B FE05[BC070000] inc byte [counter] 148 00000081 90 nop 149 00000082 90 nop 150 00000083 90 nop 151 00000084 EBEF jmp short waitforkey 152 153 terminate: 154 00000086 E8F0020000 call set_text_mode 155 sys _exit 155 <1> 155 <1> 155 <1> 155 <1> 155 <1> %if %0 >= 2 155 <1> mov ebx, %2 155 <1> %if %0 >= 3 155 <1> mov ecx, %3 155 <1> %if %0 = 4 155 <1> mov edx, %4 155 <1> %endif 155 <1> %endif 155 <1> %endif 155 0000008B B801000000 <1> mov eax, %1 155 <1> 155 00000090 CD40 <1> int 40h 156 halt: 157 00000092 EBFE jmp short halt 158 159 getkey: 160 00000094 30E4 xor ah, ah 161 00000096 CD32 int 32h 162 163 00000098 663D032E cmp ax, 2E03h 164 0000009C 74E8 je short terminate 165 0000009E 3C1B cmp al, 1Bh ; ESC key 166 000000A0 74E4 je short terminate 167 168 000000A2 3C2B cmp al, '+' 169 000000A4 7512 jne short _1 170 171 000000A6 A0[C4070000] mov al, [hipotenus] 172 173 000000AB 3C8E cmp al, 142 174 000000AD 734D jnb short _3_ ; beep 175 176 ; delete line by drawing black line 177 ; with same length and with same x,y position 178 000000AF E856020000 call blackline 179 ; increase length of the line 180 000000B4 FEC0 inc al 181 000000B6 EB8B jmp short _new_line_1 ; draw with new length 182 _1: 183 000000B8 3C2D cmp al, '-' 184 000000BA 7515 jne short _2 185 186 000000BC A0[C4070000] mov al, [hipotenus] 187 188 000000C1 3C03 cmp al, 3 189 000000C3 7637 jna short _3_ ; beep 190 191 ; delete line by drawing black line 192 ; with same length and with same x,y position 193 000000C5 E840020000 call blackline 194 ; decrease length of the line 195 000000CA FEC8 dec al 196 000000CC E972FFFFFF jmp _new_line_1 ; draw with new length 197 _2: 198 000000D1 3C20 cmp al, 20h ; space 199 000000D3 7509 jne short _3 200 000000D5 8005[C0070000]08 add byte [color], 8 201 000000DC EB92 jmp short _0 202 _3: 203 000000DE 80FC4B cmp ah, 4Bh 204 000000E1 7523 jne short _4 205 ; left arrow 206 000000E3 803D[BE070000]B4 cmp byte [angle], 180 207 000000EA 73F2 jnb short _3 208 000000EC E819020000 call blackline ; clear current position 209 000000F1 FE05[BE070000] inc byte [angle] 210 000000F7 E94CFFFFFF jmp _new_line_2 211 _3_: 212 000000FC E828020000 call beep 213 00000101 E96FFFFFFF jmp waitforkey 214 _4: 215 00000106 80FC4D cmp ah, 4Dh 216 00000109 7519 jne short _5 217 ; right arrow 218 0000010B 803D[BE070000]00 cmp byte [angle], 0 219 00000112 76CA jna short _3 220 00000114 E8F1010000 call blackline ; clear current position 221 00000119 FE0D[BE070000] dec byte [angle] 222 0000011F E924FFFFFF jmp _new_line_2 223 _5: 224 00000124 80FC50 cmp ah, 50h 225 00000127 751F jne short _7 226 ; down arrow 227 00000129 A0[BE070000] mov al, [angle] 228 0000012E 2C05 sub al, 5 229 00000130 7707 ja short _6 230 00000132 E8F2010000 call beep 231 00000137 30C0 xor al, al ; 0 232 _6: 233 00000139 E8CC010000 call blackline ; clear current position 234 0000013E A2[BE070000] mov [angle], al 235 00000143 E905FFFFFF jmp _new_line_3 236 _7: 237 00000148 80FC48 cmp ah, 48h 238 0000014B 7514 jne short _8 239 ; up arrow 240 0000014D A0[BE070000] mov al, [angle] 241 00000152 0405 add al, 5 242 00000154 3CB4 cmp al, 180 243 00000156 72E1 jb short _6 244 00000158 E8CC010000 call beep 245 0000015D B0B4 mov al, 180 246 0000015F EBD8 jmp short _6 247 _8: 248 00000161 80FC47 cmp ah, 47h ; Home key 249 00000164 7504 jne short _9 250 00000166 28C0 sub al, al ; 0 ; set angle to 0 degree 251 00000168 EBCF jmp short _6 252 _9: 253 0000016A 80FC4F cmp ah, 4Fh ; End key 254 0000016D 7504 jne short _10 255 0000016F B0B4 mov al, 180 ; set angle to 180 degrees 256 00000171 EBC6 jmp short _6 257 _10: 258 00000173 663D0D1C cmp ax, 1C0Dh 259 00000177 7509 jne short _11 260 00000179 8005[C0070000]04 add byte [color], 4 261 00000180 EB22 jmp short _13 262 _11: 263 00000182 80FC53 cmp ah, 53h ; INSERT 264 00000185 741D je short _13 265 00000187 80FC52 cmp ah, 52h ; DEL 266 0000018A 7418 je short _13 267 268 0000018C 80FC49 cmp ah, 49h ; Page UP 269 0000018F 7508 jne short _12 270 00000191 FE0D[C0070000] dec byte [color] 271 00000197 EB0B jmp short _13 272 _12: 273 00000199 80FC51 cmp ah, 51h ; Page Down 274 0000019C 7510 jne short _14 275 0000019E FE05[C0070000] inc byte [color] 276 _13: 277 000001A4 E880010000 call beep 278 000001A9 E9C2FEFFFF jmp _0 279 _14: 280 000001AE E9C2FEFFFF jmp waitforkey 281 282 print_msg: 283 000001B3 B40E mov ah, 0Eh 284 000001B5 BB07000000 mov ebx, 7 285 ;mov bl, 7 ; char attribute & color 286 p_next_chr: 287 000001BA AC lodsb 288 000001BB 08C0 or al, al 289 000001BD 7404 jz short p_retn ; retn 290 000001BF CD31 int 31h 291 000001C1 EBF7 jmp short p_next_chr 292 p_retn: 293 000001C3 C3 retn 294 295 drawline: 296 ; INPUT: 297 ; [_x0] 298 ; [_y0] 299 ; [_x1] 300 ; [_y1] 301 ; [sin] 302 ; [cos] 303 ; [color] 304 ; 305 ; Modified registers: esi, edi, eax, ecx, ebx, edx 306 307 _draw_l_0: 308 000001C4 31C9 xor ecx, ecx 309 000001C6 890D[D8070000] mov [_x2], ecx ; 0 ; reset 310 000001CC 890D[DC070000] mov [_y2], ecx ; 0 ; reset 311 000001D2 890D[E8070000] mov [pixelcount], ecx ; reset 312 000001D8 A0[D0070000] mov al, [_x1] 313 000001DD 3A05[D4070000] cmp al, [_y1] 314 000001E3 7302 jnb short _draw_l_x0 315 ; base axis is y-axis 316 000001E5 EB7F jmp _draw_l_y0 317 _draw_l_x0: 318 ; base axis is x-axis 319 ; draw line from x = 0 to [_x1] 320 ; set y by using x*([sin]/[cos]) 321 ; cl = 0 322 ;mov byte [prevy], cl ; previous Y value 323 000001E7 E8D7000000 call writepixel 324 000001EC 8A0D[DC070000] mov cl, [_y2] 325 _draw_l_x1: 326 000001F2 A1[D8070000] mov eax, [_x2] 327 000001F7 FEC0 inc al 328 000001F9 3A05[D0070000] cmp al, [_x1] 329 000001FF 7747 ja short _draw_l_x3 330 00000201 A2[D8070000] mov [_x2], al 331 00000206 8B15[E0070000] mov edx, [sin] 332 0000020C F7E2 mul edx 333 0000020E 8B1D[E4070000] mov ebx, [cos] 334 00000214 F7F3 div ebx 335 00000216 A3[DC070000] mov [_y2], eax 336 0000021B 88C5 mov ch, al 337 0000021D FEC1 inc cl 338 0000021F 38E9 cmp cl, ch ; previous Y+1 < current Y ? 339 ;jnb short _draw_l_x0 340 00000221 EBC4 jmp short _draw_l_x0 341 00000223 FE0D[D8070000] dec byte [_x2] 342 _draw_l_x2: 343 00000229 880D[DC070000] mov [_y2], cl 344 0000022F E88F000000 call writepixel 345 00000234 FEC1 inc cl 346 00000236 38E9 cmp cl, ch ; loop end for [_y2] 347 00000238 72EF jb short _draw_l_x2 348 0000023A 882D[DC070000] mov [_y2], ch 349 00000240 FE05[D8070000] inc byte [_x2] 350 00000246 EB9F jmp short _draw_l_x0 351 352 _draw_l_x3: 353 _draw_l_y3: 354 writeline: 355 ;mov edx, [pixelcount] 356 ; edx = pixel count 357 ; esi = user's single color pixel buffer address 358 00000248 BE[EC070000] mov esi, _fx 359 sys _video, 0305h, [color], [pixelcount] 359 <1> 359 <1> 359 <1> 359 <1> 359 <1> %if %0 >= 2 359 0000024D BB05030000 <1> mov ebx, %2 359 <1> %if %0 >= 3 359 00000252 8B0D[C0070000] <1> mov ecx, %3 359 <1> %if %0 = 4 359 00000258 8B15[E8070000] <1> mov edx, %4 359 <1> %endif 359 <1> %endif 359 <1> %endif 359 0000025E B81F000000 <1> mov eax, %1 359 <1> 359 00000263 CD40 <1> int 40h 360 361 00000265 C3 retn 362 363 _draw_l_y0: 364 ; base axis is y-axis 365 ; draw line from y = 0 to [_y1] 366 ; set x by using y*([cos]/[sin]) 367 ; cl = 0 368 369 ;mov byte [prevx], cl ; previous X value 370 00000266 E858000000 call writepixel 371 0000026B 8A0D[D8070000] mov cl, [_x2] 372 _draw_l_y1: 373 00000271 A1[DC070000] mov eax, [_y2] 374 00000276 FEC0 inc al 375 00000278 3A05[D4070000] cmp al, [_y1] 376 0000027E 77C8 ja short _draw_l_y3 377 00000280 A2[DC070000] mov [_y2], al 378 ;mov edx, [cos] 379 ;mul edx 380 00000285 F725[E4070000] mul dword [cos] 381 ;mov ebx, [sin] 382 ;div ebx 383 0000028B F735[E0070000] div dword [sin] 384 00000291 A3[D8070000] mov [_x2], eax 385 00000296 88C5 mov ch, al 386 00000298 FEC1 inc cl 387 0000029A 38E9 cmp cl, ch ; previous X+1 < current X ? 388 ;jnb short _draw_l_y0 389 0000029C EBC8 jmp short _draw_l_y0 390 0000029E FE0D[DC070000] dec byte [_y2] 391 _draw_l_y2: 392 000002A4 880D[D8070000] mov [_x2], cl 393 000002AA E814000000 call writepixel 394 000002AF FEC1 inc cl 395 000002B1 38E9 cmp cl, ch ; loop end for [_y2] 396 000002B3 72EF jb short _draw_l_y2 397 000002B5 882D[D8070000] mov [_x2], ch 398 000002BB FE05[DC070000] inc byte [_y2] 399 000002C1 EBA3 jmp short _draw_l_y0 400 401 writepixel: 402 ; write pixel to line buffer (of user) 403 ; Modified registers: eax, ebx, edx 404 000002C3 A1[CC070000] mov eax, [_y0] ; 150 405 000002C8 2B05[DC070000] sub eax, [_y2] ; max. 142 406 000002CE BA40010000 mov edx, 320 407 000002D3 F7E2 mul edx 408 000002D5 0305[C8070000] add eax, [_x0] ; 160 409 ; center of the screen 410 000002DB 803D[BE070000]5A cmp byte [angle], 90 411 000002E2 7608 jna short wp_1 412 wp_0: 413 000002E4 2B05[D8070000] sub eax, [_x2] ; negative direction 414 000002EA EB06 jmp short wp_2 415 wp_1: 416 000002EC 0305[D8070000] add eax, [_x2] ; positive direction 417 wp_2: 418 000002F2 8B1D[E8070000] mov ebx, [pixelcount] 419 000002F8 C1E302 shl ebx, 2 ; * 4 420 000002FB 81C3[EC070000] add ebx, _fx ; line buffer 421 00000301 8903 mov [ebx], eax 422 00000303 FF05[E8070000] inc dword [pixelcount] 423 00000309 C3 retn 424 425 blackline: 426 0000030A 50 push eax 427 0000030B 30C0 xor al, al 428 0000030D 8605[C0070000] xchg [color], al ; color = 0 429 00000313 A2[BF070000] mov [pcolor], al 430 00000318 E82BFFFFFF call writeline 431 0000031D A0[BF070000] mov al, [pcolor] 432 00000322 A2[C0070000] mov [color], al ; restore color 433 00000327 58 pop eax 434 00000328 C3 retn 435 436 beep: 437 ; call beep function (16/64 second, 886Hz) 438 sys _audio, 16, 1331 438 <1> 438 <1> 438 <1> 438 <1> 438 <1> %if %0 >= 2 438 00000329 BB10000000 <1> mov ebx, %2 438 <1> %if %0 >= 3 438 0000032E B933050000 <1> mov ecx, %3 438 <1> %if %0 = 4 438 <1> mov edx, %4 438 <1> %endif 438 <1> %endif 438 <1> %endif 438 00000333 B820000000 <1> mov eax, %1 438 <1> 438 00000338 CD40 <1> int 40h 439 0000033A C3 retn 440 441 getsinus: 442 ; Input: 443 ; AL = angle 444 ; output: 445 ; EAX = sin(angle) * 16777216 446 ; 447 ; Modified registers: eax, esi 448 ; 449 0000033B 0FB6F0 movzx esi, al 450 0000033E C1E602 shl esi, 2 ; * 4 451 00000341 81C6[E7040000] add esi, sinustable 452 00000347 8B06 mov eax, [esi] 453 00000349 A3[E0070000] mov [sin], eax 454 0000034E C3 retn 455 456 getcosinus: 457 ; Input: 458 ; AL = angle 459 ; output: 460 ; EAX = cos(angle) * 16777216 461 ; 462 ; Modified registers: eax, esi 463 464 0000034F 3C5A cmp al, 90 ; 90 degrees 465 00000351 7209 jb short gcos_1 466 00000353 2C5A sub al, 90 467 00000355 BE[E7040000] mov esi, cos_90 468 0000035A EB05 jmp short gcos_2 469 gcos_1: 470 0000035C BE[4F060000] mov esi, cos_0 471 gcos_2: 472 00000361 0FB6C0 movzx eax, al 473 00000364 C1E002 shl eax, 2 ; * 4 474 00000367 01C6 add esi, eax 475 00000369 8B06 mov eax, [esi] 476 0000036B A3[E4070000] mov [cos], eax 477 00000370 C3 retn 478 479 getxy: 480 ; Input: 481 ; EAX = sin or cos value * 16777216 482 ; output: 483 ; EAX = x or y projection 484 ; 485 ; Modified registers: eax, edx, (ecx) 486 ; 487 488 ;mov edx, [hipotenus] 489 ;mul edx 490 00000371 F725[C4070000] mul dword [hipotenus] 491 ;mov ecx, 16777216 492 ;div ecx 493 00000377 C1E818 shr eax, 24 494 0000037A C3 retn 495 496 set_text_mode: 497 0000037B 30E4 xor ah, ah 498 0000037D B003 mov al, 3 499 ;int 10h ; al = 03h text mode, int 10 video 500 0000037F CD31 int 31h ; TRDOS 386 - Video interrupt 501 00000381 C3 retn 502 503 program_msg: 504 00000382 5452444F5320333836- db "TRDOS 386 v2.0.3 - ('sysvideo') Test Program - Draw Line (as rotated)" 504 0000038B 2076322E302E33202D- 504 00000394 202827737973766964- 504 0000039D 656F27292054657374- 504 000003A6 2050726F6772616D20- 504 000003AF 2D2044726177204C69- 504 000003B8 6E652028617320726F- 504 000003C1 746174656429 505 000003C7 0D0A db 0Dh, 0Ah 506 000003C9 6279204572646F6761- db "by Erdogan Tan - 20/02/2021" 506 000003D2 6E2054616E202D2032- 506 000003DB 302F30322F32303231 507 ;db 0Dh, 0Ah, 0 508 000003E4 0D0A0D0A db 0Dh, 0Ah, 0Dh, 0Ah 509 510 000003E8 557365204172726F77- db "Use Arrow Keys, Home, End to rotate the LINE .." 510 000003F1 204B6579732C20486F- 510 000003FA 6D652C20456E642074- 510 00000403 6F20726F7461746520- 510 0000040C 746865204C494E4520- 510 00000415 2E2E 511 00000417 0D0A db 0Dh, 0Ah 512 00000419 557365202B2C2D206B- db "Use +,- keys to increase and decrease LINE LENGTH .." 512 00000422 65797320746F20696E- 512 0000042B 63726561736520616E- 512 00000434 642064656372656173- 512 0000043D 65204C494E45204C45- 512 00000446 4E475448202E2E 513 0000044D 0D0A db 0Dh, 0Ah 514 0000044F 55736520454E544552- db "Use ENTER key to draw LINE with new color .." 514 00000458 206B657920746F2064- 514 00000461 726177204C494E4520- 514 0000046A 77697468206E657720- 514 00000473 636F6C6F72202E2E 515 0000047B 0D0A db 0Dh, 0Ah 516 0000047D 557365205350414345- db "Use SPACE, Pg Up, Pg Down keys to change COLOR .." 516 00000486 2C2050672055702C20- 516 0000048F 506720446F776E206B- 516 00000498 65797320746F206368- 516 000004A1 616E676520434F4C4F- 516 000004AA 52202E2E 517 000004AE 0D0A db 0Dh, 0Ah 518 000004B0 507265737320455343- db "Press ESC to exit .." 518 000004B9 20746F206578697420- 518 000004C2 2E2E 519 000004C4 0D0A db 0Dh, 0Ah 520 000004C6 0D0A db 0Dh, 0Ah 521 000004C8 507265737320616E79- db "Press any key to continue .." 521 000004D1 206B657920746F2063- 521 000004DA 6F6E74696E7565202E- 521 000004E3 2E 522 nextline: 523 000004E4 0D0A00 db 0Dh, 0Ah, 0 524 525 sinustable: 526 ; from A = 0 degree to 180 degrees (sin(A)*65536) 527 ;dd 0 528 ;dd 1144, 2287, 3430, 4572, 5712, 6850, 7987, 9121, 10252, 11380, 12505, 13626 529 ;dd 14742, 15855, 16962, 18064, 19161, 20252, 21336, 22415, 23486, 24550, 25607 530 ;dd 26656, 27697, 28729, 29753, 30767, 31772, 32768, 33754, 34729, 35693, 36647 531 ;dd 37590, 38521, 39441, 40348, 41243, 42126, 42995, 43852, 44695, 45525, 46341 532 ;dd 47143, 47930, 48703, 49461, 50203, 50931, 51643, 52339, 53020, 53684, 54332 533 ;dd 54963, 55578, 56175, 56756, 57319, 57865, 58393, 58903, 59396, 59870, 60326 534 ;dd 60764, 61183, 61584, 61966, 62328, 62672, 62997, 63303, 63589, 63856, 64104 535 ;dd 64332, 64540, 64729, 64898, 65048, 65177, 65287, 65376, 65446, 65496, 65526 536 ;dd 65536 537 ;dd 65526, 65496, 65446, 65376, 65287, 65177, 65048, 64898, 64729, 64540, 64332 538 ;dd 64104, 63856, 63589, 63303, 62997, 62672, 62328, 61966, 61584, 61183, 60764 539 ;dd 60326, 59870, 59396, 58903, 58393, 57865, 57319, 56756, 56175, 55578, 54963 540 ;dd 54332, 53684, 53020, 52339, 51643, 50931, 50203, 49461, 48703, 47930, 47143 541 ;dd 46341, 45525, 44695, 43852, 42995, 42126, 41243, 40348, 39441, 38521, 37590 542 ;dd 36647, 35693, 34729, 33754, 32768, 31772, 30767, 29753, 28729, 27697, 26656 543 ;dd 25607, 24550, 23486, 22415, 21336, 20252, 19161, 18064, 16962, 15855, 14742 544 ;dd 13626, 12505, 11380, 10252, 9121, 7987, 6850, 5712, 4572, 3430, 2287, 1144 545 ;dd 0 546 ; from A = 0 degree to 180 degrees (sin(A)*65536*256) 547 ; 0º 548 000004E7 00000000 cos_90: dd 0 549 000004EB C37704002CEF0800E4- dd 292803, 585516, 878052, 1170319, 1462231, 1753697, 2044628, 2334937, 2624535, 2913333 549 000004F4 650D008FDB1100D74F- 549 000004FD 160061C21A00D4321F- 549 00000506 00D9A02300170C2800- 549 0000050F 35742C00 550 00000513 DCD83000B339350064- dd 3201244, 3488179, 3774052, 4058776, 4342263, 4624427, 4905183, 5184445, 5462127, 5738146 550 0000051C 96390098EE3D00F741- 550 00000525 42002B904600DFD84A- 550 0000052E 00BD1B4F006F585300- 550 00000537 A28E5700 551 0000053B 00BE5B0038E65F00F5- dd 6012416, 6284856, 6555381, 6823909, 7090358, 7354647, 7616697, 7876426, 8133756 551 00000544 066400E51F6800B630- 551 0000054D 6C0017397000B93874- 551 00000556 004A2F78007C1C7C00 552 cos_60: ; 30º 553 0000055F 0000800089D98300CA- dd 8388608, 8640905, 8890570, 9137527, 9381700, 9623016, 9861400, 10096781, 10329086, 10558244 553 00000568 A88700776D8B004427- 553 00000571 8F00E8D59200187996- 553 0000057A 008D109A00FE9B9D00- 553 00000583 241BA100 554 00000587 BB8DA4007CF3A70025- dd 10784187, 11006844, 11226149, 11442034, 11654434 554 00000590 4CAB007297AE0022D5- 554 00000599 B100 555 sin_45: ; 45º 556 0000059B F304B500A726B800FF- cos_45: dd 11863283, 12068519, 12270079, 12467901, 12661926, 12852093, 13038346, 13220627, 13398880, 13573053 556 000005A4 39BB00BD3EBE00A634- 556 000005AD C1007D1BC4000AF3C6- 556 000005B6 0013BBC9006073CC00- 556 000005BF BD1BCF00 557 000005C3 F3B3D100CE3BD4001D- dd 13743091, 13908942, 14070557, 14227886, 14380881 557 000005CC B3D600AE19D900516F- 557 000005D5 DB00 558 cos_30: ; 60º 559 000005D7 D7B3DD0014E7DF00DA- dd 14529495, 14673684, 14813402, 14948609, 15079262, 15205322, 15326749, 15443509, 15555564, 15662880 559 000005E0 08E2000119E4005E17- 559 000005E9 E600CA03E8001DDEE9- 559 000005F2 0035A6EB00EC5BED00- 559 000005FB 20FFEE00 560 000005FF B28FF000810DF20071- dd 15765426, 15863169, 15956081, 16044131, 16127295, 16205546, 16278861, 16347217, 16410594, 16468971 560 00000608 78F30063D0F4003F15- 560 00000611 F600EA46F7004D65F8- 560 0000061A 005170F900E267FA00- 560 00000623 EB4BFB00 561 00000627 5C1CFC0025D9FC0035- dd 16522332, 16570661, 16613941, 16652161, 16685309, 16713374, 16736348, 16754223, 16766996, 16774661 561 00000630 82FD008117FE00FD98- 561 00000639 FE009E06FF005C60FF- 561 00000642 002FA6FF0014D8FF00- 561 0000064B 05F6FF00 562 sin_90: ; 90º 563 0000064F 0000000105F6FF0014- cos_0: dd 16777216, 16774661, 16766996, 16754223, 16736348, 16713374, 16685309, 16652161, 16613941, 16570661 563 00000658 D8FF002FA6FF005C60- 563 00000661 FF009E06FF00FD98FE- 563 0000066A 008117FE003582FD00- 563 00000673 25D9FC00 564 00000677 5C1CFC00EB4BFB00E2- dd 16522332, 16468971, 16410594, 16347217, 16278861, 16205546, 16127295, 16044131, 15956081, 15863169 564 00000680 67FA005170F9004D65- 564 00000689 F800EA46F7003F15F6- 564 00000692 0063D0F4007178F300- 564 0000069B 810DF200 565 0000069F B28FF00020FFEE00EC- dd 15765426, 15662880, 15555564, 15443509, 15326749, 15205322, 15079262, 14948609, 14813402, 14673684 565 000006A8 5BED0035A6EB001DDE- 565 000006B1 E900CA03E8005E17E6- 565 000006BA 000119E400DA08E200- 565 000006C3 14E7DF00 566 ; 120º 567 000006C7 D7B3DD00516FDB00AE- dd 14529495, 14380881, 14227886, 14070557, 13908942, 13743091, 13573053, 13398880, 13220627, 13038346 567 000006D0 19D9001DB3D600CE3B- 567 000006D9 D400F3B3D100BD1BCF- 567 000006E2 006073CC0013BBC900- 567 000006EB 0AF3C600 568 000006EF 7D1BC400A634C100BD- dd 12852093, 12661926, 12467901, 12270079, 12068519 568 000006F8 3EBE00FF39BB00A726- 568 00000701 B800 569 ; 135º 570 00000703 F304B50022D5B10072- dd 11863283, 11654434, 11442034, 11226149, 11006844, 10784187, 10558244, 10329086, 10096781, 9861400 570 0000070C 97AE00254CAB007CF3- 570 00000715 A700BB8DA400241BA1- 570 0000071E 00FE9B9D008D109A00- 570 00000727 18799600 571 0000072B E8D5920044278F0077- dd 9623016, 9381700, 9137527, 8890570, 8640905 571 00000734 6D8B00CAA8870089D9- 571 0000073D 8300 572 ; 150º 573 0000073F 000080007C1C7C004A- dd 8388608, 8133756, 7876426, 7616697, 7354647, 7090358, 6823909, 6555381, 6284856, 6012416, 5738146 573 00000748 2F7800B93874001739- 573 00000751 7000B6306C00E51F68- 573 0000075A 00F506640038E65F00- 573 00000763 00BE5B00A28E5700 574 0000076B 6F585300BD1B4F00DF- dd 5462127, 5184445, 4905183, 4624427, 4342263, 4058776, 3774052, 3488179, 3201244, 2913333, 2624535 574 00000774 D84A002B904600F741- 574 0000077D 420098EE3D00649639- 574 00000786 00B3393500DCD83000- 574 0000078F 35742C00170C2800 575 00000797 D9A02300D4321F0061- dd 2334937, 2044628, 1753697, 1462231, 1170319, 878052, 585516, 292803 575 000007A0 C21A00D74F16008FDB- 575 000007A9 1100E4650D002CEF08- 575 000007B2 00C3770400 576 ; 180º 577 000007B7 00000000 dd 0 578 579 bss: 580 581 ABSOLUTE bss 582 583 000007BB alignb 4 584 585 bss_start: 586 counter: 587 000007BC resw 1 588 000007BE angle: resb 1 589 000007BF pcolor: resb 1 ; previous color (used for black line drawing) 590 000007C0 color: resd 1 591 hipotenus: 592 000007C4 resd 1 ; current hypotenuse value (line length) 593 000007C8 _x0: resd 1 ; horizontal start point 594 000007CC _y0: resd 1 ; vertical start point 595 000007D0 _x1: resd 1 ; hypotenuse * cos(angle), X-axis value of the end point 596 000007D4 _y1: resd 1 ; hypotenuse * sin(angle), Y-axis value of the end point 597 000007D8 _x2: resd 1 ; interim value of X (< _x1) = cotangent(angle)*_y1 (if _y1 > _x1) 598 000007DC _y2: resd 1 ; interim value of Y (< _y1) = tangent(angle)*_x1 (if _x1 > _y1) 599 000007E0 sin: resd 1 ; sine(angle) * 16777216 600 000007E4 cos: resd 1 ; cosine(angle) * 16777216 601 pixelcount: 602 000007E8 resd 1 603 000007EC _fx: resd 142 ; For every X values from 0 to 142 604 00000A24 resd 512-142 ; additional buffer 605 bss_end: