I'm running a basic program (shell..?) with two assembly programs handling two different graphical screens. How can I combine the asm programs into one while using the basic program to choose which screen to show? Thank you
It's copying the buffer to the graph screen but each program had different data to copy to the LCD.
I wanted to have a variable passed from BASIC to asm (maybe through ans?) that decided which image would be copied.
main:
b_call(_RunIndicOff)
ld hl, Main_Menu
d de, plotsscreen
ld bc, 768
ldir
ret
Main_Menu: ;full screen
.db %00000000,%00000000,%00...
I wanted to have a variable passed from BASIC to asm (maybe through ans?) that decided which image would be copied.
main:
b_call(_RunIndicOff)
ld hl, Main_Menu
d de, plotsscreen
ld bc, 768
ldir
ret
Main_Menu: ;full screen
.db %00000000,%00000000,%00...
That's a bit of a PITA. BASIC programs use a custom floating-point format, while the Z80 just deals in bytes, so you need to convert between the two. You can do something like this:
Code:
Code:
bcall(_AnsName)
bcall(_FindSym)
ret c ; Not found
and 1Fh
cp RealObj
ret nz ; Wrong type
b_call(_RclAns)
b_call(_ConvDim) ; Only accepts 1-99; throws an error for 0, less than 0, or greater than 99.
cp 1
jr z, DoFunction1
cp 2
jr z, DoFunction2
...
; No value matches
ret
DoFunction1:
...
ret
DoFunction2:
...
ret
Also, if you need numbers greater than 99, you can use _ConvOP1 rather than _ConvDim. The LSB is stored in the 'a' register, and the value up to 9999 is stored in 'de'. Just some more information if you ever need it.
I'm pretty sure _RclAns returns the type in A, and RealObj=0 so you should be able to do:
Code:
Code:
b_call(_RclAns)
and $1F
ret nz
b_call(_ConvDim) ; Only accepts 1-99; throws an error for 0, less than 0, or greater than 99.
ld b,a
djnz checkfunction2
function1:
...
ret
checkfunction2:
djnz checkfunction3
function2:
...
ret
checkfunction3:
djnz checkfunction4
function3:
...
ret
checkfunction4:
.
.
.
ret
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement