|
@@ -70,7 +70,12 @@ section .data
|
70
|
70
|
def_str bigline_error, {"Line with more than 16 tokens !", 0xA}
|
71
|
71
|
def_str nl_error, {"Character \n is not the last one", 0xA}
|
72
|
72
|
def_str badop_error, {"Bad OP", 0xA}
|
|
73
|
+
|
73
|
74
|
window_title: db "Yaglitch", 0x0
|
|
75
|
+ font_name: db "Sans.ttf", 0x0
|
|
76
|
+ FC_FILE: db "file", 0x0
|
|
77
|
+ FC_FAMILY: db "family", 0x0
|
|
78
|
+ FC_LANG: db "lang", 0x0
|
74
|
79
|
|
75
|
80
|
section .bss
|
76
|
81
|
|
|
@@ -116,6 +121,18 @@ section .bss
|
116
|
121
|
|
117
|
122
|
visu_surf: resq 1
|
118
|
123
|
|
|
124
|
+ text_surf: resq 1
|
|
125
|
+
|
|
126
|
+ ttf_font: resq 1
|
|
127
|
+
|
|
128
|
+ sdl_color: resd 1
|
|
129
|
+
|
|
130
|
+ fc_config: resq 1
|
|
131
|
+ fc_pattern: resq 1
|
|
132
|
+ fc_object_set: resq 1
|
|
133
|
+ fc_font_set: resq 1
|
|
134
|
+ fc_font_file_ptr: resq 1
|
|
135
|
+
|
119
|
136
|
section .text
|
120
|
137
|
global _start
|
121
|
138
|
_start:
|
|
@@ -371,13 +388,26 @@ sdl_init:
|
371
|
388
|
test rax, rax
|
372
|
389
|
jnz exit_fatal
|
373
|
390
|
|
|
391
|
+ ; Init SDL
|
374
|
392
|
mov rdi, 0x0000FFFF
|
375
|
393
|
call SDL_Init
|
376
|
394
|
|
|
395
|
+ ; Open Audio -> setting spec to 8bit etc. (see .data)
|
377
|
396
|
mov rdi, audiospec_wanted
|
378
|
397
|
mov rsi, audiospec_recv
|
379
|
398
|
call SDL_OpenAudio
|
380
|
399
|
|
|
400
|
+ %ifdef MIX_AUDIO
|
|
401
|
+ ; init callback heap infos
|
|
402
|
+ mov rax, 0xc ; brk
|
|
403
|
+ xor rdi, rdi ; get heap start addr
|
|
404
|
+ mov [cllbck_heapsz], rdi
|
|
405
|
+ syscall
|
|
406
|
+ cmp rax, -1
|
|
407
|
+ je exit_fatal
|
|
408
|
+ mov [cllbck_heap], rax
|
|
409
|
+ %endif
|
|
410
|
+
|
381
|
411
|
; video init 256*256 window
|
382
|
412
|
; init visu_scr : *screen
|
383
|
413
|
%ifdef SDL1
|
|
@@ -447,22 +477,64 @@ sdl_init:
|
447
|
477
|
|
448
|
478
|
; RAZ surface & blit
|
449
|
479
|
;call clear_screen ;useless
|
|
480
|
+ ; init fontconfig
|
|
481
|
+ call FcInitLoadConfigAndFonts
|
|
482
|
+ mov [fc_config], rax
|
|
483
|
+ call FcPatternCreate
|
|
484
|
+ mov [fc_pattern], rax
|
|
485
|
+
|
|
486
|
+ mov rdi, FC_FILE
|
|
487
|
+ ;mov rsi, FC_FAMILY
|
|
488
|
+ ;mov rdx, FC_LANG
|
|
489
|
+ xor rcx, rcx
|
|
490
|
+ xor r8, r8
|
|
491
|
+ call FcObjectSetBuild
|
|
492
|
+
|
|
493
|
+ mov [fc_object_set], rax
|
|
494
|
+ mov rdi, [fc_config]
|
|
495
|
+ mov rsi, [fc_pattern]
|
|
496
|
+ mov rdx, [fc_object_set]
|
|
497
|
+ call FcFontList
|
|
498
|
+ mov [fc_font_set], rax
|
|
499
|
+
|
|
500
|
+ mov rdi, [rax+8]
|
|
501
|
+ mov rdi, [rdi] ; 1st font in set
|
|
502
|
+ ;mov rdi, [rdi+8] ; 2nd font in set
|
|
503
|
+ push rdi ; debug
|
|
504
|
+ call FcPatternPrint
|
|
505
|
+ pop rdi
|
|
506
|
+ mov rsi, FC_FILE
|
|
507
|
+ xor rdx, rdx
|
|
508
|
+ mov rcx, fc_font_file_ptr
|
|
509
|
+ call FcPatternGetString
|
|
510
|
+dbg:
|
|
511
|
+ ; Init SDL_ttf
|
|
512
|
+ call TTF_Init
|
|
513
|
+ cmp rax, 0
|
|
514
|
+ jl sdl_error
|
|
515
|
+ ; open font
|
|
516
|
+ mov rdi, [fc_font_file_ptr]
|
|
517
|
+ mov rsi, 18 ; 18 pts/inch
|
|
518
|
+ call TTF_OpenFont
|
|
519
|
+ test rax, rax
|
|
520
|
+ jz sdl_error
|
|
521
|
+ mov [ttf_font], rax
|
450
|
522
|
|
451
|
|
- %ifdef MIX_AUDIO
|
452
|
|
- ; init callback heap infos
|
453
|
|
- mov rax, 0xc ; brk
|
454
|
|
- xor rdi, rdi ; get heap start addr
|
455
|
|
- mov [cllbck_heapsz], rdi
|
456
|
|
- syscall
|
457
|
|
- cmp rax, -1
|
458
|
|
- je exit_fatal
|
459
|
|
- mov [cllbck_heap], rax
|
460
|
|
- %endif
|
|
523
|
+ mov dword [sdl_color], 0xFFFFFFFF
|
|
524
|
+ mov rdi, [ttf_font]
|
|
525
|
+ mov rsi, glitch_name
|
|
526
|
+ mov rdx, sdl_color
|
|
527
|
+ call TTF_RenderText_Solid ; render text in surface
|
|
528
|
+
|
|
529
|
+ ; blit & flip text surface
|
|
530
|
+ mov rdi, [ttf_font]
|
|
531
|
+ call blitflip_visu
|
461
|
532
|
|
462
|
|
- audio_start:
|
463
|
|
- ;start audio
|
464
|
|
- xor rdi, rdi
|
465
|
|
- call SDL_PauseAudio
|
|
533
|
+
|
|
534
|
+audio_start:
|
|
535
|
+ ;start audio
|
|
536
|
+ xor rdi, rdi
|
|
537
|
+ call SDL_PauseAudio
|
466
|
538
|
|
467
|
539
|
loop_event:
|
468
|
540
|
xor rdi, rdi
|