Very simple .LIST and .NLIST implementation.

Thanks to Don North. Also added a simple test.
Fixes #3.
This commit is contained in:
Olaf Seibert 2017-04-23 13:51:53 +02:00
parent c771c875cb
commit eb60cfe315
4 changed files with 56 additions and 3 deletions

View File

@ -277,12 +277,16 @@ static int assemble(
case P_ENDR:
case P_ENDM:
case P_SBTTL:
case P_LIST:
case P_NLIST:
case P_PRINT:
return 1; /* Accepted, ignored. (An obvious
need: get assembly listing
controls working. ) */
controls working fully. ) */
case P_LIST:
if (pass > 0) list_level++;
return 1;
case P_NLIST:
if (pass > 0) list_level--;
return 1;
case P_IDENT:
{

View File

@ -14,6 +14,7 @@ TESTS="test-asciz \
test-impword \
test-include \
test-jmp \
test-listing \
test-locals \
test-macro-comma \
test-prec \

26
tests/test-listing.lst.ok Normal file
View File

@ -0,0 +1,26 @@
1 ;;;;;;
2 ;
3 ; Test the (so far very basic) .LIST and .NLIST directives.
4 ;
5
6 ; This should get listed (list_level 1)
7 .nlist
10 ; This should get listed (list_level 1)
11 .list
12 ; This should get listed (list_level 2)
13 .nlist
14 ; This should get listed (list_level 1)
15 .nlist
22 ; This should get listed (list_level 1)
22
Symbol table
. ******R 001
Program sections:
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
000000 001 (RW,I,LCL,REL,CON,NOSAV)

22
tests/test-listing.mac Normal file
View File

@ -0,0 +1,22 @@
;;;;;;
;
; Test the (so far very basic) .LIST and .NLIST directives.
;
; This should get listed (list_level 1)
.nlist
; This should NOT get listed (list_level 0)
.list
; This should get listed (list_level 1)
.list
; This should get listed (list_level 2)
.nlist
; This should get listed (list_level 1)
.nlist
; This should NOT get listed (list_level 0)
.nlist
; This should NOT get listed (list_level -1)
.list
; This should NOT get listed (list_level 0)
.list
; This should get listed (list_level 1)