Assembly Prompt

Post Reply
softobamboni
Posts: 1
Joined: Mon May 20, 2024 11:17 am

Assembly Prompt

Post 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
Attachments
Screenshot 2024-05-24 at 09.13.00.png
Screenshot 2024-05-24 at 09.13.00.png (368.14 KiB) Viewed 2744 times
asmprompt.prg
(1.04 KiB) Downloaded 236 times
asmprompt.asm
(14.42 KiB) Downloaded 253 times
asmprompt_list.txt
(28.37 KiB) Downloaded 245 times
Last edited by softobamboni on Fri May 24, 2024 7:13 am, edited 4 times in total.
TomXP411
Posts: 1788
Joined: Tue May 19, 2020 8:49 pm

Re: Assembly Prompt

Post 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
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

Re: Assembly Prompt

Post 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
Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
User avatar
Daedalus
Posts: 229
Joined: Fri Nov 11, 2022 3:03 am

Re: Assembly Prompt

Post 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.
TomXP411
Posts: 1788
Joined: Tue May 19, 2020 8:49 pm

Re: Assembly Prompt

Post by TomXP411 »

Wow, that really makes for a nice way to visualize what's happening in real time!

Great job!
Post Reply