-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVCPU_bak1.s
2578 lines (2157 loc) · 89 KB
/
VCPU_bak1.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
************************************************************
*
* Program: VCPU
* Short: Vampire CPU monitor tool.
* Author: flype
* Type: util/moni
* Version: 0.1 (Novembre 2019)
* Architecture: m68k-amigaos
* Requires: AmigaOS V36+, AC68080
* Copyright: (C) 2016-2019 APOLLO-Team
* Compiler: HiSoft Devpac 3.18 for AmigaOS
*
************************************************************
*
* TODO:
*
* [X] CPU revision
* [X] IPC: 0.00 instead of 000%
* [X] Menu->Settings->Skins...
* [X] Menu->Settings->Backdrop
* [X] Menu->Settings->Borderless
* [X] Menu->Settings->RefreshRate
* [X] ToolTypes Load
* [_] ToolTypes Save
* [_] Iconify
* [X] Commodity General
* [_] Commodity HotKeys
* [_] Skin engine
*
************************************************************
INCDIR progdir:include/
; AmigaOS libraries
INCLUDE dos/dos.i
INCLUDE dos/dosextens.i
INCLUDE dos/dos_lib.i
INCLUDE exec/exec.i
INCLUDE exec/exec_lib.i
INCLUDE devices/timer.i
INCLUDE devices/timer_lib.i
INCLUDE diskfont/diskfont.i
INCLUDE diskfont/diskfont_lib.i
INCLUDE graphics/gfxbase.i
INCLUDE graphics/rastport.i
INCLUDE graphics/graphics_lib.i
INCLUDE graphics/text.i
INCLUDE intuition/intuition.i
INCLUDE intuition/intuition_lib.i
INCLUDE libraries/amigaguide.i
INCLUDE libraries/amigaguide_lib.i
INCLUDE libraries/commodities.i
INCLUDE libraries/commodities_lib.i
INCLUDE libraries/gadtools.i
INCLUDE libraries/gadtools_lib.i
INCLUDE utility/utility.i
INCLUDE utility/utility_lib.i
INCLUDE workbench/icon_lib.i
INCLUDE workbench/startup.i
INCLUDE workbench/workbench.i
; Third-party libraries
INCLUDE inc/guigfx.i
INCLUDE inc/guigfx_lib.i
INCLUDE inc/reqtools.i
INCLUDE inc/reqtools_lib.i
INCLUDE inc/screennotify.i
INCLUDE inc/screennotify_lib.i
INCLUDE inc/vampire.i
INCLUDE inc/vampire_lib.i
INCLUDE inc/V_MACROS.i
************************************************************
*
* CONSTANTS
*
************************************************************
WIN_LEFT EQU 0
WIN_TOP EQU 18
WIN_WIDTH EQU 200
WIN_HEIGHT EQU 200
************************************************************
*
* STRUCTURES
*
************************************************************
RSRESET
ggt_Tag0 RS.L 1
ggt_SrcX RS.L 1
ggt_Tag1 RS.L 1
ggt_SrcY RS.L 1
ggt_Tag2 RS.L 1
ggt_SrcW RS.L 1
ggt_Tag3 RS.L 1
ggt_SrcH RS.L 1
ggt_Tag4 RS.L 1
ggt_DstW RS.L 1
ggt_Tag5 RS.L 1
ggt_DstH RS.L 1
ggt_SIZEOF RS.L 0
RSRESET
bar_Val1 RS.L 1 ; New value
bar_Val2 RS.L 1 ; Old value
bar_DstX RS.L 1 ; Destination X
bar_DstY RS.L 1 ; Destination Y
bar_PicW RS.L 1 ; Picture Width
bar_PicH RS.L 1 ; Picture Height
bar_PicBg RS.L 1 ; Picture handle
bar_PicFg RS.L 1 ; Picture handle
bar_hDraw RS.L 1 ; Draw handle
bar_hTags RS.L 1 ; Tags handle
bar_SIZEOF RS.L 0 ; SizeOf
************************************************************
*
* ENTRY POINT
*
************************************************************
MACHINE MC68060
MAIN:
move.l #RETURN_FAIL,_RC ; Return Code
;----------------------------------------
; Workbench Start
;----------------------------------------
.wbStart
suba.l a1,a1 ; name
CALLEXEC FindTask ; (name)(a1)
move.l d0,a4 ; process
move.l pr_CLI(a4),d0 ; process->pr_CLI
bne.s .openLibs ; skip
lea.l pr_MsgPort(a4),a0 ; process->msgport
CALLEXEC WaitPort ; (msgport)(a0)
lea.l pr_MsgPort(a4),a0 ; process->msgport
CALLEXEC GetMsg ; (msgport)(a0)
move.l d0,WBStartMsg ; WBStart message
;----------------------------------------
; Open libraries
;----------------------------------------
.openLibs
LIBOPEN DOS ;
LIBOPEN Diskfont ;
LIBOPEN Icon ;
LIBOPEN Intuition ;
LIBOPEN Gadtools ;
LIBOPEN Gfx ;
LIBOPEN GuiGfx ;
LIBOPEN Reqtools ;
LIBOPEN ScreenNotify ;
LIBOPEN Utility ;
LIBOPEN AmigaGuide ;
LIBOPEN Commodities ;
;----------------------------------------
; Hardware informations
;----------------------------------------
.checkCPU
bsr V_CPU_Detect080 ; AC68080 ?
tst.l d0 ;
bne.s .checkDone ;
lea StrError1(pc),a0 ;
move.l a0,d1 ;
CALLDOS PutStr ;
bra.w .closeLibs ;
.checkDone
bsr GetAvailMem ; infos
bsr GetHWInfos ; infos
move.l #4,d2
bsr MenuItem_Setting_RefreshRate ; rate
;----------------------------------------
; Open program
;----------------------------------------
.handleEvents
bsr LoadToolTypes ;
bsr Window_Open ;
tst.l d0 ;
beq .closeLibs ;
bsr Fonts_Open ;
bsr CxBroker_Install ;
bsr ScreenNotify_Install ;
bsr V_TemperatureInit ;
bsr V_TemperatureFind ;
bsr V_TemperatureRead ;
lea.l StrTEMP(pc),a0 ;
bsr V_TemperatureToString ;
bsr CenterTexts ;
bsr Window_ObtainPens ;
bsr Window_Redraw ;
bsr Window_Events ;
bsr Window_ReleasePens ;
bsr Window_Close ;
bsr V_TemperatureFree ;
bsr ScreenNotify_Uninstall ;
bsr CxBroker_Uninstall ;
bsr Fonts_Close ;
move.l #RETURN_OK,_RC ; Return Code
;----------------------------------------
; Exit program
;----------------------------------------
.closeLibs
LIBCLOSE Commodities ;
LIBCLOSE AmigaGuide ;
LIBCLOSE Utility ;
LIBCLOSE ScreenNotify ;
LIBCLOSE Reqtools ;
LIBCLOSE GuiGfx ;
LIBCLOSE Gfx ;
LIBCLOSE Gadtools ;
LIBCLOSE Intuition ;
LIBCLOSE Icon ;
LIBCLOSE Diskfont ;
LIBCLOSE DOS ;
.closeWB
move.l WBStartMsg(pc),d0 ; WBStart message
beq.s .exit ; skip
CALLEXEC Forbid ; (void)
move.l WBStartMsg(pc),a1 ; WBStart message
CALLEXEC ReplyMsg ; (msg)(a1)
.exit
move.l _RC,d0 ; DOS Result
rts ; Exit Program
************************************************************
*
* FONTS FUNCTIONS
*
************************************************************
ta_TextFont EQU ta_SIZEOF
Fonts_Open:
.font1
lea.l MyTextA1(pc),a0 ; textattr
CALLDISKFONT OpenDiskFont ; (textattr)(a0)
lea.l MyTextA1(pc),a0 ; textattr
move.l d0,ta_TextFont(a0) ; store
.font2
lea.l MyTextA2(pc),a0 ; textattr
CALLDISKFONT OpenDiskFont ; (textattr)(a0)
lea.l MyTextA2(pc),a0 ; textattr
move.l d0,ta_TextFont(a0) ; store
.font3
lea.l MyTextA3(pc),a0 ; textattr
CALLDISKFONT OpenDiskFont ; (textattr)(a0)
lea.l MyTextA3(pc),a0 ; textattr
move.l d0,ta_TextFont(a0) ; store
rts ; Return
;-----------------------------------------------------------
Fonts_Close:
.font1
lea.l MyTextA1(pc),a0 ; textattr
tst.l ta_TextFont(a0) ; textfont
beq.s .font2 ;
move.l ta_TextFont(a0),a1 ;
CALLGRAF CloseFont ; (textfont)(a1)
.font2
lea.l MyTextA2(pc),a0 ; textattr
tst.l ta_TextFont(a0) ; textfont
beq.s .font3 ;
move.l ta_TextFont(a0),a1 ;
CALLGRAF CloseFont ; (textfont)(a1)
.font3
lea.l MyTextA3(pc),a0 ; textattr
tst.l ta_TextFont(a0) ; textfont
beq.s .exit ;
move.l ta_TextFont(a0),a1 ;
CALLGRAF CloseFont ; (textfont)(a1)
.exit
rts
;-----------------------------------------------------------
CenterTexts:
movem.l d0-a6,-(sp) ; Push
lea.l MyIText1(pc),a2 ; first item
.loop
tst.w it_LeftEdge(a2) ; zero ?
bne.s .next ; skip
move.l MyWindow(pc),a1 ; window
move.l wd_RPort(a1),a1 ; rastport
move.l it_ITextFont(a2),a0 ; itext->textattr
move.l ta_TextFont(a0),a0 ; textfont
tst.l a0
beq.s .next
CALLGRAF SetFont ; (rp,textfont)(a1,a0)
move.l it_IText(a2),a0 ; itext->string
moveq.l #-1,d0 ; reset count
.size
addq.l #1,d0 ; count++
tst.b (a0)+ ; test char
bne.s .size ; next char
move.l MyWindow(pc),a1 ; window
move.l wd_RPort(a1),a1 ; rastport
move.l it_IText(a2),a0 ; itext->string
CALLGRAF TextLength ; (rp,string,count)(a1,a0,d0)
move.w #WIN_WIDTH,d1 ; (W)
sub.w d0,d1 ; (W-w)
lsr.w #1,d1 ; (W-w)/2
move.w d1,it_LeftEdge(a2) ; itext->leftedge
.next
move.l it_NextText(a2),a2 ; next item
tst.l a2 ; last item ?
bne.s .loop ; continue
movem.l (sp)+,d0-a6 ; Pop
rts ; Return
************************************************************
*
* MENUITEM FUNCTIONS
*
************************************************************
MenuItem_Quit:
lea.l ExitRequested(pc),a0 ; Exit
move.l #1,(a0) ; TRUE
rts ; return
;-----------------------------------------------------------
MenuItem_About:
movem.l d0-a6,-(sp) ; push
lea.l ReqAboutBody(pc),a1 ; body
lea.l ReqAboutGads(pc),a2 ; gadgets
suba.l a3,a3 ; reqinfo
lea.l ValBUFFER(pc),a4 ; array
move.l #APP_VERSION,0*4(a4) ; array[0]
move.l #APP_RELEASEDATE,1*4(a4) ; array[1]
move.l #APP_DESCRIPTION,2*4(a4) ; array[2]
move.l #APP_AUTHOR,3*4(a4) ; array[3]
move.l #APP_COMMENT,4*4(a4) ; array[4]
move.l #APP_COPYRIGHT,5*4(a4) ; array[5]
lea.l ReqAboutTags(pc),a0 ; tags
move.l MyWindow(pc),4(a0) ; tags[0]
CALLRT rtEZRequestA ; (a0,a1,a2,a3,a4)
movem.l (sp)+,d0-a6 ; pop
rts ; return
;-----------------------------------------------------------
MenuItem_Help:
movem.l d0-a6,-(sp) ; Push
move.l MyWindow(pc),a0 ; window
lea.l .pointerTags1(pc),a1 ; tags
CALLINT SetWindowPointerA ; (win,tags)(a0,a1)
lea.l APP_NAME(pc),a1 ; Basename
lea.l APP_GUIDE(pc),a2 ; Filename
lea.l MyNewAmigaGuide(pc),a0 ; NewAmigaGuide
move.l a1,nag_BaseName(a0) ; nag.nag_BaseName
move.l a2,nag_Name(a0) ; nag.nag_Name
suba.l a1,a1 ; tags
CALLAG OpenAmigaGuideA ; (nag,tags)(a0,a1)
move.l d0,MyAmigaGuide ; handle
tst.l d0 ; null ?
beq.s .exit ; skip
move.l MyAmigaGuide(pc),a0 ; handle
CALLAG CloseAmigaGuide ; (handle)(a0)
move.l MyWindow(pc),a0 ; window
lea.l .pointerTags2(pc),a1 ; tags
CALLINT SetWindowPointerA ; (win,tags)(a0,a1)
.exit
movem.l (sp)+,d0-a6 ; Pop
rts
.pointerTags1:
DC.L WA_BusyPointer,1
DC.L WA_PointerDelay,1
.pointerTags2:
DC.L TAG_DONE
;-----------------------------------------------------------
MenuItem_Iconify:
movem.l d2-d7/a2-a6,-(sp) ; push
movem.l (sp)+,d2-d7/a2-a6 ; pop
rts
;-----------------------------------------------------------
MenuItem_FPUSwitch:
movem.l d0-a6,-(sp) ; push
lea.l ReqFPUBody(pc),a1 ; body
lea.l ReqFPUGads(pc),a2 ; gadgets
suba.l a3,a3 ; reqinfo
tst.w d2 ; menunum->sub
bne.s 1$ ; skip
lea.l .disable(pc),a0 ; string
bra.s 2$ ; skip
1$ lea.l .enable(pc),a0 ; string
2$ lea.l ValBUFFER(pc),a4 ; array
move.l a0,(a4) ; array[0]
lea.l ReqFPUTags(pc),a0 ; tags
move.l MyWindow(pc),4(a0) ; tags[0]
CALLRT rtEZRequestA ; (a0,a1,a2,a3,a4)
cmp.l #1,d0 ; result
bne.s .exit ; skip
CALLEXEC Disable ; multitask off
tst.w d2 ; menunum->sub
bne.s 3$ ; skip
bsr V_CPU_DFP_On ; disable fpu
bra.s 4$ ; skip
3$ bsr V_CPU_DFP_Off ; enable fpu
4$ CALLEXEC ColdReboot ; reboot
CALLEXEC Enable ; multitask on
.exit
movem.l (sp)+,d0-a6 ; pop
rts ; return
.enable: DC.B "enable",0
.disable: DC.B "disable",0
CNOP 0,4
;-----------------------------------------------------------
MenuItem_SuperScalar:
movem.l d0-a6,-(sp) ; Push
cmp.w #0,d2 ; menunum->sub
beq.s .item0 ;
cmp.w #1,d2 ; menunum->sub
beq.s .item1 ;
bra.s .exit ; skip
.item0
bsr V_CPU_ESS_Off ; poke hardware
bra.s .exit ; skip
.item1
bsr V_CPU_ESS_On ; poke hardware
.exit
movem.l (sp)+,d0-a6 ; Pop
rts
;-----------------------------------------------------------
MenuItem_TurtleMode:
movem.l d0-a6,-(sp) ; Push
cmp.w #0,d2 ; menunum->sub
beq.s .item0 ;
cmp.w #1,d2 ; menunum->sub
beq.s .item1 ;
bra.s .exit ; skip
.item0
bsr V_CPU_ICACHE_On ; poke hardware
bra.s .exit ; skip
.item1
bsr V_CPU_ICACHE_Off ; poke hardware
.exit
movem.l (sp)+,d0-a6 ; Pop
rts
;-----------------------------------------------------------
MenuItem_FastIDE:
movem.l d0-a6,-(sp) ; Push
move.l d2,d0 ; menunum->sub
andi.l #$000000ff,d0 ; ubyte
cmp.l #VREG_FASTIDE_FASTEST,d0 ; max ?
bls.s .apply ;
move.l #VREG_FASTIDE_FASTEST,d0 ; max
.apply
bsr V_SetFastIDE ; poke hardware
.exit
movem.l (sp)+,d0-a6 ; Pop
rts
;-----------------------------------------------------------
MenuItem_SDClockDivider:
movem.l d0-a6,-(sp) ; Push
cmp.w #5,d2 ; menunum->sub
bne.s .fromMenu ; skip
.fromUser
lea.l ValSDValue(pc),a1 ; &num
lea.l ReqSDTitle(pc),a2 ; title
sub.l a3,a3 ; reqinfo
lea.l ReqSDSelectTags(pc),a0 ; tags
move.l MyWindow(pc),4(a0) ; tags[0]
CALLRT rtGetLongA ; (&num,title,reqinfo,tags)(a1,a2,a3,a0)
tst.l d0 ; result
beq.s .exit ; cancelled
bra.s .checkzero ; accepted
.fromMenu
andi.l #$000000ff,d2 ; ubyte
move.l d2,ValSDValue ; &num
.checkzero
tst.l ValSDValue(pc) ; &num
bne.s .apply ; &num > 0 is ok
lea.l ReqSDAcceptBody(pc),a1 ; body
lea.l ReqSDAcceptGads(pc),a2 ; gadgets
suba.l a3,a3 ; reqinfo
suba.l a4,a4 ; array
lea.l ReqSDAcceptTags(pc),a0 ; tags
move.l MyWindow(pc),4(a0) ; tags[0]
CALLRT rtEZRequestA ; (a0,a1,a2,a3,a4)
cmp.l #1,d0 ; result
bne.s .exit ; skip
.apply
move.l ValSDValue(pc),d0 ; &num
bsr V_SetSDClockDivider ; poke hardware
.exit
movem.l (sp)+,d0-a6 ; Pop
rts
;-----------------------------------------------------------
MenuItem_SerialNumber:
movem.l d0-a6,-(sp) ; Push
lea.l ReqSNBuffer(pc),a5 ; buffer
move.l a5,a0 ; buffer
bsr _v_read_sn ; read S/N
tst.l d0 ; success ?
beq.s .exit ; skip
lea.l ReqSNBody(pc),a1 ; body
lea.l ReqSNGads(pc),a2 ; gadgets
suba.l a3,a3 ; reqinfo
lea.l ValBUFFER(pc),a4 ; array
move.l a5,(a4) ; array[0]
lea.l ReqSNTags(pc),a0 ; tags
move.l MyWindow(pc),4(a0) ; tags[0]
CALLRT rtEZRequestA ; (a0,a1,a2,a3,a4)
tst.l d0 ; result
bne.s .exit ; skip
lea.l ReqSNBuffer(pc),a0 ; buffer
bsr V_ClipWrite ; copy to clipboard
.exit
movem.l (sp)+,d0-a6 ; Push
rts
;-----------------------------------------------------------
MenuItem_Setting_RefreshRate:
cmp.w #20,d2 ; max ?
bgt.s .exit ; skip
move.l d2,d1 ; menunum->sub
andi.l #$ffff,d1 ; n
move.l #1,d0 ; 1
lsl.l d1,d0 ; 1 << n
move.l $4.w,a0 ; execbase
move.l ValMULT(pc),d1 ; mult
mulu.l ex_EClockFrequency(a0),d1 ; mult*eclock
mulu.l #10,d1 ; mult*eclock*10
divu.l d0,d1 ; new rate
lea.l ValRATE(pc),a0 ; new rate
move.l d1,(a0) ; new rate
.exit
rts ; return
;-----------------------------------------------------------
MenuItem_Setting_Backdrop:
movem.l d0-a6,-(sp) ; push
andi.l #$0000ffff,d2 ; menunum->sub
lea.l OpenWindowTags(pc),a0 ; taglist
move.l d2,4+(6*8)(a0) ; taglist[] -> WA_Backdrop
bsr Window_Reopen ; close & reopen
movem.l (sp)+,d0-a6 ; pop
rts ; return
;-----------------------------------------------------------
MenuItem_Setting_Borderless:
movem.l d0-a6,-(sp) ; push
andi.l #$0000ffff,d2 ; menunum->sub
move.l d2,d1 ; !bool
neg.l d1 ; !bool
not.l d1 ; !bool
lea.l OpenWindowTags(pc),a0 ; taglist
move.l d2,4+(07*8)(a0) ; taglist[] -> WA_Borderless
move.l d1,4+(08*8)(a0) ; taglist[] -> WA_CloseGadget
move.l d1,4+(09*8)(a0) ; taglist[] -> WA_DepthGadget
move.l d1,4+(10*8)(a0) ; taglist[] -> WA_DragBar
bsr Window_Reopen ; close and reopen
movem.l (sp)+,d0-a6 ; pop
rts ; return
;-----------------------------------------------------------
MenuItem_Setting_Skin:
movem.l d0-a6,-(sp) ; push
cmp.w #7,d2 ; max ?
bgt.s .exit ; skip
lea.l FileWinBG(pc),a0 ; background
lea.l SkinArray(pc),a1 ; table
move.l (a1,d2.w*4),(a0) ; store new
bsr Window_Reopen ; close and reopen
.exit
movem.l (sp)+,d0-a6 ; pop
rts ; return
************************************************************
*
* WINDOW FUNCTIONS
*
************************************************************
Window_Reopen:
bsr Window_ReleasePens ;
bsr Window_Close ;
bsr Window_Open ;
bsr Window_ObtainPens ;
bsr Window_Redraw ;
bsr BarDraw ;
rts
;-----------------------------------------------------------
Window_Open:
movem.l d1-a6,-(sp) ; Push
;----------------------------------------
; Open Window
;----------------------------------------
.winopen
tst.l MyWindow(pc) ; window
bne .exit ;
suba.l a0,a0 ; newwindow
lea.l OpenWindowTags(pc),a1 ; tags
move.l MyWindowX(pc),4+(0*8)(a1) ; tags[0]
move.l MyWindowY(pc),4+(1*8)(a1) ; tags[1]
CALLINT OpenWindowTagList ; (newwindow,tags)(a0,a1)
tst.l d0 ; null ?
beq.w .exit ; skip
move.l d0,MyWindow ; window
;----------------------------------------
; Window and screen titles
;----------------------------------------
.wintitles
move.l d0,a0 ; win
lea.l APP_NAME(pc),a1 ; wintitle
lea.l APP_VERSTRING+6(pc),a2 ; scrtitle
CALLINT SetWindowTitles ; (win,wintitle,scrtitle)(a0,a1,a2)
;----------------------------------------
; Window gadgets and menus list
;----------------------------------------
.wingadgets
move.l MyWindow(pc),a0 ; win
lea.l MyDragGadget(pc),a1 ; gad
move.w #~0,d0 ; pos.w
CALLINT AddGadget ; (win,gad,pos)(a0,a1,d0)
.winmenus
move.l MyWindow(pc),a0 ; win
move.l wd_WScreen(a0),a0 ; win->scr
suba.l a1,a1 ; tags
CALLGT GetVisualInfoA ; (screen,tags)(a0,a1)
move.l d0,MyVisualInfo ; visualInfo
lea.l MyNewMenu(pc),a0 ; newmenu
suba.l a1,a1 ; tags
CALLGT CreateMenusA ; (newmenu,tags)(a0,a1)
move.l d0,MyMenuStrip ; visualInfo
move.l MyMenuStrip(pc),a0 ; menustrip
move.l MyVisualInfo(pc),a1 ; visualinfo
lea.l LayoutMenusTags(pc),a2 ; tags
CALLGT LayoutMenusA ; (menustrip,visualinfo,tags)(a0,a1,a2)
move.l MyWindow(pc),a0 ; win
move.l MyMenuStrip(pc),a1 ; menustrip
CALLINT SetMenuStrip ; (win,menustrip)(a0,a1)
move.l MyWindow(pc),a0 ; win
move.l #$F820,d0 ; menunumber.w -> iconify
CALLINT OffMenu ; (win,menunumber)(a0,d0)
;----------------------------------------
; Initialize GuiGfx stuff
;----------------------------------------
.psmcreate
lea.l GuiGfxTags(pc),a0 ; tags
CALLGUIGFX CreatePenShareMapA ; (tags)(a0)
tst.l d0 ;
beq .exit ;
move.l d0,GuiGfxPenShareMap ; psm
.picload1
move.l FileWinBG(pc),a0 ; filename
lea.l GuiGfxTags(pc),a1 ; tags
CALLGUIGFX LoadPictureA ; (filename,tags)(a0,a1)
tst.l d0 ;
beq .psmdel ;
move.l d0,GuiGfxPic1 ; pic
.picload2
lea.l FileBarBG1(pc),a0 ; filename
lea.l GuiGfxTags(pc),a1 ; tags
CALLGUIGFX LoadPictureA ; (filename,tags)(a0,a1)
tst.l d0 ;
beq .psmdel ;
move.l d0,GuiGfxPic2 ; pic
.picload3
lea.l FileBarFG1(pc),a0 ; filename
lea.l GuiGfxTags(pc),a1 ; tags
CALLGUIGFX LoadPictureA ; (filename,tags)(a0,a1)
tst.l d0 ;
beq .psmdel ;
move.l d0,GuiGfxPic3 ; pic
.picadd1
move.l GuiGfxPenShareMap(pc),a0 ; psm
move.l GuiGfxPic1(pc),a1 ; picture
lea.l GuiGfxTags(pc),a2 ; tags
CALLGUIGFX AddPictureA ; (psm,pic,tags)(a0,a1,a2)
tst.l d0 ;
beq .psmdel ;
.picadd2
move.l GuiGfxPenShareMap(pc),a0 ; psm
move.l GuiGfxPic2(pc),a1 ; picture
lea.l GuiGfxTags(pc),a2 ; tags
CALLGUIGFX AddPictureA ; (psm,pic,tags)(a0,a1,a2)
tst.l d0 ;
beq .psmdel ;
.picadd3
move.l GuiGfxPenShareMap(pc),a0 ; psm
move.l GuiGfxPic3(pc),a1 ; picture
lea.l GuiGfxTags(pc),a2 ; tags
CALLGUIGFX AddPictureA ; (psm,pic,tags)(a0,a1,a2)
tst.l d0 ;
beq .psmdel ;
.gethandle
move.l GuiGfxPenShareMap(pc),a0 ; psm
move.l MyWindow(pc),a1 ; win
move.l wd_RPort(a1),a1 ; win->rp
move.l MyWindow(pc),a2 ; win
move.l wd_WScreen(a2),a2 ; win->scr
adda.l #sc_ViewPort,a2 ; win->scr->vp
adda.l #vp_ColorMap,a2 ; win->scr->vp.cm
move.l (a2),a2 ; cm
lea.l GuiGfxTags(pc),a3 ; tags
CALLGUIGFX ObtainDrawHandleA ; (psm,rp,cm,tags)(a0,a1,a2,a3)
tst.l d0 ;
beq .psmdel ;
move.l d0,GuiGfxDrawHandle ; handle
.barinit
lea.l BarCP1(pc),a0 ; bar mips1
lea.l BarTags(pc),a1 ; bar tags
move.l #100,bar_PicW(a0) ;
move.l #010,bar_PicH(a0) ;
move.l GuiGfxPic2(pc),bar_PicBg(a0) ;
move.l GuiGfxPic3(pc),bar_PicFg(a0) ;
move.l GuiGfxDrawHandle(pc),bar_hDraw(a0)
move.l a1,bar_hTags(a0) ;
lea.l BarCP2(pc),a0 ; bar mips2
lea.l BarTags(pc),a1 ; bar tags
move.l #100,bar_PicW(a0) ;
move.l #010,bar_PicH(a0) ;
move.l GuiGfxPic2(pc),bar_PicBg(a0) ;
move.l GuiGfxPic3(pc),bar_PicFg(a0) ;
move.l GuiGfxDrawHandle(pc),bar_hDraw(a0)
move.l a1,bar_hTags(a0) ;
lea.l BarCFP(pc),a0 ; bar flops
lea.l BarTags(pc),a1 ; bar tags
move.l #100,bar_PicW(a0) ;
move.l #010,bar_PicH(a0) ;
move.l GuiGfxPic2(pc),bar_PicBg(a0) ;
move.l GuiGfxPic3(pc),bar_PicFg(a0) ;
move.l GuiGfxDrawHandle(pc),bar_hDraw(a0)
move.l a1,bar_hTags(a0) ;
.psmdel
move.l GuiGfxPenShareMap(pc),a0 ; psm
CALLGUIGFX DeletePenShareMap ; (psm)(a0)
.exit
move.l MyWindow(pc),d0 ; window
movem.l (sp)+,d1-a6 ; Pop
rts ; Return
;-----------------------------------------------------------
Window_Close:
movem.l d0-a6,-(sp) ; push
;----------------------------------------
; Release GuiGfx stuff
;----------------------------------------
.delpic1
tst.l GuiGfxPic1(pc) ; picture
beq.s .delpic2 ;
move.l GuiGfxPic1(pc),a0 ;
CALLGUIGFX DeletePicture ; (picture)(a0)
clr.l GuiGfxPic1 ;
.delpic2
tst.l GuiGfxPic2(pc) ; picture
beq.s .delpic3 ;
move.l GuiGfxPic2(pc),a0 ;
CALLGUIGFX DeletePicture ; (picture)(a0)
clr.l GuiGfxPic2 ;
.delpic3
tst.l GuiGfxPic3(pc) ; picture
beq .deldrawhandle ;
move.l GuiGfxPic3(pc),a0 ;
CALLGUIGFX DeletePicture ; (picture)(a0)
clr.l GuiGfxPic3 ;
.deldrawhandle
tst.l GuiGfxDrawHandle(pc) ; drawhandle
beq .clearmenus ;
move.l GuiGfxDrawHandle(pc),a0 ;
CALLGUIGFX ReleaseDrawHandle ; (drawhandle)(a0)
clr.l GuiGfxDrawHandle ;
;----------------------------------------
; Close Menus
;----------------------------------------
.clearmenus
tst.l MyWindow(pc) ; window
beq.s .freemenus ;
move.l MyWindow(pc),a0 ;
CALLINT ClearMenuStrip ; (window)(a0)
.freemenus
tst.l MyMenuStrip(pc) ; menustrip
beq.s .freevisualinfo ;
move.l MyMenuStrip(pc),a0 ;
CALLGT FreeMenus ; (menustrip)(a0)
clr.l MyMenuStrip ;
.freevisualinfo
tst.l MyVisualInfo(pc) ; visualinfo
beq.s .closewindow ;
move.l MyVisualInfo(pc),a0 ;
CALLGT FreeVisualInfo ; (visualinfo)(a0)
clr.l MyVisualInfo ;
;----------------------------------------
; Close Window
;----------------------------------------
.closewindow
tst.l MyWindow(pc) ; window
beq.s .exit ;
move.l MyWindow(pc),a0 ;
moveq.l #0,d0 ;
move.w wd_LeftEdge(a0),d0 ; window->x
move.l d0,MyWindowX ;
move.w wd_TopEdge(a0),d0 ; window->y
move.l d0,MyWindowY ;
CALLINT CloseWindow ; (window)(a0)
clr.l MyWindow ;
.exit
movem.l (sp)+,d0-a6 ; Pop
rts ;
;-----------------------------------------------------------
Window_Redraw:
movem.l d0-a6,-(sp) ; push
tst.l MyWindow(pc) ; window
beq.s .exit ;
tst.l GuiGfxDrawHandle(pc) ; drawhandle
beq.s .exit ;
;----------------------------------------
; Draw pictures
;----------------------------------------
bsr Window_DrawBack ; background
;----------------------------------------
; Draw Texts
;----------------------------------------
move.l MyWindow(pc),a0 ; window
move.l wd_RPort(a0),a0 ; rastport
lea.l MyIText1(pc),a1 ; textfont
moveq.w #0,d0 ; x.w
moveq.w #0,d1 ; y.w
CALLINT PrintIText ; (rp,itext,x,y)(a0,a1,d0,d1)
.exit
movem.l (sp)+,d0-a6 ; pop
rts ; return
;-----------------------------------------------------------
Window_DrawBack:
movem.l d0-a6,-(sp) ; push
tst.l GuiGfxDrawHandle(pc) ; drawhandle
beq.s .exit ;
tst.l GuiGfxPic1(pc) ; picture
beq.s .exit ;
move.l GuiGfxDrawHandle(pc),a0 ; handle
move.l GuiGfxPic1(pc),a1 ; picture
moveq.w #0,d0 ; x.w
moveq.w #0,d1 ; y.w
lea.l GuiGfxTags(pc),a2 ; tags
CALLGUIGFX DrawPictureA ; (handle,pic,x,y,tags)(a0,a1,d0,d1,a2)
.exit
movem.l (sp)+,d0-a6 ; pop
rts ; return
;-----------------------------------------------------------
BarDraw:
lea.l BarCP1(pc),a0 ;
move.l #100,bar_Val1(a0) ;
bsr BarDraw1 ;
lea.l BarCP2(pc),a0 ;
move.l #100,bar_Val1(a0) ;