diff --git a/CGI.pas b/CGI.pas index eadb764..df52da2 100644 --- a/CGI.pas +++ b/CGI.pas @@ -33,6 +33,7 @@ const cge1 = 57; {compiler error} cge2 = 58; {implementation restriction: too many local labels} cge3 = 60; {implementation restriction: string space exhausted} + cge4 = 188; {local variable out of range for DP addressing} {65816 native code generation} {----------------------------} diff --git a/Gen.pas b/Gen.pas index 50c9e52..ec629de 100644 --- a/Gen.pas +++ b/Gen.pas @@ -6776,8 +6776,12 @@ procedure GenTree {op: icptr}; opcode := op^.s; if opcode < 256 then opcode := opcode | asmFlag; - if op^.slab <> 0 then + if op^.slab <> 0 then begin val := val+LabelToDisp(op^.slab); + if mode = direct then + if (val > 255) or (val < 0) then + Error(cge4); + end; {if} if mode in [relative,longrelative] then GenNative(opcode, mode, op^.llab, op^.lab, op^.q) else if (mode = longabsolute) and (op^.llab <> 0) then diff --git a/Scanner.pas b/Scanner.pas index 8c4d62d..b1b1141 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -803,6 +803,7 @@ if list or (numErr <> 0) then begin 185: msg := @'lint: unused variable: '; 186: msg := @'lint: implicit conversion changes value of constant'; 187: msg := @'expression has incomplete struct or union type'; + 188: msg := @'local variable used in asm statement is out of range for addressing mode'; end; {case} if extraStr <> nil then begin extraStr^ := concat(msg^,extraStr^); diff --git a/cc.notes b/cc.notes index 2491249..697c609 100644 --- a/cc.notes +++ b/cc.notes @@ -271,6 +271,10 @@ The unary conversion rules have been modified to convert values of type char or In the binary conversions, if either operand has a floating-point type, the semantic type is the largest floating-point type of either operand. However, floating-point operations are always evaluated with the range and precision of the SANE extended format. +p. 333,334 + +If assembly code attempts to access a local variable using direct page addressing when its location is more than 255 bytes from the start of the direct page, ORCA/C will now detect and report this error ("local variable used in asm statement is out of range for addressing mode"). + p. 337 The ORCA/C compiler is intended as a faithful implementation of ANSI C with some extensions, but there have always been some library functions from ANSI C that were missing in ORCA/C. Chapter 19 should start with a summary of these omissions.