-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.s
783 lines (645 loc) · 19 KB
/
commands.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
.include "include/macros.i"
.include "include/ascii.i"
.include "include/hardware.i"
.global commandarray
.global printbuffer
.global clear
.global testtextmode
.section .rodata
.align 2
| command array consists of a command string link and some userdata for
| each named command. this userdata points to another record which consists
| of a subroutine reference (the handler) and a reference to a
| zero-terminated list of maximum data types.
commandarray: checkcommand "readbyte", 3
checkcommand "readword", 3
checkcommand "readlong", 3
checkcommand "dump", 3, 3
checkcommand "writebytes", 3, 1 + VARARG
checkcommand "writewords", 3, 2 + VARARG
checkcommand "writelongs", 3, 3 + VARARG
nocheckcommand "parsertest"
nocheckcommand "help"
checkcommand "diskidentify", 3
checkcommand "diskread", 3, 2, 1
checkcommand "diskwrite", 3, 2, 1
| checkcommand "playvgm", 3
| nocheckcommand "stopvgm"
nocheckcommand "showticks"
| checkcommand "clear", 3
| checkcommand "testvread", 3, 2, 2
| checkcommand "testvwrite", 3, 2, 2
checkcommand "checksum", 3, 2
checkcommand "memcopy", 3, 2, 3
checkcommand "patternfillw" 3, 2
checkcommand "patternfillb" 3, 2
checkcommand "memfill", 3, 2, 2
| checkcommand "showbmp", 3
| nocheckcommand "testtextmode"
| nocheckcommand "testattribs"
| checkcommand "setattrib", 1
| checkcommand "spitxrx", 1, 3, 2, 3, 2
checkcommand "sendkeyboard", 1
nocheckcommand "showkeyboard"
| nocheckcommand "sawtest"
checkcommand "download", 0x80, 3
| checkcommand "playpcm", 1, 3, 3, 1
nocheckcommand "showscancodes"
checkcommand "keyleds", 1
nocheckcommand "ledon"
nocheckcommand "ledoff"
nocheckcommand "reset"
| nocheckcommand "mousetest"
| checkcommand "dma", 3, 2
nocheckcommand "memtest"
| nocheckcommand "vidmemtest"
| nocheckcommand "anajoytest"
checkcommand "i2ctx", 1, 3, 2
checkcommand "i2crx", 1, 3, 2
| checkcommand "i2splay", 3, 2
checkcommand "eepromread", 1, 3, 2, 2
checkcommand "eepromwrite", 1, 3, 2, 2
checkcommand "floattest", 3
checkcommand "print", 3, 2
nocheckcommand "mandlebrot"
nocheckcommand "clearscreen"
nocheckcommand "drawstuff"
nocheckcommand "looptest"
checkcommand "ethdl", 0x80, 3
nocheckcommand "linuxdl"
checkcommand "linuxrun", 0x80
nocheckcommand "testtransmit"
nocheckcommand "resetkeyboard"
nocheckcommand "identkeyboard"
nocheckcommand "initmouse"
endcommand
.section .text
.align 2
| all commands: on entry a0 will be the type (word) array, and a1 will be the
| value (long) array.
| read the byte, word or long at the first argument and display it.
readbyte: movea.l (0,%a1),%a0 | get the first argument
move.b (%a0),%d0 | get the byte at that addr
movea.l #printbuffer,%a0 | set the output buffer
bsr bytetoascii | convert into a0
bra readcommon | add newline and print
readword: movea.l (0,%a1),%a0 | get the first argument
move.w (%a0),%d0 | get the word at that addr
movea.l #printbuffer,%a0 | set the output buffer
bsr wordtoascii | convert into a0
bra readcommon | add newline and print
readlong: movea.l (0,%a1),%a0 | get the first argument
move.l (%a0),%d0 | get the long at that addr
movea.l #printbuffer,%a0 | set the output buffer
bsr longtoascii | convert into a0
bra readcommon | add newline and print
readcommon: lea (newlinemsg,%pc),%a1 | need a newline
bsr strconcat | add it
movea.l #printbuffer,%a0 | wind buffer back
bsr conputstr | and print it
rts
| dump out (in words) from the first argument the length, the second
| argument (a byte count). the output includes the location, the hex,
| and the ascii, with unprintable chars showing as a dot. through this code:
|
| a0=the lilne buffer, a1=a string to concatenate, d0=coverted digits,
| d1=bytes left in total, d2=words or bytes left in this line,
| d3=up count of d2.
.section .text
.align 2
dump: movea.l (0*4,%a1),%a2 | get the start addr (a2)
move.l (1*4,%a1),%d1 | get the length (d1)
and.l #0xfffffff0,%d1 | round length, whole lines
| print the address first.
1: movea.l #printbuffer,%a0 | setup the print buffer
move.l %a2,%d0 | we need to convert the ...
bsr longtoascii | ... current address
move.b #ASC_SP,(%a0)+ | add a space
move.b #ASC_SP,(%a0)+ | add another space
| now the 16 bytes, in groups of words
move.w #8-1,%d2 | 8 words across
clr.w %d3 | up counter of words
2: move.w (%d3.w,%a2),%d0 | read the word
bsr wordtoascii | add it to the output
move.b #ASC_SP,(%a0)+ | add a space
cmp.w #4,%d2 | look for middle word
bne 3f | no extra space
move.b #ASC_SP,(%a0)+ | add a extra space
3: addq.w #2,%d3 | inc, in words, up counter
dbra %d2,2b | more words?
move.b #ASC_SP,(%a0)+ | only need one space
| ascii display
move.b #'[',(%a0)+ | add a bracket
move.w #16-1,%d2 | 16 bytes (chars) to print
clr.w %d3 | up counter of words
4: move.b (%d3.w,%a2),%d0 | read the byte
bsr makecharprint | convert it to dot?
move.b %d0,(%a0)+ | add it to the stream
addq.w #1,%d3 | inc up counter
dbra %d2,4b | more ascii?
move.b #']',(%a0)+ | close the brackets
| finish up and print the line
lea.l (newlinemsg,%pc),%a1 | finish with ...
bsr strconcat | ... a new line
movea.l #printbuffer,%a0 | now we can ...
bsr conputstr | ... print this line!
adda.l #0x10,%a2 | move to next chunk
sub.l #0x10,%d1 | adjust the byte count
bne 1b | back for more lines
rts
| writebytes, writewords and writelongs: write a list of values to memory
writeprelim: movea.l %a1,%a2 | where to find what writing
adda.l #4,%a2 | onto second arg
movea.l (0,%a1),%a1 | where we are writing to
adda.l #2,%a0 | move to second type
rts
writebytes: bsr writeprelim | setup
1: tst.w (%a0)+ | see if we are at end
beq 2f | yes? out
move.b (3,%a2),(%a1)+ | write the byte
adda.l #4,%a2 | move to next value
bra 1b
2: rts
writewords: bsr writeprelim | setup
1: tst.w (%a0)+ | see if we are at end
beq 2f | yes? out
move.w (2,%a2),(%a1)+ | write the byte
adda.l #4,%a2 | move to next value
bra 1b
2: rts
writelongs: bsr writeprelim | setup
1: tst.w (%a0)+ | see if we are at end
beq 2f | yes? out
move.l (0,%a2),(%a1)+ | write the byte
adda.l #4,%a2 | move to next value
bra 1b
2: rts
| test the parser: output the bytes, words and longs.
.section .text
.align 2
parsertest: movea.l %a0,%a2 | arg type table into a2
1: move.w (%a2)+,%d0 | get the current type
beq 2f | end of list?
movea.l #printbuffer,%a0 | start of print buffer
lea (typemsg,%pc),%a1 | add the type label
bsr strconcat | ...
bsr wordtoascii | convert d0 and append
lea (spacesmsg,%pc),%a1 | add a space
bsr strconcat | ...
lea (valuemsg,%pc),%a1 | value label
bsr strconcat | add it
move.l (%a3)+,%d0 | get the value
bsr longtoascii | add the value to a0
lea (newlinemsg,%pc),%a1 | end with a newline
bsr strconcat | append it
movea.l #printbuffer,%a0 | wind a0 back to start
bsr conputstr | and print it
bra 1b
2: rts
.section .rodata
.align 2
typemsg: .asciz "Type: "
valuemsg: .asciz "Value: "
| display help message.
.section .text
.align 2
help: lea (helpmsg,%pc),%a0 | get the help message
bsr conputstr | print it
rts
.section .rodata
.align 2
helpmsg: .ascii "Memory/IO:\r\n"
.ascii " readbyte addr.l : read byte at addr\r\n"
.ascii " readword addr.l : read word at addr\r\n"
.ascii " readlong addr.l : read long at addr\r\n"
.ascii " dump addr.l length.l : dump from addr, length bytes in ascii and hex\r\n"
.ascii " writebytes addr.l [value.b ...] : write bytes at addr\r\n"
.ascii " writewords addr.l [value.w ...] : write words at addr\r\n"
.ascii " writelongs addr.l [value.l ...] : write longs at addr\r\n"
.ascii "Disk:\r\n"
.ascii " diskidentify addr.l : write disk identify data at addr\r\n"
.ascii " diskread addr.l sector.w count.b : read sector, count 512B sectors\r\n"
.ascii " diskwrite addr.l sector.w count.b : write sector, count 512B sectors\r\n"
| .ascii "Video Game Music:\r\n"
| .ascii " playvgm addr.l : play VGM file from memory at addr\r\n"
| .ascii " stopvgm : stop VGM playback\r\n"
.ascii "Other:\r\n"
| .ascii " showticks : show the tick count in 1/44100 seconds\r\n"
.ascii " parsertest [foo.l] [bar.w] [baz.b] ... : test the parser\r\n"
.ascii " testvread addr.l start.w count.w : test video read into addr\r\n"
.ascii " testvwrite addr.l start.w count.w : test video write from addr\r\n"
.ascii " checksum addr.l count.w : checksum memory, connt in longs\r\n"
.ascii " clear data.l : clear the screen with data\r\n"
.ascii " help : this help.\r\n"
.asciz ""
.section .text
.align 2
diskidentify: movea.l (0*4,%a1),%a0 | get address to write in
bsr ideidentify | do the identify command
rts
diskread: movea.l (0*4,%a1),%a0 | get address to write in
move.l (1*4,%a1),%d1 | get the start sector
move.l (2*4,%a1),%d0 | and the count
bsr ideread | do the read command
rts
ethdl: move.l (1*4,%a1),-(%sp)
move.l (0*4,%a1),-(%sp)
bsr eth_download
lea 8(%sp),%sp
rts
linuxdl: move.l #0x1000,-(%sp)
move.l #vmlinux_name,-(%sp)
bsr eth_download
lea 8(%sp),%sp
rts
linuxrun: move.l (0*4,%a1),-(%sp) | stack the string
bsr linux_bootinfo | set bootinfo with cmdlien
lea 4(%sp),%sp | restore sp
move.l #0x0000,%d0
movec.l %d0,%cacr
move.w #0x2700,%sr
jmp 0x1000 | start the kernel
diskwrite: movea.l (0*4,%a1),%a0 | get address to write in
move.l (1*4,%a1),%d1 | get the start sector
move.l (2*4,%a1),%d0 | and the count
bsr idewrite | do the write command
rts
|playvgm: movea.l (0*4,%a1),%a6 | get the start addr into a6
| bsr vgmplayer | start the playback
| rts
|stopvgm: bsr vgmstop | simple wrapper
| rts
showticks: move.l timerticks,%d0
movea.l #printbuffer,%a0 | set the output buffer
bsr longtoascii | convert into a0
lea (newlinemsg,%pc),%a1 | need a newline
bsr strconcat | add it
movea.l #printbuffer,%a0 | wind buffer back
bsr conputstr | and print it
rts
|clear: move.l (0*4,%a1),%d2
| bsr conclear
| rts
|testvread: movea.l (0*4,%a1),%a0 | get address to write in
| move.w (1*4+2,%a1),%d1 | get the start
| move.w (2*4+2,%a1),%d0 | and the count
| subq.w #1,%d0 | used in dbra
| move.w %d1,VGARWADDRLO | one hit
| movea.l #VGADATA,%a1
| move.w (%a1),%d1 | dumamy read
|1: move.w (%a1),(%a0)+
| dbra %d0,1b
rts
|testvwrite: movea.l (0*4,%a1),%a0 | get address to read from
| move.w (1*4+2,%a1),%d1 | get the start
| move.w (2*4+2,%a1),%d0 | and the count
| subq.w #1,%d0 | used in dbra
| move.w %d1,VGARWADDRLO | one hit
| movea.l #VGADATA,%a1
|1: move.w (%a0)+,(%a1)
| dbra %d0,1b
| rts
memcopy: movea.l (0*4,%a1),%a0 | get address to read from
move.w (1*4+2,%a1),%d1 | get the length
subq.w #1,%d1 | used in dbra
movea.l (2*4,%a1),%a1 | get the detstination
1: move.l (%a0)+,(%a1)+ | copy the long
dbra %d1,1b | more?
rts
patternfillw: movea.l (0*4,%a1),%a0 | get address to read from
move.w (1*4+2,%a1),%d1 | get the length
subq.w #1,%d1 | used in dbra
1: move.w %d1,(%a0)+ | write the counter
dbra %d1,1b
rts
patternfillb: movea.l (0*4,%a1),%a0 | get address to read from
move.w (1*4+2,%a1),%d1 | get the length
subq.w #1,%d1 | used in dbra
1: move.b %d1,(%a0)+ | write the counter
dbra %d1,1b
rts
memfill: movea.l (0*4,%a1),%a0 | get address to read from
move.w (1*4+2,%a1),%d1 | get the length
move.w (2*4+2,%a1),%d0
subq.w #1,%d1 | used in dbra
1: move.w %d0,(%a0)+ | write the counter
dbra %d1,1b
rts
checksum: movea.l (0*4,%a1),%a0 | get address to read from
move.w (1*4+2,%a1),%d1 | get the length
subq.w #1,%d1 | used in dbra
clr.l %d0 | clear sum
1: add.l (%a0)+,%d0 | sum it
dbra %d1,1b | back for more
movea.l #printbuffer,%a0 | set the output buffer
bsr longtoascii | convert into a0
lea (newlinemsg,%pc),%a1 | need a newline
bsr strconcat | add it
movea.l #printbuffer,%a0 | wind buffer back
bsr conputstr | and print it
rts
|showbmp: movea.l (0*4,%a1),%a0 | get the address of bmp
| bsr bmpshow | display and wait
| rts
|testtextmode: move.w #80*60,%d0
| bsr conclear
| clr.w %d1
|1: move.w %d1,VGADATA | character
| add.w #0x0101,%d1
| dbra %d0,1b
| bsr congetchar
| bsr conclear
| rts
|testattribs: move.w #4-1,%d2
| move.w #0,VGARWADDRLO
| clr.w %d1
| movea.l #VGADATA,%a0
|2: move.w #640/16*480,%d0 | count of words
|1: move.w #0x00ff,(%a0)
| move.w #0xff00,(%a0)
| dbra %d0,1b
| bsr congetchar
| move.w #0,VGARWADDRLO
| dbra %d2,2b
| bsr conclear
| rts
|setattrib: move.b (0*4+3,%a1),attributes
| rts
|spitxrx: movea.l %a1,%a6
| movea.l (1*4,%a6),%a1 | get source
| move.w (2*4+2,%a6),%d1 | get the length to read
| movea.l (3*4,%a6),%a2 | get destination
| move.w (4*4+2,%a6),%d2 | get the length to write
| move.b (0*4+3,%a6),SPISELECTS
| tst.w %d1
| beq spirx
|spitx: subq.w #1,%d1 | dbra
|1: move.b (%a1)+,SPIDATA | get byte to send
| dbra %d1,1b
|
|spirx: tst.w %d2
| beq done
| subq.w #1,%d2 | dbra
|2: clr.b %d0
| move.b #0,SPIDATA
| nop
| move.b SPIDATA,(%a2)+
| dbra %d2,2b
|done: move.b #0,SPISELECTS
| rts
|anajoytest: move.b #0x03,SPISELECTS
| move.b #0x68,SPIDATA
| nop
| nop
| move.b SPIDATA,%d0
| lsl.w #8,%d0
| move.b #0,SPIDATA
| nop
| nop
| move.b SPIDATA,%d0
|
| movea.l #printbuffer,%a0 | set the output buffer
| bsr wordtoascii | convert into a0
| lea (newlinemsg,%pc),%a1 | need a newline
| bsr strconcat | add it
| movea.l #printbuffer,%a0 | wind buffer back
| bsr conputstr | and print it
|
| move.b #0,SPISELECTS
| move.w #0xffff,%d0
|1: dbra %d0,1b
| bra anajoytest
i2ctx: move.b (0*4+3,%a1),%d1 | i2c address
movea.l (1*4,%a1),%a0 | start addr
move.w (2*4+2,%a1),%d0 | length
bsr i2cwrite
rts
i2crx: move.b (0*4+3,%a1),%d1 | i2c address
movea.l (1*4,%a1),%a0 | start addr
move.w (2*4+2,%a1),%d0 | length
bsr i2cread
rts
eepromread: move.b (0*4+3,%a1),%d1 | i2c address
move.l (1*4,%a1),%a0 | local address
move.w (2*4+2,%a1),%d0 | length
move.w (3*4+2,%a1),%d2 | remote address
bsr i2ceewriteread
rts
eepromwrite: move.b (0*4+3,%a1),%d1 | i2c address
move.l (1*4,%a1),%a0 | local address
move.w (2*4+2,%a1),%d3 | length in pages
move.w (3*4+2,%a1),%d2 | remote address
1: bsr i2ceepagewrite
add.w #0x20,%d2
subq.w #1,%d3
bne 1b
rts
|i2splay: movea.l (0*4,%a1),%a0 | start addr
| move.w (1*4+2,%a1),%d0 | length
|
|i2splayloop: move.b (%a0)+,I2SDATA | trigger write
|
|1: btst.b #0,I2SSTATUS | get status
| bne 1b | loop until not busy
|
| dbra %d0,i2splayloop | more?
| bra i2splay
|
| rts
sendkeyboard: move.b (0*4+3,%a1),%d0
bsr conputmcuchar
rts
showkeyboard: bsr testcongetchar
move.b %d0,%d1
cmp.b #ASC_ESC,%d0
beq showkeyboardo
bsr serputchar
bra showkeyboard
showkeyboardo: rts
|sawtest: move.w #0x3000,%d0
| move.w #0xff-1,%d1
||1: bsr sendspiword
| addi.w #0x10,%d0
| dbra %d1,1b
| move.w #0xff-1,%d1
||2: bsr sendspiword
| subi.w #0x10,%d0
| dbra %d1,2b
| bra sawtest
download: movea.l (0*4,%a1),%a0
movea.l (1*4,%a1),%a2
move.b #1,%d0
bsr dlputchar
bsr dlputstr
clr.b %d0
bsr dlputchar
bsr dlgetchar | ignore response for now
move.w #4-1,%d1
clr.l %d2
1: lsl.l #8,%d2
bsr dlgetchar
move.b %d0,%d2
dbra %d1,1b | d2 now has length
movea.l #printbuffer,%a0 | wind a0 back to start
lea (filesizemsg,%pc),%a1 | value label
bsr strconcat | add it
move.l %d2,%d0
bsr longtoascii | add the value to a0
lea (newlinemsg,%pc),%a1 | end with a newline
bsr strconcat | append it
movea.l #printbuffer,%a0 | wind a0 back to start
bsr conputstr | and print it
move.b #1,%d0 | load the go signal
bsr dlputchar | and send it
2: tst.l %d2
beq 4f
bsr dlgetchar
move.b %d0,(%a2)+ | save the read byte
tst.b %d2 | look at lowest byte
bne 3f | not zero, don't print
move.b #'.,%d0 | print . every 256 bytes
bsr conputchar
3: subq.l #1,%d2
bra 2b
4: lea (newlinemsg,%pc),%a0 | end with a newline
bsr conputstr | and print it
rts
.section .rodata
.align 2
filesizemsg: .asciz "File size: "
| .section .text
| .align 2
|playpcm: move.b (0*4+3,%a1),%d2
| movea.l (1*4,%a1),%a0
| move.l (2*4,%a1),%d1
| move.w (3*4+2,%a1),%d0
|
| lsl.w #4,%d0
| or.w #0xb000,%d0
| ror.w #8,%d0
| move.b %d2,SPISELECTS
| move.b %d0,SPIDATA
| ror.w #8,%d0
| move.b %d0,SPIDATA
| move.b #0,SPISELECTS
|1: clr.w %d0
| move.b (%a0)+,%d0
| lsl.w #4,%d0
| or.w #0x3000,%d0
| ror.w #8,%d0
| move.b %d2,SPISELECTS
| move.b %d0,SPIDATA
| ror.w #8,%d0
| move.b %d0,SPIDATA
| move.b #0,SPISELECTS
|
|2: move.w #0x10,%d0
|3: dbra %d0,3b
|
| subq.l #1,%d1
| bne 1b
|
| rts
initmouse: move.b #0xf4,%d0
bsr txkeyboard
bsr rxkeyboard
rts
identkeyboard: move.b #0xf2,%d0
bsr txkeyboard
bsr rxkeyboard
bsr rxkeyboard
bsr rxkeyboard
rts
showscancodes: bsr rxkeyboard
bra showscancodes
txkeyboard: btst.b #2,PS2ASTATUS
beq txkeyboard
move.b %d0,PS2ASCANCODE
1: btst.b #2,PS2ASTATUS
bne 1b
rts
rxkeyboard: movem.l %a0-%a1,-(%sp)
1: btst.b #0,PS2ASTATUS
beq 1b
move.b PS2ASCANCODE,%d0
movea.l #printbuffer,%a0 | set the output buffer
bsr bytetoascii | convert into a0
lea (newlinemsg,%pc),%a1 | need a newline
bsr strconcat | add it
movea.l #printbuffer,%a0 | wind buffer back
bsr conputstr | and print it
movem.l (%sp)+,%a0-%a1
rts
keyleds: move.b #0xed,%d0
bsr txkeyboard
bsr rxkeyboard
move.b (0*4+3,%a1),%d0
bsr txkeyboard
bsr rxkeyboard
rts
resetkeyboard: move.b #0xff,%d0
bsr txkeyboard
bsr rxkeyboard
bsr rxkeyboard
rts
ledon: move.b #1,LED
rts
ledoff: move.b #0,LED
rts
reset: reset
rts
|dma: move.l #0,VGARWADDRHI
| move.l (0*4,%a1),DMASRCHI
| move.w (1*4+2,%a1),DMALEN
| move.w #0x0003,DMAFLAGS
| rts
|
|vidmemtest: move.w #0,%d0
|1: bsr vsetmemtoword
| bsr vcmpmemtoword
| add.w #0xaa55,%d0
| movea.l #printbuffer,%a0 | set the output buffer
| bsr wordtoascii | convert into a0
| lea (newlinemsg,%pc),%a1 | need a newline
| bsr strconcat | add it
| movea.l #printbuffer,%a0 | wind buffer back
| bsr conputstr | and print it
|
| bra 1b
| rts
floattest: fmove.d #0f2.0,%fp0
fsqrt.x %fp0
move.l (0*4+0,%a1),%a0
fmove.d %fp0,(%a0)
rts
print: move.l (1*4,%a1),-(%sp) | length.w
move.l (0*4,%a1),-(%sp) | data.l
bsr print_buffer
lea.l 8(%sp),%sp
rts
mandlebrot: bsr mandlebrotc
rts
looptest: moveq.l #1,%d0
move.w #0x800,%d1
move.b #1,LED
move.l #1,temp
1: add.l temp,%d0
dbra %d1,1b
move.b #0,LED
movea.l #printbuffer,%a0 | set the output buffer
bsr longtoascii | convert into a0
lea (newlinemsg,%pc),%a1 | need a newline
bsr strconcat | add it
movea.l #printbuffer,%a0 | wind buffer back
bsr conputstr | and print it
rts
testtransmit: bsr ne2k_setup
bsr test_transmit
rts
.section .bss
.align 2
| shared buffer used for printing.
printbuffer: .space 256
temp: .long
.section .rodata
vmlinux_name: .asciz "vmlinux.bin"