comparison TL1/TL1os9.asm @ 168:2937e970aac6

generate os9 module done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 11 Apr 2019 13:59:28 +0900
parents 3f8bbec566b3
children c9dc1be48de4
comparison
equal deleted inserted replaced
167:3f8bbec566b3 168:2937e970aac6
45 OPER RMB 1 45 OPER RMB 1
46 GLL RMB 1 left value g 0xff / local l 46 GLL RMB 1 left value g 0xff / local l
47 AMODE RMB 1 47 AMODE RMB 1
48 ACC RMB 1 48 ACC RMB 1
49 LSIZE RMB 1 local variable size (including arguments ) 49 LSIZE RMB 1 local variable size (including arguments )
50 GSIZE RMB 1 global variable including array
50 TCOUNT RMB 1 1 search reserved word only, 5 search all local/global var/array, proc 51 TCOUNT RMB 1 1 search reserved word only, 5 search all local/global var/array, proc
51 TEND RMB 2 table end (search start from here ) include local name 52 TEND RMB 2 table end (search start from here ) include local name
52 WEND RMB 2 word end 53 WEND RMB 2 word end
53 PMODE RMB 1 0x20 main, 1 proc, 0 ? 54 PMODE RMB 1 0x20 main, 1 proc, 0 ?
54 RSW RMB 1 0 word lookup, 0xff word register mode in tlook 55 RSW RMB 1 0 word lookup, 0xff word register mode in tlook
69 ** 70 **
70 LIBR equ . 71 LIBR equ .
71 ioentry rmb $80 72 ioentry rmb $80
72 readbuff rmb bufsiz+1 73 readbuff rmb bufsiz+1
73 74
74 OBJSTART RMB 11 75 OBJSTART RMB 10
75 76
76 77
77 * OBJECT PG AREA 78 * OBJECT PG AREA
78 79
79 WTBLE RMB $100+500 80 WTBLE RMB $100+500
84 85
85 size equ . 86 size equ .
86 87
87 name fcs /TL1/ 88 name fcs /TL1/
88 fcb edition 89 fcb edition
90
89 91
90 ** OBJECT START 92 ** OBJECT START
91 ****** 93 ******
92 C tst <runmod 94 C tst <runmod
93 beq c2 95 beq c2
203 CMPA #$31 FUNC? 205 CMPA #$31 FUNC?
204 BNE *+4 206 BNE *+4
205 BSR REGNAM 207 BSR REGNAM
206 CLR LSIZE 208 CLR LSIZE
207 BSR REG0 209 BSR REG0
210 LDB LSIZE
211 STB GSIZE
208 LBSR PROG 212 LBSR PROG
209 LBSR STPOUT 213 LBSR STPOUT
210 LDX TEND 214 LDX TEND
211 STX GEND 215 STX GEND
212 PLOOP LDA SY 216 PLOOP LDA SY
1426 pshs x,y,u 1430 pshs x,y,u
1427 lda #$ff 1431 lda #$ff
1428 sta <runmod 1432 sta <runmod
1429 ldy <pc 1433 ldy <pc
1430 ldd #$87CD 1434 ldd #$87CD
1435 std ,y
1436 leay 4,y skip size
1437 ldd #$0d module name offset
1431 std ,y++ 1438 std ,y++
1432 ldd #$0c0a 1439 ldd #$1180 type language
1433 std ,y++ 1440 std ,y++
1434 leay 9,y 1441 ldd #$1a00 attribue rev
1442 leay 5,y
1443 * put module name
1435 ldx ,s 1444 ldx ,s
1436 bsr mkmodnam 1445 bsr mkmodnam
1437 tfr y,d 1446 tfr y,d
1438 subd #LIBEND+2 1447 leax crt0top,pcr
1439 std modofs 1448 pshs x
1449 subd ,s++
1450 subd #2
1451 std modofs
1440 leau crt0top,pc 1452 leau crt0top,pc
1441 ldx #LIBEND-crt0top 1453 ldx #LIBEND-crt0top
1442 libcpy ldd ,u++ 1454 libcpy lda ,u+
1443 std ,y++ 1455 sta ,y+
1444 leax -2,x 1456 leax -1,x
1445 bhi libcpy 1457 bne libcpy
1446 sty <PC 1458 sty <PC
1447 puls x,y,u,pc 1459 puls x,y,u,pc
1448 1460
1449 mkmodnam pshs x,y,u 1461 mkmodnam pshs x,y,u
1450 m4 tfr x,u 1462 m7 tfr x,u
1451 tst ,x 1463 lda ,x+
1452 lbeq ERROR * no file name 1464 lbeq ERROR * no file name
1453 cmpa #' ' 1465 cmpa #' '
1454 bne m0 1466 bne m2
1455 leax 1,x 1467 bra m7
1456 bra m4
1457 m0 lda ,x+ 1468 m0 lda ,x+
1458 cmpa #' ' 1469 m2 cmpa #' '
1459 ble m1 1470 ble m1
1460 cmpa #'/' 1471 cmpa #'/'
1461 bne m0 1472 beq m8
1462 cmpa #':' 1473 cmpa #':'
1463 bne m0 1474 bne m0
1464 tfr x,u 1475 m8 tfr x,u
1465 bra m0 1476 bra m0
1466 m1 lda ,u+ 1477 m1 lda ,u+
1467 cmpa #' ' 1478 cmpa #' '
1468 ble m3 1479 ble m3
1469 cmpa #'.' 1480 cmpa #'.'
1475 sta -1,y 1486 sta -1,y
1476 sty 2,s 1487 sty 2,s
1477 puls x,y,u,pc 1488 puls x,y,u,pc
1478 1489
1479 modend leax OBJECT,u * header setup 1490 modend leax OBJECT,u * header setup
1480 ldy <PC 1491 ldd <PC
1481 sty 2,x 1492 pshs x
1493 subd ,s++
1494 addd #3
1495 std 2,x module size
1482 * header parity 1496 * header parity
1483 clra 1497 clra
1484 ldb #7 1498 ldb #8
1485 m4 adda ,x+ 1499 m4 eora ,x+
1486 decb 1500 decb
1487 bne m4 1501 bne m4
1502 eora #$ff
1488 sta ,x+ header parity 1503 sta ,x+ header parity
1489 leay OBJECT,u 1504 leay crt0,pcr
1490 leay crt0-crt0top,y 1505 ldd modofs
1491 sty ,x++ start address 1506 addd #11
1492 ldy GEND 1507 leay d,y
1493 clra 1508 tfr y,d
1494 clrb 1509 pshs x
1495 m5 tst ,y+ 1510 subd ,s++
1496 bpl m5 1511 std ,x++ start address offset
1497 beq m6 1512 clra
1498 leay 1,y 1513 ldb GSIZE
1499 addd #1 1514 addd #1
1500 bra m5 1515 std ,x global size
1501 m6 std $b,u global size
1502 * mod CRC 1516 * mod CRC
1503 pshs d,u 1517 pshs d,u
1504 leax OBJECT,u 1518 leax OBJECT,u
1505 ldu <PC 1519 ldu <PC
1506 clr ,u 1520 lda #$ff
1507 clr 1,u 1521 sta ,u
1508 clr 2,u 1522 sta 1,u
1523 sta 2,u
1524 tfr u,d
1525 pshs x
1526 subd ,s++
1527 tfr d,y
1509 os9 F$CRC 1528 os9 F$CRC
1529 com ,u
1530 com 1,u
1531 com 2,u
1510 1532
1511 * write to file 1533 * write to file
1512 ldu 2,s 1534 ldu 2,s
1513 leax OBJECT,u 1535 leax OBJECT,u
1514 ldd 4,x 1536 ldd 4,x
1515 leax d,x 1537 leax d,x
1516 lda 2 write 1538 ldd #$27f 10 01111111
1517 os9 I$Open 1539 os9 I$Create
1518 lbcs ERROR 1540 lbcs ERROR
1519 sta ,s 1541 sta ,s
1520 ldu 2,s 1542 ldu 2,s
1521 leax OBJECT,u 1543 leax OBJECT,u
1522 ldd <PC 1544 ldy 2,x module size
1523 addd #3
1524 pshs x
1525 subd ,s++
1526 lda ,s 1545 lda ,s
1527 os9 I$Write 1546 os9 I$Write
1528 lbcs ERROR 1547 lbcs ERROR
1529 clra 1548 puls d,u
1549 clrb
1530 os9 F$Exit all end 1550 os9 F$Exit all end
1531
1532 1551
1533 ********************** 1552 **********************
1534 * ADVANCE WORD 1553 * ADVANCE WORD
1535 ** 1554 **
1536 WTABLE FCB 0 END MARK 1555 WTABLE FCB 0 END MARK
1968 1987
1969 crt0 stx <arg 1988 crt0 stx <arg
1970 leax OBJSTART,u 1989 leax OBJSTART,u
1971 * compiled code follows 1990 * compiled code follows
1972 1991
1973 LIBEND 1992 LIBEND equ *
1974 1993
1975 1994
1976 emod 1995 emod
1977 eom equ * 1996 eom equ *
1978 end 1997 end