Skip to content

/X execute machine, pass register val to mint var #45

Description

@SteveJustin1963

i dont think this is possible
for example i want to get z80 R value and use
as a pydosudo random number and pass it to a mint var

:R
  [
    #ED #5F  // LD A,R
    #32      // LD (nn),A
    /v /v    // Address of r variable (low byte, high byte)
  ] /X
  r
;

or more random

:I
  [
    #3E #A5     // LD A, #A5 (Initialize R with a non-zero value)
    #ED #4F     // LD R, A
  ] /X
;

:R
  [
    #ED #5F     // LD A, R (Get current R value)
    #CB #3F     // SRL A (Shift right logical)
    #57         // LD D, A (Store shifted value in D)
    #ED #5F     // LD A, R (Get R value again)
    #AA         // XOR D (XOR with shifted value)
    #ED #4F     // LD R, A (Store result back in R)
    #32         // LD (nn), A
    /v /v       // Address of r variable (low byte, high byte)
  ] /X
  r
;

I
:G
  R
  255 &        // Mask to ensure 8-bit value
;

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions