-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.asm
1629 lines (1455 loc) · 25.9 KB
/
project.asm
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
[org 0x0100]
jmp start
temp: db'Temp'
length: dw 4
speed: db'rpm'
length1: dw 3
rm1: dw 1199,1203,1
rm2: dw 1517,1525,3
rm3: dw 2317,2325,4
tickcount: dd 0 ;timer
tc: dd 0
fr: dw 00,00
end: dw 0
oldisr: dd 0
;-------------------------------------------------------------start-----------------------------------------------------------;
line:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
l:
mov word[es:di],0x37db
add di,2
cmp di,si
jne l
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret
des:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
d:
mov word[es:di],0x0f27
add di,2
cmp di,si
jne d
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret 4
red:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
r_e_d:
mov word[es:di],0x34db
add di,2
cmp di,si
jne r_e_d
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret 4
green:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
g_r_e_e_n:
mov word[es:di],0x32db
add di,2
cmp di,si
jne g_r_e_e_n
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret 4
black:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
b:
mov word[es:di],0x0000
add di,2
cmp di,si
jne b
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret 4
printstr:
push bp
mov bp, sp
push es
push ax
push cx
push si
push di
mov ax, 0xb800
mov es, ax ; point es to video base
mov al, 80 ; load al with columns per row
mul byte [bp+10] ; multiply with y position
add ax, [bp+12] ; add x position
shl ax, 1 ; turn into byte offset
mov di,ax ; point di to required location
mov si, [bp+6] ; point si to string
mov cx, [bp+4] ; load length of string in cx
mov ah, [bp+8] ; load attribute in ah
nextchar: mov al, [si] ; load next char of string
mov [es:di], ax ; show this char on screen
add di, 2
add si, 1 ; move to next char in string
loop nextchar ; repeat the operation cx times
pop di
pop si
pop cx
pop ax
pop es
pop bp
ret 10
;-------------------------------------------------------------sky-----------------------------------------------------------;
sky:
mov bp,sp
push ax
push es
push cx
push si
push di
mov ax,0xb800
mov es,ax
mov di,0
s:
mov word[es:di],0x0bdb ;color
add di,2
cmp di ,1120
jne s
pop di
pop si
pop cx
pop es
pop ax
ret
;-------------------------------------------------------------Dashboard-----------------------------------------------------------;
dashboard:
mov bp,sp
push ax
push es
push cx
push si
push di
mov ax,0xb800
mov es,ax
mov di,3040
color:
mov word[es:di],0x26db
add di,2
cmp di ,4000 ;checks if di has reached the end
jne color
pop di
pop si
pop cx
pop es
pop ax
ret
;-------------------------------------------------------------BackMirrors-----------------------------------------------------------;
backmirrors:
push es
push ax
mov ax,0xb800
mov es,ax
rightbackmirror:
mov word[es:3344],0xffff
mov word[es:3346],0xffff
mov word[es:3348],0xffff
mov word[es:3350],0xffff
mov word[es:3352],0x22db
mov word[es:3354],0x22db
mov word[es:3356],0x22db
mov word[es:3358],0x22db
mov word[es:3504],0xffff
mov word[es:3506],0xffff
mov word[es:3508],0xffff
mov word[es:3510],0xffff
mov word[es:3512],0xffff
mov word[es:3514],0x22db
mov word[es:3516],0x22db
mov word[es:3518],0x22db
leftbackmirror:
mov word[es:3200],0x22db
mov word[es:3202],0x22db
mov word[es:3204],0x22db
mov word[es:3206],0x22db
mov word[es:3208],0xffff
mov word[es:3210],0xffff
mov word[es:3212],0xffff
mov word[es:3214],0xffff
mov word[es:3360],0x22db
mov word[es:3362],0x22db
mov word[es:3364],0x22db
mov word[es:3366],0xffff
mov word[es:3368],0xffff
mov word[es:3370],0xffff
mov word[es:3372],0xffff
mov word[es:3374],0xffff
pop ax
pop es
ret
;-------------------------------------------------------------Gear-----------------------------------------------------------;
gear:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov al,80
mul byte[bp+10]
add ax,[bp+12]
shl ax,1
mov di,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
ga:
mov word[es:di],0x01cd
add di,2
cmp di,si
jne ga
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret 4
steering_center:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov al,80
mul byte[bp+10]
add ax,[bp+12]
shl ax,1
mov di,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
s_c_:
mov word[es:di],0x38db
add di,2
cmp di,si
jne s_c_
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret 4
gearbox:
mov bp,sp
push ax
push es
push cx
push si
push di
push bx
push dx
mov cx,2
mov ax,0xb800
mov es,ax
mov al,80
mul byte[bp+10]
add ax,[bp+12]
shl ax,1
mov di,ax
mov di,[bp+4]
mov bx,[bp+4]
mov si,[bp+2]
mov dx,[bp+2]
gb:
mov word[es:di],0x01ba
add di,2
cmp di,si
jne gb
pop dx
pop bx
pop di
pop si
pop cx
pop es
pop ax
ret 4
l500:
jmp signal
ster_chk:
add si,160
add di,160
jmp s_c
ster:
push si
push di
push ax
mov si,3430
mov di,3434
s_c:
mov ax,si ;starting point
push ax
mov ax,di ;ending point
push ax
call black
cmp di,3914
je ster2
cmp di,3914
jne ster_chk
ster_chk2:
add si,160
add di,160
jmp s_c2
ster2:
mov si,3460
mov di,3464
s_c2:
mov ax,si ;starting point
push ax
mov ax,di ;ending point
push ax
call black
cmp di,3944
je l500
cmp di,3944
jne ster_chk2
signal_c:
add si,160
add di,160
jmp s_ch
signal:
mov si,170
mov di,188
s_ch:
mov ax,si ;starting point
push ax
mov ax,di ;ending point
push ax
call black
cmp di,828
jne signal_c
l200:
mov ax,3792
push ax
mov ax,3808
push ax
call black
mov ax,3800
push ax
mov ax,3802
push ax
call gearbox
mov ax,3792
push ax
mov ax,3794
push ax
call gearbox
mov ax,3808
push ax
mov ax,3810
push ax
call gearbox
mov ax,3968
push ax
mov ax,3970
push ax
call gearbox
mov ax,3952
push ax
mov ax,3968
push ax
call gear
mov ax,3952
push ax
mov ax,3954
push ax
call gearbox
mov ax,3960
push ax
mov ax,3962
push ax
call gearbox
mov ax,170
push ax
mov ax,178
push ax
call red
mov ax,180
push ax
mov ax,188
push ax
call red
mov ax,490
push ax
mov ax,498
push ax
call red
mov ax,500
push ax
mov ax,508
push ax
call red
mov ax,810
push ax
mov ax,818
push ax
call green
mov ax,820
push ax
mov ax,828
push ax
call green
mov ax,44
push ax
mov ax,22
push ax
mov ax,3
push ax
mov ax,temp
push ax
push word[length]
call printstr
mov ax,38
push ax
mov ax,22
push ax
mov ax,3
push ax
mov ax,speed
push ax
push word[length1]
call printstr
mov ax,3914
push ax
mov ax,3940
push ax
call des
mov ax,3922
push ax
mov ax,3932
push ax
call steering_center
mov ax,3762
push ax
mov ax,3772
push ax
call steering_center
mov ax,3792
push ax
call circle
mov ax,3894
push ax
mov ax,3898
push ax
call red
mov ax,3894
push ax
call fire
jmp l300
l300:
pop ax
pop di
pop si
ret
button:
push bp
mov bp,sp
push ax
push es
push di
push cx
push si
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov ax,0x0904
mov [es:di],ax
pop si
pop cx
pop di
pop es
pop ax
pop bp
ret 2
fire:
push bp
mov bp,sp
push ax
push es
push di
push cx
push si
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov cx,1
mov ax,0x4746
mov [es:di],ax
pop si
pop cx
pop di
pop es
pop ax
pop bp
ret 2
circle:
push bp
mov bp,sp
push ax
push es
push di
push cx
push si
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov ax,0x0A6f;ascii of o
mov [es:di],ax
pop si
pop cx
pop di
pop es
pop ax
pop bp
ret 2
clrscr:
push es
push ax
push di
mov ax, 0xb800
mov es, ax ; point es to video base
mov di, 0 ; point di to top left column
nextloc: mov word [es:di], 0x0720 ; clear next char on screen
add di, 2 ; move to next screen location
cmp di, 4000 ; has the whole screen cleared
jne nextloc ; if no clear next position
pop di
pop ax
pop es
ret
redish:
push es
push ax
push cx
push di
mov ax,0xb800
mov es,ax
mov di,162
mov cx,84
linee:
mov word[es:di],0x34db
add di,2
sub cx,1
cmp cx,81
jne linee
pop di
pop cx
pop ax
pop es
ret
greenish:
push es
push ax
push cx
push di
mov ax,0xb800
mov es,ax
mov di,482
mov cx,244
lineee:
mov word[es:di],0x06db
add di,2
sub cx,1
cmp cx,241
jne lineee
pop di
pop cx
pop ax
pop es
ret
yellowish:
push es
push ax
push cx
push di
mov ax,0xb800
mov es,ax
mov di,802
mov cx,404
lineeee:
mov word[es:di],0x22db
add di,2
sub cx,1
cmp cx,401
jne lineeee
pop di
pop cx
pop ax
pop es
ret
;-------------------------------------------------------------GrassArea-----------------------------------------------------------;
GrassArea:
push si
push di
push ax
push cx
push bx
push dx
push es
mov si,1121 ;;left start
mov di,1181 ;;left end
mov bx,1223 ;;right start
mov cx,1281 ;;right end
c_g:
push si
mov ax,0xb800
mov es,ax
gl:
mov byte[es:si],0x23
add si,2
cmp di,si
jne gl
mov si,bx
gr:
mov byte[es:si],0x23
add si,2
cmp cx,si
jne gr
pop si
push di
push bx
call road
cGA:
add si,160
add di,156
add bx,164
add cx,160
cmp cx,3201
jne c_g
cmp word[fr],1
jne ende
mov word[end],1
ende:
pop es
pop dx
pop bx
pop cx
pop ax
pop di
pop si
ret
grass:
push bp
mov bp,sp
push ax
push es
push si
push di
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov si,[bp+6]
g:
mov byte[es:si],0x23
add si,2
cmp di,si
jne g
pop di
pop si
pop es
pop ax
pop bp
ret 4
road:
push bp
mov bp,sp
push ax
push es
push si
push di
mov ax,0xb800
mov es,ax
mov di,[bp+4]
mov si,[bp+6]
r:
mov byte[es:si],0x73
add si,2
cmp di,si
jne r
pop di
pop si
pop es
pop ax
pop bp
ret 4
;-------------------------------------------------------------Patches-----------------------------------------------------------;
patches1:
push es
push ax
mov ax,0xb800
mov es,ax
mov word[es:1198],0x0720
mov word[es:1200],0x0720
mov word[es:1202],0x0720
mov word[es:1358],0x0720
mov word[es:1360],0x0720
mov word[es:1362],0x0720
mov word[es:1518],0x0720
mov word[es:1520],0x0720
mov word[es:1522],0x0720
pop ax
pop es
ret
patches2:
push es
push ax
mov ax,0xb800
mov es,ax
mov word[es:1838],0x0720
mov word[es:1840],0x0720
mov word[es:1842],0x0720
mov word[es:1998],0x0720
mov word[es:2000],0x0720
mov word[es:2002],0x0720
mov word[es:2158],0x0720
mov word[es:2160],0x0720
mov word[es:2162],0x0720
pop ax
pop es
ret
patches3:
push es
push ax
mov ax,0xb800
mov es,ax
mov word[es:2478],0x0720
mov word[es:2480],0x0720
mov word[es:2482],0x0720
mov word[es:2638],0x0720
mov word[es:2640],0x0720
mov word[es:2642],0x0720
mov word[es:2798],0x0720
mov word[es:2800],0x0720
mov word[es:2802],0x0720
pop ax
pop es
ret
crow:
push es
push ax
mov ax,0xb800
mov es,ax
mov word[es:180],0x0720
mov word[es:182],0x0720
mov word[es:186],0x0720
mov word[es:188],0x0720
mov word[es:344],0x0720
mov word[es:210],0x0720
mov word[es:212],0x0720
mov word[es:216],0x0720
mov word[es:218],0x0720
mov word[es:374],0x0720
mov word[es:300],0x0720
mov word[es:302],0x0720
mov word[es:306],0x0720
mov word[es:308],0x0720
mov word[es:464],0x0720
pop ax
pop es
ret
sun:
push es
push ax
mov ax,0xb800
mov es,ax
mov word[es:290],0x26db
mov word[es:292],0x26db
mov word[es:294],0x26db
mov word[es:296],0x26db
mov word[es:298],0x26db
mov word[es:450],0x26db
mov word[es:452],0x26db
mov word[es:454],0x26db
mov word[es:456],0x26db
mov word[es:458],0x26db
mov word[es:610],0x26db
mov word[es:612],0x26db
mov word[es:614],0x26db
mov word[es:616],0x26db
mov word[es:618],0x26db
pop ax
pop es
ret
fuel:
push es
push ax
mov ax,0xb800
mov es,ax
mov word[es:3700],0x0720
mov word[es:3702],0x0720
mov word[es:3704],0x0720
mov word[es:3706],0x0720
mov word[es:3860],0x4720
mov word[es:3862],0x4720
mov word[es:3864],0x4720
mov word[es:3866],0x4720
mov word[es:3860],0x4746
mov word[es:3862],0x4755
mov word[es:3864],0x4745
mov word[es:3866],0x474c
pop ax
pop es
ret
gas:
push es
push ax
mov ax,0xb800
mov es,ax
mov word[es:3720],0x0720
mov word[es:3722],0x0720