mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-08 18:58:05 +11:00
a034f63e23
This should make tests a bit more convenient to write and debug. Moreover, begin de de-IX-ization of parseExpr. I have, in a local WIP, a parseExpr implemented using a recursive descent algo, it passes all tests, but it unfortunately assembles a faulty zasm. I have to find the expressions that it doesn't parse properly. But before I do that, I prefer to commit these significant improvements I've been making to tests harness in parallel of this development.
68 lines
941 B
NASM
68 lines
941 B
NASM
.equ foo 456 ; AFTER_ORG should not get that value
|
|
.org 0x1234
|
|
.equ AFTER_ORG @
|
|
.org 0
|
|
|
|
jp test
|
|
|
|
.inc "ascii.h"
|
|
.inc "core.asm"
|
|
.inc "lib/ari.asm"
|
|
.inc "lib/fmt.asm"
|
|
.inc "stdio.asm"
|
|
.inc "common.asm"
|
|
|
|
dummyLabel:
|
|
|
|
.equ dummyLabel 0x42
|
|
|
|
test:
|
|
ld hl, 0xffff
|
|
ld sp, hl
|
|
|
|
; *** Just little z80 flags memo.
|
|
and a ; clear carry
|
|
ld hl, 100
|
|
ld de, 101
|
|
sbc hl, de
|
|
jp nc, fail ; carry is set
|
|
call nexttest
|
|
|
|
and a ; clear carry
|
|
ld hl, 101
|
|
ld de, 100
|
|
sbc hl, de
|
|
jp c, fail ; carry is reset
|
|
call nexttest
|
|
|
|
ld a, 1
|
|
dec a
|
|
jp m, fail ; positive
|
|
dec a
|
|
jp p, fail ; negative
|
|
call nexttest
|
|
|
|
; Test that .equ can override label
|
|
ld de, 0x42
|
|
ld hl, dummyLabel
|
|
call assertEQW
|
|
call nexttest
|
|
|
|
; test that "@" is updated by a .org directive
|
|
ld hl, AFTER_ORG
|
|
ld de, 0x1234
|
|
call assertEQW
|
|
call nexttest
|
|
|
|
; test that AND affects the Z flag
|
|
ld a, 0x69
|
|
and 0x80
|
|
call assertZ
|
|
call nexttest
|
|
|
|
; success
|
|
xor a
|
|
halt
|
|
|
|
STDIO_RAMSTART:
|