With the goal of learning how to use the DCS_SDK, I decided to make a simple program for the job.

Here's what happened, I tried compiling (compile myfile.z80) and everything was OK, however, the assembled programs (when opened with WabbitEmu and DCS7) are TI-Basic programs!

So, I tried a few programs to test this.

When ran using Asm(prgmNAME I always get INVALID.

Any ideas? Here are a few programs I tried:


Code:
#include "ti83plus.inc"
.org 40339
.db t2ByteTok, tAsmCmp

  B_CALL _ClrLCDFull    ;Clear the screen
 
     ld a, 1         ;Set a register to 1
     add a, 5        ;Solve the problem 1 + 5
     ld h,0          ;Set h register to 0
     ld l, a         ;Set l register to a (6)
 
  B_CALL _DispHL        ;Display register hl (6)
  B_CALL _getKey        ;Wait for a getkey

  ret                   ;End of program




Code:
.nolist
#include "ti83plus.inc"
list

db BBh, 6Dh
Start:
  B_CALL _ClrLCDFull
  ld hl,1
  B_CALL _DispHL
  B_CALL _getKey
   B_CALL _ClrLCDFull
  ret



Code:
.nolist
#include "ti83plus.inc"
#define    ProgStart    $9D95
.list
.org    ProgStart - 2
    .db    t2ByteTok, tAsmCmp
    b_call(_ClrLCDFull)
    ld    hl, 0
    ld    (PenCol), hl
    ld    hl, msg
    b_call(_PutS)            ; Display the text
    b_call(_NewLine)
    ret

msg:
    .db "Hello world!", 0
.end
.end



Code:
; Program Name:
; Author:
; Version:
; Date:
; Written for Doors CS 7.0 and higher (http://dcs.cemetech.net)

.nolist
#include "ti83plus.inc"
#include "dcs7.inc"
.list
   .org progstart
   .db $BB,$6D
Init:
   xor d
   ret
   jr Start
   
   .dw Description         ;or .dw $0000 if you don't have a description
   .db $07,$00         ;always this string
   .dw Icon         ;or .dw $0000 if you don't have an icon
   .dw ALE            ;usually .dw $0000 if you don't have or know what an ALE is
Start:                             ;main routines
   ;etc etc etc
   ;ret
Description:
   .db "Description",0   ;can be omitted if .dw Description is .dw 0000 above
Icon:            ;a 16x16 icon (can be omitted if .dw Icon is .dw 0000 above)
   .db %11111111,%11111000
   .db %10000000,%00001100
   .db %10111100,%00001010
   .db %10010010,%00001111
   .db %10010010,%01010001
   .db %10010010,%10101001
   .db %10111100,%01010101
   .db %10000000,%00000001
   .db %10101010,%10101001
   .db %10010101,%01010101
   .db %10101010,%10101001
   .db %10000000,%00000001
   .db %10010101,%01010101
   .db %10101010,%10101001
   .db %10000000,%00000001
   .db %11111111,%11111111
ALE:               ;must be omitted if .dw ALE is .dw 0000 above
   .db "ZALE",0,0,0,0 ;always eight bytes, use
   .db "ZLALE",0,0,0 ;zeros for extra bytes
   .db $FF ;put after last ALE



Any ideas? I am using cmd and then "compile myfile.z80" (myfile.z80 is in the source folder) to compile.

These are just some, I tried about 10, always the same error.

EDIT: compile.bat also returns no errors in the cmd.
I'll look at this a bit more, but this stuck out to me: Don't use .org 40339, use the hexadecimal equate, $9D93. Also, that would be: compile myfile. No .z80, because the batch file automatically takes care of that.
The problem is probably your compile line. It is indeed just "compile myfile", not "compile myfile.z80" or "compile myfile.asm". My preferred header format is:


Code:
; Program Name:
; Author:
; Version:
; Date:
; Written for Doors CS 7.0 and higher (http://dcs.cemetech.net)

.nolist
#include "dcs7.inc"
.list
   .org progstart
   .db $BB,$6D
Init:
Notice that progstart is $9d93.

Code:
; Program Name: 
; Author: 
; Version: 
; Date: 
; Written for Doors CS 7.0 and higher (http://dcs.cemetech.net)

.nolist
#include "ti83plus.inc"
#include "dcs7.inc"
.list
   .org progstart
   .db $BB,$6D
Init:
  B_CALL _ClrLCDFull    ;Clear the screen
   
  ld a, 1               ;Set a register to 1
  add a, 5              ;Solve the problem 1 + 5
  ld h,0                ;Set h register to 0
  ld l, a               ;Set l register to a (6)
   
  B_CALL _DispHL        ;Display register hl (6)
  B_CALL _getKey        ;Wait for a getkey

  ret                   ;End of program



Code:

compile myfile


I get:

The proper syntax is bcall(_command), not B_CALL _command. Smile Also, did you know that you can copy-paste text from command windows?
KermMartian wrote:
The proper syntax is bcall(_command), not B_CALL _command. Smile Also, did you know that you can copy-paste text from command windows?

This. To copy and paste text, right click in the command window and choose Mark (or whatever it is in your language), select the text, and right click it again and choose Copy to copy it to your clipboard.
Kerm I'm sorry but I stopped using the DCS SDK, I got Spasm and created a simple python program customized for me that I just double click and it compiles and runs in WabbitEmu (it sends both the compiled program and DoorsCS).

It works very well for me. I'd also like to know how far including "dcs7.inc" affects my programs because I always include it (as you have in your header).
dcs7.Inc allows you to use Doors CS, MirageOS, ION, and TI-OS routines in your program.
Cool to see you're learning assembly scout Smile it's actually extremely fun to code in, once I Relearned it again, I lost interest in learning a HLL like java Razz

And, scout, the reason the syntax is like that for bcalls is because its not an actual instruction -- it's a macro that stands in place of the instruction RST 28h / .db xxxx
Ashbad: I learnt Assembly a few months ago, I'm relearning it now to understand it better, so I'm skipping a few things Razz
Ashbad wrote:
Cool to see you're learning assembly scout Smile it's actually extremely fun to code in, once I Relearned it again, I lost interest in learning a HLL like java Razz

And, scout, the reason the syntax is like that for bcalls is because its not an actual instruction -- it's a macro that stands in place of the instruction RST 28h / .db xxxx


But Java is cool Sad Though I will agree, low level languages are a little more fun Wink
_player1537 wrote:
Ashbad wrote:
Cool to see you're learning assembly scout Smile it's actually extremely fun to code in, once I Relearned it again, I lost interest in learning a HLL like java Razz

And, scout, the reason the syntax is like that for bcalls is because its not an actual instruction -- it's a macro that stands in place of the instruction RST 28h / .db xxxx


But Java is cool Sad Though I will agree, low level languages are a little more fun Wink


Java is for people who aren't able to use x86 or (whatever a Mac uses) assembly xD

Though, x86 on windows is horrible, you have to be so careful and you have to set so many things up before you can even start writing Razz

but yes, java is cool Smile

[/off topic]
ScoutDavid wrote:
Kerm I'm sorry but I stopped using the DCS SDK, I got Spasm and created a simple python program customized for me that I just double click and it compiles and runs in WabbitEmu (it sends both the compiled program and DoorsCS).
A three line batch script wrapped around the existing SDK would have done that for you, but whatever. Why didn't you ask? Rolling Eyes

Quote:
It works very well for me. I'd also like to know how far including "dcs7.inc" affects my programs because I always include it (as you have in your header).
What Souvik1997 said.
KermMartian wrote:
ScoutDavid wrote:
Kerm I'm sorry but I stopped using the DCS SDK, I got Spasm and created a simple python program customized for me that I just double click and it compiles and runs in WabbitEmu (it sends both the compiled program and DoorsCS).
A three line batch script wrapped around the existing SDK would have done that for you, but whatever. Why didn't you ask? Rolling Eyes


Yeah, but I'm happy now Very Happy
Whatever. Anyway, how is your assembly-writing progressing? Did you write a massively-multiplayer CALCnet game yet? Wink
KermMartian wrote:
Whatever. Anyway, how is your assembly-writing progressing? Did you write a massively-multiplayer CALCnet game yet? Wink


I'll try and make a quadratic solver (with no input, I define, in the code, a,b and c) tonight. It looks a hard to do maths in Assembly though.
It's hard to do floating point math. It's easy to do integer math, and it's pretty simple to do fixed-point math. For example, to do all the parabolic calculations in Obliterate, I use 16-bit values, where the upper 8 bits are the decimal part of each number, and the lower 8 bits are the fractional part. The AI is more complex; in parts of it I needed to use 24-bit and 32-bit numbers to be able to retain enough precision for the AIs to be even moderately accurate.
KermMartian wrote:
It's hard to do floating point math. It's easy to do integer math, and it's pretty simple to do fixed-point math. For example, to do all the parabolic calculations in Obliterate, I use 16-bit values, where the upper 8 bits are the decimal part of each number, and the lower 8 bits are the fractional part. The AI is more complex; in parts of it I needed to use 24-bit and 32-bit numbers to be able to retain enough precision for the AIs to be even moderately accurate.


Meh, I'm not gonna do that any more, since I can't deal negative numbers in Assembly.

I have learnt a lot of stuff today, loops, labels, variables (ints and strings).

I also learnt how to use hex inline Assembly, so I can use Hexadecimal, which is much better than Assembly for some stuff, not better, but cooler.

I learnt jr and jp and know the differences between the two.

Tomorrow I'll learn the F register (which I started learning now) but I didn't understand it at all.

According to Hot Dog:


Code:
ld a, 1
dec a
ld a, 250
ld e, 6
add a, e ; Remember that a cannot be bigger than 255, so it resets to zero


The first one won't set the F register, but this:


Code:
ld a, 250
ld e, 6
add a, e


This will, Aren't they the same????
ScoutDavid wrote:
Meh, I'm not gonna do that any more, since I can't deal negative numbers in Assembly.
Assembly can easily deal with negative numbers, or do you mean that you don't understand negative numbers? If it's the latter, I'd be happy to help you understand how signed numbers work in z80 ASM.

Quote:
I have learnt a lot of stuff today, loops, labels, variables (ints and strings).

I also learnt how to use hex inline Assembly, so I can use Hexadecimal, which is much better than Assembly for some stuff, not better, but cooler.
It's not better or faster for anything unless that's the way you learned (cf. Zeda).

Quote:
I learnt jr and jp and know the differences between the two.
Excellent, including limitations and size (2 bytes vs 3 bytes)?

Quote:
Tomorrow I'll learn the F register (which I started learning now) but I didn't understand it at all.
You basically just need to worry about the results from comparisons, like z/nz and c/nc.

Quote:
According to Hot Dog:


Code:
ld a, 1
dec a
ld a, 250
ld e, 6
add a, e ; Remember that a cannot be bigger than 255, so it resets to zero


The first one won't set the F register, but this:


Code:
ld a, 250
ld e, 6
add a, e


This will, Aren't they the same????
They do the same thing; ld a,1 \ dec a \ ld a,250 is functionally identical to ld a,250. The 'dec a' line sets the z flag, though, so I'm not sure what he's going for there.
I understand when to use jp and when to use jr. If it's a short jump, jr, if it's a long jump (impossible to be done with jr (128bytes or -128bytes)) I should use jp.

@Kerm: I know *a lot* of hex codes by heart that I prefer to use in hexadecimal rather than in mnemonics.
  
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
Page 1 of 2
» 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

 

Advertisement