This commit is contained in:
marketideas 2019-11-17 19:54:48 -08:00
parent 3286572aa7
commit 09482611cf
5 changed files with 38 additions and 273 deletions

37
asm.cpp
View File

@ -216,7 +216,7 @@ void CLASS::print(uint32_t lineno)
pcol += printf(":[Error] %s", errStrings[errorcode].c_str());
if (errorText.length() > 0)
{
pcol += printf(" (%s)",errorText.c_str());
pcol += printf(" (%s)", errorText.c_str());
}
}
else if (!commentprinted)
@ -392,8 +392,9 @@ void CLASS::set(std::string line)
else if (c > ' ')
{
operand += c;
if (c == '\'')
if (c <= '/')
{
delim = c;
state = 8;
}
else
@ -403,15 +404,18 @@ void CLASS::set(std::string line)
}
break;
case 5:
if ((c == '\'') || (c == '"'))
if (c > ' ')
{
delim = c;
operand += c;
state = 8;
}
else if (c > ' ')
{
operand += c;
if ((c == '\'') || (c == '"'))
{
delim = c;
operand += c;
state = 8;
}
else
{
operand += c;
}
}
else
{
@ -428,19 +432,22 @@ void CLASS::set(std::string line)
case 7:
comment += c;
break;
case 9:
break;
case 8:
if (c == delim)
if (c < ' ')
{
}
else if (c == delim)
{
operand += c;
state = 5;
state=5;
}
else
{
operand += c;
operand+=c;
}
break;
case 9:
break;
}
}
printlable = lable;

View File

@ -1,81 +0,0 @@
; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Assembler: cc65
;
; Both cc65 (2.17) and Merlin32 (1.0) have problems computing branches that
; wrap around a bank (e.g. from $0010 to $ffd0). cc65 is slightly less
; egregious in that a workaround is possible: if you specify a label that
; is in range, and then an offset, it will generate code.
.setcpu "65816"
symlong = $123456
.org $1000
clc
xce
sep #$30
.a8
.i8
jmp zero
.org $0000
zero: bit a:zero
low: lda zero
lda low
bne low-$40 ;reference symbol
bmi low-$40 ;EDIT: format as hex
per low-$40
bvs more
brl more1
lodat: .byte $00,$01,$02 ;EDIT: set label
more: lda more-2
brl zero-$40 ;branch to high
.org $0080
more1: bit a:more1
jml bank44
.org $ffc0
high:
bit high
brl high+$43 ;branch to low
.org $440000
bank44: cmp f:bank44
low44: lda bank44
lda a:bank44 & $ffff
lda z:bank44 & $ffff ;DP ref, should resolve to "zero"
bmi low44
per low44-$40
bne low44-$40 ;branch to high44
brl bank44-$40 ;branch to late44
dat44: ;EDIT: set label
.addr dat44 ;EDIT: format as 16-bit Address
.faraddr dat44 ;EDIT: format as 24-bit Address
.org $44ffc0
late44: cmp f:late44
high44: beq cont44 ;EDIT: set label
bmi late44+$44 ;branch to low44
brl late44+$44 ;branch to low44
cont44: jml twok
.org $2000
twok: bit twok
pea dat44 & $ffff ;EDIT: set symbol=dat44
pea dat44 >> 16 ;EDIT: set symbol=dat44
bne skip
jmp [lodat]
skip: nop
j1: jsr j2 ;EDIT: set symbol=j2 for all, confirm auto-labels vanish
j2: jsr j3 ;EDIT: set label
j3: jsr j1
jsl symlong
rts

View File

@ -1,8 +0,0 @@
MEMORY {
MAIN: file=%O, start=%S, size=65536;
}
SEGMENTS {
CODE: load=MAIN, type=rw;
}
FEATURES {}
SYMBOLS {}

View File

