Git Product home page Git Product logo

dcpu16's Issues

DIV behavior incorrect - EX

The behavior of the EX register when performing a DIV is incorrect. EX should be set to ((b<<16)/a) & 0xffff as per the spec, rather than (b/a) << 16 & 0xffff, which will always be zero in 16 bit division.

Problem with indirect addressing to labels

Code

jmp start
    :data1      dat 0,0,0,0
    :data2      dat 0,0,0,0
    :data3      dat 0x0000
:start
    mov data1, sp   ; saving initial stack pointer if we should inline into other program (OS)
    SET [0x6], 0x3000
    SET I, [0x6]

    SET [data2], 0x4000
    SET I, [data2]

Compiles into

PC   SP   OV   A    B    C    X    Y    Z    I    J    Instruction
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----------
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 JMP 0x000b
000b 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 MOV 0x000a, SP
000d 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 MOV [0x0006], 0x3000
0010 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 MOV I, [0x0006]
0012 0000 0000 0000 0000 0000 0000 0000 0000 3000 0000 MOV [0x0006], 0x4000
0015 0000 0000 0000 0000 0000 0000 0000 0000 3000 0000 MOV I, [0x4000]
0017 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 MOV PUSH, 3

However 0015 should be MOV I, [0x0006] too.

Incorrect RAM size

In your VM, you initialize 65536 words of RAM, whereas the specification calls for 0x10000 words of ram (128kw).
Is there something I'm missing?

Need a keyword for defining data arrays

Just something like DATA keyword for values longer than WORD can do.

:string
    data 0,1,2,3,4,5,6,7
    data 'H','e','l','l','o'

And maybe some strings support?
judofyr's rcpu for example orients onto 0x8000 for string output and 0x9000 for input.

SET [REGISTER], SMTH doesn't work

I couldn't definitely understand from reference manual if it should work that way but assembler should at least exit with error or warn user but not to compile wrong code silently.

For example:

SET [0x30], A
SET [0x30], [A]
SET A, 0x30
SET [A], 0x30

Compiles into

SET [0x0030], A
SET [0x0030], A
SET A, 0x0030
SET A, 0x0030

I think there is a problem somewhere in bracket parsing algorithm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.