User Tools

Site Tools


sd-8516_assembly_language_part_ii

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sd-8516_assembly_language_part_ii [2026/02/14 02:50] appledogsd-8516_assembly_language_part_ii [2026/02/14 03:02] (current) appledog
Line 209: Line 209:
  
  
-== Lesson 19: Debugging Techniques +== Lesson 11: Debugging Techniques 
-There are several ways you can debug programs in SDA assembly. If you look at the console, inserting SED will turn on trace debugging and you will in general be able to see what the CPU is executing (if, debugging has been turned on during compilation)Otherwise you may need to HALT at any particular position and read the registers yourself. However if you can do neither, or are looking for something a bit more helpfulrecall the methods of PRINTing that allow you to print messages.+There are several ways you can debug programs in SDA assembly. 
 + 
 +=== SED/CLD 
 +In research or development builds, inserting SED will turn on trace debugging and you will be able to see what the CPU is executing. Howeverfor release or community edition builds debugging has been turned off for speedTherefore if you are interested in debugging your code and the console messages are not helping, you can use the following to help analyze and debug your code:
  
 === INT 05h IO_PUTNUM === INT 05h IO_PUTNUM
-One way is to use IO_PUTNUM from int05 (CAM/IL interrupt):+IO_PUTNUM is a CAM/IL function that prints a number (in bto the screen:
  
     LDB #10                 ; print a number in b (0-65535)     LDB #10                 ; print a number in b (0-65535)
 +    
     LDAH $63                ; IO_PUTNUM     LDAH $63                ; IO_PUTNUM
     INT $05     INT $05
- 
  
 === INT 05h IO_PRINT_STR === INT 05h IO_PRINT_STR
 +Similarly, IO_PRINT_STR will print a string followed by a newline.
 +
         LDBLX @hello_world         LDBLX @hello_world
         LDAH $66                ; IO_PRINT_STR         LDAH $66                ; IO_PRINT_STR
Line 237: Line 241:
  
 === INT 10h print string === INT 10h print string
-The interface for the above is based on the KERNAL BIOS interface in Int 10h.+The interface for the above is based on the KERNAL BIOS interface from INT 10h.
  
         LDAH $26                ;   AH=26h: Write string at cursor         LDAH $26                ;   AH=26h: Write string at cursor
Line 243: Line 247:
         INT 0x10         INT 0x10
  
-The underlying function that this calls is write_string, but outside of kernal assembly you will not have access to this function. This is because the labels are not shared outside of the compilation; you will however have direct access to this function via INT 10h. +Note: The assembler will place a #13 (CR, hex $0D) inside the string if you type \n. Howeverif you are dealing with strings on your own you must handle this yourself. For this you can use the set cursor position call (INT 10h, AH=22h) or the CR and LF and scroll functions (1Ah1Bh and 1Ch, respectively).
- +
-        LDBLX @hello_world +
-        CALL @write_string +
-     +
-        CALL @carriage_return +
-        CALL @linefeed +
- +
-For user use, the assembler will place a #13 (CR, hex $0D) inside the string if you type \n. Therefore although there is no carriage return function, you can do that via the set cursor position call (INT 10h, AH=22h) and you can send a CRLF pair by calling INT 10hAH=26h on a string containing a newline (#13 or 0x0D).+
  
-If you need to issue a newline on it's own you can store the cursor position, issue a CRLF at the bottom of the screen and then restore the cursor X position. +You can also just call IO_NEWLINE from INT 05h, which calls **''@carriage_return''** and **''@linefeed''** internally.
-Also, under the hood, IO_NEWLINE from int 05 calls **''@carriage_return''** and **''@linefeed''.**+
  
 === INT 10h print char === INT 10h print char
sd-8516_assembly_language_part_ii.1771037441.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki