[Coco] Fooling around with assembly in RS-DOS environment
Dave Philipsen
dave at davebiz.com
Mon Apr 11 01:24:05 EDT 2016
Lee, here's a little code snippet that I use a lot for displaying text
strings. In fact, I have it as 'ROM call' in a monitor I use quite a
bit. If you're displaying text strings with standard ASCII 7-bit
characters you don't even have to use a null terminator. Just set bit 7
of the final character. It makes it a little easier so you don't have
to set aside a separate data area for your string. You can add your own
modifications to this code by creating other entry points for
positioning the cursor before you display the string or perhaps changing
fg or bg colors. Also, you may or may not want to preserve the X
register or clear the A register on return:
org $3f00
start jsr text
fcs "HELLO WORLD!",$0d
rts
text pshs x save x register
ldx 2,s get pointer to string (pc)
txt1 lda ,x+ get a character
bmi txt2 if hi bit is set, it's the end of the string
beq txt3 if zero, it's null-terminated
jsr [$a002] ROM call to display character
bra txt1 get next character
txt2 anda #$7f mask off hi-bit
jsr [$a002] display character
txt3 clra
stx 2,s return address (pc) just after end of string
puls x,pc return from subroutine to modified address
Dave
On 4/10/2016 11:31 PM, Lee Patterson wrote:
> Mark,
> I was looking at the ASXXXX assembler, to be able to write assembly for my PC-1360 Pocket Computer. Would be good to use for both 6809 and 1360. Could I trouble you for a sample command line to compile a 6809 asm to a DECB binary using the AS compiler? Maybe a tiny hello world asm to go along with it if it is different then mine?
>
> I did this one for lwasm:
>
> # lwasm -9 -b -o hello1.bin hello1.asm && writecocofile --verbose hello.dsk hello1.bin && coco3 `pwd`/hello.dsk hello1
> org $3F00
> start ldx #msg point to our message
> lee lda ,x+ get current ASCII character
> beq x@ exit if it's the NULL-terminator
> jsr [40962] print the character using stdout hook
> bra lee keep printing
> x@ rts
>
> msg fcc "HELLO WORLD!"
> fcb 13,0
>
> end start
>
>
>
> Thanks,
> Lee
>
>
>> On Apr 10, 2016, at 11:40 PM, Mark McDougall <msmcdoug at iinet.net.au> wrote:
>>
>> On 11/04/2016 10:21 AM, Rich Carreiro wrote:
>>
>>> I'm not a purist on this -- it does NOT have to be EDTASM
>>> running on the emulated CoCo (in fact, I'd probably prefer
>>> it wasn't, since I don't feel like dealing with 32-char line
>>> lengths and all-caps when programming).
>>>
>>> Are there any CoCo assemblers that can run in Windows
>>> or Linux that can create executables that a CoCo emulator
>>> can load and run?
>> At the end of the day, I prefer productivity over the "pure" experience of developing on the Coco, so for me cross-assembling is a no-brainer.
>>
>> Personally, I use AS6809 which will produce a Coco .BIN file courtesy of contributions by our own Boisy Pitre. I use my favourite editor (70 lines of text) and it's all command-line driven so a makefile does all the building.
>>
>> For testing/debugging I use MESS which, despite claims I don't understand, is far more powerful than any other Coco-based debugger could ever hope to be (eg. watchpoints), and gives you more information to boot. I've used it for both reverse-engineering and developing software on all sorts of platforms, not just Coco. It's invaluable in my arsenal.
>>
>> In my personal opinion, integrated IDE's that supposedly make your life easier are of very limited benefit to a seasoned developer, regardless of platform. Pressing <UP><UP><ENTER> twice, once to build and once to run MESS is not exactly taxing, and ultimately more flexible and customisable.
>>
>> It's doubly true in my case, because I develop for multiple retro platforms, and use the ASXXXX assemblers for all of them. My entire development environment is identical then for each of them, which is a definite productivity boost.
>>
>> I'm sure plenty disagree, and you may even be one of them.
>>
>> Regards,
>>
>> --
>> | Mark McDougall | "Electrical Engineers do it
>> | <http://members.iinet.net.au/~msmcdoug> | with less resistance!"
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>
More information about the Coco
mailing list