Pelles C forum

Assembly language => Assembly discussions => Topic started by: Vortex on May 24, 2012, 07:39:55 PM

Title: Poasm and Pelles C run-time library
Post by: Vortex on May 24, 2012, 07:39:55 PM
Here is a quick demo using the function _splitpath from Pelles C run-time static library crt.lib

_splitpath depends on the function strncpy which is extracted automatically from crt.lib


Code: [Select]
include     splitpathDemo.inc

.data

path1       db 'D:\PellesC\project\splitpath.asm',0
f1          db 'drive = %s',13,10
            db 'dir   = %s',13,10
            db 'name  = %s',13,10
            db 'ext   = %s',13,10,0

.data?

buffer      db 128 dup(?)
drive1      db 4 dup(?)
dir1        db 32 dup(?)
name1       db 16 dup(?)
ext1        db 4 dup(?)

.code

start:

    invoke  _splitpath,ADDR path1,ADDR drive1,ADDR dir1,\
            ADDR name1,ADDR ext1

    invoke  wsprintf,ADDR buffer,ADDR f1,ADDR drive1,ADDR dir1,ADDR name1,\
            ADDR ext1

    invoke  StdOut,ADDR buffer
    invoke  ExitProcess,0

END start