Page 1 of 1

Assembly Prompt

Posted: Wed May 22, 2024 10:46 am
by softobamboni
An assembly interpreter written in assembly.

Try It Now!

Only implied, absolute and immediate addressing modes are supported rn. The address and value numbers are interpreted in hexadecimal. The lda, ldx, ldy, inc*, inx, iny, dec*, dex, dey, sta, stx, sty, stz, clc, sec, cld, sed, adc, sbc, and, ora, eor, jsr, tax, tay, txa, tya, rol*, ror*, asl*, lsr* instructions are implemented
* - only in accumulator addressing mode

You can quit the program by typing Q at the prompt and toggle on or off the register value output by typing M at the prompt.

HOW IT WORKS: if the inputted instruction is single-byte and has implied (or accumulator) addressing mode, it takes cached in zero page A, X, Y and PS registers, executes the instruction and stores potentially changed registers back to zero page. For more than one byte long instructions, it assembles the instruction from the input the user gave, pulls the registers from zero page, jumps to instruction and pushes the registers back to zero page.

This program in GitHub: https://github.com/softobamboni/ASM_Prompt

#R47

Re: Assembly Prompt

Posted: Wed May 22, 2024 10:37 pm
by TomXP411
That's pretty clever. It might be useful to do something like show the CPU status registers on the right side of the screen, like:
LDA #80          ; A=80 X=00 Y=00 P=N-------
ASL              ; A=00 X=00 Y=00 P=-------C
And if the operation writes to memory, maybe show a dump of the area surrounding the operation:
STA $1000        ;A=80 X=00 Y=00 P=N-------  0FFD: 00 00 00 80 00 00 00 00
When you put that together, that could be a really powerful tool for teaching assembly language

Re: Assembly Prompt

Posted: Fri May 24, 2024 10:02 am
by JimmyDansbo
This is getting better and better :)

When you update your top post and upload a new .prg, remember to also update the Try It Now link.
So far I have done it for you ;-)

I would also suggest that after you have updated top post, you add a comment that tells a bit about what changes have happened. That makes it possible to follow along in your progress.

Keep up the good work

Re: Assembly Prompt

Posted: Fri May 24, 2024 11:43 am
by Daedalus
So basically, this is a tool for learning the mnemonics of assembly? Ok! Cool! 65C02 is hard enough... then you have 65C816 with it's greatly expanded addressing modes and bank registers.

Another addition would be a "reset" command that could also take an instruction mnemonic (Like LDA) or an addressing mode, like A (Accumulator), etc... or a list of either so you can then zero in on what you want to try out.
\
Edited to add: Forgot this part... the reset would clear the screen, then dump a text explanation of the instruction / mode (Or the list of either) to the screen, then put the entry cursor below that.

Anything that helps people learn assembly is A OK in my book.

Re: Assembly Prompt

Posted: Sun May 26, 2024 6:25 am
by TomXP411
Wow, that really makes for a nice way to visualize what's happening in real time!

Great job!