I am working on a program that will send the state of the keyboard through the link cable. I am getting a strange error, and I can't find anything about on the sites I have searched. I am getting ERR:BREAK when I run the program, which I have deduced happens when the program tries to run "b_call(_SendPacket)". The rest of the code works, and when I take out that single line, it does everything else it is supposed to, displaying the state of the keyboard as a string.
This is my first assembly program, so I only know what I have read on tutorials and forums (and the start and keyloop sections were copy/pasted from here). If anyone has any tips or pointers I would greatly appreciate them.

Code:

; Program Name: Key Dump
; Author(s): Willllllliam
; Description: Sends the current state of the keyboard through the link cable.

.nolist
#include "ti83plus.inc"
.list

   .org userMem-2
   .db $BB,$6D
start:

    ld hl,$9872 ;the current state of the keyboard will be saved to these 7 bytes
    ld bc,$0701  ;repeat 7 times
    ld de,$FEFF ;d = $FE (%11111110, reads first bit), e = $FF (resets the keyboard)
keyloop:
    out (c),e  ;output $FF to port 1 to reset keyboard
    out (c),d  ;
    rlc d ;shift d left one bit, now we have the next scan group byte in d
    ; i'm not sure if you'll need a longer delay here or not, you might need a couple filler instructions here
    ini ;decs b and reads a byte from port c and stores it to (hl), then incs hl.
    jp nz,keyloop
send:
   ld hl, $9872
   ld (iMathPtr5), hl ;address of data to be sent
   ld hl, $7315
   ld (header), hl ;start of packet 1 (Machine ID byte, Command ID byte)
   ld hl, $0700
   ld (header+2), hl ;start of packet 2 (Size)
   b_call(_SendPacket)
   ld hl, $9872
   b_call(_PutS)
   b_call(_NewLine)
   ret
.end
.end


Also, quick FYI about this program, it is designed to run on a loop, which I have implemented in a separate TI-BASIC program for simplicity.
I'm not aware of the bcall, however it looks like you're setting size to $0700, which is 1792 bytes and not 7?
@tr1p1ea Thank you for catching that. I fixed it. (The error still happens, though)
Where have you obtained your information on SendPacket? Just from WikiTi? https://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:4ED6

It notes that it expects some flags to be set up. It's also always good to have an error handler installed when performing any link related tasks.
Yes, I found it on WikiTi. I thought that the flags might have been the issue, but I couldn't find any information on how the flags should be set up. Where would I find an error handler? I am unfortunately on Mac, by the way.
  
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 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

 

Advertisement