@ -1,153 +0,0 @@
; Copyright 2019 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Assembler: ACME (for the PETSCII/screen code support)
!cpu 65816
* = $1000
clc
xce
sep #$30
!as
!rs
; Single-byte operand
lda #'A' ;format as low ASCII
lda #'A' | $80 ;format as high ASCII
lda #'A' | $80 ;format as PETSCII
lda #'A' ;format as screen code
ldx #'a' ;format as low ASCII
ldx #'a' | $80 ;format as high ASCII
ldx #'a' - $20 ;format as PETSCII
ldx #$01 ;format as screen code
lda #$7f ;EDIT: force to low ASCII
lda #$7f ;EDIT: force to high ASCII
lda #$7f ;EDIT: force to PETSCII
lda #$7f ;EDIT: force to screen code
lda #$0d ;verify the instruction operand editor only allows C64SC
; Single letter in a 16-bit immediate
rep #$30
!al
!rl
lda #'B'
lda #'B' | $80
lda #'B' | $80
lda #'B'
sep #$30
!as
!rs
rts
; Single-byte data items
!byte 'C'
!byte 'C' | $80
!byte 'C' | $80
!byte 'C'
; Double-byte data items
!byte 'd', 0
!byte 'd' | $80, 0
!byte 'd' - $20, 0
!byte $04, 0
; Double-byte big-endian data items
!byte 0, 'E'
!byte 0, 'E' | $80
!byte 0, 'E' | $80
!byte 0, 'E'
; Start with the basics
!byte $80
!text "low ASCII str"
; !byte $80 ; let them run together to test scan / dialog behavior
!xor $80 {
!text "high ASCII str"
}
!byte $80
!pet "PETSCII str"
!byte $80
!scr "Screen Code str"
; Get a bit fancy
!byte $82
!text $07,"Low ASCII CRLF",$0d,$0a
!byte $82
!xor $80 {
!text $07,"High ASCII CRLF",$0d,$0a
}
!byte $82
!pet $93,"PETSCII with ",$96,"control",$05," codes",$0d
; no control chars in screen code
; Test the ASCII $20-7e range.
!byte $83
!text " !",$22,"#$%&'()*+,-./0123456789:;<=>?"
!text "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"
!text "`abcdefghijklmnopqrstuvwxyz{|}~"
!byte $83
!xor $80 {
!text " !",$22,"#$%&'()*+,-./0123456789:;<=>?"
!text "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"
!text "`abcdefghijklmnopqrstuvwxyz{|}~"
}
!byte $83
!pet " !",$22,"#$%&'()*+,-./0123456789:;<=>?"
!pet "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"
!pet "`abcdefghijklmnopqrstuvwxyz{|}~"
!byte $83
!scr " !",$22,"#$%&'()*+,-./0123456789:;<=>?"
!scr "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"
!scr "`abcdefghijklmnopqrstuvwxyz{|}~"
; The 2005 test exercises low/high ASCII strings, so no need to do that here.
; Do a quick test with C64 characters. Note Screen Code can't be null-terminated
; by definition.
!byte $84
!pet "IICSTEP esrever" ;format as StringReverse
!byte $84
!pet "null term PETSCII",0 ;format as StringNullTerm
!byte $84
!pet "This null-terminated string is too long to fit on a single line, and will be split.",0
!byte $84
!pet 19,"PETSCII with length" ;format as StringL8
!byte $84
!pet 20,0,"PETSCII with length2" ;format as StringL16
!byte $84
!pet "pet dcI" ;format as StringDCI
!byte $84
!scr "edoC neercS esrever" ;format as StringReverse
!byte $84
!scr 23,"Screen Code with length" ;format as StringL8
!byte $84
!scr 24,0,"Screen Code with length2" ;format as StringL16
!byte $84
!scr "Screen Code DC",$c9 ;format as StringDCI
!byte $84
!byte $85
; All bytes, from 00-ff. Handy for seeing what the auto-scanner picks up.
allbytes
!hex 000102030405060708090a0b0c0d0e0f
!hex 101112131415161718191a1b1c1d1e1f
!hex 202122232425262728292a2b2c2d2e2f
!hex 303132333435363738393a3b3c3d3e3f
!hex 404142434445464748494a4b4c4d4e4f
!hex 505152535455565758595a5b5c5d5e5f
!hex 606162636465666768696a6b6c6d6e6f
!hex 707172737475767778797a7b7c7d7e7f
!hex 808182838485868788898a8b8c8d8e8f
!hex 909192939495969798999a9b9c9d9e9f
!hex a0a1a2a3a4a5a6a7a8a9aaabacadaeaf
!hex b0b1b2b3b4b5b6b7b8b9babbbcbdbebf
!hex c0c1c2c3c4c5c6c7c8c9cacbcccdcecf
!hex d0d1d2d3d4d5d6d7d8d9dadbdcdddedf
!hex e0e1e2e3e4e5e6e7e8e9eaebecedeeef
!hex f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff

View File

@ -1,19 +1,19 @@
(0) 2019-11-17 - BRK does not detect a lable that can't be evaluated
(0) 2019-11-17 - ASCII parsing in both eval and for ASC type commands
(0) 2019-11-17 -s IF processing for character compare mode
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 -s
(0) 2019-11-17 - IF processing for character compare mode
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -
(0) 2019-11-17 -