Howto try small machine code programs in BASIC ?
Re: Howto try small machine code programs in BASIC ?
You can transfer values from one register to another with TFR.
I recommend you read the whole Inside the Dragon. It is very well written, and everything you find there is something you eventually would like to know, so it will just save you a lot of time and questions.
I recommend you read the whole Inside the Dragon. It is very well written, and everything you find there is something you eventually would like to know, so it will just save you a lot of time and questions.
Re: Howto try small machine code programs in BASIC ?
Yes your right, Inside the Dragon is really a good book. I would like to have it in real printed form. But not found it yet on ebay...
Last edited by jedie on Sat Oct 05, 2013 2:37 pm, edited 1 time in total.
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Re: Howto try small machine code programs in BASIC ?
I'll keep my eye out for a copy - I can't let mine go - its signed by Duncan Smeed himself !
Simon Hardy
Re: Howto try small machine code programs in BASIC ?
I snatched mine from Amazon UK some months ago for £4.31 Later the dealers smelled the blood and I saw it for several hundred pounds. Now there is one there for £21.87, the same seller also has it on AbeBooks UK.
Last edited by tormod on Sat Oct 05, 2013 3:28 pm, edited 1 time in total.
Re: Howto try small machine code programs in BASIC ?
I get it for 21€
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Re: Howto try small machine code programs in BASIC ?
I need a little bit help... again
I created a small BASIC test program to display the CC registers. But doesn't work
The assembler code only:
I also tried this:
But this makes no sence, because STA will change the CC registers.
So other idea:
But it seems that i won't get the right CC values in all variants
And next question: How apply bitmask operations in BASIC? To get from the HEX value the each flag?
I created a small BASIC test program to display the CC registers. But doesn't work
Code: Select all
10 ' TEST CC REGISTERS
20 LA=&H4000 ' LOAD / EXECUTE ADDRESS
25 PRINT "POKE MACHINE CODE TO: $";HEX$(LA)
30 PA = LA ' START ADDRESS FOR POKE
50 READ HB$ ' HEX CONSTANTS
60 IF HB$="END" THEN 100
70 POKE PA,VAL("&H"+HB$) ' POKE VALUE INTO MEMORY
80 PA = PA + 1 ' INCREMENT POKE ADDRESS
90 GOTO 50
100 PRINT "LOADED, END ADDRESS IS: $"; HEX$(PA-1)
110 PRINT
120 INPUT "INPUT 'A' VALUE (DEZ)";A
130 POKE &H5000,A ' SET START VALUE
150 PRINT "A=";A;" VALUE FROM $5000: ";PEEK(&H5000)
160 FOR I = 1 TO 14
170 EXEC LA
180 CC=PEEK(&H5002)
190 PRINT "A=";PEEK(&H5000);" CC=$";HEX$(CC)
200 NEXT I
500 GOTO 120
1000 ' MACHINE CODE IN HEX
1010 DATA B6,50,00 ' LDA $5000
1020 DATA 8B,01 ' ADDA 1
1030 DATA 1F,A1 ' TFR CC,X
1040 DATA BF,50,02 ' STX $5002
1050 DATA B7,50,00 ' STA $5000
1060 DATA 39 ' RTS
10000 DATA END
Code: Select all
1010 DATA B6,50,00 ' LDA $5000
1020 DATA 8B,01 ' ADDA 1
1030 DATA 1F,A1 ' TFR CC,X
1040 DATA BF,50,02 ' STX $5002
1050 DATA B7,50,00 ' STA $5000
Code: Select all
1030 DATA B6,50,00 ' LDA $5000
1040 DATA 8B,01 ' ADDA 1
1050 DATA B7,50,00 ' STA $5000 ' STORE A TO M
1060 DATA 1F,A0 ' TFR CC,D ' STORE CC IN D
1070 DATA FD,50,02 ' STD $5002 ' STORE D TO M
So other idea:
Code: Select all
1010 DATA B6,50,00 ' LDA $5000
1020 DATA 8B,01 ' ADDA 1
1030 DATA 36,01 ' PSHU CC TO U STACK
1040 DATA FF,50,01 ' STU $5002 ' SAVE CC FROM U TO M
1050 DATA B7,50,00 ' STA $5000
1060 DATA 27,01 ' PULU CC FROM U STACK
And next question: How apply bitmask operations in BASIC? To get from the HEX value the each flag?
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Re: Howto try small machine code programs in BASIC ?
The CC register is 8-bit. The correct code should be as follows.
Code: Select all
TFR CC,A
STA $5002
Code: Select all
LDA $5000 ' Load A from Memory
ADDA #1 ' A=A+1
STA $5000 ' Store A to Memory
TFR CC,B ' Transfer value of CC to B register
STD $5002 ' Store D (A+B register = D register) to Memory
Re: Howto try small machine code programs in BASIC ?
zephyr wrote:The CC register is 8-bit.
Thanks!
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Re: Howto try small machine code programs in BASIC ?
Tried this:
But gets strange behaviour in XRoar.
Now i try to use STD
EDIT: It the 1030 DATA 1F,A9 ' TFR CC,B what brings XRoar into trouble. Maybe a but or my DATA code wrong?
Code: Select all
1010 DATA B6,50,00 ' LDA $5000
1020 DATA 8B,01 ' ADDA 1
1030 DATA 1F,A9 ' TFR CC,B
1040 DATA F7,50,01 ' STB $5001
1050 DATA B7,50,00 ' STA $5000
1060 DATA 39 ' RTS
Now i try to use STD
EDIT: It the 1030 DATA 1F,A9 ' TFR CC,B what brings XRoar into trouble. Maybe a but or my DATA code wrong?
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Re: Howto try small machine code programs in BASIC ?
Have now add a unittest in DragonPy with similar machine code and it seems that it works right: https://github.com/jedie/DragonPy/commi ... a04fcd4ace
I should test it on a real machine
I should test it on a real machine
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809