comparison TL1/TL1os9.asm @ 164:c90b9be8c307

TL1 module write
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 10 Apr 2019 07:42:15 +0900
parents e09e66204c71
children 5aefcd52aba8
comparison
equal deleted inserted replaced
163:e09e66204c71 164:c90b9be8c307
51 WEND RMB 2 word end 51 WEND RMB 2 word end
52 PMODE RMB 1 0x20 main, 1 proc, 0 ? 52 PMODE RMB 1 0x20 main, 1 proc, 0 ?
53 RSW RMB 1 0 word lookup, 0xff word register mode in tlook 53 RSW RMB 1 0 word lookup, 0xff word register mode in tlook
54 GEND RMB 2 end of global name 54 GEND RMB 2 end of global name
55 SSW RMB 1 55 SSW RMB 1
56 runmod RMB 1
56 modofs RMB 2 module library offset 57 modofs RMB 2 module library offset
57 58
58 filepath rmb 2 59 filepath rmb 2
59 parmptr rmb 2 60 parmptr rmb 2
60 stdin rmb 2 61 stdin rmb 2
67 ** 68 **
68 LIBR equ . 69 LIBR equ .
69 ioentry rmb $80 70 ioentry rmb $80
70 readbuff rmb bufsiz+1 71 readbuff rmb bufsiz+1
71 72
72 OBJSTART RMB 12 73 OBJSTART RMB 11
73 74
74 75
75 * OBJECT PG AREA 76 * OBJECT PG AREA
76 77
77 WTBLE RMB $100+500 78 WTBLE RMB $100+500
97 LDX <PC 98 LDX <PC
98 leay ,x 99 leay ,x
99 OBJMP JMP OBJECT,u 100 OBJMP JMP OBJECT,u
100 101
101 102
102 start ldy #-2 17 xx xx 103 start LEAY OBJECT,u
104 STY PC
105 lda ,x
106 cmpa '-'
107 bne run
108 leax 1,x
109 lda ,x+
110 cmp 'c'
111 bne run
112 lbsr modsetup
113 bra fread
114 run ldy #-2 17 xx xx
103 sty modofs 115 sty modofs
104 clr <stdin 116 fread clr <stdin
105 stx <parmptr save parameter pointer 117 stx <parmptr save parameter pointer
106 stu <work save parameter pointer 118 stu <work save parameter pointer
107 lda #READ. read access mode 119 lda #READ. read access mode
108 os9 I$Open open file 120 os9 I$Open open file
109 lbcs ferr branch if error 121 lbcs ferr branch if error
174 tbl1 lda ,x+ 186 tbl1 lda ,x+
175 sta ,y+ 187 sta ,y+
176 decb 188 decb
177 bne tbl1 189 bne tbl1
178 sty TEND 190 sty TEND
179 LEAX OBJECT,u
180 STX PC
181 ** 191 **
182 LBSR CRLF 192 LBSR CRLF
183 BSR REG0 193 BSR REG0
184 LBSR WORD 194 LBSR WORD
185 CMPA #$30 PROC? 195 CMPA #$30 PROC?
1405 PULS A 1415 PULS A
1406 LDX ZR 1416 LDX ZR
1407 BRA EL2 1417 BRA EL2
1408 EL LDX PC 1418 EL LDX PC
1409 LBRA C 1419 LBRA C
1420
1421 modsetup
1422 pshs x,y,u
1423 lda #$ff
1424 sta <runmod
1425 puls x,y,pc
1426 ldy <pc
1427 ldd #$87CD
1428 std ,y++
1429 ldd #$0c0a
1430 std ,y++
1431 ldd #$000d
1432 ldy <pc
1433 leay 0xd,y
1434 ldx ,s
1435 bsr mkmodnam
1436 sty <runtop
1437 leau crt0top,pc
1438 ldx #LIBEND-crt0top
1439 libcpy ldd ,u++
1440 std ,y++
1441 leax -2,x
1442 bhi libcpy
1443 sty <PC
1444 ldd <runtop
1445 subd #LIBEND+2
1446 std modofs
1447 puls x,y,u,pc
1448
1449 mkmodnam pshs x,y.u
1450 m0 lda ,x+
1451 bne m2
1452 cmpa '/'
1453 bne m0
1454 tfr x,u
1455 bra m0
1456 m1 lda ,u+
1457 beq m3
1458 cmpa '.'
1459 beq m3
1460 sta ,y+
1461 bra m1
1462 m3 lda -1,y
1463 ora #$80
1464 sta -1,y
1465 sty 2,s
1466 puls x,y,u,pc
1467
1468 modend leax OBJECT,u * header setup
1469 ldy <PC
1470 sty 2,x
1471 * header parity
1472 clra
1473 ldb #7
1474 m4 adda ,x+
1475 decb
1476 bne m4
1477 sta ,x+ header parity
1478 leay OBJECT,u
1479 leay crt0-crt0top,y
1480 sty ,x++ start address
1481 ldy GEND
1482 clra
1483 clrb
1484 m5 tst ,y+
1485 bpl m5
1486 beq m6
1487 leay 1,y
1488 addd #1
1489 bra m5
1490 m6 std $b,u global size
1491 * mod CRC
1492 pshs d,u
1493 leax OBJECT,u
1494 ldu <PC
1495 clr ,u
1496 clr 1,u
1497 clr 2,u
1498 os9 F$CRC
1499
1500 * write to file
1501 ldu 2,s
1502 leax OBJECT,u
1503 ldd 4,x
1504 leax d,x
1505 lda 2 write
1506 os9 I$Open
1507 bcs ERROR
1508 sta ,s
1509 ldu 2,s
1510 leax OBJECT,u
1511 ldd <PC
1512 addd #3
1513 pshs x
1514 subd ,s++
1515 lda ,s
1516 os9 I$Write
1517 bcs ERROR
1518 clra
1519 os9 F$Exit all end
1520
1410 1521
1411 ********************** 1522 **********************
1412 * ADVANCE WORD 1523 * ADVANCE WORD
1413 ** 1524 **
1414 WTABLE FCB 0 END MARK 1525 WTABLE FCB 0 END MARK
1513 ****** 1624 ******
1514 * SUPORTING ROUTINES 1625 * SUPORTING ROUTINES
1515 * & I/0 CONTROL 1626 * & I/0 CONTROL
1516 ** 1627 **
1517 1628
1629 crt0top
1630
1518 ** 1631 **
1519 * PUSH LB & SET NEW LB 1632 * PUSH LB & SET NEW LB
1520 ** 1633 **
1521 *PSHLB pshs y 1634 *PSHLB pshs y
1522 * leay ,x 1635 * leay ,x
1839 * On input the D register contains the number of timer 1952 * On input the D register contains the number of timer
1840 * ticks to wait. Each timer tick is 20ms 1953 * ticks to wait. Each timer tick is 20ms
1841 TFR D,X 1954 TFR D,X
1842 OS9 F$Sleep 1955 OS9 F$Sleep
1843 PULS D,X,PC 1956 PULS D,X,PC
1957
1958 crt0 stx <args
1959 leax OBJSTART,u
1960 * compiled code follows
1961
1844 LIBEND 1962 LIBEND
1845 1963
1846 1964
1847 emod 1965 emod
1848 eom equ * 1966 eom equ *